Re: [PATCH 2/4] platform/x86/amd: pmc: Write dummy postcode into the STB DRAM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/25/23 21:29, Shyam Sundar S K wrote:


On 1/25/2023 11:13 PM, Limonciello, Mario wrote:
[Public]



-----Original Message-----
From: Shyam Sundar S K <Shyam-sundar.S-k@xxxxxxx>
Sent: Wednesday, January 25, 2023 05:31
To: hdegoede@xxxxxxxxxx; markgross@xxxxxxxxxx
Cc: Goswami, Sanket <Sanket.Goswami@xxxxxxx>; platform-driver-
x86@xxxxxxxxxxxxxxx; S-k, Shyam-sundar <Shyam-sundar.S-k@xxxxxxx>
Subject: [PATCH 2/4] platform/x86/amd: pmc: Write dummy postcode into
the STB DRAM

Based on the recommendation from the PMFW team in order to get the
recent telemetry data present on the STB DRAM the driver is required
to send one dummy write to the STB buffer, so it internally triggers
the PMFW to emit the latest telemetry data in the STB DRAM region.

Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@xxxxxxx>
---
  drivers/platform/x86/amd/pmc.c | 6 ++++++
  1 file changed, 6 insertions(+)

diff --git a/drivers/platform/x86/amd/pmc.c
b/drivers/platform/x86/amd/pmc.c
index 01632e6b7820..0dd9fb576f09 100644
--- a/drivers/platform/x86/amd/pmc.c
+++ b/drivers/platform/x86/amd/pmc.c
@@ -43,6 +43,7 @@
  #define AMD_PMC_STB_S2IDLE_PREPARE	0xC6000001
  #define AMD_PMC_STB_S2IDLE_RESTORE	0xC6000002
  #define AMD_PMC_STB_S2IDLE_CHECK	0xC6000003
+#define AMD_PMC_STB_DUMMY_PC		0xC6000007

Is there significance to this specific code? Any particular reason
not to pick an incremental code like 0xC6000004?

Wanted to just keep in inline with Windows code atleast w.r.t to this
dummy postcode. However, if you think it does not make sense I can
change it to incremental one.


That's a great reason to keep it this way. People who look at the STB can have familiarity on the milestones they see.

If there are other ones that are used for Windows in similar vain across suspend/restore as the 3 that we have today we should adjust those too.

Thanks,
Shyam




  /* STB S2D(Spill to DRAM) has different message port offset */
  #define STB_SPILL_TO_DRAM		0xBE
@@ -250,6 +251,11 @@ static int amd_pmc_stb_debugfs_open_v2(struct
inode *inode, struct file *filp)
  	u32 *buf, fsize, num_samples, stb_rdptr_offset = 0;
  	int ret;

+	/* Write dummy postcode while reading the STB buffer */
+	ret = amd_pmc_write_stb(dev, AMD_PMC_STB_DUMMY_PC);
+	if (ret)
+		dev_err(dev->dev, "error writing to STB: %d\n", ret);
+
  	buf = kzalloc(S2D_TELEMETRY_BYTES_MAX, GFP_KERNEL);
  	if (!buf)
  		return -ENOMEM;
--
2.25.1




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux