lkml.org 
[lkml]   [2008]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 07/73] SPARC64: Fix memory controller register access when non-SMP.

    2.6.23-stable review patch. If anyone has any objections, please let us know.
    ------------------
    From: David Miller <davem@davemloft.net>

    [SPARC64]: Fix memory controller register access when non-SMP.

    [ Upstream commit: b332b8bc9c67165eabdfc7d10b4a2e4cc9f937d0 ]

    get_cpu() always returns zero on non-SMP builds, but we
    really want the physical cpu number in this code in order
    to do the right thing.

    Based upon a non-SMP kernel boot failure report from Bernd Zeimetz.

    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    arch/sparc64/kernel/chmc.c | 16 ++++++++++------
    1 file changed, 10 insertions(+), 6 deletions(-)

    --- a/arch/sparc64/kernel/chmc.c
    +++ b/arch/sparc64/kernel/chmc.c
    @@ -1,7 +1,6 @@
    -/* $Id: chmc.c,v 1.4 2002/01/08 16:00:14 davem Exp $
    - * memctrlr.c: Driver for UltraSPARC-III memory controller.
    +/* memctrlr.c: Driver for UltraSPARC-III memory controller.
    *
    - * Copyright (C) 2001 David S. Miller (davem@redhat.com)
    + * Copyright (C) 2001, 2007 David S. Miller (davem@davemloft.net)
    */

    #include <linux/module.h>
    @@ -16,6 +15,7 @@
    #include <linux/init.h>
    #include <asm/spitfire.h>
    #include <asm/chmctrl.h>
    +#include <asm/cpudata.h>
    #include <asm/oplib.h>
    #include <asm/prom.h>
    #include <asm/io.h>
    @@ -242,8 +242,11 @@ int chmc_getunumber(int syndrome_code,
    */
    static u64 read_mcreg(struct mctrl_info *mp, unsigned long offset)
    {
    - unsigned long ret;
    - int this_cpu = get_cpu();
    + unsigned long ret, this_cpu;
    +
    + preempt_disable();
    +
    + this_cpu = real_hard_smp_processor_id();

    if (mp->portid == this_cpu) {
    __asm__ __volatile__("ldxa [%1] %2, %0"
    @@ -255,7 +258,8 @@ static u64 read_mcreg(struct mctrl_info
    : "r" (mp->regs + offset),
    "i" (ASI_PHYS_BYPASS_EC_E));
    }
    - put_cpu();
    +
    + preempt_enable();

    return ret;
    }
    --


    \
     
     \ /
      Last update: 2008-02-07 00:59    [W:0.020 / U:118.820 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site