Skip to contentSkip to conversation

drm/amdgpu: fix aldebaran xgmi topology for vf

PATCH In review Jonathan Kim 3 participants 5 messages Mar 9, 2022 – Mar 10, 2022

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

PATCH 1/1 drm/amdgpu: fix aldebaran xgmi topology for vf

VFs must also distinguish whether or not the TA supports full duplex or half duplex link records in order to report the correct xGMI topology.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -2
index 3ce1d38a7822..a6acec1a6155 100644
@@ -310,6 +310,10 @@ static int psp_sw_init(void *handle)
 		return ret;
 	}
 
+	adev->psp.xgmi_context.supports_extended_data =
+		!adev->gmc.xgmi.connected_to_cpu &&
+			adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2);
+
 	memset(&boot_cfg_entry, 0, sizeof(boot_cfg_entry));
 	if (psp_get_runtime_db_entry(adev,
 				PSP_RUNTIME_ENTRY_TYPE_BOOT_CONFIG,
@@ -3008,7 +3012,6 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev)
 		adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr->sos.size_bytes);
 		adev->psp.sos.start_addr = ucode_array_start_addr +
 				le32_to_cpu(sos_hdr->sos.offset_bytes);
-		adev->psp.xgmi_context.supports_extended_data = false;
 	} else {
 		/* Load alternate PSP SOS FW */
 		sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3 *)adev->psp.sos_fw->data;
@@ -3023,7 +3026,6 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev)
 		adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr_v1_3->sos_aux.size_bytes);
 		adev->psp.sos.start_addr = ucode_array_start_addr +
 			le32_to_cpu(sos_hdr_v1_3->sos_aux.offset_bytes);
-		adev->psp.xgmi_context.supports_extended_data = true;
 	}
 
 	if ((adev->psp.sys.size_bytes == 0) || (adev->psp.sos.size_bytes == 0)) {
Signature · 1 line
2.25.1
#1 lore raw
Quoted 4 lines · Jonathan Kim

VFs must also distinguish whether or not the TA supports full duplex or half duplex link records in order to report the correct xGMI topology.

I think I'm missing something here. Your condition for setting supports_extended_data is exactly the same, but you're initializing it in a different function. Can you explain how that change relates to SRIOV?

Thanks,
  Felix

Quoted 35 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -2
index 3ce1d38a7822..a6acec1a6155 100644
@@ -310,6 +310,10 @@ static int psp_sw_init(void *handle)
  		return ret;
  	}
 
+	adev->psp.xgmi_context.supports_extended_data =
+		!adev->gmc.xgmi.connected_to_cpu &&
+			adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13, 0, 2);
+
  	memset(&boot_cfg_entry, 0, sizeof(boot_cfg_entry));
  	if (psp_get_runtime_db_entry(adev,
  				PSP_RUNTIME_ENTRY_TYPE_BOOT_CONFIG,
@@ -3008,7 +3012,6 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev)
  		adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr->sos.size_bytes);
  		adev->psp.sos.start_addr = ucode_array_start_addr +
  				le32_to_cpu(sos_hdr->sos.offset_bytes);
-		adev->psp.xgmi_context.supports_extended_data = false;
  	} else {
  		/* Load alternate PSP SOS FW */
  		sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3 *)adev->psp.sos_fw->data;
@@ -3023,7 +3026,6 @@ static int psp_init_sos_base_fw(struct amdgpu_device *adev)
  		adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr_v1_3->sos_aux.size_bytes);
  		adev->psp.sos.start_addr = ucode_array_start_addr +
  			le32_to_cpu(sos_hdr_v1_3->sos_aux.offset_bytes);
-		adev->psp.xgmi_context.supports_extended_data = true;
  	}
 
  	if ((adev->psp.sys.size_bytes == 0) || (adev->psp.sos.size_bytes == 0)) {
#2 lore raw

[Public]

Quoted 7 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: March 9, 2022 6:12 PM
To: Kim, Jonathan <[email protected]>; [email protected]
Cc: Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix aldebaran xgmi topology for vf

Quoted 8 lines
Quoted 4 lines · Jonathan Kim

VFs must also distinguish whether or not the TA supports full duplex or half duplex link records in order to report the correct xGMI topology.

I think I'm missing something here. Your condition for setting supports_extended_data is exactly the same, but you're initializing it in a different function. Can you explain how that change relates to SRIOV?

I probably should have included more context when sending this out. The proposed support assignment happens after this:

        if (amdgpu_sriov_vf(adev))
                ret = psp_init_sriov_microcode(psp);
        else
                ret = psp_init_microcode(psp);
        if (ret) {
                DRM_ERROR("Failed to load psp firmware!\n");
                return ret;
        }

and psp_init_sriov_microde doesn't set secure OS micro code info (this is where the support assignment currently is).

Thanks,

Jon

Quoted 47 lines

Thanks,
Felix

Quoted 10 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -0
index 3ce1d38a7822..a6acec1a6155 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_sw_init(void *handle) · line 315

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
@@ -310,6 +310,10 @@ static int psp_sw_init(void *handle)
            return ret;
    }
 
+   adev->psp.xgmi_context.supports_extended_data =
+           !adev->gmc.xgmi.connected_to_cpu &&
+                   adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13,

0, 2);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_init_sos_base_fw(struct

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+
    memset(&boot_cfg_entry, 0, sizeof(boot_cfg_entry));
    if (psp_get_runtime_db_entry(adev,
                            PSP_RUNTIME_ENTRY_TYPE_BOOT_CONFIG,
@@ -3008,7 +3012,6 @@ static int psp_init_sos_base_fw(struct

amdgpu_device *adev)

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -1
            adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr-
 sos.size_bytes);
            adev->psp.sos.start_addr = ucode_array_start_addr +
                            le32_to_cpu(sos_hdr->sos.offset_bytes);
-           adev->psp.xgmi_context.supports_extended_data = false;
    } else {
            /* Load alternate PSP SOS FW */

sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3
*)adev->psp.sos_fw->data; @@ -3023,7 +3026,6 @@ static int

psp_init_sos_base_fw(struct amdgpu_device *adev)

Quoted 9 lines
            adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr_v1_3-
sos_aux.size_bytes);
            adev->psp.sos.start_addr = ucode_array_start_addr +
                    le32_to_cpu(sos_hdr_v1_3->sos_aux.offset_bytes);
-           adev->psp.xgmi_context.supports_extended_data = true;
    }

    if ((adev->psp.sys.size_bytes == 0) || (adev->psp.sos.size_bytes ==

0)) {

#3 lore raw

[Public]

Yes, we need the correct setting in both bare-metal and sriov to populate the correct xgmi link info. Move the setting to a common place that not be affect by SRIOV or not make sense to me.

The change is reviewed by : Shaoyun.liu <[email protected]>

-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Wednesday, March 9, 2022 6:31 PM
To: Kuehling, Felix <[email protected]>; [email protected]
Cc: Liu, Shaoyun <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: fix aldebaran xgmi topology for vf

[Public]

Quoted 8 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: March 9, 2022 6:12 PM
To: Kim, Jonathan <[email protected]>; [email protected]
Cc: Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix aldebaran xgmi topology for vf

Quoted 8 lines
Quoted 4 lines · Jonathan Kim

VFs must also distinguish whether or not the TA supports full duplex or half duplex link records in order to report the correct xGMI topology.

I think I'm missing something here. Your condition for setting supports_extended_data is exactly the same, but you're initializing it in a different function. Can you explain how that change relates to SRIOV?

I probably should have included more context when sending this out. The proposed support assignment happens after this:

        if (amdgpu_sriov_vf(adev))
                ret = psp_init_sriov_microcode(psp);
        else
                ret = psp_init_microcode(psp);
        if (ret) {
                DRM_ERROR("Failed to load psp firmware!\n");
                return ret;
        }

and psp_init_sriov_microde doesn't set secure OS micro code info (this is where the support assignment currently is).

Thanks,

Jon

Quoted 48 lines

Thanks,
Felix

Quoted 10 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -0
index 3ce1d38a7822..a6acec1a6155 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_sw_init(void *handle) · line 315

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
@@ -310,6 +310,10 @@ static int psp_sw_init(void *handle)
            return ret;
    }
 
+   adev->psp.xgmi_context.supports_extended_data =
+           !adev->gmc.xgmi.connected_to_cpu &&
+                   adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13,

0, 2);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_init_sos_base_fw(struct

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+
    memset(&boot_cfg_entry, 0, sizeof(boot_cfg_entry));
    if (psp_get_runtime_db_entry(adev,
                            PSP_RUNTIME_ENTRY_TYPE_BOOT_CONFIG,
@@ -3008,7 +3012,6 @@ static int psp_init_sos_base_fw(struct

amdgpu_device *adev)

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -1
            adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr- 
 sos.size_bytes);
            adev->psp.sos.start_addr = ucode_array_start_addr +
                            le32_to_cpu(sos_hdr->sos.offset_bytes);
-           adev->psp.xgmi_context.supports_extended_data = false;
    } else {
            /* Load alternate PSP SOS FW */

sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3
*)adev->psp.sos_fw->data; @@ -3023,7 +3026,6 @@ static int

psp_init_sos_base_fw(struct amdgpu_device *adev)

Quoted 10 lines
            adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr_v1_3- 
sos_aux.size_bytes);
            adev->psp.sos.start_addr = ucode_array_start_addr +
                    le32_to_cpu(sos_hdr_v1_3->sos_aux.offset_bytes);
-           adev->psp.xgmi_context.supports_extended_data = true;
    }

    if ((adev->psp.sys.size_bytes == 0) || (adev->psp.sos.size_bytes 

==
0)) {

Reviewed-by
#4 lore raw
In reply to Kim, Jonathan
Quoted 29 lines · Jonathan

[Public]

Quoted 7 lines

-----Original Message-----
From: Kuehling, Felix <[email protected]>
Sent: March 9, 2022 6:12 PM
To: Kim, Jonathan <[email protected]>; [email protected]
Cc: Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix aldebaran xgmi topology for vf

Quoted 8 lines
Quoted 4 lines · Jonathan Kim

VFs must also distinguish whether or not the TA supports full duplex or half duplex link records in order to report the correct xGMI topology.

I think I'm missing something here. Your condition for setting supports_extended_data is exactly the same, but you're initializing it in a different function. Can you explain how that change relates to SRIOV?

I probably should have included more context when sending this out. The proposed support assignment happens after this:

         if (amdgpu_sriov_vf(adev))
                 ret = psp_init_sriov_microcode(psp);
         else
                 ret = psp_init_microcode(psp);
         if (ret) {
                 DRM_ERROR("Failed to load psp firmware!\n");
                 return ret;
         }
Quoted 1 line

and psp_init_sriov_microde doesn't set secure OS micro code info (this is where the support assignment currently is).

I see, so psp_init_sos_base_fw doesn't run on VFs and therefore the XGMI info wasn't correct. Moving this to psp_sw_init puts it in a common place that is executed on VFs and bare metal. Makes sense.

If you add that explanation to the patch description, the patch is

Quoted 51 lines

Thanks,

Jon

Quoted 46 lines

Thanks,
Felix

Quoted 10 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++--
   1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -0
index 3ce1d38a7822..a6acec1a6155 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_sw_init(void *handle) · line 315

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
@@ -310,6 +310,10 @@ static int psp_sw_init(void *handle)
             return ret;
     }
 
+   adev->psp.xgmi_context.supports_extended_data =
+           !adev->gmc.xgmi.connected_to_cpu &&
+                   adev->ip_versions[MP0_HWIP][0] == IP_VERSION(13,

0, 2);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c static int psp_init_sos_base_fw(struct

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+
     memset(&boot_cfg_entry, 0, sizeof(boot_cfg_entry));
     if (psp_get_runtime_db_entry(adev,
                             PSP_RUNTIME_ENTRY_TYPE_BOOT_CONFIG,
@@ -3008,7 +3012,6 @@ static int psp_init_sos_base_fw(struct

amdgpu_device *adev)

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +0 -1
             adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr-
 sos.size_bytes);
             adev->psp.sos.start_addr = ucode_array_start_addr +
                             le32_to_cpu(sos_hdr->sos.offset_bytes);
-           adev->psp.xgmi_context.supports_extended_data = false;
     } else {
             /* Load alternate PSP SOS FW */

sos_hdr_v1_3 = (const struct psp_firmware_header_v1_3
*)adev->psp.sos_fw->data; @@ -3023,7 +3026,6 @@ static int

psp_init_sos_base_fw(struct amdgpu_device *adev)

Quoted 9 lines
             adev->psp.sos.size_bytes = le32_to_cpu(sos_hdr_v1_3-
sos_aux.size_bytes);
             adev->psp.sos.start_addr = ucode_array_start_addr +
                     le32_to_cpu(sos_hdr_v1_3->sos_aux.offset_bytes);
-           adev->psp.xgmi_context.supports_extended_data = true;
     }

     if ((adev->psp.sys.size_bytes == 0) || (adev->psp.sos.size_bytes ==

0)) {