[PATCH v2 1/2] drm/amd/pm: skip to load smu microcode on sriov for aldebaran
Wang, Kevin(Yang)
Kevin1.Wang at amd.com
Thu Aug 12 04:01:22 UTC 2021
[AMD Official Use Only]
please ignore this patch, there some errors in here.
Best Regards,
Kevin
________________________________
From: Wang, Kevin(Yang) <Kevin1.Wang at amd.com>
Sent: Thursday, August 12, 2021 11:36 AM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Lazar, Lijo <Lijo.Lazar at amd.com>; Feng, Kenneth <Kenneth.Feng at amd.com>; Min, Frank <Frank.Min at amd.com>; Zhang, Hawking <Hawking.Zhang at amd.com>; Wang, Kevin(Yang) <Kevin1.Wang at amd.com>
Subject: [PATCH v2 1/2] drm/amd/pm: skip to load smu microcode on sriov for aldebaran
v1:
1. skip to load smu firmware in sriov mode for aldebaran chip
2. using vbios pptable if in sriov mode.
v2:
clean up smu driver code in sriov code path
Signed-off-by: Kevin Wang <kevin1.wang at amd.com>
---
.../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c | 41 +++++++++++--------
1 file changed, 25 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
index a421ba85bd6d..ebc081dc01cd 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
@@ -85,6 +85,10 @@ int smu_v13_0_init_microcode(struct smu_context *smu)
const struct common_firmware_header *header;
struct amdgpu_firmware_info *ucode = NULL;
+ /* doesn't need to load smu firmware in IOV mode */
+ if (amdgpu_sriov_vf(adev))
+ return 0;
+
switch (adev->asic_type) {
case CHIP_ALDEBARAN:
chip_name = "aldebaran";
@@ -273,34 +277,38 @@ int smu_v13_0_setup_pptable(struct smu_context *smu)
struct amdgpu_device *adev = smu->adev;
const struct smc_firmware_header_v1_0 *hdr;
int ret, index;
- uint32_t size = 0;
+ uint32_t size = 0, pp_table_id;
uint16_t atom_table_size;
uint8_t frev, crev;
void *table;
uint16_t version_major, version_minor;
+ if (!amdgpu_sriov_vf(adev)) {
+ if (amdgpu_smu_pptable_id >= 0) {
+ pp_table_id = amdgpu_smu_pptable_id;
+ dev_info(adev->dev, "override pptable id %d\n", pp_table_id);
+ } else {
+ pp_table_id = smu->smu_table.boot_values.pp_table_id;
+ dev_info(adev->dev, "use driver provided pptable %d\n", pp_table_id);
+ }
- if (amdgpu_smu_pptable_id >= 0) {
- smu->smu_table.boot_values.pp_table_id = amdgpu_smu_pptable_id;
- dev_info(adev->dev, "override pptable id %d\n", amdgpu_smu_pptable_id);
- }
+ hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
+ version_major = le16_to_cpu(hdr->header.header_version_major);
+ version_minor = le16_to_cpu(hdr->header.header_version_minor);
+ if (version_major != 2) {
+ dev_err(adev->dev, "Unsupported smu firwmare version %d.%d\n",
+ version_major, version_minor);
+ return -EINVAL;
+ }
- hdr = (const struct smc_firmware_header_v1_0 *) adev->pm.fw->data;
- version_major = le16_to_cpu(hdr->header.header_version_major);
- version_minor = le16_to_cpu(hdr->header.header_version_minor);
- if (version_major == 2 && smu->smu_table.boot_values.pp_table_id > 0) {
- dev_info(adev->dev, "use driver provided pptable %d\n", smu->smu_table.boot_values.pp_table_id);
switch (version_minor) {
case 1:
- ret = smu_v13_0_set_pptable_v2_1(smu, &table, &size,
- smu->smu_table.boot_values.pp_table_id);
+ ret = smu_v13_0_set_pptable_v2_1(smu, &table, &size, pp_table_id);
break;
default:
ret = -EINVAL;
break;
}
- if (ret)
- return ret;
} else {
dev_info(adev->dev, "use vbios provided pptable\n");
@@ -309,11 +317,12 @@ int smu_v13_0_setup_pptable(struct smu_context *smu)
ret = amdgpu_atombios_get_data_table(adev, index, &atom_table_size, &frev, &crev,
(uint8_t **)&table);
- if (ret)
- return ret;
size = atom_table_size;
}
+ if (ret)
+ return ret;
+
if (!smu->smu_table.power_play_table)
smu->smu_table.power_play_table = table;
if (!smu->smu_table.power_play_table_size)
--
2.25.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20210812/2b532d4e/attachment.htm>
More information about the amd-gfx
mailing list