[SRU] [R] [PATCH 05/13] drm/amdgpu: fallback to default discovery offset/size in sriov guest
Yo-Jung Leo Lin (AMD)
Leo.Lin at amd.com
Mon Jul 6 06:43:33 UTC 2026
From: Hawking Zhang <Hawking.Zhang at amd.com>
BugLink: https://bugs.launchpad.net/bugs/2158690
In SRIOV guest environment, if dynamic critical region
is not enabled, fallback to default discovery offset
and size to ensure proper initialization
Signed-off-by: Hawking Zhang <Hawking.Zhang at amd.com>
Reviewed-by: Likun Gao <Likun.Gao at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
(cherry picked from commit 311f8fc05c8d1a0e65e9f91348e6d2be8cf58c60)
Signed-off-by: Yo-Jung Leo Lin (AMD) <Leo.Lin at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 20 +++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index d9072d358ebd..9f786b62ee16 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -295,13 +295,17 @@ static int amdgpu_discovery_get_tmr_info(struct amdgpu_device *adev,
if (vram_size)
adev->discovery.offset = (vram_size << 20) - DISCOVERY_TMR_OFFSET;
- if (amdgpu_sriov_vf(adev) && adev->virt.is_dynamic_crit_regn_enabled) {
- adev->discovery.offset =
- adev->virt.crit_regn_tbl[AMD_SRIOV_MSG_IPD_TABLE_ID].offset;
- adev->discovery.size =
- adev->virt.crit_regn_tbl[AMD_SRIOV_MSG_IPD_TABLE_ID].size_kb << 10;
- if (!adev->discovery.offset || !adev->discovery.size)
- return -EINVAL;
+ if (amdgpu_sriov_vf(adev)) {
+ if (adev->virt.is_dynamic_crit_regn_enabled) {
+ adev->discovery.offset =
+ adev->virt.crit_regn_tbl[AMD_SRIOV_MSG_IPD_TABLE_ID].offset;
+ adev->discovery.size =
+ adev->virt.crit_regn_tbl[AMD_SRIOV_MSG_IPD_TABLE_ID].size_kb << 10;
+ if (!adev->discovery.offset || !adev->discovery.size)
+ return -EINVAL;
+ } else {
+ goto out;
+ }
} else {
tmr_size = RREG32(mmDRIVER_SCRATCH_2);
if (tmr_size) {
@@ -321,7 +325,7 @@ static int amdgpu_discovery_get_tmr_info(struct amdgpu_device *adev,
adev->discovery.offset = tmr_offset + tmr_size - DISCOVERY_TMR_OFFSET;
}
}
-
+out:
adev->discovery.bin = kzalloc(adev->discovery.size, GFP_KERNEL);
if (!adev->discovery.bin)
return -ENOMEM;
--
2.43.0
More information about the kernel-team
mailing list