All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Richter <robert.richter@amd.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] apic, x86: Use BIOS settings for IBS and MCE threshold interrupt LVT offsets
Date: Fri, 8 Oct 2010 11:24:52 +0200	[thread overview]
Message-ID: <20101008092452.GE13563@erda.amd.com> (raw)
In-Reply-To: <20101006194150.GA17647@lenovo>

On 06.10.10 15:41:50, Cyrill Gorcunov wrote:
> On Wed, Oct 06, 2010 at 12:27:54PM +0200, Robert Richter wrote:
> > We want the BIOS to setup the EILVT APIC registers. The offsets were
> > hardcoded and BIOS settings were overwritten by the OS. Now, the
> > subsystems for MCE threshold and IBS determine the LVT offset from the
> > registers the BIOS has setup. If the BIOS setup is buggy on a family
> > 10h system, a workaround enables IBS. If the OS determines an invalid
> > register setup, a "[Firmware Bug]: " error message is reported.
> > 
> > We need this change also for upcomming cpu families.
> > 
> > Signed-off-by: Robert Richter <robert.richter@amd.com>
> > ---
> 
> Hi Robert, a few comments
> 
> ...  
> >  /*
> >   * Program the next event, relative to now
> > diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
> > index 5e97529..e13d4bd 100644
> > --- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
> > +++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
> > @@ -131,7 +131,8 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
> >  	u32 low = 0, high = 0, address = 0;
> >  	unsigned int bank, block;
> >  	struct thresh_restart tr;
> > -	u8 lvt_off;
> > +	int lvt_off = -1;
> > +	u8 offset;
> >  
> >  	for (bank = 0; bank < NR_BANKS; ++bank) {
> >  		for (block = 0; block < NR_BLOCKS; ++block) {
> > @@ -165,8 +166,28 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
> >  			if (shared_bank[bank] && c->cpu_core_id)
> >  				break;
> >  #endif
> > -			lvt_off = setup_APIC_eilvt_mce(THRESHOLD_APIC_VECTOR,
> > -						       APIC_EILVT_MSG_FIX, 0);
> > +			offset = (high & MASK_LVTOFF_HI) >> 20;
> > +			if (lvt_off < 0) {
> > +				if (setup_APIC_eilvt(offset,
> > +						     THRESHOLD_APIC_VECTOR,
> > +						     APIC_EILVT_MSG_FIX, 0)) {
> > +					pr_err(FW_BUG "cpu %d, failed to "
> > +					       "setup threshold interrupt "
> > +					       "for bank %d, block %d "
> > +					       "(MSR%08X=0x%x%08x)",
> > +					       smp_processor_id(), bank, block,
> > +					       address, high, low);
> > +					continue;
> > +				}
> > +				lvt_off = offset;
> > +			} else if (lvt_off != offset) {
> 
> Could we put explicit type specificator here? For better readbility.
> ...

Cyrill,

Do you mean an explicit type cast here, or something else?

> 
> > +static int force_ibs_eilvt_setup(void)
> > +{
> > +	int i;
> > +	int ret;
> > +
> > +	/* find the next free available EILVT entry */
> > +	for (i = 1; i < 4; i++) {
> 
> APIC_EILVT_NR_MAX here, no?

Yes, will update this if a -v2 patch set will be necessary.

Thanks for review,

-Robert

> 
> > +		if (!eilvt_is_available(i))
> > +			continue;
> > +		ret = setup_ibs_ctl(i);
> > +		if (ret)
> > +			return ret;
> > +		return 0;
> >  	}
> >  
>  
>   Cyrill
> 

-- 
Advanced Micro Devices, Inc.
Operating System Research Center


  reply	other threads:[~2010-10-08  9:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06 10:27 [PATCH 0/2] apic, x86: Use BIOS settings to setup AMD EILVT APIC registers Robert Richter
2010-10-06 10:27 ` [PATCH 1/2] apic, x86: Check if EILVT APIC registers are available (AMD only) Robert Richter
2010-10-20  5:01   ` [tip:irq/core] " tip-bot for Robert Richter
2010-10-06 10:27 ` [PATCH 2/2] apic, x86: Use BIOS settings for IBS and MCE threshold interrupt LVT offsets Robert Richter
2010-10-06 19:41   ` Cyrill Gorcunov
2010-10-08  9:24     ` Robert Richter [this message]
2010-10-08  9:37       ` Cyrill Gorcunov
2010-10-08 10:21         ` Robert Richter
2010-10-08 18:27           ` Cyrill Gorcunov
2010-10-20  5:01   ` [tip:irq/core] " tip-bot for Robert Richter

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=20101008092452.GE13563@erda.amd.com \
    --to=robert.richter@amd.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.