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 v3 06/13] platform/x86/amd/pmc: Define enum for S2D/PMC msg_port
Date: Wed, 6 Nov 2024 12:08:55 +0200 (EET)	[thread overview]
Message-ID: <32a61666-c395-e400-3e2c-e60c26f8a6b9@linux.intel.com> (raw)
In-Reply-To: <20241105173637.733589-7-Shyam-sundar.S-k@amd.com>

On Tue, 5 Nov 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 5c03ac92558f..fd7ca1626cfe 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);
> @@ -155,7 +160,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)
> @@ -172,7 +177,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;
> @@ -267,7 +272,7 @@ int amd_stb_s2d_init(struct amd_pmc_dev *dev)
>  	}
>  
>  	/* 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)
> @@ -285,7 +290,7 @@ int amd_stb_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)
> 

Hi,

This still isn't doing all what it should, you need to change all these:

if (dev->msg_port)

to:

if (dev->msg_port == MSG_PORT_S2D)

(and if there were !dev->msg_port ones, use the other enum obviously.)

And the helper, likewise comes too late in the series so it cannot help 
here and you'd need to do that == on print lines too so either make the 
helper conversion before this patch or in this patch.

-- 
 i.


  reply	other threads:[~2024-11-06 10:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 17:36 [PATCH v3 00/13] platform/x86/amd/pmc: Updates to AMD PMC driver Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 01/13] platform/x86/amd/pmc: Move STB functionality to a new file for better code organization Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 02/13] platform/x86/amd/pmc: Relocate STB Debugfs to a New File Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 03/13] platform/x86/amd/pmc: Skip Completing amd_pmc_s2d_init() on Older Platforms Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 04/13] platform/x86/amd/pmc: Invoke amd_pmc_s2d_init() Post Debugfs Registration Shyam Sundar S K
2024-11-06 10:35   ` Ilpo Järvinen
2024-11-05 17:36 ` [PATCH v3 05/13] platform/x86/amd/pmc: Update function names to align with new STB file Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 06/13] platform/x86/amd/pmc: Define enum for S2D/PMC msg_port Shyam Sundar S K
2024-11-06 10:08   ` Ilpo Järvinen [this message]
2024-11-05 17:36 ` [PATCH v3 07/13] platform/x86/amd/pmc: Isolate STB code changes to a new file Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 08/13] platform/x86/amd/pmc: Introduce helper function to set proper string Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 09/13] platform/x86/amd/pmc: Update IP information structure for newer SoCs Shyam Sundar S K
2024-11-05 19:00   ` Mario Limonciello
2024-11-06 10:14   ` Ilpo Järvinen
2024-11-07  5:28     ` Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 10/13] platform/x86/amd/pmc: Use ARRAY_SIZE() to fill num_ips information Shyam Sundar S K
2024-11-05 18:58   ` Mario Limonciello
2024-11-05 17:36 ` [PATCH v3 11/13] platform/x86/amd/pmc: Update S2D message id for 1Ah Family 70h model Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 12/13] platform/x86/amd/pmc: Add STB support for AMD Desktop variants Shyam Sundar S K
2024-11-05 17:36 ` [PATCH v3 13/13] MAINTAINERS: Change AMD PMC 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=32a61666-c395-e400-3e2c-e60c26f8a6b9@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