Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Sep 2014 10:41 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r270850 - in head/sys: i386/i386 i386/include i386/isa x86/acpica
Message-ID:  <21371080.holR7l8cnU@ralph.baldwin.cx>
In-Reply-To: <20140909085813.GC2737@kib.kiev.ua>
References:  <201408301748.s7UHmc6H059701@svn.freebsd.org> <1432043.pIBGVXe1sj@ralph.baldwin.cx> <20140909085813.GC2737@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, September 09, 2014 11:58:13 AM Konstantin Belousov wrote:
> On Sat, Sep 06, 2014 at 04:04:49PM -0400, John Baldwin wrote:
> > @@ -692,6 +706,27 @@
> > 
> >  #ifdef I586_CPU
> >  
> >  	case CPU_586:
> >  		switch (cpu_vendor_id) {
> > 
> > +		case CPU_VENDOR_AMD:
> > +#ifdef CPU_WT_ALLOC
> > +			if (((cpu_id & 0x0f0) > 0) &&
> > +			    ((cpu_id & 0x0f0) < 0x60) &&
> > +			    ((cpu_id & 0x00f) > 3))
> > +				enable_K5_wt_alloc();
> > +			else if (((cpu_id & 0x0f0) > 0x80) ||
> > +			    (((cpu_id & 0x0f0) == 0x80) &&
> > +				(cpu_id & 0x00f) > 0x07))
> > +				enable_K6_2_wt_alloc();
> > +			else if ((cpu_id & 0x0f0) > 0x50)
> > +				enable_K6_wt_alloc();
> > +#endif
> > +			if ((cpu_id & 0xf0) == 0xa0)
> > +				/*
> > +				 * Make sure the TSC runs through
> > +				 * suspension, otherwise we can't use
> > +				 * it as timecounter
> > +				 */
> > +				wrmsr(0x1900, rdmsr(0x1900) | 0x20ULL);
> > +			break;
> 
> Move of the code to initialize CPU from identcpu() to initializecpu()
> seems to be a fix on its own.  Since you are moving the fragments
> around, would you mind start using CPUID_MODEL/STEPPING etc constants ?
> The code was ancient, probably predating the defines.

I will probably split this up into a couple of commits one of which will be
to move register setting from identcpu.c to initcpu.c.  I can look at using
the constants, but in particular when using CPUID_TO_*() the logic is slightly
different (e.g. you have to check for model and family values for '6' instead
of '60' or '600'), so I would prefer to do those changes as a separate commit
to help with debugging in the future if I get one wrong.

> > --- //depot/vendor/freebsd/src/sys/i386/xen/mp_machdep.c
> > +++ //depot/user/jhb/acpipci/i386/xen/mp_machdep.c
> > @@ -602,17 +602,8 @@
> > 
> >  	npxinit();
> >  
> >  #if 0
> > 
> > -	/* set up SSE registers */
> > -	enable_sse();
> > -#endif
> > -#if 0 && defined(PAE)
> > -	/* Enable the PTE no-execute bit. */
> > -	if ((amd_feature & AMDID_NX) != 0) {
> > -		uint64_t msr;
> > -
> > -		msr = rdmsr(MSR_EFER) | EFER_NXE;
> > -		wrmsr(MSR_EFER, msr);
> > -	}
> > +	/* set up SSE/NX registers */
> 
> I suggest removing 'registers' from the comment above.

Ok.  Note that this is just a copy of the code in amd64/i386, but I will fix 
all three.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?21371080.holR7l8cnU>