1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <memory>
namespace NEO {
class GmmClientContext;
class OSInterface;
struct HardwareInfo;
class GmmHelper {
public:
GmmHelper() = delete;
GmmHelper(OSInterface *osInterface, const HardwareInfo *hwInfo);
MOCKABLE_VIRTUAL ~GmmHelper();
const HardwareInfo *getHardwareInfo();
uint32_t getMOCS(uint32_t type) const;
static void applyMocsEncryptionBit(uint32_t &index);
void forceAllResourcesUncached() { allResourcesUncached = true; };
static constexpr uint64_t maxPossiblePitch = (1ull << 31);
uint64_t canonize(uint64_t address);
uint64_t decanonize(uint64_t address);
uint32_t getAddressWidth() { return addressWidth; };
void setAddressWidth(uint32_t width) { addressWidth = width; };
bool isValidCanonicalGpuAddress(uint64_t address);
GmmClientContext *getClientContext() const;
static std::unique_ptr<GmmClientContext> (*createGmmContextWrapperFunc)(OSInterface *, HardwareInfo *);
protected:
uint32_t addressWidth;
const HardwareInfo *hwInfo = nullptr;
std::unique_ptr<GmmClientContext> gmmClientContext;
bool allResourcesUncached = false;
};
} // namespace NEO
|