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
Subject: Re: [PATCH v2 7/8] platform/x86/amd/pmc: Add STB support for AMD Desktop variants
Date: Fri, 1 Nov 2024 14:11:26 +0200 (EET)	[thread overview]
Message-ID: <f16a0977-0f3b-cdee-880e-fdffc69ac84b@linux.intel.com> (raw)
In-Reply-To: <20241029155440.3499273-8-Shyam-sundar.S-k@amd.com>

On Tue, 29 Oct 2024, Shyam Sundar S K wrote:

> Previously, AMD's Ryzen Desktop SoCs did not include support for STB.
> However, to accommodate this recent change, PMFW has implemented a new
> message port pair mechanism for handling messages, arguments, and
> responses, specifically designed for distinguishing from Mobile SoCs.
> Therefore, it is necessary to update the driver to properly handle this
> incoming change.
> 
> Add a new function amd_stb_update_args() to simply the arguments that
> needs to be passed between S2D supported Mobile SoCs vs Desktop SoCs.
> 
> 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 | 31 +++++++++++++++++++++-----
>  1 file changed, 26 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/platform/x86/amd/pmc/mp1_stb.c b/drivers/platform/x86/amd/pmc/mp1_stb.c
> index 917c111b31c9..6a3cfcbb614e 100644
> --- a/drivers/platform/x86/amd/pmc/mp1_stb.c
> +++ b/drivers/platform/x86/amd/pmc/mp1_stb.c
> @@ -36,6 +36,11 @@
>  #define AMD_S2D_REGISTER_RESPONSE	0xA80
>  #define AMD_S2D_REGISTER_ARGUMENT	0xA88
>  
> +/* STB S2D(Spill to DRAM) message port offset for 44h model */

Add space before (

I know there might be some older ones lying around with the incorrect 
spacing but lets not add any new ones.

> +#define AMD_GNR_REGISTER_MESSAGE	0x524
> +#define AMD_GNR_REGISTER_RESPONSE	0x570
> +#define AMD_GNR_REGISTER_ARGUMENT	0xA40
> +
>  static bool enable_stb;
>  module_param(enable_stb, bool, 0644);
>  MODULE_PARM_DESC(enable_stb, "Enable the STB debug mechanism");
> @@ -239,12 +244,31 @@ static const struct file_operations amd_stb_debugfs_fops_v2 = {
>  	.release = amd_stb_debugfs_release_v2,
>  };
>  
> +static void amd_stb_update_args(struct amd_pmc_dev *dev)
> +{
> +	if (cpu_feature_enabled(X86_FEATURE_ZEN5))
> +		switch (boot_cpu_data.x86_model) {
> +		case 0x44:
> +			dev->stb_arg.msg = AMD_GNR_REGISTER_MESSAGE;
> +			dev->stb_arg.arg = AMD_GNR_REGISTER_ARGUMENT;
> +			dev->stb_arg.resp = AMD_GNR_REGISTER_RESPONSE;
> +			return;

default branch missing.

> +	}

Eh? That's a weird indentation for sure. :-)

Both levels of this nested construct need braces, please.

-- 
 i.

> +
> +	dev->stb_arg.msg = AMD_S2D_REGISTER_MESSAGE;
> +	dev->stb_arg.arg = AMD_S2D_REGISTER_ARGUMENT;
> +	dev->stb_arg.resp = AMD_S2D_REGISTER_RESPONSE;
> +}
> +
>  static bool amd_is_stb_supported(struct amd_pmc_dev *dev)
>  {
>  	switch (dev->cpu_id) {
>  	case AMD_CPU_ID_YC:
>  	case AMD_CPU_ID_CB:
> -		dev->stb_arg.s2d_msg_id = 0xBE;
> +		if (boot_cpu_data.x86_model == 0x44)
> +			dev->stb_arg.s2d_msg_id = 0x9B;
> +		else
> +			dev->stb_arg.s2d_msg_id = 0xBE;
>  		break;
>  	case AMD_CPU_ID_PS:
>  		dev->stb_arg.s2d_msg_id = 0x85;
> @@ -260,10 +284,7 @@ static bool amd_is_stb_supported(struct amd_pmc_dev *dev)
>  		return false;
>  	}
>  
> -	dev->stb_arg.msg = AMD_S2D_REGISTER_MESSAGE;
> -	dev->stb_arg.arg = AMD_S2D_REGISTER_ARGUMENT;
> -	dev->stb_arg.resp = AMD_S2D_REGISTER_RESPONSE;
> -
> +	amd_stb_update_args(dev);
>  	return true;
>  }
>  
> 


  parent reply	other threads:[~2024-11-01 12:11 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
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 [this message]
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=f16a0977-0f3b-cdee-880e-fdffc69ac84b@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=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