drm/amdgpu: Check APU supports true APP mode
authorRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Wed, 9 Nov 2022 04:04:30 +0000 (23:04 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 9 Jun 2023 13:49:05 +0000 (09:49 -0400)
On GPXIP 9.4.3 APU, in no carveout mode there is no real vram heap and
could be emulated by the driver over the interleaved NUMA system memory
and the APU could also  be in the carveout mode during early development
stage or otherwise for debugging purpose so introduce a new member in
amdgpu_gmc to figure out whether the APU is in the native mode as per
the production configuration. AMD_IS_APU cannot be used for Accelerated
Processing Platform APUs as it might be used in a different context on
previous generations or on small APUs.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Tested-by: Graham Sider <graham.sider@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

index 572ef5be539fc358652a84ce69696711b960b20a..e408abfc2daf3d8029bb82663d97bebe0830ca53 100644 (file)
@@ -251,6 +251,7 @@ struct amdgpu_gmc {
        uint64_t                last_fault:AMDGPU_GMC_FAULT_RING_ORDER;
 
        bool tmz_enabled;
+       bool is_app_apu;
 
        const struct amdgpu_gmc_funcs   *gmc_funcs;
 
index 2966aca9545d6551211dc3702b61a7e4073ec603..0792c48fe347d4bdb0ff8dd2ba2dc181d044cfba 100644 (file)
@@ -1442,6 +1442,20 @@ static int gmc_v9_0_early_init(void *handle)
                        adev->smuio.funcs->is_host_gpu_xgmi_supported(adev);
        }
 
+       if (adev->ip_versions[GC_HWIP][0] == IP_VERSION(9, 4, 3)) {
+               enum amdgpu_pkg_type pkg_type =
+                       adev->smuio.funcs->get_pkg_type(adev);
+               /* On GFXIP 9.4.3. APU, there is no physical VRAM domain present
+                * and the APU, can be in used two possible modes:
+                *  - carveout mode
+                *  - native APU mode
+                * "is_app_apu" can be used to identify the APU in the native
+                * mode.
+                */
+               adev->gmc.is_app_apu = (pkg_type == AMDGPU_PKG_TYPE_APU &&
+                                       !pci_resource_len(adev->pdev, 0));
+       }
+
        gmc_v9_0_set_gmc_funcs(adev);
        gmc_v9_0_set_irq_funcs(adev);
        gmc_v9_0_set_umc_funcs(adev);