[ppc64] iSeries fixes, from Stephen Rothwell --- arch/ppc64/kernel/htab.c | 1 + arch/ppc64/kernel/idle.c | 43 +++++++++++++++++++------------------------ arch/ppc64/kernel/setup.c | 2 ++ arch/ppc64/kernel/smp.c | 3 +++ 4 files changed, 25 insertions(+), 24 deletions(-) diff -puN arch/ppc64/kernel/htab.c~ppc64-iseries_cleanup arch/ppc64/kernel/htab.c --- 25/arch/ppc64/kernel/htab.c~ppc64-iseries_cleanup 2004-01-13 23:22:54.000000000 -0800 +++ 25-akpm/arch/ppc64/kernel/htab.c 2004-01-13 23:22:54.000000000 -0800 @@ -18,6 +18,7 @@ * 2 of the License, or (at your option) any later version. */ +#include #include #include #include diff -puN arch/ppc64/kernel/idle.c~ppc64-iseries_cleanup arch/ppc64/kernel/idle.c --- 25/arch/ppc64/kernel/idle.c~ppc64-iseries_cleanup 2004-01-13 23:22:54.000000000 -0800 +++ 25-akpm/arch/ppc64/kernel/idle.c 2004-01-13 23:22:54.000000000 -0800 @@ -46,40 +46,35 @@ extern long poll_pending(void); int (*idle_loop)(void); #ifdef CONFIG_PPC_ISERIES +unsigned long maxYieldTime = 0; +unsigned long minYieldTime = 0xffffffffffffffffUL; + static void yield_shared_processor(void) { - struct paca_struct *lpaca = get_paca(); + unsigned long tb; + unsigned long yieldTime; HvCall_setEnabledInterrupts(HvCall_MaskIPI | HvCall_MaskLpEvent | HvCall_MaskLpProd | HvCall_MaskTimeout); - if (!ItLpQueue_isLpIntPending(paca->lpQueuePtr)) { - /* - * Compute future tb value when yield should expire. - * We want to be woken up when the next decrementer is - * to fire. - */ - - local_irq_disable(); - lpaca->yielded = 1; /* Indicate a prod is desired */ - lpaca->xLpPaca.xIdle = 1; /* Inform the HV we are idle */ + tb = get_tb(); + /* Compute future tb value when yield should expire */ + HvCall_yieldProcessor(HvCall_YieldTimed, tb+tb_ticks_per_jiffy); + + yieldTime = get_tb() - tb; + if (yieldTime > maxYieldTime) + maxYieldTime = yieldTime; - HvCall_yieldProcessor(HvCall_YieldTimed, - lpaca->next_jiffy_update_tb); - - lpaca->yielded = 0; /* Back to IPI's */ - local_irq_enable(); + if (yieldTime < minYieldTime) + minYieldTime = yieldTime; - /* - * The decrementer stops during the yield. Force a fake - * decrementer here and let the timer_interrupt code sort - * out the actual time. - */ - lpaca->xLpPaca.xIntDword.xFields.xDecrInt = 1; - } - + /* + * The decrementer stops during the yield. Force a fake decrementer + * here and let the timer_interrupt code sort out the actual time. + */ + get_paca()->xLpPaca.xIntDword.xFields.xDecrInt = 1; process_iSeries_events(); } diff -puN arch/ppc64/kernel/setup.c~ppc64-iseries_cleanup arch/ppc64/kernel/setup.c --- 25/arch/ppc64/kernel/setup.c~ppc64-iseries_cleanup 2004-01-13 23:22:54.000000000 -0800 +++ 25-akpm/arch/ppc64/kernel/setup.c 2004-01-13 23:22:54.000000000 -0800 @@ -146,7 +146,9 @@ void __init disable_early_printk(void) void setup_system(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { +#ifdef CONFIG_PPC_PSERIES unsigned int ret, i; +#endif #ifdef CONFIG_XMON_DEFAULT debugger = xmon; diff -puN arch/ppc64/kernel/smp.c~ppc64-iseries_cleanup arch/ppc64/kernel/smp.c --- 25/arch/ppc64/kernel/smp.c~ppc64-iseries_cleanup 2004-01-13 23:22:54.000000000 -0800 +++ 25-akpm/arch/ppc64/kernel/smp.c 2004-01-13 23:22:54.000000000 -0800 @@ -126,6 +126,9 @@ static int smp_iSeries_numProcs(void) for (i=0; i < NR_CPUS; ++i) { lpPaca = paca[i].xLpPacaPtr; if ( lpPaca->xDynProcStatus < 2 ) { + cpu_set(i, cpu_available_map); + cpu_set(i, cpu_possible_map); + cpu_set(i, cpu_present_at_boot); ++np; } } _