Skip to content

Commit c6ea14d

Browse files
Shyam Sundar S Kij-intel
authored andcommitted
platform/x86/amd/pmc: adjust getting DRAM size behavior
amd_pmc_get_dram_size() is used to get the DRAM size information. But in the current code, mailbox command to get the DRAM size info is sent based on the values of dev->major and dev->minor. But dev->major and dev->minor will have either junk or zero assigned to them until at least once a call to amd_pmc_get_smu_version() is made which ideally populates dev->major and dev->minor. However, adding a amd_pmc_get_smu_version() call to amd_pmc_get_dram_size() has a downside of elevating the boot times. After talking to the PMFW team, it's understood that the "get dram size" mbox command would only be supported on specific platforms (like Mendocino) and not all. So, adjust getting DRAM size behavior such that, - if running on Rembrandt or Mendocino and the underlying PMFW knows how to execute the "get dram size" command it shall give the custom dram size. - if the underlying FW does not report the dram size, we just proceed further and assign the default dram size. The simplest way to address this is to remove amd_pmc_get_dram_size() function and directly call the "get dram size" command in the amd_pmc_s2d_init(). Reported-by: Mark Hasemeyer <[email protected]> Fixes: be8325f ("platform/x86/amd: pmc: Get STB DRAM size from PMFW") Cc: [email protected] Suggested-by: Sanket Goswami <[email protected]> Signed-off-by: Shyam Sundar S K <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Mario Limonciello <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Signed-off-by: Ilpo Järvinen <[email protected]>
1 parent 92c4759 commit c6ea14d

File tree

1 file changed

+2
-29
lines changed
  • drivers/platform/x86/amd/pmc

1 file changed

+2
-29
lines changed

drivers/platform/x86/amd/pmc/pmc.c

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -964,33 +964,6 @@ static const struct pci_device_id pmc_pci_ids[] = {
964964
{ }
965965
};
966966

967-
static int amd_pmc_get_dram_size(struct amd_pmc_dev *dev)
968-
{
969-
int ret;
970-
971-
switch (dev->cpu_id) {
972-
case AMD_CPU_ID_YC:
973-
if (!(dev->major > 90 || (dev->major == 90 && dev->minor > 39))) {
974-
ret = -EINVAL;
975-
goto err_dram_size;
976-
}
977-
break;
978-
default:
979-
ret = -EINVAL;
980-
goto err_dram_size;
981-
}
982-
983-
ret = amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->s2d_msg_id, true);
984-
if (ret || !dev->dram_size)
985-
goto err_dram_size;
986-
987-
return 0;
988-
989-
err_dram_size:
990-
dev_err(dev->dev, "DRAM size command not supported for this platform\n");
991-
return ret;
992-
}
993-
994967
static int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
995968
{
996969
u32 phys_addr_low, phys_addr_hi;
@@ -1009,8 +982,8 @@ static int amd_pmc_s2d_init(struct amd_pmc_dev *dev)
1009982
return -EIO;
1010983

1011984
/* Get DRAM size */
1012-
ret = amd_pmc_get_dram_size(dev);
1013-
if (ret)
985+
ret = amd_pmc_send_cmd(dev, S2D_DRAM_SIZE, &dev->dram_size, dev->s2d_msg_id, true);
986+
if (ret || !dev->dram_size)
1014987
dev->dram_size = S2D_TELEMETRY_DRAMBYTES_MAX;
1015988

1016989
/* Get STB DRAM address */

0 commit comments

Comments
 (0)