drm/amdgpu: Add guest driver CUID support
Subsystems (2)
PATCH v2 1/1 drm/amdgpu: Add guest driver CUID support
v2:
use debugfs_create_x64 and debugfs_create_x8 to create node.
v1:
1. Add guest driver CUID support
2. Do not expose vf index(variable "fcn_idx") to customers, replace the fcn_idx with pad.
Only expose the unitid to customers.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1074,6 +1074,7 @@ struct amdgpu_device {long psp_timeout;uint64_t unique_id; +uint8_t unitid;uint64_t df_perfmon_config_assign_mask[AMDGPU_MAX_DF_PERFMONS ];/* enable runtime pm on the device */
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -0
@@ -2126,6 +2126,9 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)debugfs_create_x32 ("amdgpu_smu_debug" ,0600 , root, &adev->pm.smu_debug_mask); +debugfs_create_x64 ("unique_id" ,0444 , root, &adev->unique_id); +debugfs_create_x8 ("unitid" ,0444 , root, &adev->unitid); + ent =debugfs_create_file ("amdgpu_preempt_ib" ,0600 , root, adev, &fops_ib_preempt);if (IS_ERR (ent)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +6 -2
@@ -534,8 +534,12 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)if ((adev->virt.decode_max_dimension_pixels >0 ) || (adev->virt.encode_max_dimension_pixels >0 )) adev->virt.is_mm_bw_enabled = true; - adev->unique_id = - ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid; + adev->unique_id = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid; + + adev->unitid =0 ; +if (amdgpu_sriov_is_unitid_support (adev)) + adev->unitid = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->unitid; + adev->virt.ras_en_caps.all = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->ras_en_caps.all; adev->virt.ras_telemetry_en_caps.all = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->ras_telemetry_en_caps.all;
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +1 -1
@@ -295,7 +295,7 @@ struct amd_sriov_msg_pf2vf_info {uint32_t vf2pf_update_interval_ms;/* identification in ROCm SMI */ uint64_t uuid; -uint32_t fcn_idx; +uint32_t pad;/* flags to indicate which register access method VF should use */ union amd_sriov_reg_access_flags reg_access_flags;/* MM BW management */
Signature · 1 line
2.48.1
AMD General
Hi, Koenig, Christian.
The line " adev->unitid = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->unitid;" is 97 characters long, and checkpatch.pl enforces a 100-character line-length limit.
checkpatch.pl passes my patch:
root@chonglidebug:/work/kernel/linux# ./scripts/checkpatch.pl ./0001-drm-amdgpu-Add-guest-driver-CUID-support.patch
WARNING: patch prefix 'b' exists, appears to be a -p0 patchWARNING: patch prefix 'b' exists, appears to be a -p0 patch
WARNING: patch prefix 'b' exists, appears to be a -p0 patch
WARNING: patch prefix 'b' exists, appears to be a -p0 patch
total: 0 errors, 4 warnings, 38 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
./0001-drm-amdgpu-Add-guest-driver-CUID-support.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
Thanks,
Chong.
-----Original Message-----
From: Li, Chong(Alan) <[email protected]>
Sent: Saturday, May 9, 2026 6:15 PM
To: [email protected]
Cc: Koenig, Christian <[email protected]>; Chang, HaiJun <[email protected]>; Li, Chong(Alan) <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Add guest driver CUID support
v2:
use debugfs_create_x64 and debugfs_create_x8 to create node.
v1:
1. Add guest driver CUID support
2. Do not expose vf index(variable "fcn_idx") to customers, replace the fcn_idx with pad.
Only expose the unitid to customers.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -1074,6 +1074,7 @@ struct amdgpu_device {long psp_timeout;uint64_t unique_id; +uint8_t unitid;uint64_t df_perfmon_config_assign_mask[AMDGPU_MAX_DF_PERFMONS ];/* enable runtime pm on the device */
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -0
@@ -2126,6 +2126,9 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)debugfs_create_x32 ("amdgpu_smu_debug" ,0600 , root, &adev->pm.smu_debug_mask); +debugfs_create_x64 ("unique_id" ,0444 , root, &adev->unique_id); +debugfs_create_x8 ("unitid" ,0444 , root, &adev->unitid); + ent =debugfs_create_file ("amdgpu_preempt_ib" ,0600 , root, adev, &fops_ib_preempt);if (IS_ERR (ent)) {
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +6 -2
@@ -534,8 +534,12 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)if ((adev->virt.decode_max_dimension_pixels >0 ) || (adev->virt.encode_max_dimension_pixels >0 )) adev->virt.is_mm_bw_enabled = true; - adev->unique_id = - ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid; + adev->unique_id = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid; + + adev->unitid =0 ; +if (amdgpu_sriov_is_unitid_support (adev)) + adev->unitid = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->unitid; + adev->virt.ras_en_caps.all = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->ras_en_caps.all; adev->virt.ras_telemetry_en_caps.all = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->ras_telemetry_en_caps.all;
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +1 -1
@@ -295,7 +295,7 @@ struct amd_sriov_msg_pf2vf_info {uint32_t vf2pf_update_interval_ms;/* identification in ROCm SMI */ uint64_t uuid; -uint32_t fcn_idx; +uint32_t pad;/* flags to indicate which register access method VF should use */ union amd_sriov_reg_access_flags reg_access_flags;/* MM BW management */
--
2.48.1
Christian König
maintainerQuoted 7 lines · Chong(Alan)
AMD General
Hi, Koenig, Christian.
The line "
adev->unitid= ((structamd_sriov_msg_pf2vf_info*)pf2vf_info)->unitid;" is 97 characters long, and checkpatch.pl enforces a 100-character line-length limit.
That is to long, checkpatch.pl enforces 80 character lines.
Since the cast to amd_sriov_msg_pf2vf_info is done multiple times I strongly suggest to use a local variable for that.
Apart from this the patch looks good to me, but I'm wondering if it shouldn't be split into multiple patches. The change of fcn_idx into pad looks unrelated of hand.
Regards,
Christian.
Quoted 112 lines
checkpatch.pl passes my patch:
root@chonglidebug:/work/kernel/linux# ./scripts/checkpatch.pl ./0001-drm-amdgpu-Add-guest-driver-CUID-support.patch WARNING: patch prefix 'b' exists, appears to be a -p0 patchWARNING: patch prefix 'b' exists, appears to be a -p0 patch
WARNING: patch prefix 'b' exists, appears to be a -p0 patch
WARNING: patch prefix 'b' exists, appears to be a -p0 patch
total: 0 errors, 4 warnings, 38 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace../0001-drm-amdgpu-Add-guest-driver-CUID-support.patch has style problems, please review.
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH inMAINTAINERS.Thanks,
Chong.-----Original Message-----
From: Li, Chong(Alan) <[email protected]>
Sent: Saturday, May 9, 2026 6:15 PM
To: [email protected]
Cc: Koenig, Christian <[email protected]>; Chang, HaiJun <[email protected]>; Li, Chong(Alan) <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Add guest driver CUID supportv2:
usedebugfs_create_x64anddebugfs_create_x8to create node.v1:
1. Add guest driver CUID support
2. Do not expose vfindex(variable "fcn_idx")to customers, replace thefcn_idxwith pad.
Only expose the unitid to customers.Signed-off-by chong li <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-0@@ -1074,6 +1074,7 @@ struct amdgpu_device {long psp_timeout;uint64_t unique_id; +uint8_t unitid;uint64_t df_perfmon_config_assign_mask[AMDGPU_MAX_DF_PERFMONS ];/* enable runtime pm on the device */ drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3
-0@@ -2126,6 +2126,9 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)debugfs_create_x32 ("amdgpu_smu_debug" ,0600 , root, &adev->pm.smu_debug_mask); +debugfs_create_x64 ("unique_id" ,0444 , root, &adev->unique_id); +debugfs_create_x8 ("unitid" ,0444 , root, &adev->unitid); + ent =debugfs_create_file ("amdgpu_preempt_ib" ,0600 , root, adev, &fops_ib_preempt);if (IS_ERR (ent)) {drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +6
-2@@ -534,8 +534,12 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev)if ((adev->virt.decode_max_dimension_pixels >0 ) || (adev->virt.encode_max_dimension_pixels >0 )) adev->virt.is_mm_bw_enabled = true; - adev->unique_id = - ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid; + adev->unique_id = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->uuid; + + adev->unitid =0 ; +if (amdgpu_sriov_is_unitid_support (adev)) + adev->unitid = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->unitid; + adev->virt.ras_en_caps.all = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->ras_en_caps.all; adev->virt.ras_telemetry_en_caps.all = ((struct amd_sriov_msg_pf2vf_info *)pf2vf_info)->ras_telemetry_en_caps.all;drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +1
-2@@ -295,7 +295,7 @@ struct amd_sriov_msg_pf2vf_info {uint32_t vf2pf_update_interval_ms;/* identification in ROCm SMI */ uint64_t uuid; -uint32_t fcn_idx; +uint32_t pad;/* flags to indicate which register access method VF should use */ union amd_sriov_reg_access_flags reg_access_flags;/* MM BW management */ --2.48.1