Changed the definition of mtype_local=2 to MTYPE_CC or UC depending on the chip. On GFX12.1 it means MTYPE_UC.
The default local MTYPE on GFX12.1 now depends on the XCD revision due to ISA changes. Only XCD A0 will support MTYPE_NC. Signed-off-by: Felix Kuehling <[email protected]> Reviewed-by: Harish Kasiviswanathan <[email protected]> Tested-by: SiuChi Chan <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c | 13 +++++++++---- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 7 +++++-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 3e5634de077f1..5e0029530b791 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -872,7 +872,7 @@ module_param_named_unsafe(no_queue_eviction_on_vm_fault, amdgpu_no_queue_evictio * DOC: mtype_local (int) */ int amdgpu_mtype_local = -1; -MODULE_PARM_DESC(mtype_local, "MTYPE for local memory (default: ASIC dependent, 0 = MTYPE_RW, 1 = MTYPE_NC, 2 = MTYPE_CC)"); +MODULE_PARM_DESC(mtype_local, "MTYPE for local memory (default: ASIC dependent, 0 = MTYPE_RW, 1 = MTYPE_NC, 2 = MTYPE_CC or MTYPE_UC)"); module_param_named_unsafe(mtype_local, amdgpu_mtype_local, int, 0444); /** diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c index df72eb2b67ae0..b676830120026 100644 --- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c @@ -630,15 +630,19 @@ static void gmc_v12_1_get_mtypes(struct amdgpu_device *adev, unsigned int *mtype_remote) { bool is_aid_a1 = SOC_V1_0_DIE_REV_AID(adev->rev_id) == 1; + bool is_xcd_a0 = SOC_V1_0_DIE_REV_XCD(adev->rev_id) == 0; - /* Local memory: ASIC default depends on the AID stepping. */ - *mtype_local = is_aid_a1 ? MTYPE_RW : MTYPE_NC; + /* Local memory: Only AID A1 support MTYPE_RW. On AID A0 the default + * MTYPE depends on the XCD revision due to ISA changes + */ + *mtype_local = is_aid_a1 ? MTYPE_RW : + is_xcd_a0 ? MTYPE_NC : MTYPE_UC; if (amdgpu_mtype_local == 0) *mtype_local = MTYPE_RW; else if (amdgpu_mtype_local == 1) *mtype_local = MTYPE_NC; else if (amdgpu_mtype_local == 2) - DRM_INFO_ONCE("MTYPE_CC not supported for local memory\n"); + *mtype_local = MTYPE_UC; /* Remote memory defaults to MTYPE_UC on GFX 12.1. */ *mtype_remote = MTYPE_UC; @@ -648,7 +652,8 @@ static void gmc_v12_1_get_mtypes(struct amdgpu_device *adev, *mtype_remote = MTYPE_UC; DRM_INFO_ONCE("Using %s for local memory and %s for remote memory\n", - *mtype_local == MTYPE_RW ? "MTYPE_RW" : "MTYPE_NC", + *mtype_local == MTYPE_RW ? "MTYPE_RW" : + *mtype_local == MTYPE_NC ? "MTYPE_NC" : "MTYPE_UC", *mtype_remote == MTYPE_NC ? "MTYPE_NC" : "MTYPE_UC"); } diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c index ed5e3318877be..d0773ca9a0659 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -1265,7 +1265,7 @@ svm_range_get_pte_flags(struct kfd_node *node, struct amdgpu_vm *vm, bool coherent = flags & (KFD_IOCTL_SVM_FLAG_COHERENT | KFD_IOCTL_SVM_FLAG_EXT_COHERENT); bool ext_coherent = flags & KFD_IOCTL_SVM_FLAG_EXT_COHERENT; unsigned int mtype_local, mtype_remote; - bool is_aid_a1, is_local, is_spx; + bool is_aid_a1, is_xcd_a0, is_local, is_spx; if (domain == SVM_RANGE_VRAM_DOMAIN) bo_node = prange->svm_bo->node; @@ -1354,12 +1354,15 @@ svm_range_get_pte_flags(struct kfd_node *node, struct amdgpu_vm *vm, break; case IP_VERSION(12, 1, 0): is_aid_a1 = SOC_V1_0_DIE_REV_AID(node->adev->rev_id) == 1; + is_xcd_a0 = SOC_V1_0_DIE_REV_XCD(node->adev->rev_id) == 0; is_local = (domain == SVM_RANGE_VRAM_DOMAIN) && (bo_node->adev == node->adev); mtype_local = amdgpu_mtype_local == 0 ? AMDGPU_VM_MTYPE_RW : amdgpu_mtype_local == 1 ? AMDGPU_VM_MTYPE_NC : - is_aid_a1 ? AMDGPU_VM_MTYPE_RW : AMDGPU_VM_MTYPE_NC; + amdgpu_mtype_local == 2 ? AMDGPU_VM_MTYPE_UC : + is_aid_a1 ? AMDGPU_VM_MTYPE_RW : + is_xcd_a0 ? AMDGPU_VM_MTYPE_NC : AMDGPU_VM_MTYPE_UC; /* Remote memory defaults to MTYPE_UC on GFX 12.1 and can be * overridden through the amdgpu_mtype_remote module parameter * (0 = MTYPE_NC, 1 = MTYPE_UC). -- 2.43.0
