2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2023-07-03 17:44:27 +08:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2019-10-21 20:54:08 +08:00
|
|
|
class GmmClientContext;
|
2018-01-12 16:08:49 +08:00
|
|
|
struct HardwareInfo;
|
2022-11-25 15:53:05 +08:00
|
|
|
struct RootDeviceEnvironment;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2018-06-21 17:36:47 +08:00
|
|
|
class GmmHelper {
|
2017-12-21 07:45:38 +08:00
|
|
|
public:
|
2018-06-21 17:36:47 +08:00
|
|
|
GmmHelper() = delete;
|
2022-11-25 15:53:05 +08:00
|
|
|
GmmHelper(const RootDeviceEnvironment &rootDeviceEnvironment);
|
2018-07-13 13:42:18 +08:00
|
|
|
MOCKABLE_VIRTUAL ~GmmHelper();
|
2018-07-23 18:23:48 +08:00
|
|
|
|
2018-07-27 19:59:39 +08:00
|
|
|
const HardwareInfo *getHardwareInfo();
|
2020-02-04 19:13:57 +08:00
|
|
|
uint32_t getMOCS(uint32_t type) const;
|
2022-09-23 22:13:06 +08:00
|
|
|
static void applyMocsEncryptionBit(uint32_t &index);
|
2022-02-21 21:33:41 +08:00
|
|
|
void forceAllResourcesUncached() { allResourcesUncached = true; };
|
2018-07-23 18:23:48 +08:00
|
|
|
|
2021-09-23 00:52:10 +08:00
|
|
|
static constexpr uint64_t maxPossiblePitch = (1ull << 31);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2023-07-03 17:44:27 +08:00
|
|
|
uint64_t canonize(uint64_t address) const;
|
|
|
|
uint64_t decanonize(uint64_t address) const;
|
2019-09-17 18:53:37 +08:00
|
|
|
|
2022-06-08 16:23:02 +08:00
|
|
|
uint32_t getAddressWidth() { return addressWidth; };
|
|
|
|
void setAddressWidth(uint32_t width) { addressWidth = width; };
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2021-12-23 23:32:23 +08:00
|
|
|
bool isValidCanonicalGpuAddress(uint64_t address);
|
|
|
|
|
2019-12-04 19:36:16 +08:00
|
|
|
GmmClientContext *getClientContext() const;
|
2018-07-27 19:59:39 +08:00
|
|
|
|
2022-12-20 02:41:13 +08:00
|
|
|
const RootDeviceEnvironment &getRootDeviceEnvironment() const;
|
2022-11-25 15:53:05 +08:00
|
|
|
static std::unique_ptr<GmmClientContext> (*createGmmContextWrapperFunc)(const RootDeviceEnvironment &);
|
2018-05-17 17:47:35 +08:00
|
|
|
|
2018-07-03 16:00:12 +08:00
|
|
|
protected:
|
2022-06-08 16:23:02 +08:00
|
|
|
uint32_t addressWidth;
|
2022-12-20 02:41:13 +08:00
|
|
|
const RootDeviceEnvironment &rootDeviceEnvironment;
|
2018-07-23 18:23:48 +08:00
|
|
|
std::unique_ptr<GmmClientContext> gmmClientContext;
|
2022-02-21 21:33:41 +08:00
|
|
|
bool allResourcesUncached = false;
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|