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