Skip to content

Commit 852e7ea

Browse files
committed
Update canonize to fix VA size bugs
Signed-off-by: Vihang Mehta <[email protected]>
1 parent 9104c20 commit 852e7ea

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Source/GmmLib/TranslationTable/GmmUmdTranslationTable.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ GMM_STATUS GmmLib::PageTable::AllocateL3Table(uint32_t L3TableSize, uint32_t L3A
7272
return Status;
7373
}
7474

75-
TTL3.GfxAddress = GMM_GFX_ADDRESS_CANONIZE(Alloc.GfxVA);
75+
TTL3.GfxAddress = GMM_GFX_ADDRESS_CANONIZE(pClientContext, Alloc.GfxVA);
7676
TTL3.CPUAddress = Alloc.CPUVA;
7777
TTL3.NeedRegisterUpdate = true;
7878
TTL3.L3Handle = (HANDLE)(uintptr_t)Alloc.Handle;

Source/GmmLib/inc/External/Common/GmmCommonExt.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ typedef uint32_t GMM_GLOBAL_GFX_ADDRESS, GMM_GLOBAL_GFX_SIZE_T;
126126
#define GMM_GLOBAL_GFX_SIZE_T_CAST(x) ((GMM_GLOBAL_GFX_SIZE_T)(x))
127127
#endif
128128

129-
#define GMM_GFX_ADDRESS_CANONIZE(a) (((int64_t)(a) << (64 - 48)) >> (64 - 48)) // TODO(Minor): When GMM adds platform-dependent VA size caps, change from 48.
130-
#define GMM_GFX_ADDRESS_DECANONIZE(a) ((uint64_t)(a) & (((uint64_t) 1 << 48) - 1)) // "
131-
132129
#define GMM_GFX_PLATFORM_VA_SIZE(pClientContext) (((pClientContext)->GetLibContext()->GetSkuTable().Ftr57bGPUAddressing) ? 57 : 48)
133130
#define VASize(pCC) GMM_GFX_PLATFORM_VA_SIZE(pCC)
134131

132+
#define GMM_GFX_ADDRESS_CANONIZE(pCC, a) (((int64_t)(a) << (64 - VASize(pCC))) >> (64 - VASize(pCC)))
133+
#define GMM_GFX_ADDRESS_DECANONIZE(pCC, a) ((uint64_t)(a) & (((uint64_t) 1 << VASize(pCC)) - 1))
134+
135135
#define GMM_BIT_RANGE(endbit, startbit) ((endbit) - (startbit) + 1)
136136
#define GMM_BIT(bit) (1)
137137

Source/GmmLib/inc/External/Common/GmmResourceInfoCommon.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,11 @@ namespace GmmLib
297297
{
298298
if (IsD3DDdiAllocation)
299299
{
300-
return (void *)GMM_GFX_ADDRESS_CANONIZE(ExistingSysMem.pGfxAlignedVirtAddress);
300+
return (void *)GMM_GFX_ADDRESS_CANONIZE(pClientContext, ExistingSysMem.pGfxAlignedVirtAddress);
301301
}
302302
else
303303
{
304-
return (void *)GMM_GFX_ADDRESS_CANONIZE(ExistingSysMem.pVirtAddress);
304+
return (void *)GMM_GFX_ADDRESS_CANONIZE(pClientContext, ExistingSysMem.pVirtAddress);
305305
}
306306
}
307307

@@ -983,7 +983,7 @@ namespace GmmLib
983983
// Support for Sparse/Tiled resources will be unified in later
984984
if (SvmAddress)
985985
{
986-
return GMM_GFX_ADDRESS_CANONIZE(SvmAddress);
986+
return GMM_GFX_ADDRESS_CANONIZE(pClientContext, SvmAddress);
987987
}
988988
else
989989
{

0 commit comments

Comments
 (0)