mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Yazen Ghannam <Yazen.Ghannam@amd.com>
Cc: linux-edac@vger.kernel.org, Tony Luck <tony.luck@intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/4] x86/mce/AMD; EDAC,amd64: Move find_umc_channel() to AMD mcheck
Date: Wed, 22 Mar 2017 22:16:47 +0100	[thread overview]
Message-ID: <20170322211647.GA7242@nazgul.tnic> (raw)
In-Reply-To: <1490041614-90057-3-git-send-email-Yazen.Ghannam@amd.com>

On Mon, Mar 20, 2017 at 03:26:52PM -0500, Yazen Ghannam wrote:
> We need to find a UMC's channel number from mcheck code when translating
> UMC normalized addresses to system physical addresses. So move the function
> there from EDAC.
> 
> Also, drop the struct pvt from the function parameters since we don't use
> it. And add a sanity check to make sure we're only looking at UMCs in case
> the UMC instance IDs ever match up with other bank types.
> 
> Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com>
> ---

...

> diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
> index 524cc57..10fddcc 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
> @@ -755,6 +755,27 @@ int umc_normaddr_to_sysaddr(u64 norm_addr, u16 nid, u8 umc, u64 *sys_addr)
>  }
>  EXPORT_SYMBOL_GPL(umc_normaddr_to_sysaddr);
>  
> +/*
> + * To find the UMC channel represented by this bank we need to match on its
> + * instance_id. The instance_id of a bank is held in the lower 32 bits of its
> + * IPID.
> + */
> +int find_umc_channel(struct mce *m)
> +{
> +	u32 umc_instance_id[] = {0x50f00, 0x150f00};
> +	u32 instance_id = m->ipid & GENMASK(31, 0);
> +	int i, channel = -EINVAL;
> +
> +	if (smca_banks[m->bank].hwid &&
> +	    smca_banks[m->bank].hwid->bank_type == SMCA_UMC)
> +		for (i = 0; i < ARRAY_SIZE(umc_instance_id); i++)
> +			if (umc_instance_id[i] == instance_id)
> +				channel = i;
> +
> +	return channel;
> +}
> +EXPORT_SYMBOL_GPL(find_umc_channel);

This is an exported function now so it should have a prefix. Maybe
"amd_find_umc_channel" or so.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

  reply	other threads:[~2017-03-22 21:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 20:26 [PATCH v2 0/4] Call memory_failure() on Deferred errors Yazen Ghannam
2017-03-20 20:26 ` [PATCH v2 1/4] EDAC,mce_amd: Find node ID on SMCA systems using generic methods Yazen Ghannam
2017-03-20 20:26 ` [PATCH v2 2/4] x86/mce/AMD; EDAC,amd64: Move find_umc_channel() to AMD mcheck Yazen Ghannam
2017-03-22 21:16   ` Borislav Petkov [this message]
2017-03-22 21:41     ` Ghannam, Yazen
2017-03-20 20:26 ` [PATCH v2 3/4] x86/mce/AMD: Mark Deferred errors as Action Optional on SMCA systems Yazen Ghannam
2017-03-20 20:26 ` [PATCH v2 4/4] x86/mce: Add AMD SMCA support to SRAO notifier Yazen Ghannam
2017-03-21 21:47   ` Ghannam, Yazen
2017-03-22 21:13   ` Borislav Petkov
2017-03-22 21:40     ` Ghannam, Yazen

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=20170322211647.GA7242@nazgul.tnic \
    --to=bp@alien8.de \
    --cc=Yazen.Ghannam@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@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

all inboxes | Powered by JetHome®