drm/amdgpu: Synchronize sriov host to add block_mmsch bit field
Subsystems (3)
PATCH 1/3 drm/amdgpu: Synchronize sriov host to add block_mmsch bit field
Synchronize sriov host to add block_mmsch bit field.
--- drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +2 -1
@@ -198,8 +198,9 @@ union amd_sriov_ras_caps { uint64_t block_jpeg : 1; uint64_t block_ih : 1; uint64_t block_mpio : 1; + uint64_t block_mmsch : 1; uint64_t poison_propogation_mode : 1; - uint64_t reserved : 44; + uint64_t reserved : 43; } bits;uint64_t all; };
Signature · 1 line
2.34.1
PATCH 2/3 drm/amdgpu: Add lock to serialize sriov command execution
Add lock to serialize sriov command execution.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 2 ++ drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -0
@@ -917,6 +917,7 @@ static void amdgpu_virt_init_ras(struct amdgpu_device *adev) RATELIMIT_MSG_ON_RELEASE);mutex_init (&adev->virt.ras.ras_telemetry_mutex); +mutex_init (&adev->virt.access_req_mutex); adev->virt.ras.cper_rptr =0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -0
@@ -324,6 +324,8 @@ struct amdgpu_virt {/* Spinlock to protect access to the RLCG register interface */ spinlock_t rlcg_reg_lock; +struct mutex access_req_mutex; +union amd_sriov_ras_caps ras_en_caps;union amd_sriov_ras_caps ras_telemetry_en_caps;struct amdgpu_virt_ras ras;
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +12 -5
@@ -173,13 +173,17 @@ static void xgpu_nv_mailbox_trans_msg (struct amdgpu_device *adev,static int xgpu_nv_send_access_requests_with_param (struct amdgpu_device *adev,enum idh_request req,u32 data1,u32 data2,u32 data3) { -int r, retry =1 ; +struct amdgpu_virt *virt = &adev->virt; +int r =0 , retry =1 ;enum idh_event event =-1 ; +mutex_lock (&virt->access_req_mutex); send_request: -if (amdgpu_ras_is_rma (adev)) -return -ENODEV ; +if (amdgpu_ras_is_rma (adev)) { + r = -ENODEV ; + goto out; + }xgpu_nv_mailbox_trans_msg (adev, req, data1, data2, data3);
@@ -217,7 +221,7 @@ static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev,if (req !=IDH_REQ_GPU_INIT_DATA ) {dev_err (adev->dev,"Doesn't get msg:%d from pf, error=%d\n" , event, r); -return r; + goto out; }else /* host doesn't support REQ_GPU_INIT_DATA handshake */ adev->virt.req_init_data_ver =0 ; }else {
@@ -246,7 +250,10 @@ static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev, } } -return 0 ; +out: +mutex_unlock (&virt->access_req_mutex); + +return r; } static int xgpu_nv_send_access_requests(struct amdgpu_device *adev,
Signature · 1 line
2.34.1
RE: [PATCH 2/3] drm/amdgpu: Add lock to serialize sriov command execution
[AMD Official Use Only - AMD Internal Distribution Only]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of YiPeng Chai
Sent: Thursday, November 13, 2025 16:42
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Li, Candice <[email protected]>; Yang, Stanley <[email protected]>; Su, Joe <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 2/3] drm/amdgpu: Add lock to serialize sriov command execution
Add lock to serialize sriov command execution.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 2 ++ drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +1 -0
@@ -917,6 +917,7 @@ static void amdgpu_virt_init_ras(struct amdgpu_device *adev) RATELIMIT_MSG_ON_RELEASE);mutex_init (&adev->virt.ras.ras_telemetry_mutex); +mutex_init (&adev->virt.access_req_mutex);
[kevin]:
it seems the "mutex_destroy()" function is missed in this change? this can lead to resource leaks.
Btw, all above 2 locks have this kind of issue.
Best Regards,
Kevin
adev->virt.ras.cper_rptr = 0;
}
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +2 -0
@@ -324,6 +324,8 @@ struct amdgpu_virt {/* Spinlock to protect access to the RLCG register interface */ spinlock_t rlcg_reg_lock; +struct mutex access_req_mutex; +union amd_sriov_ras_caps ras_en_caps;union amd_sriov_ras_caps ras_telemetry_en_caps;struct amdgpu_virt_ras ras;
drivers/gpu/drm/amd/amdgpu/mxgpu_nv.c +12 -5
@@ -173,13 +173,17 @@ static void xgpu_nv_mailbox_trans_msg (struct amdgpu_device *adev, static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev, enum idh_request req, u32 data1, u32 data2, u32 data3) { - int r, retry = 1; + struct amdgpu_virt *virt = &adev->virt; +int r =0 , retry =1 ;enum idh_event event =-1 ; +mutex_lock (&virt->access_req_mutex); send_request: -if (amdgpu_ras_is_rma (adev)) -return -ENODEV ; +if (amdgpu_ras_is_rma (adev)) { + r = -ENODEV ; + goto out; + }xgpu_nv_mailbox_trans_msg (adev, req, data1, data2, data3);
@@ -217,7 +221,7 @@ static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev,if (req !=IDH_REQ_GPU_INIT_DATA ) {dev_err (adev->dev,"Doesn't get msg:%d from pf, error=%d\n" , event, r); -return r; + goto out; }else /* host doesn't support REQ_GPU_INIT_DATA handshake */ adev->virt.req_init_data_ver =0 ; }else {
@@ -246,7 +250,10 @@ static int xgpu_nv_send_access_requests_with_param(struct amdgpu_device *adev, } } -return 0 ; +out: +mutex_unlock (&virt->access_req_mutex); + +return r; } static int xgpu_nv_send_access_requests(struct amdgpu_device *adev,
--
2.34.1
PATCH 3/3 drm/amdgpu: Fix the issue of missing ras message on sriov host
In reply to YiPeng ChaiThis code only applies to amdgpu processing
poison consumption after uniras is enabled,
but not to sriov.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 15 --------------- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0 -15
@@ -36,7 +36,6 @@#include "amdgpu_ras.h" #include "amdgpu_umc.h" #include "amdgpu_reset.h" -#include "amdgpu_ras_mgr.h" /* Total memory size in system memory and all GPU VRAM. Used to * estimate worst case amount of memory to reserve for page tables
@@ -757,20 +756,6 @@ void amdgpu_amdkfd_ras_pasid_poison_consumption_handler(struct amdgpu_device *ad enum amdgpu_ras_block block, uint16_t pasid, pasid_notify pasid_fn, void *data, uint32_t reset) { - - if (amdgpu_uniras_enabled(adev)) { - struct ras_ih_info ih_info; - -memset (&ih_info,0 ,sizeof (ih_info)); - ih_info.block = block; - ih_info.pasid = pasid; - ih_info.reset = reset; - ih_info.pasid_fn = pasid_fn; - ih_info.data = data; -amdgpu_ras_mgr_handle_consumer_interrupt (adev, &ih_info); -return ; - } -amdgpu_umc_pasid_poison_handler (adev ,block ,pasid ,pasid_fn ,data ,reset ); }
drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +10 -0
@@ -24,6 +24,7 @@#include <linux/sort.h> #include "amdgpu.h" #include "umc_v6_7.h" +#include "amdgpu_ras_mgr.h" #define MAX_UMC_POISON_POLLING_TIME_SYNC 20 //ms#define MAX_UMC_HASH_STRING_SIZE 256
@@ -273,6 +274,15 @@ int amdgpu_umc_pasid_poison_handler(struct amdgpu_device *adev, }amdgpu_ras_error_data_fini (&err_data); + }else if (amdgpu_uniras_enabled (adev)) { +struct ras_ih_info ih_info = {0 }; + + ih_info.block = block; + ih_info.pasid = pasid; + ih_info.reset = reset; + ih_info.pasid_fn = pasid_fn; + ih_info.data = data; +amdgpu_ras_mgr_handle_consumer_interrupt (adev, &ih_info); }else {struct amdgpu_ras *con =amdgpu_ras_get_context (adev);int ret;
Signature · 1 line
2.34.1
RE: [PATCH 3/3] drm/amdgpu: Fix the issue of missing ras message on sriov host
[AMD Official Use Only - AMD Internal Distribution Only]
Series is
Regards,
Hawking
-----Original Message-----
From: Chai, Thomas <[email protected]>
Sent: Thursday, November 13, 2025 16:42
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Li, Candice <[email protected]>; Yang, Stanley <[email protected]>; Su, Joe <[email protected]>; Chai, Thomas <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Fix the issue of missing ras message on sriov host
This code only applies to amdgpu processing poison consumption after uniras is enabled, but not to sriov.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 15 --------------- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +0 -1
@@ -36,7 +36,6 @@#include "amdgpu_ras.h" #include "amdgpu_umc.h" #include "amdgpu_reset.h" -#include "amdgpu_ras_mgr.h" /* Total memory size in system memory and all GPU VRAM. Used to * estimate worst case amount of memory to reserve for page tables @@ -757,20 +756,6 @@ void amdgpu_amdkfd_ras_pasid_poison_consumption_handler(struct amdgpu_device *ad
enum amdgpu_ras_block block, uint16_t pasid, pasid_notify pasid_fn, void *data, uint32_t reset) {
-
- if (amdgpu_uniras_enabled(adev)) {
- struct ras_ih_info ih_info;
-
- memset(&ih_info, 0, sizeof(ih_info));
- ih_info.block = block;
- ih_info.pasid = pasid;
- ih_info.reset = reset;
- ih_info.pasid_fn = pasid_fn;
- ih_info.data = data;
- amdgpu_ras_mgr_handle_consumer_interrupt(adev, &ih_info);
- return;
- }
-
amdgpu_umc_pasid_poison_handler(adev, block, pasid, pasid_fn, data, reset); }drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c +10 -0
@@ -24,6 +24,7 @@#include <linux/sort.h> #include "amdgpu.h" #include "umc_v6_7.h" +#include "amdgpu_ras_mgr.h" #define MAX_UMC_POISON_POLLING_TIME_SYNC 20 //ms#define MAX_UMC_HASH_STRING_SIZE 256
@@ -273,6 +274,15 @@ int amdgpu_umc_pasid_poison_handler(struct amdgpu_device *adev, }amdgpu_ras_error_data_fini (&err_data); + }else if (amdgpu_uniras_enabled (adev)) { +struct ras_ih_info ih_info = {0 }; + + ih_info.block = block; + ih_info.pasid = pasid; + ih_info.reset = reset; + ih_info.pasid_fn = pasid_fn; + ih_info.data = data; +amdgpu_ras_mgr_handle_consumer_interrupt (adev, &ih_info); }else {struct amdgpu_ras *con =amdgpu_ras_get_context (adev);int ret;
--
2.34.1