The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
	Avadhut Naik <avanaik92@gmail.com>
Subject: Re: [PATCH v9 2/7] RAS/AMD/ATL: Refactor PRM address translation into a common helper
Date: Wed, 5 Aug 2026 09:52:45 -0400	[thread overview]
Message-ID: <20260805135245.GA13467@yaz-khff2.amd.com> (raw)
In-Reply-To: <20260805051917.GEanLH1c_I3ayfTccC@fat_crate.local>

On Tue, Aug 04, 2026 at 10:19:17PM -0700, Borislav Petkov wrote:
> On Thu, Jul 30, 2026 at 03:48:29PM -0400, Yazen Ghannam wrote:
> > Every PRM address translation follows the same pattern. Each fills a
> > parameter buffer, invokes the handler, and checks the result. Only the
> > handler GUID and the output buffer differ.
> > 
> > Factor the common sequence into prm_umc_norm_to_addr().
> 
> And here your commit message ends. The rest is describing the diff.
> 

Okay.

> > -unsigned long prm_umc_norm_to_sys_addr(u8 socket_id, u64 bank_id, unsigned long addr)
> > +int prm_umc_norm_to_addr(guid_t guid, u8 socket_id, u64 bank_id,
> > +			 unsigned long addr, void *out_buf)
> 
> So if you're going to have a param buffer structure, you might as well use it:
> 
> diff --git a/drivers/ras/amd/atl/prm.c b/drivers/ras/amd/atl/prm.c
> index 3d5a6f5ae0a9..726464f31e10 100644
> --- a/drivers/ras/amd/atl/prm.c
> +++ b/drivers/ras/amd/atl/prm.c
> @@ -26,18 +26,11 @@ struct param_buf {
>  	void *out_buf;
>  } __packed;
>  
> -int prm_umc_norm_to_addr(guid_t guid, u8 socket_id, u64 bank_id,
> -			 unsigned long addr, void *out_buf)
> +static int __prm_umc_norm_to_addr(guid_t guid, struct param_buf *p)
>  {
> -	struct param_buf p_buf;
>  	int ret;
>  
> -	p_buf.norm_addr = addr;
> -	p_buf.socket    = socket_id;
> -	p_buf.bank_id   = bank_id;
> -	p_buf.out_buf   = out_buf;
> -
> -	ret = acpi_call_prm_handler(guid, &p_buf);
> +	ret = acpi_call_prm_handler(guid, p);
>  	if (!ret)
>  		return 0;
>  
> @@ -52,9 +45,15 @@ int prm_umc_norm_to_addr(guid_t guid, u8 socket_id, u64 bank_id,
>  unsigned long prm_umc_norm_to_sys_addr(u8 socket_id, u64 bank_id, unsigned long addr)
>  {
>  	unsigned long sys_addr;
> +	struct param_buf p_buf = {
> +		.norm_addr = addr,
> +		.socket    = socket_id,
> +		.bank_id   = bank_id,
> +		.out_buf    = &sys_addr,
> +	};
>  	int ret;
>  
> -	ret = prm_umc_norm_to_addr(norm_to_sys_guid, socket_id, bank_id, addr, &sys_addr);
> +	ret = __prm_umc_norm_to_addr(norm_to_sys_guid, &p_buf);
>  	if (ret)
>  		return ret;
>  
> -- 

Right, it gets mostly there in the later patches:
  int prm_umc_norm_to_addr(guid_t guid, struct atl_umc_addr *addr, void *out_buf);

I'll do another revision with your proposal.

Thanks,
Yazen

  reply	other threads:[~2026-08-05 13:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 19:48 [PATCH v9 0/7] Incorporate DRAM address in EDAC messages Yazen Ghannam
2026-07-30 19:48 ` [PATCH v9 1/7] RAS/AMD/ATL: Always build PRM address translation support Yazen Ghannam
2026-07-31 23:55   ` Borislav Petkov
2026-08-03 15:24     ` Yazen Ghannam
2026-08-05  4:51       ` Borislav Petkov
2026-07-30 19:48 ` [PATCH v9 2/7] RAS/AMD/ATL: Refactor PRM address translation into a common helper Yazen Ghannam
2026-08-05  5:19   ` Borislav Petkov
2026-08-05 13:52     ` Yazen Ghannam [this message]
2026-07-30 19:48 ` [PATCH v9 3/7] RAS/AMD/ATL: Add unified UMC address translation interface Yazen Ghannam
2026-07-30 19:48 ` [PATCH v9 4/7] RAS/AMD, EDAC/amd64: Use unified interface for SPA translation Yazen Ghannam
2026-07-30 19:48 ` [PATCH v9 5/7] RAS/AMD/ATL: Remove the standalone SPA translation interface Yazen Ghannam
2026-07-30 19:48 ` [PATCH v9 6/7] RAS/AMD/ATL: Add DRAM address translation via PRM Yazen Ghannam
2026-07-30 19:48 ` [PATCH v9 7/7] EDAC/amd64: Include DRAM address in output Yazen Ghannam

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=20260805135245.GA13467@yaz-khff2.amd.com \
    --to=yazen.ghannam@amd.com \
    --cc=avanaik92@gmail.com \
    --cc=bp@alien8.de \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@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