[PATCH 2/2] drm/amdgpu: Check VF critical region before RAS poison injection

Liu, Xiang(Dean) Xiang.Liu at amd.com
Wed Aug 20 08:54:51 UTC 2025


[AMD Official Use Only - AMD Internal Distribution Only]

Hi Stanley,
Sure, will do, thanks.

Regards,

Liu, Xiang

________________________________
From: Yang, Stanley <Stanley.Yang at amd.com>
Sent: Wednesday, August 20, 2025 3:28 PM
To: Liu, Xiang(Dean) <Xiang.Liu at amd.com>; Chai, Thomas <YiPeng.Chai at amd.com>; amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Zhang, Hawking <Hawking.Zhang at amd.com>; Zhou1, Tao <Tao.Zhou1 at amd.com>
Subject: RE: [PATCH 2/2] drm/amdgpu: Check VF critical region before RAS poison injection


[AMD Official Use Only - AMD Internal Distribution Only]


All checking work should be done in host side, not only check current vf critical region but also other vf critical region.

For example, in extreme cases, current row memory addresses may be in other vfs critical region, please handle this case in host side.



Regards,

Stanley

From: Liu, Xiang(Dean) <Xiang.Liu at amd.com>
Sent: Wednesday, August 20, 2025 2:02 PM
To: Chai, Thomas <YiPeng.Chai at amd.com>; amd-gfx at lists.freedesktop.org
Cc: Zhang, Hawking <Hawking.Zhang at amd.com>; Zhou1, Tao <Tao.Zhou1 at amd.com>; Yang, Stanley <Stanley.Yang at amd.com>
Subject: Re: [PATCH 2/2] drm/amdgpu: Check VF critical region before RAS poison injection



[AMD Official Use Only - AMD Internal Distribution Only]



Hi,

As discuss offline with Thomas, will check the VF critical address regions of guest in another patch as a new feature.

Regards,

Liu, Xiang

________________________________

From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org<mailto:amd-gfx-bounces at lists.freedesktop.org>> on behalf of Liu, Xiang(Dean) <Xiang.Liu at amd.com<mailto:Xiang.Liu at amd.com>>
Sent: Wednesday, August 20, 2025 1:33 PM
To: Chai, Thomas <YiPeng.Chai at amd.com<mailto:YiPeng.Chai at amd.com>>; amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org> <amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org>>
Cc: Zhang, Hawking <Hawking.Zhang at amd.com<mailto:Hawking.Zhang at amd.com>>; Zhou1, Tao <Tao.Zhou1 at amd.com<mailto:Tao.Zhou1 at amd.com>>; Yang, Stanley <Stanley.Yang at amd.com<mailto:Stanley.Yang at amd.com>>
Subject: Re: [PATCH 2/2] drm/amdgpu: Check VF critical region before RAS poison injection



[AMD Official Use Only - AMD Internal Distribution Only]



Hi Thomas,

Sure, will do, thanks.

Regards,

Liu, Xiang

________________________________

From: Chai, Thomas <YiPeng.Chai at amd.com<mailto:YiPeng.Chai at amd.com>>
Sent: Wednesday, August 20, 2025 9:39 AM
To: Liu, Xiang(Dean) <Xiang.Liu at amd.com<mailto:Xiang.Liu at amd.com>>; amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org> <amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org>>
Cc: Zhang, Hawking <Hawking.Zhang at amd.com<mailto:Hawking.Zhang at amd.com>>; Zhou1, Tao <Tao.Zhou1 at amd.com<mailto:Tao.Zhou1 at amd.com>>; Yang, Stanley <Stanley.Yang at amd.com<mailto:Stanley.Yang at amd.com>>
Subject: RE: [PATCH 2/2] drm/amdgpu: Check VF critical region before RAS poison injection



[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Liu, Xiang(Dean) <Xiang.Liu at amd.com<mailto:Xiang.Liu at amd.com>>
Sent: Tuesday, August 19, 2025 1:26 PM
To: amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org>
Cc: Zhang, Hawking <Hawking.Zhang at amd.com<mailto:Hawking.Zhang at amd.com>>; Zhou1, Tao <Tao.Zhou1 at amd.com<mailto:Tao.Zhou1 at amd.com>>; Yang, Stanley <Stanley.Yang at amd.com<mailto:Stanley.Yang at amd.com>>; Chai, Thomas <YiPeng.Chai at amd.com<mailto:YiPeng.Chai at amd.com>>; Liu, Xiang(Dean) <Xiang.Liu at amd.com<mailto:Xiang.Liu at amd.com>>
Subject: [PATCH 2/2] drm/amdgpu: Check VF critical region before RAS poison injection

Check VF critical region before RAS poison injection to ensure that the poison injection will not hit the VF critical region.

Signed-off-by: Xiang Liu <xiang.liu at amd.com<mailto:xiang.liu at amd.com>>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
index b00cbb927ca8..6730de574fdc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
@@ -219,10 +219,17 @@ static int amdgpu_check_address_validity(struct amdgpu_device *adev,
        struct amdgpu_vram_block_info blk_info;
        uint64_t page_pfns[32] = {0};
        int i, ret, count;
+       bool hit = false;

        if (amdgpu_ip_version(adev, UMC_HWIP, 0) < IP_VERSION(12, 0, 0))
                return 0;

+       if (amdgpu_sriov_vf(adev)) {
+               if (amdgpu_virt_check_vf_critical_region(adev, address, &hit))
+                       return -EPERM;
+               return hit ? -EACCES : 0;

[Thomas]Only checking if the address is within the PF critical address regions may be not sufficient,
          The VF critical address regions of guest may be also need to be checked.

+       }
+
        if ((address >= adev->gmc.mc_vram_size) ||
            (address >= RAS_UMC_INJECT_ADDR_LIMIT))
                return -EFAULT;
--
2.34.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20250820/9dfc65ef/attachment-0001.htm>


More information about the amd-gfx mailing list