diff --git a/shared/source/os_interface/linux/drm_memory_manager.cpp b/shared/source/os_interface/linux/drm_memory_manager.cpp index b01f1ed057..d0886ffadd 100644 --- a/shared/source/os_interface/linux/drm_memory_manager.cpp +++ b/shared/source/os_interface/linux/drm_memory_manager.cpp @@ -1960,13 +1960,7 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData & if (useBooMmap) { auto totalSizeToAlloc = alignedSize + alignment; - uint64_t preferredAddress = 0; - auto gfxPartition = getGfxPartition(allocationData.rootDeviceIndex); - if (allocationData.flags.isUSMHostAllocation && gfxPartition->getHeapLimit(HeapIndex::HEAP_EXTENDED) > 0u) { - preferredAddress = acquireGpuRange(totalSizeToAlloc, allocationData.rootDeviceIndex, HeapIndex::HEAP_EXTENDED); - } - - auto cpuPointer = this->mmapFunction(reinterpret_cast(preferredAddress), totalSizeToAlloc, PROT_NONE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); + auto cpuPointer = this->mmapFunction(0, totalSizeToAlloc, PROT_NONE, MAP_SHARED | MAP_ANONYMOUS, -1, 0); auto cpuBasePointer = cpuPointer; cpuPointer = alignUp(cpuPointer, alignment); @@ -1976,7 +1970,6 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData & reinterpret_cast(cpuPointer), alignedSize, 0u, maxOsContextCount, -1)); if (!bo) { - releaseGpuRange(reinterpret_cast(preferredAddress), totalSizeToAlloc, allocationData.rootDeviceIndex); this->munmapFunction(cpuBasePointer, totalSizeToAlloc); return nullptr; } @@ -1985,7 +1978,6 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData & auto ioctlHelper = drm.getIoctlHelper(); uint64_t mmapOffsetWb = ioctlHelper->getDrmParamValue(DrmParam::MmapOffsetWb); if (!retrieveMmapOffsetForBufferObject(allocationData.rootDeviceIndex, *bo, mmapOffsetWb, offset)) { - releaseGpuRange(reinterpret_cast(preferredAddress), totalSizeToAlloc, allocationData.rootDeviceIndex); this->munmapFunction(cpuPointer, size); return nullptr; } @@ -2001,7 +1993,6 @@ DrmAllocation *DrmMemoryManager::createAllocWithAlignment(const AllocationData & auto allocation = std::make_unique(allocationData.rootDeviceIndex, allocationData.type, bo.get(), cpuPointer, canonizedGpuAddress, alignedSize, MemoryPool::System4KBPages); allocation->setMmapPtr(cpuPointer); allocation->setMmapSize(alignedSize); - allocation->setReservedAddressRange(reinterpret_cast(preferredAddress), totalSizeToAlloc); if (pointerDiff != 0) { allocation->registerMemoryToUnmap(cpuBasePointer, pointerDiff, this->munmapFunction); } diff --git a/shared/test/common/mocks/linux/mock_drm_memory_manager.cpp b/shared/test/common/mocks/linux/mock_drm_memory_manager.cpp index d40d1476d9..943c71cb8b 100644 --- a/shared/test/common/mocks/linux/mock_drm_memory_manager.cpp +++ b/shared/test/common/mocks/linux/mock_drm_memory_manager.cpp @@ -24,8 +24,6 @@ std::atomic lseekCalledCount(0); std::atomic closeInputFd(0); std::atomic closeCalledCount(0); std::vector mmapVector(64); -std::vector mmapCapturedExtendedPointers(64); -bool captureExtendedPointers = false; TestedDrmMemoryManager::TestedDrmMemoryManager(ExecutionEnvironment &executionEnvironment) : MemoryManagerCreate(gemCloseWorkerMode::gemCloseWorkerInactive, false, diff --git a/shared/test/common/mocks/linux/mock_drm_memory_manager.h b/shared/test/common/mocks/linux/mock_drm_memory_manager.h index 00260fe254..eec5cac4fb 100644 --- a/shared/test/common/mocks/linux/mock_drm_memory_manager.h +++ b/shared/test/common/mocks/linux/mock_drm_memory_manager.h @@ -20,16 +20,8 @@ extern std::atomic lseekCalledCount; extern std::atomic closeInputFd; extern std::atomic closeCalledCount; extern std::vector mmapVector; -extern std::vector mmapCapturedExtendedPointers; -extern bool captureExtendedPointers; inline void *mmapMock(void *addr, size_t length, int prot, int flags, int fd, off_t offset) noexcept { - if (reinterpret_cast(addr) > maxNBitValue(48)) { - if (captureExtendedPointers) { - mmapCapturedExtendedPointers.push_back(addr); - } - addr = nullptr; - } if (addr) { return addr; } diff --git a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index 5f8fd5c018..6359774bc7 100644 --- a/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -6184,30 +6184,3 @@ TEST_F(DrmMemoryManagerWithExplicitExpectationsTest, givenDrmMemoryManagerWhenGp EXPECT_GT(memoryManager->getGfxPartition(1)->getHeapLimit(HeapIndex::HEAP_STANDARD), gmmHelper->decanonize(addressRange.address)); memoryManager->freeGpuAddress(addressRange, 1); } - -TEST_F(DrmMemoryManagerTest, given57bAddressSpaceWhenAllocatingHostUSMThenAddressFromExtendedHeapIsTaken) { - if (defaultHwInfo->capabilityTable.gpuAddressSpace < maxNBitValue(57)) { - GTEST_SKIP(); - } - captureExtendedPointers = true; - mmapCapturedExtendedPointers.clear(); - std::vector regionInfo(1); - regionInfo[0].region = {drm_i915_gem_memory_class::I915_MEMORY_CLASS_SYSTEM, 0}; - - auto &drm = static_cast(memoryManager->getDrm(mockRootDeviceIndex)); - drm.memoryInfo.reset(new MemoryInfo(regionInfo, drm)); - AllocationProperties allocationProperties(mockRootDeviceIndex, MemoryConstants::cacheLineSize, AllocationType::SVM_CPU, {}); - allocationProperties.flags.isUSMHostAllocation = true; - auto hostUSM = memoryManager->allocateGraphicsMemoryInPreferredPool(allocationProperties, nullptr); - captureExtendedPointers = false; - EXPECT_NE(nullptr, hostUSM); - - EXPECT_EQ(1u, mmapCapturedExtendedPointers.size()); - auto gpuAddress = reinterpret_cast(mmapCapturedExtendedPointers[0]); - mmapCapturedExtendedPointers.clear(); - auto gmmHelper = memoryManager->getGmmHelper(mockRootDeviceIndex); - EXPECT_LE(memoryManager->getGfxPartition(mockRootDeviceIndex)->getHeapBase(HeapIndex::HEAP_EXTENDED), gmmHelper->decanonize(gpuAddress)); - EXPECT_GT(memoryManager->getGfxPartition(mockRootDeviceIndex)->getHeapLimit(HeapIndex::HEAP_EXTENDED), gmmHelper->decanonize(gpuAddress)); - - memoryManager->freeGraphicsMemory(hostUSM); -}