From: Mark Hasemeyer <markhas@chromium.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: "Shyam Sundar S K" <Shyam-sundar.S-k@amd.com>,
stable@vger.kernel.org, "Mark Hasemeyer" <markhas@chromium.org>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Mark Gross" <markgross@kernel.org>,
"Sanket Goswami" <Sanket.Goswami@amd.com>,
platform-driver-x86@vger.kernel.org
Subject: [PATCH v1] platform/x86/amd/pmc: Get smu version before reading dram size
Date: Fri, 27 Oct 2023 15:28:05 -0600 [thread overview]
Message-ID: <20231027212916.1035991-1-markhas@chromium.org> (raw)
Calls to amd_pmc_get_dram_size can fail because the function assumes smu
version information has already been read when it hasn't. The smu
version is lazily read as opposed to being read at probe because it is
slow and increases boot time.
Read the smu version information if it has not been read yet.
Link: https://lore.kernel.org/all/a3ee6577-d521-6d18-0a15-2f97d6f8ac3a@amd.com/
Fixes: be8325fb3d8c ("platform/x86/amd: pmc: Get STB DRAM size from PMFW")
Cc: stable@vger.kernel.org # 6.5.x
Signed-off-by: Mark Hasemeyer <markhas@chromium.org>
---
drivers/platform/x86/amd/pmc/pmc.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/platform/x86/amd/pmc/pmc.c b/drivers/platform/x86/amd/pmc/pmc.c
index cd6ac04c1468..f668eddbc5d5 100644
--- a/drivers/platform/x86/amd/pmc/pmc.c
+++ b/drivers/platform/x86/amd/pmc/pmc.c
@@ -970,6 +970,11 @@ static int amd_pmc_get_dram_size(struct amd_pmc_dev *dev)
switch (dev->cpu_id) {
case AMD_CPU_ID_YC:
+ if (!dev->major) {
+ ret = amd_pmc_get_smu_version(dev);
+ if (ret)
+ goto err_dram_size;
+ }
if (!(dev->major > 90 || (dev->major == 90 && dev->minor > 39))) {
ret = -EINVAL;
goto err_dram_size;
--
2.42.0.820.g83a721a137-goog
next reply other threads:[~2023-10-27 21:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-27 21:28 Mark Hasemeyer [this message]
2023-10-30 9:24 ` [PATCH v1] platform/x86/amd/pmc: Get smu version before reading dram size Ilpo Järvinen
2023-10-30 16:09 ` Mark Hasemeyer
2023-10-30 16:17 ` Mario Limonciello
2023-10-31 7:53 ` Shyam Sundar S K
2023-10-31 15:17 ` Mark Hasemeyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231027212916.1035991-1-markhas@chromium.org \
--to=markhas@chromium.org \
--cc=Sanket.Goswami@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox