From: Mukul Joshi <[email protected]>

Derive mtype_remote in gmc_v12_1_get_npa_flags() from
gmc_v12_1_get_mtypes() so the module-parameter override and ASIC
defaults are honored instead of recomputing with hard-coded values.

Signed-off-by: Mukul Joshi <[email protected]>
Reviewed-by: Harish Kasiviswanathan <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
index 4e7b6e2c87ab5..565ee7fba3cdb 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
@@ -28,6 +28,10 @@
 #include "oss/osssys_7_1_0_sh_mask.h"
 #include "ivsrcid/vmc/irqsrcs_vmc_1_0.h"
 
+static void gmc_v12_1_get_mtypes(struct amdgpu_device *adev,
+                                unsigned int *mtype_local,
+                                unsigned int *mtype_remote);
+
 static int gmc_v12_1_vm_fault_interrupt_state(struct amdgpu_device *adev,
                                              struct amdgpu_irq_src *src,
                                              unsigned int type,
@@ -603,10 +607,9 @@ static void gmc_v12_1_get_vm_pde(struct amdgpu_device 
*adev, int level,
 static void gmc_v12_1_get_npa_flags(struct amdgpu_device *adev,
                                    uint64_t *flags)
 {
-       bool is_aid_a1 = (adev->rev_id & 0x10);
-       unsigned int mtype_remote;
+       unsigned int mtype_local, mtype_remote;
 
-       mtype_remote = is_aid_a1 ? MTYPE_NC : MTYPE_UC;
+       gmc_v12_1_get_mtypes(adev, &mtype_local, &mtype_remote);
 
        *flags = AMDGPU_PTE_MTYPE_GFX12(*flags, mtype_remote);
        /* VSCT = 0011 to identify NPA. Additionally PTE.B = 1 */
-- 
2.55.0

Reply via email to