X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Sanket.Goswami@amd.com,  platform-driver-x86@vger.kernel.org,
	 Mario Limonciello <mario.limonciello@amd.com>
Subject: Re: [PATCH v2 3/8] platform/x86/amd/pmc: Define enum for S2D/PMC msg_port
Date: Tue, 5 Nov 2024 11:44:57 +0200 (EET)	[thread overview]
Message-ID: <311cb5fc-b350-189a-9029-367a934c929b@linux.intel.com> (raw)
In-Reply-To: <051c7469-3b9d-4bb0-8370-1dfc489d16c3@amd.com>

[-- Attachment #1: Type: text/plain, Size: 3385 bytes --]

On Tue, 5 Nov 2024, Shyam Sundar S K wrote:
> On 11/1/2024 15:58, Ilpo Järvinen wrote:
> > On Tue, 29 Oct 2024, Shyam Sundar S K wrote:
> > 
> >> To distinguish between the PMC message port and the S2D (Spill to DRAM)
> >> message port, replace the use of 0 and 1 with an enum.
> >>
> >> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> >> Co-developed-by: Sanket Goswami <Sanket.Goswami@amd.com>
> >> Signed-off-by: Sanket Goswami <Sanket.Goswami@amd.com>
> >> Signed-off-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
> >> ---
> >>  drivers/platform/x86/amd/pmc/mp1_stb.c | 13 +++++++++----
> >>  1 file changed, 9 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c
> >> index 5efec020ecac..2b06861c479b 100644
> >> --- a/drivers/platform/x86/amd/pmc/mp1_stb.c
> >> +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c
> >> @@ -47,6 +47,11 @@ enum s2d_arg {
> >>  	S2D_DRAM_SIZE,
> >>  };
> >>  
> >> +enum s2d_msg_port {
> >> +	MSG_PORT_PMC,
> >> +	MSG_PORT_S2D,
> >> +};
> >> +
> >>  struct amd_stb_v2_data {
> >>  	size_t size;
> >>  	u8 data[] __counted_by(size);
> >> @@ -156,7 +161,7 @@ static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
> >>  		dev_err(dev->dev, "error writing to STB: %d\n", ret);
> >>  
> >>  	/* Spill to DRAM num_samples uses separate SMU message port */
> >> -	dev->msg_port = 1;
> >> +	dev->msg_port = MSG_PORT_S2D;
> >>  
> >>  	ret = amd_pmc_send_cmd(dev, 0, &val, STB_FORCE_FLUSH_DATA, 1);
> >>  	if (ret)
> >> @@ -173,7 +178,7 @@ static int amd_stb_debugfs_open_v2(struct inode *inode, struct file *filp)
> >>  	/* Get the num_samples to calculate the last push location */
> >>  	ret = amd_pmc_send_cmd(dev, S2D_NUM_SAMPLES, &num_samples, dev->s2d_msg_id, true);
> >>  	/* Clear msg_port for other SMU operation */
> >> -	dev->msg_port = 0;
> >> +	dev->msg_port = MSG_PORT_PMC;
> >>  	if (ret) {
> >>  		dev_err(dev->dev, "error: S2D_NUM_SAMPLES not supported : %d\n", ret);
> >>  		return ret;
> >> @@ -266,7 +271,7 @@ int amd_s2d_init(struct amd_pmc_dev *dev)
> >>  				    &amd_stb_debugfs_fops);
> >>  
> >>  	/* Spill to DRAM feature uses separate SMU message port */
> >> -	dev->msg_port = 1;
> >> +	dev->msg_port = MSG_PORT_S2D;
> >>  
> >>  	amd_pmc_send_cmd(dev, S2D_TELEMETRY_SIZE, &size, dev->s2d_msg_id, true);
> >>  	if (size != S2D_TELEMETRY_BYTES_MAX)
> >> @@ -284,7 +289,7 @@ int amd_s2d_init(struct amd_pmc_dev *dev)
> >>  	stb_phys_addr = ((u64)phys_addr_hi << 32 | phys_addr_low);
> >>  
> >>  	/* Clear msg_port for other SMU operation */
> >> -	dev->msg_port = 0;
> >> +	dev->msg_port = MSG_PORT_PMC;
> >>  
> >>  	dev->stb_virt_addr = devm_ioremap(dev->dev, stb_phys_addr, dev->dram_size);
> >>  	if (!dev->stb_virt_addr)
> > 
> > This change is incomplete, you missed all places using it:
> > 
> > if (dev->msg_port) { 
> > 
> > + add helper for this:
> > 
> > dev->msg_port ? "S2D" : "PMC"
> > 
> 
> 
> I am not sure if I understand your comment fully. Can you please
> elaborate?

There are users of dev->msg_port that should be also touched by this 
change but weren't.

For the printing, I suggested a helper function which returns the correct 
string so you don't need to do the compare within print argument.

-- 
 i.

  reply	other threads:[~2024-11-05  9:45 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-29 15:54 [PATCH v2 0/8] platform/x86/amd/pmc: Updates to AMD PMC driver Shyam Sundar S K
2024-10-29 15:54 ` [PATCH v2 1/8] platform/x86/amd/pmc: Move STB functionality to a new file for better code organization Shyam Sundar S K
2024-11-01 10:15   ` Ilpo Järvinen
2024-11-05  5:08     ` Shyam Sundar S K
2024-10-29 15:54 ` [PATCH v2 2/8] platform/x86/amd/pmc: Update function names to align with new STB file Shyam Sundar S K
2024-11-01 10:22   ` Ilpo Järvinen
2024-10-29 15:54 ` [PATCH v2 3/8] platform/x86/amd/pmc: Define enum for S2D/PMC msg_port Shyam Sundar S K
2024-11-01 10:28   ` Ilpo Järvinen
2024-11-05  5:04     ` Shyam Sundar S K
2024-11-05  9:44       ` Ilpo Järvinen [this message]
2024-11-05 17:39         ` Shyam Sundar S K
2024-10-29 15:54 ` [PATCH v2 4/8] platform/x86/amd/pmc: Isolate STB code changes to a new file Shyam Sundar S K
2024-10-29 15:54 ` [PATCH v2 5/8] platform/x86/amd/pmc: Update IP information structure for newer SoCs Shyam Sundar S K
2024-11-01 12:04   ` Ilpo Järvinen
2024-11-05  5:15     ` Shyam Sundar S K
2024-11-05  9:59       ` Ilpo Järvinen
2024-11-05 10:06         ` Shyam Sundar S K
2024-10-29 15:54 ` [PATCH v2 6/8] platform/x86/amd/pmc: Update S2D message id for 1Ah Family 70h model Shyam Sundar S K
2024-10-29 16:13   ` Mario Limonciello
2024-10-29 15:54 ` [PATCH v2 7/8] platform/x86/amd/pmc: Add STB support for AMD Desktop variants Shyam Sundar S K
2024-10-29 16:14   ` Mario Limonciello
2024-11-01 12:11   ` Ilpo Järvinen
2024-10-29 15:54 ` [PATCH v2 8/8] MAINTAINERS: Change AMD PMF driver status to "Supported" Shyam Sundar S K

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=311cb5fc-b350-189a-9029-367a934c929b@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=Sanket.Goswami@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=hdegoede@redhat.com \
    --cc=mario.limonciello@amd.com \
    --cc=platform-driver-x86@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