Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1607029 > unrolled thread
| Started by | Borislav Petkov <bp@alien8.de> |
|---|---|
| First post | 2017-03-22 22:20 +0100 |
| Last post | 2017-03-22 22:50 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2 2/4] x86/mce/AMD; EDAC,amd64: Move find_umc_channel() to AMD mcheck Borislav Petkov <bp@alien8.de> - 2017-03-22 22:20 +0100
RE: [PATCH v2 2/4] x86/mce/AMD; EDAC,amd64: Move find_umc_channel() to AMD mcheck "Ghannam, Yazen" <Yazen.Ghannam@amd.com> - 2017-03-22 22:50 +0100
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2017-03-22 22:20 +0100 |
| Subject | Re: [PATCH v2 2/4] x86/mce/AMD; EDAC,amd64: Move find_umc_channel() to AMD mcheck |
| Message-ID | <tnVPJ-nl-25@gated-at.bofh.it> |
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.
--
[toc] | [next] | [standalone]
| From | "Ghannam, Yazen" <Yazen.Ghannam@amd.com> |
|---|---|
| Date | 2017-03-22 22:50 +0100 |
| Message-ID | <tnWiJ-yV-3@gated-at.bofh.it> |
| In reply to | #1607029 |
> -----Original Message-----
> From: Borislav Petkov [mailto:bp@alien8.de]
> Sent: Wednesday, March 22, 2017 5:17 PM
> To: Ghannam, Yazen <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
>
> 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.
>
Okay, will do.
Thanks,
Yazen
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web