Please pull from 'for-2.6.24' branch
Paul,
Please pull from 'for-2.6.24' branch of
master.kernel.org:/pub/scm/linux/kernel/git/olof/pasemi.git for-2.6.24
to receive the following updates:
arch/powerpc/kernel/sysfs.c | 60 +++++++++++++++++ arch/powerpc/platforms/pasemi/idle.c | 8 ++ arch/powerpc/platforms/pasemi/pasemi.h | 4 - arch/powerpc/platforms/pasemi/pci.c | 71 ++++++++++++++++++++ arch/powerpc/platforms/pasemi/setup.c | 112 +++++++++++++++++++++++++++++++-- include/asm-powerpc/reg.h | 48 ++++++++++---- 6 files changed, 281 insertions(+), 22 deletions(-)
Olof Johansson (5):
[POWERPC] pasemi: add pasemi_pci_getcfgaddr()
[POWERPC] pasemi: Add workaround for erratum 5945 [POWERPC] pasemi: Export more SPRs to sysfs when CONFIG_DEBUG_KERNEL=y [POWERPC] pasemi: Print more information at machine check [POWERPC] pasemi: Move pasemi_idle_init() to late_initcall()
Patches also posted as replies to this email for general info.
Thanks,
Olof
[POWERPC] pasemi: add pasemi_pci_getcfgaddr()
commit aa37284d64c33d4755072d4bb4b5b1304d415d97
Author: Olof Johansson <[email protected]> Date: Sat Sep 1 15:43:52 2007 -0500
[POWERPC] pasemi: add pasemi_pci_getcfgaddr()
Add pasemi_pci_getcfgaddr(), to get the remapped address of a specific config register for a PCI device.
arch/powerpc/platforms/pasemi/pasemi.h +2 -0
@@ -6,6 +6,8 @@ extern void pas_pci_init(void);extern void __devinit pas_pci_irq_fixup (struct pci_dev *dev);extern void __devinit pas_pci_dma_dev_setup (struct pci_dev *dev); +extern void __iomem *pasemi_pci_getcfgaddr (struct pci_dev *dev,int offset); +extern void __init alloc_iobmap_l2 (void );extern void __init pasemi_idle_init (void );
arch/powerpc/platforms/pasemi/pci.c +9 -0
@@ -175,3 +175,12 @@ void __init pas_pci_init(void)/* Use the common resource allocation mechanism */ pci_probe_only =1 ; } + +void __iomem *pasemi_pci_getcfgaddr (struct pci_dev *dev,int offset) +{ +struct pci_controller *hose; + + hose =pci_bus_to_host (bus); + + return pa_pxp_cfg_addr(hose, hose->number, dev->devfn, int offset) +}
[POWERPC] pasemi: Add workaround for erratum 5945
In reply to Olof Johanssoncommit 3f7a4e905341e46e7b442a9326c3b31229e25209
Author: Olof Johansson <[email protected]> Date: Mon Sep 3 00:11:49 2007 -0500
[POWERPC] pasemi: Add workaround for erratum 5945
Erratum 5945 causes some of the registers on the PCIe root ports to not read correctly. Do a small dance to avoid this: Write an unused register, read the value and write it back. Thankfully this is not in a hot code path.
arch/powerpc/platforms/pasemi/pci.c +60 -2
@@ -51,6 +51,61 @@ static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose,return hose->cfg_data +PA_PXP_CFA (bus, devfn, offset); } +static inline int is_root_port (int busno,int devfn) +{ +return ((busno ==0 ) && (PCI_FUNC (devfn) <4 ) && + ((PCI_SLOT (devfn) ==16 ) || (PCI_SLOT (devfn) ==17 ))); +} + +static inline int is_5945_reg (int reg) +{ +return (((reg >=0x18 ) && (reg <0x34 )) || + ((reg >=0x158 ) && (reg <0x178 ))); +} + +static int workaround_5945 (struct pci_bus *bus,unsigned int devfn, +int offset,int len,u32 *val) +{ +struct pci_controller *hose; +void volatile __iomem *addr, *dummy; +int byte; +u32 tmp; + +if (!is_root_port (bus->number, devfn) || !is_5945_reg (offset)) +return 0 ; + + hose =pci_bus_to_host (bus); + + addr =pa_pxp_cfg_addr (hose, bus->number, devfn, offset & ~0x3 ); + byte = offset &0x3 ; + +/* Workaround bug 5945: write 0 to a dummy register before reading, +* and write back what we read. We must read/write the full 32-bit +* contents so we need to shift and mask by hand. +*/ + dummy =pa_pxp_cfg_addr (hose, bus->number, devfn,0x10 ); +out_le32 (dummy,0 ); + tmp =in_le32 (addr); +out_le32 (addr, tmp); + +switch (len) { +case 1 : + *val = (tmp >> (8 *byte)) &0xff ; +break ; +case 2 : +if (byte ==0 ) + *val = tmp &0xffff ; +else + *val = (tmp >>16 ) &0xffff ; +break ; +default : + *val = tmp; +break ; + } + +return 1 ; +} +static int pa_pxp_read_config (struct pci_bus *bus,unsigned int devfn,int offset,int len,u32 *val) {
@@ -64,6 +119,9 @@ static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,if (!pa_pxp_offset_valid (bus->number, devfn, offset))return PCIBIOS_BAD_REGISTER_NUMBER ; +if (workaround_5945 (bus, devfn, offset, len, val)) +return PCIBIOS_SUCCESSFUL ; + addr =pa_pxp_cfg_addr (hose, bus->number, devfn, offset);/*
@@ -180,7 +238,7 @@ void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset) {struct pci_controller *hose; - hose =pci_bus_to_host (bus); + hose =pci_bus_to_host (dev->bus); - return pa_pxp_cfg_addr(hose, hose->number, dev->devfn, int offset) +return (void __iomem *)pa_pxp_cfg_addr (hose, dev->bus->number, dev->devfn, offset); }
[POWERPC] pasemi: Export more SPRs to sysfs when CONFIG_DEBUG_KERNEL=y
In reply to Olof Johanssoncommit e34d30c44975ed7db1542f6548f2716185c87baf
Author: Olof Johansson <[email protected]> Date: Sat Sep 1 14:45:07 2007 -0500
[POWERPC] pasemi: Export more SPRs to sysfs when CONFIG_DEBUG_KERNEL=y
Export some of the implementation-specific registers via sysfs. Useful when debugging, etc.
arch/powerpc/kernel/sysfs.c +60 -0
@@ -197,6 +197,36 @@ SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);SYSFS_PMCSETUP (pa6t_pmc4,SPRN_PA6T_PMC4 );SYSFS_PMCSETUP (pa6t_pmc5,SPRN_PA6T_PMC5 ); +#ifdef CONFIG_DEBUG_KERNEL +SYSFS_PMCSETUP (hid0,SPRN_HID0 ); +SYSFS_PMCSETUP (hid1,SPRN_HID1 ); +SYSFS_PMCSETUP (hid4,SPRN_HID4 ); +SYSFS_PMCSETUP (hid5,SPRN_HID5 ); +SYSFS_PMCSETUP (ima0,SPRN_PA6T_IMA0 ); +SYSFS_PMCSETUP (ima1,SPRN_PA6T_IMA1 ); +SYSFS_PMCSETUP (ima2,SPRN_PA6T_IMA2 ); +SYSFS_PMCSETUP (ima3,SPRN_PA6T_IMA3 ); +SYSFS_PMCSETUP (ima4,SPRN_PA6T_IMA4 ); +SYSFS_PMCSETUP (ima5,SPRN_PA6T_IMA5 ); +SYSFS_PMCSETUP (ima6,SPRN_PA6T_IMA6 ); +SYSFS_PMCSETUP (ima7,SPRN_PA6T_IMA7 ); +SYSFS_PMCSETUP (ima8,SPRN_PA6T_IMA8 ); +SYSFS_PMCSETUP (ima9,SPRN_PA6T_IMA9 ); +SYSFS_PMCSETUP (imaat,SPRN_PA6T_IMAAT ); +SYSFS_PMCSETUP (btcr,SPRN_PA6T_BTCR ); +SYSFS_PMCSETUP (pccr,SPRN_PA6T_PCCR ); +SYSFS_PMCSETUP (rpccr,SPRN_PA6T_RPCCR ); +SYSFS_PMCSETUP (der,SPRN_PA6T_DER ); +SYSFS_PMCSETUP (mer,SPRN_PA6T_MER ); +SYSFS_PMCSETUP (ber,SPRN_PA6T_BER ); +SYSFS_PMCSETUP (ier,SPRN_PA6T_IER ); +SYSFS_PMCSETUP (sier,SPRN_PA6T_SIER ); +SYSFS_PMCSETUP (siar,SPRN_PA6T_SIAR ); +SYSFS_PMCSETUP (tsr0,SPRN_PA6T_TSR0 ); +SYSFS_PMCSETUP (tsr1,SPRN_PA6T_TSR1 ); +SYSFS_PMCSETUP (tsr2,SPRN_PA6T_TSR2 ); +SYSFS_PMCSETUP (tsr3,SPRN_PA6T_TSR3 ); +#endif /* CONFIG_DEBUG_KERNEL */ static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL);
@@ -228,6 +258,36 @@ static struct sysdev_attribute pa6t_attrs[] = {_SYSDEV_ATTR (pmc3,0600 , show_pa6t_pmc3, store_pa6t_pmc3),_SYSDEV_ATTR (pmc4,0600 , show_pa6t_pmc4, store_pa6t_pmc4),_SYSDEV_ATTR (pmc5,0600 , show_pa6t_pmc5, store_pa6t_pmc5), +#ifdef CONFIG_DEBUG_KERNEL +_SYSDEV_ATTR (hid0,0600 , show_hid0, store_hid0), +_SYSDEV_ATTR (hid1,0600 , show_hid1, store_hid1), +_SYSDEV_ATTR (hid4,0600 , show_hid4, store_hid4), +_SYSDEV_ATTR (hid5,0600 , show_hid5, store_hid5), +_SYSDEV_ATTR (ima0,0600 , show_ima0, store_ima0), +_SYSDEV_ATTR (ima1,0600 , show_ima1, store_ima1), +_SYSDEV_ATTR (ima2,0600 , show_ima2, store_ima2), +_SYSDEV_ATTR (ima3,0600 , show_ima3, store_ima3), +_SYSDEV_ATTR (ima4,0600 , show_ima4, store_ima4), +_SYSDEV_ATTR (ima5,0600 , show_ima5, store_ima5), +_SYSDEV_ATTR (ima6,0600 , show_ima6, store_ima6), +_SYSDEV_ATTR (ima7,0600 , show_ima7, store_ima7), +_SYSDEV_ATTR (ima8,0600 , show_ima8, store_ima8), +_SYSDEV_ATTR (ima9,0600 , show_ima9, store_ima9), +_SYSDEV_ATTR (imaat,0600 , show_imaat, store_imaat), +_SYSDEV_ATTR (btcr,0600 , show_btcr, store_btcr), +_SYSDEV_ATTR (pccr,0600 , show_pccr, store_pccr), +_SYSDEV_ATTR (rpccr,0600 , show_rpccr, store_rpccr), +_SYSDEV_ATTR (der,0600 , show_der, store_der), +_SYSDEV_ATTR (mer,0600 , show_mer, store_mer), +_SYSDEV_ATTR (ber,0600 , show_ber, store_ber), +_SYSDEV_ATTR (ier,0600 , show_ier, store_ier), +_SYSDEV_ATTR (sier,0600 , show_sier, store_sier), +_SYSDEV_ATTR (siar,0600 , show_siar, store_siar), +_SYSDEV_ATTR (tsr0,0600 , show_tsr0, store_tsr0), +_SYSDEV_ATTR (tsr1,0600 , show_tsr1, store_tsr1), +_SYSDEV_ATTR (tsr2,0600 , show_tsr2, store_tsr2), + _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), +#endif /* CONFIG_DEBUG_KERNEL */ };
include/asm-powerpc/reg.h +37 -11
58 lines not on this page · raw message
[POWERPC] pasemi: Print more information at machine check
In reply to Olof Johanssoncommit c456a6cdfe86cb0e2e2187f5e76768f9215e0693
Author: Olof Johansson <[email protected]> Date: Tue Sep 4 21:49:51 2007 -0500
[POWERPC] pasemi: Print more information at machine check
Add printout of some SoC error status registers, and dump the SLB contents for those machine check events where it makes sense.
Since we can't go about and ioremap registers at machine check time, and we generally want to do as little as possible to print out the information, pre-build a table of the registers to dump and their address in the common PCI config space range.
arch/powerpc/platforms/pasemi/setup.c +106 -4
@@ -39,8 +39,21 @@#include "pasemi.h" +/* SDC reset register, must be pre-mapped at reset time */ static void __iomem *reset_reg; +/* Various error status registers, must be pre-mapped at MCE time */ + +#define MAX_MCE_REGS 32 +struct mce_regs { +char *name; +void __iomem *addr; +}; + +static struct mce_regs mce_regs[MAX_MCE_REGS ]; +static int num_mce_regs; + +static void pas_restart (char *cmd) {printk ("Restarting...\n" );
@@ -106,6 +119,59 @@ void __init pas_setup_arch(void)pasemi_idle_init (); } +static int __init pas_setup_mce_regs (void ) +{ +struct pci_dev *dev; +int reg; + +if (!machine_is (pasemi)) +return -ENODEV ; + +/* Remap various SoC status registers for use by the MCE handler */ + + reg =0 ; + + dev =pci_get_device (PCI_VENDOR_ID_PASEMI ,0xa00a ,NULL ); +while (dev && reg <MAX_MCE_REGS ) { + mce_regs[reg].name =kasprintf (GFP_KERNEL , +"mc%d_mcdebug_errsta" , reg); + mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0x730 ); + dev =pci_get_device (PCI_VENDOR_ID_PASEMI ,0xa00a , dev); + reg++; + } + + dev =pci_get_device (PCI_VENDOR_ID_PASEMI ,0xa001 ,NULL ); +if (dev && reg+4 <MAX_MCE_REGS ) { + mce_regs[reg].name ="iobdbg_IntStatus1" ; + mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0x438 ); + reg++; + mce_regs[reg].name ="iobdbg_IOCTbusIntDbgReg" ; + mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0x454 ); + reg++; + mce_regs[reg].name ="iobiom_IntStatus" ; + mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0xc10 ); + reg++; + mce_regs[reg].name ="iobiom_IntDbgReg" ; + mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0xc1c ); + reg++; + } + + dev =pci_get_device (PCI_VENDOR_ID_PASEMI ,0xa009 ,NULL ); +if (dev && reg+2 <MAX_MCE_REGS ) { + mce_regs[reg].name ="l2csts_IntStatus" ; + mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0x200 ); + reg++; + mce_regs[reg].name ="l2csts_Cnt" ; + mce_regs[reg].addr =pasemi_pci_getcfgaddr (dev,0x214 ); + reg++; + } + + num_mce_regs = reg; + +return 0 ; +} +device_initcall (pas_setup_mce_regs); +static __init void pas_init_IRQ (void ) {struct device_node *np;
@@ -166,25 +232,34 @@ static int pas_machine_check_handler(struct pt_regs *regs) {int cpu =smp_processor_id ();unsigned long srr0, srr1, dsisr; +int dump_slb =0 ; +int i; srr0 = regs->nip; srr1 = regs->msr; dsisr =mfspr (SPRN_DSISR );printk (KERN_ERR "Machine Check on CPU %d\n" , cpu); -printk (KERN_ERR "SRR0 0x%016lx SRR1 0x%016lx\n" , srr0, srr1); -printk (KERN_ERR "DSISR 0x%016lx DAR 0x%016lx\n" , dsisr, regs->dar); +printk (KERN_ERR "SRR0 0x%016lx SRR1 0x%016lx\n" , srr0, srr1); +printk (KERN_ERR "DSISR 0x%016lx DAR 0x%016lx\n" , dsisr, regs->dar); +printk (KERN_ERR "BER 0x%016lx MER 0x%016lx\n" ,mfspr (SPRN_PA6T_BER ), +mfspr (SPRN_PA6T_MER )); +printk (KERN_ERR "IER 0x%016lx DER 0x%016lx\n" ,mfspr (SPRN_PA6T_IER ), +mfspr (SPRN_PA6T_DER ));printk (KERN_ERR "Cause:\n" );if (srr1 &0x200000 )printk (KERN_ERR "Signalled by SDC\n" ); +if (srr1 &0x100000 ) {printk (KERN_ERR "Load/Store detected error:\n" );if (dsisr &0x8000 )printk (KERN_ERR "D-cache ECC double-bit error or bus error\n" );if (dsisr &0x4000 )printk (KERN_ERR "LSU snoop response error\n" ); -if (dsisr &0x2000 ) +if (dsisr &0x2000 ) {printk (KERN_ERR "MMU SLB multi-hit or invalid B field\n" ); + dump_slb =1 ; + }if (dsisr &0x1000 )printk (KERN_ERR "Recoverable Duptags\n" );if (dsisr &0x800 )
@@ -192,13 +267,40 @@ static int pas_machine_check_handler(struct pt_regs *regs)if (dsisr &0x400 )printk (KERN_ERR "TLB parity error count overflow\n" ); } +if (srr1 &0x80000 )printk (KERN_ERR "Bus Error\n" ); -if (srr1 &0x40000 ) + +if (srr1 &0x40000 ) {printk (KERN_ERR "I-side SLB multiple hit\n" ); + dump_slb =1 ; + } +if (srr1 &0x20000 )printk (KERN_ERR "I-cache parity error hit\n" ); +if (num_mce_regs ==0 ) +printk (KERN_ERR "No MCE registers mapped yet, can't dump\n" ); +else +printk (KERN_ERR "SoC debug registers:\n" ); + +for (i =0 ; i < num_mce_regs; i++) +printk (KERN_ERR "%s: 0x%08x\n" , mce_regs[i].name, +in_le32 (mce_regs[i].addr)); + +if (dump_slb) { +unsigned long e, v; +int i; + +printk (KERN_ERR "slb contents:\n" ); +for (i =0 ; i <SLB_NUM_ENTRIES ; i++) { + asmvolatile ("slbmfee %0,%1" :"=r" (e) :"r" (i)); + asmvolatile ("slbmfev %0,%1" :"=r" (v) :"r" (i)); +printk (KERN_ERR "%02d %016lx %016lx\n" , i, e, v); + } + } + +/* SRR1[62] is from MSR[62] if recoverable, so pass that back */ return !!(srr1 &0x2 ); }
[POWERPC] pasemi: Move pasemi_idle_init() to late_initcall()
In reply to Olof Johanssoncommit 6a30bd1e2160e921a8fb051b472dfaf068f4f386
Author: Olof Johansson <[email protected]> Date: Tue Sep 4 21:53:30 2007 -0500
[POWERPC] pasemi: Move pasemi_idle_init() to late_initcall()
Move pasemi_idle_init() to be a late_initcall instead of being called from setup_arch(). This way the cpufreq driver has a chance to initialize and save away the boot time astate before we go to idle for the first time.
arch/powerpc/platforms/pasemi/idle.c +7 -1
@@ -72,8 +72,11 @@ static int pasemi_system_reset_exception(struct pt_regs *regs)return 1 ; } -void __init pasemi_idle_init (void ) +static int __init pasemi_idle_init (void ) { +if (!machine_is (pasemi)) +return -ENODEV ; +#ifndef CONFIG_PPC_PASEMI_CPUFREQ printk (KERN_WARNING "No cpufreq driver, powersavings modes disabled\n" ); current_mode =0 ;
@@ -82,7 +85,10 @@ void __init pasemi_idle_init(void) ppc_md.system_reset_exception = pasemi_system_reset_exception; ppc_md.power_save = modes[current_mode].entry;printk (KERN_INFO "Using PA6T idle loop (%s)\n" , modes[current_mode].name); + +return 0 ; } +late_initcall (pasemi_idle_init);static int __init idle_param (char *p) {
arch/powerpc/platforms/pasemi/pasemi.h +0 -2
@@ -10,8 +10,6 @@ extern void __iomem *pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset);extern void __init alloc_iobmap_l2 (void ); -extern void __init pasemi_idle_init (void ); -/* Power savings modes, implemented in asm */ extern void idle_spin (void );extern void idle_doze (void );
arch/powerpc/platforms/pasemi/setup.c +0 -2
@@ -115,8 +115,6 @@ void __init pas_setup_arch(void)/* Remap SDC register for doing reset */ /* XXXOJN This should maybe come out of the device tree */ reset_reg =ioremap (0xfc101100 ,4 ); - -pasemi_idle_init (); }static int __init pas_setup_mce_regs (void )
Re: [POWERPC] pasemi: Move pasemi_idle_init() to late_initcall()
Quoted 9 lines · Olof Johansson
commit
6a30bd1e2160e921a8fb051b472dfaf068f4f386Author: Olof Johansson <[email protected]> Date: Tue Sep 4 21:53:30 2007 -0500[POWERPC] pasemi: Move
pasemi_idle_init()tolate_initcall()Move
pasemi_idle_init()to be alate_initcallinstead of being called fromsetup_arch(). This way the cpufreq driver has a chance to initialize and save away the boot time astate before we go to idle for the first time.
The patch looks fine, but while I was reviewing this I noticed that the pasemi cpufreq code is bool in Kconfig, but it has stuff like module_init() etc in it. It's not hurting anything, but it did temporarily make me wonder "what happens if the cpufreq driver is modular"?
Re: [POWERPC] pasemi: Move pasemi_idle_init() to late_initcall()
Quoted 11 lines · Nathan Lynch
Quoted 9 lines · Olof Johansson
commit
6a30bd1e2160e921a8fb051b472dfaf068f4f386Author: Olof Johansson <[email protected]> Date: Tue Sep 4 21:53:30 2007 -0500[POWERPC] pasemi: Move
pasemi_idle_init()tolate_initcall()Move
pasemi_idle_init()to be alate_initcallinstead of being called fromsetup_arch(). This way the cpufreq driver has a chance to initialize and save away the boot time astate before we go to idle for the first time.
Quoted 5 lines
The patch looks fine, but while I was reviewing this I noticed that the pasemi cpufreq code is bool in
Kconfig, but it has stuff likemodule_init()etc in it. It's not hurting anything, but it did temporarily make me wonder "what happens if the cpufreq driver is modular"?
Good point. I actually kept it from being modular for the very reason that it's needed in the idle loop to restore the cpu frequency when coming out of power savings modes.
The whole idle/cpufreq dependencies should be overhauled at some point, to avoid this, or at least allow the cpufreq driver to be a module (and make idle default to spin when it's not loaded).
-Olof