Date: Mon, 17 May 2010 23:08:22 +0530 From: "C. Jayachandran" <c.jayachandran@gmail.com> To: Neel Natu <neelnatu@gmail.com> Cc: freebsd-mips@freebsd.org Subject: Re: Minor fixup for the MIPS SMP platform code. Message-ID: <AANLkTim5HbGok2z8ZImgCvpBbMSWVx-G34YBTo9dPEUE@mail.gmail.com> In-Reply-To: <AANLkTin1CmrTmuwChVnwBaSRsnQO8mcwE5P9fXBtPTvp@mail.gmail.com> References: <AANLkTikjF2SUa5GomVRtus176hjKyUyPAeDF-p1kwCcO@mail.gmail.com> <AANLkTin1CmrTmuwChVnwBaSRsnQO8mcwE5P9fXBtPTvp@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] On Mon, May 17, 2010 at 9:08 PM, Neel Natu <neelnatu@gmail.com> wrote: > Hi JC, > > Your patch looks good. Thanks for cleaning up the platform-specific > code from mp_machdep.c. > > There are a couple of style things you might want to take care of: > > 1. In hwfunc.h there is an extra space after the '*' in the > declaration of platform_smp_topo() > > 2. In platform_smp_topo() for XLR: > - Values in return statements should be enclosed in parantheses. > - space around binary operator '/' > > Looks like I've been a bit sloppy here, updated patch attached, with all the comments so far addressed. Thanks, JC. > best > Neel > > On Mon, May 17, 2010 at 7:33 AM, C. Jayachandran > <c.jayachandran@gmail.com> wrote: > > The attached patch (also at > > http://sites.google.com/site/cjayachandran/files) has two changes: > > - moves the intr masking code to platform_init_ap, so that we can avoid > the > > #ifdef for XLR > > - adds a platform_smp_topo() function so that platforms can define their > > topology > > > > I've also attempted to fixup sys/mips/sibyte to reflect these changes, > but > > it might need further work. > > sys/mips/cavium also might need similar changes for SMP. > > > > Please review and apply if the changes are okay. > > > > Thanks, > > JC. > > > > > -- C. Jayachandran c.jayachandran@gmail.com [-- Attachment #2 --] Index: sys/mips/sibyte/sb_machdep.c =================================================================== --- sys/mips/sibyte/sb_machdep.c (revision 208189) +++ sys/mips/sibyte/sb_machdep.c (working copy) @@ -344,9 +344,16 @@ return (4); } +struct cpu_group * +platform_smp_topo(void) +{ + return (smp_topo_none()); +} + void platform_init_ap(int cpuid) { + int ipi_int_mask, clock_int_mask; KASSERT(cpuid == 1, ("AP has an invalid cpu id %d", cpuid)); @@ -356,6 +363,13 @@ kseg0_map_coherent(); sb_intr_init(cpuid); + + /* + * Unmask the clock and ipi interrupts. + */ + clock_int_mask = hard_int_mask(5); + ipi_int_mask = hard_int_mask(platform_ipi_intrnum()); + set_intr_mask(ALL_INT_MASK & ~(ipi_int_mask | clock_int_mask)); } int Index: sys/mips/include/hwfunc.h =================================================================== --- sys/mips/include/hwfunc.h (revision 208189) +++ sys/mips/include/hwfunc.h (working copy) @@ -93,5 +93,11 @@ */ extern int platform_num_processors(void); +/* + * Return the topology of processors on this platform + */ +struct cpu_group *platform_smp_topo(void); + + #endif /* SMP */ #endif /* !_MACHINE_HWFUNC_H_ */ Index: sys/mips/rmi/xlr_machdep.c =================================================================== --- sys/mips/rmi/xlr_machdep.c (revision 208189) +++ sys/mips/rmi/xlr_machdep.c (working copy) @@ -534,6 +534,8 @@ /* Setup interrupts for secondary CPUs here */ stat = mips_rd_status(); + KASSERT((stat & MIPS_SR_INT_IE) == 0, + ("Interrupts enabled in %s!", __func__)); stat |= MIPS_SR_COP_2_BIT | MIPS_SR_COP_0_BIT; mips_wr_status(stat); @@ -570,4 +572,11 @@ { return fls(xlr_boot1_info.cpu_online_map); } + +struct cpu_group * +platform_smp_topo() +{ + return (smp_topo_2level(CG_SHARE_L2, platform_num_processors() / 4, + CG_SHARE_L1, 4, CG_FLAG_THREAD)); +} #endif Index: sys/mips/mips/mpboot.S =================================================================== --- sys/mips/mips/mpboot.S (revision 208189) +++ sys/mips/mips/mpboot.S (working copy) @@ -76,10 +76,8 @@ PTR_LA gp, _C_LABEL(_gp) -#ifndef TARGET_XLR_XLS jal platform_init_ap move a0, s0 -#endif jal smp_init_secondary move a0, s0 Index: sys/mips/mips/mp_machdep.c =================================================================== --- sys/mips/mips/mp_machdep.c (revision 208189) +++ sys/mips/mips/mp_machdep.c (working copy) @@ -196,8 +196,7 @@ struct cpu_group * cpu_topo(void) { - - return (smp_topo_none()); + return (platform_smp_topo()); } int @@ -238,10 +237,6 @@ void smp_init_secondary(u_int32_t cpuid) { -#ifndef TARGET_XLR_XLS - int ipi_int_mask, clock_int_mask; -#endif - /* TLB */ Mips_SetWIRED(0); Mips_TLBFlush(num_tlbentries); @@ -294,18 +289,7 @@ while (smp_started == 0) ; /* nothing */ -#ifndef TARGET_XLR_XLS /* - * Unmask the clock and ipi interrupts. - */ - clock_int_mask = hard_int_mask(5); - ipi_int_mask = hard_int_mask(platform_ipi_intrnum()); - set_intr_mask(ALL_INT_MASK & ~(ipi_int_mask | clock_int_mask)); -#else - platform_init_ap(cpuid); -#endif - - /* * Bootstrap the compare register. */ mips_wr_compare(mips_rd_count() + counter_freq / hz);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTim5HbGok2z8ZImgCvpBbMSWVx-G34YBTo9dPEUE>
