drm/amdgpu: Avoid fetching vram vendor information
Subsystems (2)
PATCH 1/2 drm/amdgpu: Avoid fetching vram vendor information
For GFX 9.4.3 APUs, the current method of fetching vram vendor information is not reliable. Avoid fetching the information.
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -1
@@ -1952,7 +1952,8 @@ static void gmc_v9_4_3_init_vram_info(struct amdgpu_device *adev)static const u32 regBIF_BIOS_SCRATCH_4 =0x50 ;u32 vram_info; -if (!amdgpu_sriov_vf (adev)) { +/* Only for dGPU, vendor informaton is reliable */ +if (!amdgpu_sriov_vf (adev) && !(adev->flags &AMD_IS_APU )) { vram_info =RREG32 (regBIF_BIOS_SCRATCH_4); adev->gmc.vram_vendor = vram_info &0xF ; }
Signature · 1 line
2.25.1
PATCH 2/2 drm/amdgpu: Show vram vendor only if available
Ony if vram vendor info is available, show in sysfs.
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +16 -1
@@ -221,8 +221,23 @@ static struct attribute *amdgpu_vram_mgr_attributes[] = { NULL }; +static umode_t amdgpu_vram_attrs_is_visible (struct kobject *kobj, +struct attribute *attr,int i) +{ +struct device *dev =kobj_to_dev (kobj); +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (ddev); + +if (attr == &dev_attr_mem_info_vram_vendor.attr && + !adev->gmc.vram_vendor) +return 0 ; + +return attr->mode; +} +const struct attribute_group amdgpu_vram_mgr_attr_group = { - .attrs = amdgpu_vram_mgr_attributes + .attrs = amdgpu_vram_mgr_attributes, + .is_visible = amdgpu_vram_attrs_is_visible };/**
Signature · 1 line
2.25.1
RE: [PATCH 2/2] drm/amdgpu: Show vram vendor only if available
[AMD Official Use Only - General]
Series is
Reviewed-by Hawking Zhang <[email protected]>
Regards,
Hawking
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Saturday, January 20, 2024 18:19
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>
Subject: [PATCH 2/2] drm/amdgpu: Show vram vendor only if available
Ony if vram vendor info is available, show in sysfs.
Signed-off-by Lijo Lazar <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c +15 -1
@@ -221,8 +221,23 @@ static struct attribute *amdgpu_vram_mgr_attributes[] = { NULL }; +static umode_t amdgpu_vram_attrs_is_visible (struct kobject *kobj, +struct attribute *attr,int i) { +struct device *dev =kobj_to_dev (kobj); +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev =drm_to_adev (ddev); + +if (attr == &dev_attr_mem_info_vram_vendor.attr && + !adev->gmc.vram_vendor) +return 0 ; + +return attr->mode; +} +const struct attribute_group amdgpu_vram_mgr_attr_group = { - .attrs = amdgpu_vram_mgr_attributes + .attrs = amdgpu_vram_mgr_attributes, + .is_visible = amdgpu_vram_attrs_is_visible };/**
--
2.25.1