svn commit: r270850 - in head/sys: i386/i386 i386/include i386/isa x86/acpica

John Baldwin jhb at freebsd.org
Wed Sep 10 15:59:07 UTC 2014


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


More information about the svn-src-all mailing list