feature: Add pat index programming to gem create ext call

When upstream ioctl helper is created it will try to create small
allocation, adding I915_GEM_CREATE_EXT_SET_PAT extension. If it
succeeds, for all resources with valid pat index value it will then
explicitly program pat index value with gem create ext call.

PrintBOCreateDestroyResult value can be used to:
- print whether the set pat extension is supported by the kernel, when
  ioctl helper is created
- print whether set pat extension was added for a given gem create ext
  call and what pat index value was programmed

Note: introduced changes are disabled by defualt.
Toggle DisableGemCreateExtSetPat can be used to enable new functionality.

Related-To: NEO-7896

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2023-07-30 12:23:34 +02:00
committed by Compute-Runtime-Automation
parent 3e811fc9d4
commit 7ea22d0369
19 changed files with 284 additions and 70 deletions

View File

@@ -80,7 +80,7 @@ class IoctlHelper {
virtual bool isSetPairAvailable() = 0;
virtual bool isChunkingAvailable() = 0;
virtual bool isVmBindAvailable() = 0;
virtual int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks) = 0;
virtual int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks) = 0;
virtual CacheRegion closAlloc() = 0;
virtual uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) = 0;
virtual CacheRegion closFree(CacheRegion closIndex) = 0;
@@ -169,7 +169,7 @@ class IoctlHelperUpstream : public IoctlHelper {
bool isSetPairAvailable() override;
bool isChunkingAvailable() override;
bool isVmBindAvailable() override;
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks) override;
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks) override;
CacheRegion closAlloc() override;
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override;
CacheRegion closFree(CacheRegion closIndex) override;
@@ -215,6 +215,10 @@ class IoctlHelperUpstream : public IoctlHelper {
std::string getIoctlString(DrmIoctl ioctlRequest) const override;
bool getFabricLatency(uint32_t fabricId, uint32_t &latency, uint32_t &bandwidth) override;
bool isWaitBeforeBindRequired(bool bind) const override;
protected:
MOCKABLE_VIRTUAL void detectExtSetPatSupport();
bool isSetPatSupported = false;
};
template <PRODUCT_FAMILY gfxProduct>
@@ -225,7 +229,7 @@ class IoctlHelperImpl : public IoctlHelperUpstream {
return std::make_unique<IoctlHelperImpl<gfxProduct>>(drm);
}
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks) override;
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks) override;
std::vector<MemoryRegion> translateToMemoryRegions(const std::vector<uint8_t> &regionInfo) override;
unsigned int getIoctlRequestValue(DrmIoctl ioctlRequest) const override;
std::string getIoctlString(DrmIoctl ioctlRequest) const override;
@@ -239,7 +243,7 @@ class IoctlHelperPrelim20 : public IoctlHelper {
bool isSetPairAvailable() override;
bool isChunkingAvailable() override;
bool isVmBindAvailable() override;
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks) override;
int createGemExt(const MemRegionsVec &memClassInstances, size_t allocSize, uint32_t &handle, uint64_t patIndex, std::optional<uint32_t> vmId, int32_t pairHandle, bool isChunked, uint32_t numOfChunks) override;
CacheRegion closAlloc() override;
uint16_t closAllocWays(CacheRegion closIndex, uint16_t cacheLevel, uint16_t numWays) override;
CacheRegion closFree(CacheRegion closIndex) override;