Skip to contentSkip to conversation

drm/amdgpu/vcn3: send smu interface type

PATCH In review Yifan Zhang 4 participants 4 messages Mar 24, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/vcn3: send smu interface type

From: Boyuan Zhang <[email protected]>

For VCN FW to detect ASIC type

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 7 +++++++
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c   | 7 +++++++
 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +7 -0
index e2fde88aaf5e..f06fb7f882e2 100644
@@ -159,6 +159,7 @@
 #define AMDGPU_VCN_MULTI_QUEUE_FLAG	(1 << 8)
 #define AMDGPU_VCN_SW_RING_FLAG		(1 << 9)
 #define AMDGPU_VCN_FW_LOGGING_FLAG	(1 << 10)
+#define AMDGPU_VCN_SMU_VERSION_INFO_FLAG (1 << 11)
 
 #define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER	0x00000001
 #define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER		0x00000001
@@ -279,6 +280,11 @@ struct amdgpu_fw_shared_fw_logging {
 	uint32_t size;
 };
 
+struct amdgpu_fw_shared_smu_interface_info {
+	uint8_t smu_interface_type;
+	uint8_t padding[3];
+};
+
 struct amdgpu_fw_shared {
 	uint32_t present_flag_0;
 	uint8_t pad[44];
@@ -287,6 +293,7 @@ struct amdgpu_fw_shared {
 	struct amdgpu_fw_shared_multi_queue multi_queue;
 	struct amdgpu_fw_shared_sw_ring sw_ring;
 	struct amdgpu_fw_shared_fw_logging fw_log;
+	struct amdgpu_fw_shared_smu_interface_info smu_interface_info;
 };
 
 struct amdgpu_vcn_fwlog {
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +7 -0
index b16c56aa2d22..c5bf7cbfa82c 100644
@@ -219,6 +219,13 @@ static int vcn_v3_0_sw_init(void *handle)
 					     cpu_to_le32(AMDGPU_VCN_MULTI_QUEUE_FLAG) |
 					     cpu_to_le32(AMDGPU_VCN_FW_SHARED_FLAG_0_RB);
 		fw_shared->sw_ring.is_enabled = cpu_to_le32(DEC_SW_RING_ENABLED);
+		if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 2)) {
+			fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
+			fw_shared->smu_interface_info.smu_interface_type = 2;
+		} else if(adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 1)) {
+			fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
+			fw_shared->smu_interface_info.smu_interface_type = 1;
+		}
 
 		if (amdgpu_vcnfw_log)
 			amdgpu_vcn_fwlog_init(&adev->vcn.inst[i]);
Signature · 1 line
2.35.1
#1 lore raw

+ Leo,

Quoted 48 lines · Yifan

From: Boyuan Zhang <[email protected]>

For VCN FW to detect ASIC type

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 7 +++++++
 drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c   | 7 +++++++
 2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +7 -0
index e2fde88aaf5e..f06fb7f882e2 100644
@@ -159,6 +159,7 @@
 #define AMDGPU_VCN_MULTI_QUEUE_FLAG	(1 << 8)
 #define AMDGPU_VCN_SW_RING_FLAG		(1 << 9)
 #define AMDGPU_VCN_FW_LOGGING_FLAG	(1 << 10)
+#define AMDGPU_VCN_SMU_VERSION_INFO_FLAG (1 << 11)
 
 #define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER	0x00000001
 #define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER		0x00000001
@@ -279,6 +280,11 @@ struct amdgpu_fw_shared_fw_logging {
 	uint32_t size;
 };
 
+struct amdgpu_fw_shared_smu_interface_info {
+	uint8_t smu_interface_type;
+	uint8_t padding[3];
+};
+
 struct amdgpu_fw_shared {
 	uint32_t present_flag_0;
 	uint8_t pad[44];
@@ -287,6 +293,7 @@ struct amdgpu_fw_shared {
 	struct amdgpu_fw_shared_multi_queue multi_queue;
 	struct amdgpu_fw_shared_sw_ring sw_ring;
 	struct amdgpu_fw_shared_fw_logging fw_log;
+	struct amdgpu_fw_shared_smu_interface_info smu_interface_info;
 };
 
 struct amdgpu_vcn_fwlog {
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +0 -0
index b16c56aa2d22..c5bf7cbfa82c 100644

drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c static int vcn_v3_0_sw_init(void *handle) · line 228

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +7 -0
@@ -219,6 +219,13 @@ static int vcn_v3_0_sw_init(void *handle)
 					     cpu_to_le32(AMDGPU_VCN_MULTI_QUEUE_FLAG) |
 					     cpu_to_le32(AMDGPU_VCN_FW_SHARED_FLAG_0_RB);
 		fw_shared->sw_ring.is_enabled = cpu_to_le32(DEC_SW_RING_ENABLED);
+		if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 2)) {
+			fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
+			fw_shared->smu_interface_info.smu_interface_type = 2;
+		} else if(adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 1)) {
+			fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
+			fw_shared->smu_interface_info.smu_interface_type = 1;
+		}

fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;

This line can be moved out of "if else".

With that fixed, patch is Acked-by: Huang Rui <[email protected]>

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +0 -0
 		if (amdgpu_vcnfw_log)
 			amdgpu_vcn_fwlog_init(&adev->vcn.inst[i]);
Signature · 1 line
2.35.1
#2 lore raw
In reply to Yifan Zhang

Dear Yifan, dear Boyuan,

Am 24.03.22 um 03:59 schrieb Yifan Zhang:

Quoted 3 lines

From: Boyuan Zhang <[email protected]>

For VCN FW to detect ASIC type

What affect does this have? How does VCN FW behave different now?

Quoted 44 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 7 +++++++
  drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c   | 7 +++++++
  2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +7 -0
index e2fde88aaf5e..f06fb7f882e2 100644
@@ -159,6 +159,7 @@
  #define AMDGPU_VCN_MULTI_QUEUE_FLAG	(1 << 8)
  #define AMDGPU_VCN_SW_RING_FLAG		(1 << 9)
  #define AMDGPU_VCN_FW_LOGGING_FLAG	(1 << 10)
+#define AMDGPU_VCN_SMU_VERSION_INFO_FLAG (1 << 11)
 
  #define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER	0x00000001
  #define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER		0x00000001
@@ -279,6 +280,11 @@ struct amdgpu_fw_shared_fw_logging {
  	uint32_t size;
  };
 
+struct amdgpu_fw_shared_smu_interface_info {
+	uint8_t smu_interface_type;
+	uint8_t padding[3];
+};
+
  struct amdgpu_fw_shared {
  	uint32_t present_flag_0;
  	uint8_t pad[44];
@@ -287,6 +293,7 @@ struct amdgpu_fw_shared {
  	struct amdgpu_fw_shared_multi_queue multi_queue;
  	struct amdgpu_fw_shared_sw_ring sw_ring;
  	struct amdgpu_fw_shared_fw_logging fw_log;
+	struct amdgpu_fw_shared_smu_interface_info smu_interface_info;
  };
 
  struct amdgpu_vcn_fwlog {
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +0 -0
index b16c56aa2d22..c5bf7cbfa82c 100644

drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c static int vcn_v3_0_sw_init(void *handle) · line 225

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +4 -0
@@ -219,6 +219,13 @@ static int vcn_v3_0_sw_init(void *handle)
  					     cpu_to_le32(AMDGPU_VCN_MULTI_QUEUE_FLAG) |
  					     cpu_to_le32(AMDGPU_VCN_FW_SHARED_FLAG_0_RB);
  		fw_shared->sw_ring.is_enabled = cpu_to_le32(DEC_SW_RING_ENABLED);
+		if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 2)) {
+			fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
+			fw_shared->smu_interface_info.smu_interface_type = 2;
+		} else if(adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 1)) {

Please add a space before the (, which checkpatch.pl also would have found:

    $ scripts/checkpatch.pl 
/dev/shm/0001-drm-amdgpu-vcn3-send-smu-interface-type.patch
    ERROR: space required before the open parenthesis '('
    #58: FILE: drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:225:
+               } else if(adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 1)) {

Also why not order it smallest version first? Will there ever be other IP versions for VCN 3.0?

drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c static int vcn_v3_0_sw_init(void *handle) · line 231

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +3 -0
+			fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
+			fw_shared->smu_interface_info.smu_interface_type = 1;
+		}
 
  		if (amdgpu_vcnfw_log)
  			amdgpu_vcn_fwlog_init(&adev->vcn.inst[i]);

Kind regards,

Paul

#3 lore raw

[AMD Official Use Only]

Hi Paul,

This change is to differentiate device (IP_VERSION(3, 1, 2)) and device (IP_VERSION(3, 1, 1)), since they are using different mailbox registers for VCN DPM. There is no other impact for VCN.

And thank for pointing out the format issue. I just sent out V2. Please have a look.

Regards,
Boyuan

-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: March 24, 2022 1:56 AM
To: Zhang, Yifan <[email protected]>; Zhang, Boyuan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>; Huang, Ray <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/vcn3: send smu interface type

Dear Yifan, dear Boyuan,

Am 24.03.22 um 03:59 schrieb Yifan Zhang:

Quoted 3 lines

From: Boyuan Zhang <[email protected]>

For VCN FW to detect ASIC type

What affect does this have? How does VCN FW behave different now?

Quoted 44 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 7 +++++++
  drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c   | 7 +++++++
  2 files changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +7 -0
index e2fde88aaf5e..f06fb7f882e2 100644
@@ -159,6 +159,7 @@
  #define AMDGPU_VCN_MULTI_QUEUE_FLAG (1 << 8)
  #define AMDGPU_VCN_SW_RING_FLAG             (1 << 9)
  #define AMDGPU_VCN_FW_LOGGING_FLAG  (1 << 10)
+#define AMDGPU_VCN_SMU_VERSION_INFO_FLAG (1 << 11)
 
  #define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER    0x00000001
  #define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER              0x00000001
@@ -279,6 +280,11 @@ struct amdgpu_fw_shared_fw_logging {
      uint32_t size;
  };
 
+struct amdgpu_fw_shared_smu_interface_info {
+     uint8_t smu_interface_type;
+     uint8_t padding[3];
+};
+
  struct amdgpu_fw_shared {
      uint32_t present_flag_0;
      uint8_t pad[44];
@@ -287,6 +293,7 @@ struct amdgpu_fw_shared {
      struct amdgpu_fw_shared_multi_queue multi_queue;
      struct amdgpu_fw_shared_sw_ring sw_ring;
      struct amdgpu_fw_shared_fw_logging fw_log;
+     struct amdgpu_fw_shared_smu_interface_info smu_interface_info;
  };
 
  struct amdgpu_vcn_fwlog {
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +0 -0
index b16c56aa2d22..c5bf7cbfa82c 100644

drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c static int vcn_v3_0_sw_init(void *handle) · line 225

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +4 -0
@@ -219,6 +219,13 @@ static int vcn_v3_0_sw_init(void *handle)
                                           cpu_to_le32(AMDGPU_VCN_MULTI_QUEUE_FLAG) |
                                           cpu_to_le32(AMDGPU_VCN_FW_SHARED_FLAG_0_RB);
              fw_shared->sw_ring.is_enabled = cpu_to_le32(DEC_SW_RING_ENABLED);
+             if (adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 2)) {
+                     fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
+                     fw_shared->smu_interface_info.smu_interface_type = 2;
+             } else if(adev->ip_versions[UVD_HWIP][0] == IP_VERSION(3, 1, 1)) {

Please add a space before the (, which checkpatch.pl also would have found:

     $ scripts/checkpatch.pl
/dev/shm/0001-drm-amdgpu-vcn3-send-smu-interface-type.patch
     ERROR: space required before the open parenthesis '('
     #58: FILE: drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c:225:
+               } else if(adev->ip_versions[UVD_HWIP][0] ==
IP_VERSION(3, 1, 1)) {

Also why not order it smallest version first? Will there ever be other IP versions for VCN 3.0?

drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c static int vcn_v3_0_sw_init(void *handle) · line 231

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c +3 -0
+                     fw_shared->present_flag_0 |= AMDGPU_VCN_SMU_VERSION_INFO_FLAG;
+                     fw_shared->smu_interface_info.smu_interface_type = 1;
+             }
 
              if (amdgpu_vcnfw_log)
                      amdgpu_vcn_fwlog_init(&adev->vcn.inst[i]);

Kind regards,

Paul