AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Sync the pf2vf structure between guest and host
@ 2026-04-28 11:12 chong li
  0 siblings, 0 replies; 3+ messages in thread
From: chong li @ 2026-04-28 11:12 UTC (permalink / raw)
  To: amd-gfx; +Cc: Emily.Deng, haijun.chang, chong li

There are gaps in the pf2vf message structure
between the guest driver and the host driver.
The pf2vf message info structure must be kept in sync
between both sides to ensure correct interpretation of fields.

Signed-off-by: chong li <chongli2@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h    |  4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 13 +++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
index 9da0c6e9b869..d563deec0916 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
@@ -163,6 +163,8 @@ enum AMDGIM_FEATURE_FLAG {
 	AMDGIM_FEATURE_RAS_CPER = (1 << 11),
 	AMDGIM_FEATURE_XGMI_TA_EXT_PEER_LINK = (1 << 12),
 	AMDGIM_FEATURE_XGMI_CONNECTED_TO_CPU = (1 << 13),
+	AMDGIM_FEATURE_PTL_SUPPORT = (1 << 14),
+	AMDGIM_FEATURE_UNITID_SUPPORT = (1 << 15),
 };
 
 enum AMDGIM_REG_ACCESS_FLAG {
@@ -441,6 +443,8 @@ static inline bool is_virtual_machine(void)
 	((adev)->virt.gim_feature & AMDGIM_FEATURE_VCN_RB_DECOUPLE)
 #define amdgpu_sriov_is_mes_info_enable(adev) \
 	((adev)->virt.gim_feature & AMDGIM_FEATURE_MES_INFO_ENABLE)
+#define amdgpu_sriov_is_unitid_support(adev) \
+	((adev)->virt.gim_feature & AMDGIM_FEATURE_UNITID_SUPPORT)
 
 #define amdgpu_virt_xgmi_migrate_enabled(adev) \
 	((adev)->virt.is_xgmi_node_migrate_enabled && (adev)->gmc.xgmi.node_segment_size != 0)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
index 847cfd1fd004..9dcf0b07d513 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
@@ -162,7 +162,9 @@ union amd_sriov_msg_feature_flags {
 		uint32_t ras_cper		: 1;
 		uint32_t xgmi_ta_ext_peer_link	: 1;
 		uint32_t xgmi_connected_to_cpu  : 1;
-		uint32_t reserved		: 18;
+		uint32_t ptl_support		: 1;
+		uint32_t unitid_support		: 1;
+		uint32_t reserved		: 16;
 	} flags;
 	uint32_t all;
 };
@@ -256,7 +258,7 @@ struct amd_sriov_msg_pf2vf_info_header {
 	uint32_t reserved[2];
 };
 
-#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (55)
+#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (59)
 struct amd_sriov_msg_pf2vf_info {
 	/* header contains size and version */
 	struct amd_sriov_msg_pf2vf_info_header header;
@@ -314,6 +316,13 @@ struct amd_sriov_msg_pf2vf_info {
 	uint32_t more_bp;	//Reserved for future use.
 	union amd_sriov_ras_caps ras_en_caps;
 	union amd_sriov_ras_caps ras_telemetry_en_caps;
+	/* PTL status response for guest */
+	uint32_t ptl_enabled;        // PTL enable status: 0=disabled, 1=enabled
+	uint32_t ptl_pref_format1;   // Current preferred format 1
+	uint32_t ptl_pref_format2;   // Current preferred format 2
+	/* unit ID assigned by host; vf_idx [0..254] maps to unitid [1..255] (0 = pf) */
+	uint8_t unitid;
+	uint8_t padding[3];  //use the 3 bytes to align
 
 	/* reserved */
 	uint32_t reserved[256 - AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE];
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] drm/amdgpu: Sync the pf2vf structure between guest and host
@ 2026-05-06  9:25 chong li
  2026-05-07  4:37 ` Deng, Emily
  0 siblings, 1 reply; 3+ messages in thread
From: chong li @ 2026-05-06  9:25 UTC (permalink / raw)
  To: amd-gfx; +Cc: Emily.Deng, HaiJun.Chang, chong li

There are gaps in the pf2vf message structure
between the guest driver and the host driver.

The pf2vf message info structure must be kept in sync
between both sides to ensure correct interpretation of fields.

Signed-off-by: chong li <chongli2@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h    |  4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 13 +++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
index 9da0c6e9b869..d563deec0916 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
@@ -163,6 +163,8 @@ enum AMDGIM_FEATURE_FLAG {
 	AMDGIM_FEATURE_RAS_CPER = (1 << 11),
 	AMDGIM_FEATURE_XGMI_TA_EXT_PEER_LINK = (1 << 12),
 	AMDGIM_FEATURE_XGMI_CONNECTED_TO_CPU = (1 << 13),
+	AMDGIM_FEATURE_PTL_SUPPORT = (1 << 14),
+	AMDGIM_FEATURE_UNITID_SUPPORT = (1 << 15),
 };
 
 enum AMDGIM_REG_ACCESS_FLAG {
@@ -441,6 +443,8 @@ static inline bool is_virtual_machine(void)
 	((adev)->virt.gim_feature & AMDGIM_FEATURE_VCN_RB_DECOUPLE)
 #define amdgpu_sriov_is_mes_info_enable(adev) \
 	((adev)->virt.gim_feature & AMDGIM_FEATURE_MES_INFO_ENABLE)
+#define amdgpu_sriov_is_unitid_support(adev) \
+	((adev)->virt.gim_feature & AMDGIM_FEATURE_UNITID_SUPPORT)
 
 #define amdgpu_virt_xgmi_migrate_enabled(adev) \
 	((adev)->virt.is_xgmi_node_migrate_enabled && (adev)->gmc.xgmi.node_segment_size != 0)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
index 847cfd1fd004..9dcf0b07d513 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
@@ -162,7 +162,9 @@ union amd_sriov_msg_feature_flags {
 		uint32_t ras_cper		: 1;
 		uint32_t xgmi_ta_ext_peer_link	: 1;
 		uint32_t xgmi_connected_to_cpu  : 1;
-		uint32_t reserved		: 18;
+		uint32_t ptl_support		: 1;
+		uint32_t unitid_support		: 1;
+		uint32_t reserved		: 16;
 	} flags;
 	uint32_t all;
 };
@@ -256,7 +258,7 @@ struct amd_sriov_msg_pf2vf_info_header {
 	uint32_t reserved[2];
 };
 
-#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (55)
+#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (59)
 struct amd_sriov_msg_pf2vf_info {
 	/* header contains size and version */
 	struct amd_sriov_msg_pf2vf_info_header header;
@@ -314,6 +316,13 @@ struct amd_sriov_msg_pf2vf_info {
 	uint32_t more_bp;	//Reserved for future use.
 	union amd_sriov_ras_caps ras_en_caps;
 	union amd_sriov_ras_caps ras_telemetry_en_caps;
+	/* PTL status response for guest */
+	uint32_t ptl_enabled;        // PTL enable status: 0=disabled, 1=enabled
+	uint32_t ptl_pref_format1;   // Current preferred format 1
+	uint32_t ptl_pref_format2;   // Current preferred format 2
+	/* unit ID assigned by host; vf_idx [0..254] maps to unitid [1..255] (0 = pf) */
+	uint8_t unitid;
+	uint8_t padding[3];  //use the 3 bytes to align
 
 	/* reserved */
 	uint32_t reserved[256 - AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE];
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: Sync the pf2vf structure between guest and host
  2026-05-06  9:25 [PATCH] drm/amdgpu: Sync the pf2vf structure between guest and host chong li
@ 2026-05-07  4:37 ` Deng, Emily
  0 siblings, 0 replies; 3+ messages in thread
From: Deng, Emily @ 2026-05-07  4:37 UTC (permalink / raw)
  To: Li, Chong(Alan), amd-gfx@lists.freedesktop.org; +Cc: Chang, HaiJun

AMD General

Reviewed-by: Emily Deng <Emily.Deng@amd.com>

Emily Deng
Best Wishes



>-----Original Message-----
>From: Li, Chong(Alan) <Chong.Li@amd.com>
>Sent: Wednesday, May 6, 2026 5:26 PM
>To: amd-gfx@lists.freedesktop.org
>Cc: Deng, Emily <Emily.Deng@amd.com>; Chang, HaiJun
><HaiJun.Chang@amd.com>; Li, Chong(Alan) <Chong.Li@amd.com>
>Subject: [PATCH] drm/amdgpu: Sync the pf2vf structure between guest and host
>
>There are gaps in the pf2vf message structure between the guest driver and the host
>driver.
>
>The pf2vf message info structure must be kept in sync between both sides to ensure
>correct interpretation of fields.
>
>Signed-off-by: chong li <chongli2@amd.com>
>---
> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h    |  4 ++++
> drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 13 +++++++++++--
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
>b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
>index 9da0c6e9b869..d563deec0916 100644
>--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
>+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
>@@ -163,6 +163,8 @@ enum AMDGIM_FEATURE_FLAG {
>       AMDGIM_FEATURE_RAS_CPER = (1 << 11),
>       AMDGIM_FEATURE_XGMI_TA_EXT_PEER_LINK = (1 << 12),
>       AMDGIM_FEATURE_XGMI_CONNECTED_TO_CPU = (1 << 13),
>+      AMDGIM_FEATURE_PTL_SUPPORT = (1 << 14),
>+      AMDGIM_FEATURE_UNITID_SUPPORT = (1 << 15),
> };
>
> enum AMDGIM_REG_ACCESS_FLAG {
>@@ -441,6 +443,8 @@ static inline bool is_virtual_machine(void)
>       ((adev)->virt.gim_feature & AMDGIM_FEATURE_VCN_RB_DECOUPLE)
>#define amdgpu_sriov_is_mes_info_enable(adev) \
>       ((adev)->virt.gim_feature & AMDGIM_FEATURE_MES_INFO_ENABLE)
>+#define amdgpu_sriov_is_unitid_support(adev) \
>+      ((adev)->virt.gim_feature & AMDGIM_FEATURE_UNITID_SUPPORT)
>
> #define amdgpu_virt_xgmi_migrate_enabled(adev) \
>       ((adev)->virt.is_xgmi_node_migrate_enabled && (adev)-
>>gmc.xgmi.node_segment_size != 0) diff --git
>a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
>b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
>index 847cfd1fd004..9dcf0b07d513 100644
>--- a/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
>+++ b/drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h
>@@ -162,7 +162,9 @@ union amd_sriov_msg_feature_flags {
>               uint32_t ras_cper               : 1;
>               uint32_t xgmi_ta_ext_peer_link  : 1;
>               uint32_t xgmi_connected_to_cpu  : 1;
>-              uint32_t reserved               : 18;
>+              uint32_t ptl_support            : 1;
>+              uint32_t unitid_support         : 1;
>+              uint32_t reserved               : 16;
>       } flags;
>       uint32_t all;
> };
>@@ -256,7 +258,7 @@ struct amd_sriov_msg_pf2vf_info_header {
>       uint32_t reserved[2];
> };
>
>-#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (55)
>+#define AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE (59)
> struct amd_sriov_msg_pf2vf_info {
>       /* header contains size and version */
>       struct amd_sriov_msg_pf2vf_info_header header; @@ -314,6 +316,13 @@
>struct amd_sriov_msg_pf2vf_info {
>       uint32_t more_bp;       //Reserved for future use.
>       union amd_sriov_ras_caps ras_en_caps;
>       union amd_sriov_ras_caps ras_telemetry_en_caps;
>+      /* PTL status response for guest */
>+      uint32_t ptl_enabled;        // PTL enable status: 0=disabled, 1=enabled
>+      uint32_t ptl_pref_format1;   // Current preferred format 1
>+      uint32_t ptl_pref_format2;   // Current preferred format 2
>+      /* unit ID assigned by host; vf_idx [0..254] maps to unitid [1..255] (0 = pf) */
>+      uint8_t unitid;
>+      uint8_t padding[3];  //use the 3 bytes to align
>
>       /* reserved */
>       uint32_t reserved[256 - AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE];
>--
>2.48.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-07  4:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06  9:25 [PATCH] drm/amdgpu: Sync the pf2vf structure between guest and host chong li
2026-05-07  4:37 ` Deng, Emily
  -- strict thread matches above, loose matches on Subject: below --
2026-04-28 11:12 chong li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox