Skip to contentSkip to conversation

drm/amdgpu: Check VF critical region before RAS poison injection

PATCH In review Xiang Liu 4 participants 10 messages Aug 19, 2025 – Sep 17, 2025 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Xiang Liu

author
#1 lore raw

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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +7 -0
index b00cbb927ca8..6730de574fdc 100644
@@ -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;
+	}
+
 	if ((address >= adev->gmc.mc_vram_size) ||
 	    (address >= RAS_UMC_INJECT_ADDR_LIMIT))
 		return -EFAULT;
Signature · 1 line
2.34.1
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]>
Sent: Tuesday, August 19, 2025 1:26 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -0
index b00cbb927ca8..6730de574fdc 100644
@@ -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

#3 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Thomas,
Sure, will do, thanks.

Regards,

Liu, Xiang

________________________________
From: Chai, Thomas <[email protected]>
Sent: Wednesday, August 20, 2025 9:39 AM
To: Liu, Xiang(Dean) <[email protected]>; [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
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) <[email protected]>
Sent: Tuesday, August 19, 2025 1:26 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -0
index b00cbb927ca8..6730de574fdc 100644
@@ -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

#4 lore raw

[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 <[email protected]> on behalf of Liu, Xiang(Dean) <[email protected]>
Sent: Wednesday, August 20, 2025 1:33 PM
To: Chai, Thomas <[email protected]>; [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
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 <[email protected]>
Sent: Wednesday, August 20, 2025 9:39 AM
To: Liu, Xiang(Dean) <[email protected]>; [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
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) <[email protected]>
Sent: Tuesday, August 19, 2025 1:26 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -0
index b00cbb927ca8..6730de574fdc 100644
@@ -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

#5 lore raw

[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) <[email protected]>
Sent: Wednesday, August 20, 2025 2:02 PM
To: Chai, Thomas <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
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 <[email protected]<mailto:[email protected]>> on behalf of Liu, Xiang(Dean) <[email protected]<mailto:[email protected]>>
Sent: Wednesday, August 20, 2025 1:33 PM
To: Chai, Thomas <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Zhang, Hawking <[email protected]<mailto:[email protected]>>; Zhou1, Tao <[email protected]<mailto:[email protected]>>; Yang, Stanley <[email protected]<mailto:[email protected]>>
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 <[email protected]<mailto:[email protected]>>
Sent: Wednesday, August 20, 2025 9:39 AM
To: Liu, Xiang(Dean) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Zhang, Hawking <[email protected]<mailto:[email protected]>>; Zhou1, Tao <[email protected]<mailto:[email protected]>>; Yang, Stanley <[email protected]<mailto:[email protected]>>
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) <[email protected]<mailto:[email protected]>>
Sent: Tuesday, August 19, 2025 1:26 PM
To: [email protected]<mailto:[email protected]>
Cc: Zhang, Hawking <[email protected]<mailto:[email protected]>>; Zhou1, Tao <[email protected]<mailto:[email protected]>>; Yang, Stanley <[email protected]<mailto:[email protected]>>; Chai, Thomas <[email protected]<mailto:[email protected]>>; Liu, Xiang(Dean) <[email protected]<mailto:[email protected]>>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -0
index b00cbb927ca8..6730de574fdc 100644
@@ -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

#6 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Stanley,
Sure, will do, thanks.

Regards,

Liu, Xiang

________________________________
From: Yang, Stanley <[email protected]>
Sent: Wednesday, August 20, 2025 3:28 PM
To: Liu, Xiang(Dean) <[email protected]>; Chai, Thomas <[email protected]>; [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>
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) <[email protected]>
Sent: Wednesday, August 20, 2025 2:02 PM
To: Chai, Thomas <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>
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 <[email protected]<mailto:[email protected]>> on behalf of Liu, Xiang(Dean) <[email protected]<mailto:[email protected]>>
Sent: Wednesday, August 20, 2025 1:33 PM
To: Chai, Thomas <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Zhang, Hawking <[email protected]<mailto:[email protected]>>; Zhou1, Tao <[email protected]<mailto:[email protected]>>; Yang, Stanley <[email protected]<mailto:[email protected]>>
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 <[email protected]<mailto:[email protected]>>
Sent: Wednesday, August 20, 2025 9:39 AM
To: Liu, Xiang(Dean) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Zhang, Hawking <[email protected]<mailto:[email protected]>>; Zhou1, Tao <[email protected]<mailto:[email protected]>>; Yang, Stanley <[email protected]<mailto:[email protected]>>
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) <[email protected]<mailto:[email protected]>>
Sent: Tuesday, August 19, 2025 1:26 PM
To: [email protected]<mailto:[email protected]>
Cc: Zhang, Hawking <[email protected]<mailto:[email protected]>>; Zhou1, Tao <[email protected]<mailto:[email protected]>>; Yang, Stanley <[email protected]<mailto:[email protected]>>; Chai, Thomas <[email protected]<mailto:[email protected]>>; Liu, Xiang(Dean) <[email protected]<mailto:[email protected]>>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +5 -0
index b00cbb927ca8..6730de574fdc 100644
@@ -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

A message that is not in the archive (sent off-list or not yet received): BN9PR12MB5257589DCD61DB49E52EE54BFC30A@BN9PR12MB5257.namprd12.prod.outlook.com

Reviewed-by Shravan Kumar Gande
#8 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

The series looks good.

Thanks,
Shravan

_____________________________________________
From: Zhang, Hawking <[email protected]>
Sent: Tuesday, August 19, 2025 1:50 AM
To: Liu, Xiang(Dean) <[email protected]>; [email protected]; Skvortsov, Victor <[email protected]>; Gande, Shravan kumar <[email protected]>
Cc: Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>
Subject: RE: [PATCH 2/2] drm/amdgpu: Check VF critical region before RAS poison injection

[AMD Official Use Only - AMD Internal Distribution Only]

+ @Skvortsov, Victor<mailto:[email protected]>/@Gande, Shravan kumar<mailto:[email protected]>

Hi Victor/Shravan,

Could you please help review the code at your convenience?

Regards,
Hawking

-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]<mailto:[email protected]>>
Sent: Tuesday, August 19, 2025 13:26
To: [email protected]<mailto:[email protected]>
Cc: Zhang, Hawking <[email protected]<mailto:[email protected]>>; Zhou1, Tao <[email protected]<mailto:[email protected]>>; Yang, Stanley <[email protected]<mailto:[email protected]>>; Chai, Thomas <[email protected]<mailto:[email protected]>>; Liu, Xiang(Dean) <[email protected]<mailto:[email protected]>>
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.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +7 -0
index b00cbb927ca8..6730de574fdc 100644
@@ -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;
+       }
+
        if ((address >= adev->gmc.mc_vram_size) ||
            (address >= RAS_UMC_INJECT_ADDR_LIMIT))
                return -EFAULT;

--
2.34.1

#9 lore raw

Re: [PATCH 1/2] drm/amdgpu: Introduce VF critical region check for RAS poison injection

In reply to a message not in the archive

[AMD Official Use Only - AMD Internal Distribution Only]

+ @Gande, Shravan kumar<mailto:[email protected]>

Hi Shravan,

Could you please help review the code at your convenience?

Regards,

Liu, Xiang

________________________________
From: Liu, Xiang(Dean) <[email protected]>
Sent: Tuesday, August 19, 2025 1:25 PM
To: [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Introduce VF critical region check for RAS poison injection

The SRIOV guest send requet to host to check whether the poison injection address is in VF critical region or not via mabox.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c    | 55 +++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h    |  3 ++
 drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h |  5 ++
 drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c       | 14 ++++++
 drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h       |  2 +
 5 files changed, 79 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +55 -0
index 13f0cdeb59c4..3328ab63376b 100644
@@ -828,11 +828,14 @@ static void amdgpu_virt_init_ras(struct amdgpu_device *adev)
 {
         ratelimit_state_init(&adev->virt.ras.ras_error_cnt_rs, 5 * HZ, 1);
         ratelimit_state_init(&adev->virt.ras.ras_cper_dump_rs, 5 * HZ, 1);
+       ratelimit_state_init(&adev->virt.ras.ras_chk_criti_rs, 5 * HZ, 1);
 
         ratelimit_set_flags(&adev->virt.ras.ras_error_cnt_rs,
                             RATELIMIT_MSG_ON_RELEASE);
         ratelimit_set_flags(&adev->virt.ras.ras_cper_dump_rs,
                             RATELIMIT_MSG_ON_RELEASE);
+       ratelimit_set_flags(&adev->virt.ras.ras_chk_criti_rs,
+                           RATELIMIT_MSG_ON_RELEASE);
 
         mutex_init(&adev->virt.ras.ras_telemetry_mutex);
 
@@ -1501,3 +1504,55 @@ void amdgpu_virt_request_bad_pages(struct amdgpu_device *adev)
         if (virt->ops && virt->ops->req_bad_pages)
                 virt->ops->req_bad_pages(adev);
 }
+
+static int amdgpu_virt_cache_chk_criti_hit(struct amdgpu_device *adev,
+                                          struct amdsriov_ras_telemetry *host_telemetry,
+                                          bool *hit)
+{
+       struct amd_sriov_ras_chk_criti *tmp = NULL;
+       uint32_t checksum, used_size;
+
+       checksum = host_telemetry->header.checksum;
+       used_size = host_telemetry->header.used_size;
+
+       if (used_size > (AMD_SRIOV_RAS_TELEMETRY_SIZE_KB << 10))
+               return 0;
+
+       tmp = kmemdup(&host_telemetry->body.chk_criti, used_size, GFP_KERNEL);
+       if (!tmp)
+               return -ENOMEM;
+
+       if (checksum != amd_sriov_msg_checksum(tmp, used_size, 0, 0))
+               goto out;
+
+       if (hit)
+               *hit = tmp->hit ? true : false;
+
+out:
+       kfree(tmp);
+
+       return 0;
+}
+
+int amdgpu_virt_check_vf_critical_region(struct amdgpu_device *adev, u64 addr, bool *hit)
+{
+       struct amdgpu_virt *virt = &adev->virt;
+       int r = -EPERM;
+
+       if (!virt->ops || !virt->ops->req_ras_chk_criti)
+               return -EOPNOTSUPP;
+
+       /* Host allows 15 ras telemetry requests per 60 seconds. Afterwhich, the Host
+        * will ignore incoming guest messages. Ratelimit the guest messages to
+        * prevent guest self DOS.
+        */
+       if (__ratelimit(&virt->ras.ras_chk_criti_rs)) {
+               mutex_lock(&virt->ras.ras_telemetry_mutex);
+               if (!virt->ops->req_ras_chk_criti(adev, addr))
+                       r = amdgpu_virt_cache_chk_criti_hit(
+                               adev, virt->fw_reserve.ras_telemetry, hit);
+               mutex_unlock(&virt->ras.ras_telemetry_mutex);
+       }
+
+       return r;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +3 -0
index 3da3ebb1d9a1..6ca83abd7a4f 100644
@@ -98,6 +98,7 @@ struct amdgpu_virt_ops {
         int (*req_ras_err_count)(struct amdgpu_device *adev);
         int (*req_ras_cper_dump)(struct amdgpu_device *adev, u64 vf_rptr);
         int (*req_bad_pages)(struct amdgpu_device *adev);
+       int (*req_ras_chk_criti)(struct amdgpu_device *adev, u64 addr);
 };
 
 /*
@@ -252,6 +253,7 @@ struct amdgpu_virt_ras_err_handler_data {
 struct amdgpu_virt_ras {
         struct ratelimit_state ras_error_cnt_rs;
         struct ratelimit_state ras_cper_dump_rs;
+       struct ratelimit_state ras_chk_criti_rs;
         struct mutex ras_telemetry_mutex;
         uint64_t cper_rptr;
 };
@@ -447,4 +449,5 @@ int amdgpu_virt_ras_telemetry_post_reset(struct amdgpu_device *adev);
 bool amdgpu_virt_ras_telemetry_block_en(struct amdgpu_device *adev,
                                         enum amdgpu_ras_block block);
 void amdgpu_virt_request_bad_pages(struct amdgpu_device *adev);
+int amdgpu_virt_check_vf_critical_region(struct amdgpu_device *adev, u64 addr, bool *hit);
 #endif
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +5 -0
index 33edad1f9dcd..3a79ed7d8031 100644
@@ -405,12 +405,17 @@ struct amd_sriov_ras_cper_dump {
         uint32_t buf[];
 };
 
+struct amd_sriov_ras_chk_criti {
+       uint32_t hit;
+};
+
 struct amdsriov_ras_telemetry {
         struct amd_sriov_ras_telemetry_header header;
 
         union {
                 struct amd_sriov_ras_telemetry_error_count error_count;
                 struct amd_sriov_ras_cper_dump cper_dump;
+               struct amd_sriov_ras_chk_criti chk_criti;
         } body;
 };
 
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +14 -0
index f6d8597452ed..00c5db336c0e 100644
@@ -205,6 +205,9 @@ static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev,
         case IDH_REQ_RAS_BAD_PAGES:
                 event = IDH_RAS_BAD_PAGES_READY;
                 break;
+       case IDH_REQ_RAS_CHK_CRITI:
+               event = IDH_REQ_RAS_CHK_CRITI_READY;
+               break;
         default:
                 break;
         }
@@ -535,6 +538,16 @@ static int xgpu_nv_req_ras_bad_pages(struct amdgpu_device *adev)
         return xgpu_nv_send_access_requests(adev, IDH_REQ_RAS_BAD_PAGES);
 }
 
+static int xgpu_nv_check_vf_critical_region(struct amdgpu_device *adev, u64 addr)
+{
+       uint32_t addr_hi, addr_lo;
+
+       addr_hi = (uint32_t)(addr >> 32);
+       addr_lo = (uint32_t)(addr & 0xFFFFFFFF);
+       return xgpu_nv_send_access_requests_with_param(
+               adev, IDH_REQ_RAS_CHK_CRITI, addr_hi, addr_lo, 0);
+}
+
 const struct amdgpu_virt_ops xgpu_nv_virt_ops = {
         .req_full_gpu   = xgpu_nv_request_full_gpu_access,
         .rel_full_gpu   = xgpu_nv_release_full_gpu_access,
@@ -548,4 +561,5 @@ const struct amdgpu_virt_ops xgpu_nv_virt_ops = {
         .req_ras_err_count = xgpu_nv_req_ras_err_count,
         .req_ras_cper_dump = xgpu_nv_req_ras_cper_dump,
         .req_bad_pages = xgpu_nv_req_ras_bad_pages,
+       .req_ras_chk_criti = xgpu_nv_check_vf_critical_region
 };
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h +2 -0
index 5808689562cc..c1083e5e41e0 100644
@@ -43,6 +43,7 @@ enum idh_request {
         IDH_REQ_RAS_ERROR_COUNT = 203,
         IDH_REQ_RAS_CPER_DUMP = 204,
         IDH_REQ_RAS_BAD_PAGES = 205,
+       IDH_REQ_RAS_CHK_CRITI = 206
 };
 
 enum idh_event {
@@ -62,6 +63,7 @@ enum idh_event {
         IDH_RAS_BAD_PAGES_READY = 15,
         IDH_RAS_BAD_PAGES_NOTIFICATION = 16,
         IDH_UNRECOV_ERR_NOTIFICATION = 17,
+       IDH_REQ_RAS_CHK_CRITI_READY = 18,
 
         IDH_TEXT_MESSAGE = 255,
 };

--
2.34.1

#10 lore raw

RE: [PATCH 1/2] drm/amdgpu: Introduce VF critical region check for RAS poison injection

In reply to a message not in the archive

[AMD Official Use Only - AMD Internal Distribution Only]

The series looks good to me, but still need @Skvortsov, Victor or @Gande, Shravan kumar to review.

Regards,
Stanley

Quoted 218 lines

-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]>
Sent: Tuesday, August 19, 2025 1:26 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Introduce VF critical region check for RAS poison injection

The SRIOV guest send requet to host to check whether the poison injection address is in VF critical region or not via mabox.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c    | 55
+++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h    |  3 ++
 drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h |  5 ++
 drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c       | 14 ++++++
 drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h       |  2 +
 5 files changed, 79 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +6 -0
index 13f0cdeb59c4..3328ab63376b 100644
@@ -828,11 +828,14 @@ static void amdgpu_virt_init_ras(struct
 amdgpu_device *adev)  {
      ratelimit_state_init(&adev->virt.ras.ras_error_cnt_rs, 5 * HZ, 1);
      ratelimit_state_init(&adev->virt.ras.ras_cper_dump_rs, 5 * HZ, 1);
+     ratelimit_state_init(&adev->virt.ras.ras_chk_criti_rs, 5 * HZ, 1);
 
      ratelimit_set_flags(&adev->virt.ras.ras_error_cnt_rs,
                          RATELIMIT_MSG_ON_RELEASE);
      ratelimit_set_flags(&adev->virt.ras.ras_cper_dump_rs,
                          RATELIMIT_MSG_ON_RELEASE);
+     ratelimit_set_flags(&adev->virt.ras.ras_chk_criti_rs,
+                         RATELIMIT_MSG_ON_RELEASE);
 
      mutex_init(&adev->virt.ras.ras_telemetry_mutex);
 
@@ -1501,3 +1504,55 @@ void amdgpu_virt_request_bad_pages(struct
 amdgpu_device *adev)
      if (virt->ops && virt->ops->req_bad_pages)
              virt->ops->req_bad_pages(adev);
 }
+
+static int amdgpu_virt_cache_chk_criti_hit(struct amdgpu_device *adev,
+                                        struct amdsriov_ras_telemetry

*host_telemetry,

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +12 -0
+                                        bool *hit)
+{
+     struct amd_sriov_ras_chk_criti *tmp = NULL;
+     uint32_t checksum, used_size;
+
+     checksum = host_telemetry->header.checksum;
+     used_size = host_telemetry->header.used_size;
+
+     if (used_size > (AMD_SRIOV_RAS_TELEMETRY_SIZE_KB << 10))
+             return 0;
+
+     tmp = kmemdup(&host_telemetry->body.chk_criti, used_size,

GFP_KERNEL);

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +24 -0
+     if (!tmp)
+             return -ENOMEM;
+
+     if (checksum != amd_sriov_msg_checksum(tmp, used_size, 0, 0))
+             goto out;
+
+     if (hit)
+             *hit = tmp->hit ? true : false;
+
+out:
+     kfree(tmp);
+
+     return 0;
+}
+
+int amdgpu_virt_check_vf_critical_region(struct amdgpu_device *adev,
+u64 addr, bool *hit) {
+     struct amdgpu_virt *virt = &adev->virt;
+     int r = -EPERM;
+
+     if (!virt->ops || !virt->ops->req_ras_chk_criti)
+             return -EOPNOTSUPP;
+
+     /* Host allows 15 ras telemetry requests per 60 seconds. Afterwhich,

the Host
+ * will ignore incoming guest messages. Ratelimit the guest messages
to

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +12 -0
+      * prevent guest self DOS.
+      */
+     if (__ratelimit(&virt->ras.ras_chk_criti_rs)) {
+             mutex_lock(&virt->ras.ras_telemetry_mutex);
+             if (!virt->ops->req_ras_chk_criti(adev, addr))
+                     r = amdgpu_virt_cache_chk_criti_hit(
+                             adev, virt->fw_reserve.ras_telemetry, hit);
+             mutex_unlock(&virt->ras.ras_telemetry_mutex);
+     }
+
+     return r;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -0
index 3da3ebb1d9a1..6ca83abd7a4f 100644
@@ -98,6 +98,7 @@ struct amdgpu_virt_ops {
      int (*req_ras_err_count)(struct amdgpu_device *adev);
      int (*req_ras_cper_dump)(struct amdgpu_device *adev, u64 vf_rptr);
      int (*req_bad_pages)(struct amdgpu_device *adev);
+     int (*req_ras_chk_criti)(struct amdgpu_device *adev, u64 addr);
 };
 
 /*
@@ -252,6 +253,7 @@ struct amdgpu_virt_ras_err_handler_data {  struct
 amdgpu_virt_ras {
      struct ratelimit_state ras_error_cnt_rs;
      struct ratelimit_state ras_cper_dump_rs;
+     struct ratelimit_state ras_chk_criti_rs;
      struct mutex ras_telemetry_mutex;
      uint64_t cper_rptr;
 };
@@ -447,4 +449,5 @@ int amdgpu_virt_ras_telemetry_post_reset(struct

amdgpu_device *adev); bool amdgpu_virt_ras_telemetry_block_en(struct amdgpu_device *adev,

                                      enum amdgpu_ras_block block);

void amdgpu_virt_request_bad_pages(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -0
+int amdgpu_virt_check_vf_critical_region(struct amdgpu_device *adev,
+u64 addr, bool *hit);
 #endif
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +5 -0
index 33edad1f9dcd..3a79ed7d8031 100644
@@ -405,12 +405,17 @@ struct amd_sriov_ras_cper_dump {
      uint32_t buf[];
 };
 
+struct amd_sriov_ras_chk_criti {
+     uint32_t hit;
+};
+
 struct amdsriov_ras_telemetry {
      struct amd_sriov_ras_telemetry_header header;
 
      union {
              struct amd_sriov_ras_telemetry_error_count error_count;
              struct amd_sriov_ras_cper_dump cper_dump;
+             struct amd_sriov_ras_chk_criti chk_criti;
      } body;
 };
 
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +3 -0
index f6d8597452ed..00c5db336c0e 100644
@@ -205,6 +205,9 @@ static int
 xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev,
      case IDH_REQ_RAS_BAD_PAGES:
              event = IDH_RAS_BAD_PAGES_READY;
              break;
+     case IDH_REQ_RAS_CHK_CRITI:
+             event = IDH_REQ_RAS_CHK_CRITI_READY;
+             break;
      default:
              break;
      }
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +10 -0
@@ -535,6 +538,16 @@ static int xgpu_nv_req_ras_bad_pages(struct
 amdgpu_device *adev)
      return xgpu_nv_send_access_requests(adev,
 IDH_REQ_RAS_BAD_PAGES);  }
 
+static int xgpu_nv_check_vf_critical_region(struct amdgpu_device *adev,
+u64 addr) {
+     uint32_t addr_hi, addr_lo;
+
+     addr_hi = (uint32_t)(addr >> 32);
+     addr_lo = (uint32_t)(addr & 0xFFFFFFFF);
+     return xgpu_nv_send_access_requests_with_param(
+             adev, IDH_REQ_RAS_CHK_CRITI, addr_hi, addr_lo, 0); }
+
 const struct amdgpu_virt_ops xgpu_nv_virt_ops = {
      .req_full_gpu   = xgpu_nv_request_full_gpu_access,
      .rel_full_gpu   = xgpu_nv_release_full_gpu_access,
@@ -548,4 +561,5 @@ const struct amdgpu_virt_ops xgpu_nv_virt_ops = {
      .req_ras_err_count = xgpu_nv_req_ras_err_count,
      .req_ras_cper_dump = xgpu_nv_req_ras_cper_dump,
      .req_bad_pages = xgpu_nv_req_ras_bad_pages,
+     .req_ras_chk_criti = xgpu_nv_check_vf_critical_region
 };
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h +2 -1
index 5808689562cc..c1083e5e41e0 100644
@@ -43,6 +43,7 @@ enum idh_request {
      IDH_REQ_RAS_ERROR_COUNT = 203,
      IDH_REQ_RAS_CPER_DUMP = 204,
      IDH_REQ_RAS_BAD_PAGES = 205,
+     IDH_REQ_RAS_CHK_CRITI = 206
 };
 
 enum idh_event {
@@ -62,6 +63,7 @@ enum idh_event {
      IDH_RAS_BAD_PAGES_READY = 15,
      IDH_RAS_BAD_PAGES_NOTIFICATION = 16,
      IDH_UNRECOV_ERR_NOTIFICATION = 17,
+     IDH_REQ_RAS_CHK_CRITI_READY = 18,
 
      IDH_TEXT_MESSAGE = 255,
 };
--

2.34.1

#11 lore raw

RE: [PATCH 1/2] drm/amdgpu: Introduce VF critical region check for RAS poison injection

[AMD Official Use Only - AMD Internal Distribution Only]

The series looks good.

Thanks,
Shravan

-----Original Message-----
From: Yang, Stanley <[email protected]>
Sent: Tuesday, September 16, 2025 2:50 AM
To: Liu, Xiang(Dean) <[email protected]>; [email protected]; Skvortsov, Victor <[email protected]>; Gande, Shravan kumar <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Chai, Thomas <[email protected]>
Subject: RE: [PATCH 1/2] drm/amdgpu: Introduce VF critical region check for RAS poison injection

[AMD Official Use Only - AMD Internal Distribution Only]

The series looks good to me, but still need @Skvortsov, Victor or @Gande, Shravan kumar to review.

Regards,
Stanley

Quoted 221 lines

-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]>
Sent: Tuesday, August 19, 2025 1:26 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Introduce VF critical region check for RAS poison injection

The SRIOV guest send requet to host to check whether the poison injection address is in VF critical region or not via mabox.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c    | 55
+++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h    |  3 ++
 drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h |  5 ++
 drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c       | 14 ++++++
 drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h       |  2 +
 5 files changed, 79 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +7 -0
index 13f0cdeb59c4..3328ab63376b 100644
@@ -828,11 +828,14 @@ static void amdgpu_virt_init_ras(struct
 amdgpu_device *adev)  {
      ratelimit_state_init(&adev->virt.ras.ras_error_cnt_rs, 5 * HZ, 1);
      ratelimit_state_init(&adev->virt.ras.ras_cper_dump_rs, 5 * HZ,
 1);
+     ratelimit_state_init(&adev->virt.ras.ras_chk_criti_rs, 5 * HZ,
+ 1);
 
      ratelimit_set_flags(&adev->virt.ras.ras_error_cnt_rs,
                          RATELIMIT_MSG_ON_RELEASE);
      ratelimit_set_flags(&adev->virt.ras.ras_cper_dump_rs,
                          RATELIMIT_MSG_ON_RELEASE);
+     ratelimit_set_flags(&adev->virt.ras.ras_chk_criti_rs,
+                         RATELIMIT_MSG_ON_RELEASE);
 
      mutex_init(&adev->virt.ras.ras_telemetry_mutex);
@@ -1501,3 +1504,55 @@ void amdgpu_virt_request_bad_pages(struct
 amdgpu_device *adev)
      if (virt->ops && virt->ops->req_bad_pages)
              virt->ops->req_bad_pages(adev);  }
+
+static int amdgpu_virt_cache_chk_criti_hit(struct amdgpu_device *adev,
+                                        struct amdsriov_ras_telemetry

*host_telemetry,

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +11 -0
+                                        bool *hit) {
+     struct amd_sriov_ras_chk_criti *tmp = NULL;
+     uint32_t checksum, used_size;
+
+     checksum = host_telemetry->header.checksum;
+     used_size = host_telemetry->header.used_size;
+
+     if (used_size > (AMD_SRIOV_RAS_TELEMETRY_SIZE_KB << 10))
+             return 0;
+
+     tmp = kmemdup(&host_telemetry->body.chk_criti, used_size,

GFP_KERNEL);

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +25 -0
+     if (!tmp)
+             return -ENOMEM;
+
+     if (checksum != amd_sriov_msg_checksum(tmp, used_size, 0, 0))
+             goto out;
+
+     if (hit)
+             *hit = tmp->hit ? true : false;
+
+out:
+     kfree(tmp);
+
+     return 0;
+}
+
+int amdgpu_virt_check_vf_critical_region(struct amdgpu_device *adev,
+u64 addr, bool *hit) {
+     struct amdgpu_virt *virt = &adev->virt;
+     int r = -EPERM;
+
+     if (!virt->ops || !virt->ops->req_ras_chk_criti)
+             return -EOPNOTSUPP;
+
+     /* Host allows 15 ras telemetry requests per 60 seconds.
+ Afterwhich,

the Host
+ * will ignore incoming guest messages. Ratelimit the guest
+ messages
to

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +12 -0
+      * prevent guest self DOS.
+      */
+     if (__ratelimit(&virt->ras.ras_chk_criti_rs)) {
+             mutex_lock(&virt->ras.ras_telemetry_mutex);
+             if (!virt->ops->req_ras_chk_criti(adev, addr))
+                     r = amdgpu_virt_cache_chk_criti_hit(
+                             adev, virt->fw_reserve.ras_telemetry, hit);
+             mutex_unlock(&virt->ras.ras_telemetry_mutex);
+     }
+
+     return r;
+}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -0
index 3da3ebb1d9a1..6ca83abd7a4f 100644
@@ -98,6 +98,7 @@ struct amdgpu_virt_ops {
      int (*req_ras_err_count)(struct amdgpu_device *adev);
      int (*req_ras_cper_dump)(struct amdgpu_device *adev, u64 vf_rptr);
      int (*req_bad_pages)(struct amdgpu_device *adev);
+     int (*req_ras_chk_criti)(struct amdgpu_device *adev, u64 addr);
 };
 
 /*
@@ -252,6 +253,7 @@ struct amdgpu_virt_ras_err_handler_data {  struct
 amdgpu_virt_ras {
      struct ratelimit_state ras_error_cnt_rs;
      struct ratelimit_state ras_cper_dump_rs;
+     struct ratelimit_state ras_chk_criti_rs;
      struct mutex ras_telemetry_mutex;
      uint64_t cper_rptr;
 };
@@ -447,4 +449,5 @@ int amdgpu_virt_ras_telemetry_post_reset(struct

amdgpu_device *adev); bool amdgpu_virt_ras_telemetry_block_en(struct amdgpu_device *adev,

                                      enum amdgpu_ras_block block);

void amdgpu_virt_request_bad_pages(struct amdgpu_device *adev);

drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -0
+int amdgpu_virt_check_vf_critical_region(struct amdgpu_device *adev,
+u64 addr, bool *hit);
 #endif
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +5 -0
index 33edad1f9dcd..3a79ed7d8031 100644
@@ -405,12 +405,17 @@ struct amd_sriov_ras_cper_dump {
      uint32_t buf[];
 };
 
+struct amd_sriov_ras_chk_criti {
+     uint32_t hit;
+};
+
 struct amdsriov_ras_telemetry {
      struct amd_sriov_ras_telemetry_header header;
 
      union {
              struct amd_sriov_ras_telemetry_error_count error_count;
              struct amd_sriov_ras_cper_dump cper_dump;
+             struct amd_sriov_ras_chk_criti chk_criti;
      } body;
 };
 
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +3 -0
index f6d8597452ed..00c5db336c0e 100644
@@ -205,6 +205,9 @@ static int
 xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev,
      case IDH_REQ_RAS_BAD_PAGES:
              event = IDH_RAS_BAD_PAGES_READY;
              break;
+     case IDH_REQ_RAS_CHK_CRITI:
+             event = IDH_REQ_RAS_CHK_CRITI_READY;
+             break;
      default:
              break;
      }
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +10 -0
@@ -535,6 +538,16 @@ static int xgpu_nv_req_ras_bad_pages(struct
 amdgpu_device *adev)
      return xgpu_nv_send_access_requests(adev,
 IDH_REQ_RAS_BAD_PAGES);  }
 
+static int xgpu_nv_check_vf_critical_region(struct amdgpu_device
+*adev,
+u64 addr) {
+     uint32_t addr_hi, addr_lo;
+
+     addr_hi = (uint32_t)(addr >> 32);
+     addr_lo = (uint32_t)(addr & 0xFFFFFFFF);
+     return xgpu_nv_send_access_requests_with_param(
+             adev, IDH_REQ_RAS_CHK_CRITI, addr_hi, addr_lo, 0); }
+
 const struct amdgpu_virt_ops xgpu_nv_virt_ops = {
      .req_full_gpu   = xgpu_nv_request_full_gpu_access,

.rel_full_gpu = xgpu_nv_release_full_gpu_access,

drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +1 -0
@@ -548,4 +561,5 @@ const struct amdgpu_virt_ops xgpu_nv_virt_ops = {
      .req_ras_err_count = xgpu_nv_req_ras_err_count,
      .req_ras_cper_dump = xgpu_nv_req_ras_cper_dump,
      .req_bad_pages = xgpu_nv_req_ras_bad_pages,
+     .req_ras_chk_criti = xgpu_nv_check_vf_critical_region
 };
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.h +2 -1
index 5808689562cc..c1083e5e41e0 100644
@@ -43,6 +43,7 @@ enum idh_request {
      IDH_REQ_RAS_ERROR_COUNT = 203,
      IDH_REQ_RAS_CPER_DUMP = 204,
      IDH_REQ_RAS_BAD_PAGES = 205,
+     IDH_REQ_RAS_CHK_CRITI = 206
 };
 
 enum idh_event {
@@ -62,6 +63,7 @@ enum idh_event {
      IDH_RAS_BAD_PAGES_READY = 15,
      IDH_RAS_BAD_PAGES_NOTIFICATION = 16,
      IDH_UNRECOV_ERR_NOTIFICATION = 17,
+     IDH_REQ_RAS_CHK_CRITI_READY = 18,
 
      IDH_TEXT_MESSAGE = 255,
 };
--

2.34.1