From aac2e68481681a362ab6f44fc515034e2a4c7f2c Mon Sep 17 00:00:00 2001 From: Christian Krafft Date: Thu, 30 Aug 2007 01:33:53 +0200 Subject: [POWERPC] spu_manage: fix spu_unit_number for celleb device tree This fixes a regression introduced with 2.6.23-rc4 after on some confusion about the device tree interfaces. IBM QS21 device trees provide "physical-id", so we changed the code to run on that and remain compatible with all IBM machines. However, the Toshiba Celleb device tree provides the "unit-id" property, which was in the Linux code, but never used in this way on IBM hardware. Legacy device tree used the reg property for the physical id of an spe. This patch fixes find_spu_unit_number to look for the spu id in that order. The length is checked to avoid misinterpretation in case the attributes unit-id or reg do not contain the id. Signed-off-by: Christian Krafft Signed-off-by: Arnd Bergmann Cc: Jeremy Kerr --- arch/powerpc/platforms/cell/spu_manage.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c index 7c0668a9dcc..0e14f532500 100644 --- a/arch/powerpc/platforms/cell/spu_manage.c +++ b/arch/powerpc/platforms/cell/spu_manage.c @@ -48,10 +48,18 @@ static u64 __init find_spu_unit_number(struct device_node *spe) { const unsigned int *prop; int proplen; + + /* new device trees should provide the physical-id attribute */ prop = of_get_property(spe, "physical-id", &proplen); if (proplen == 4) return (u64)*prop; + /* celleb device tree provides the unit-id */ + prop = of_get_property(spe, "unit-id", &proplen); + if (proplen == 4) + return (u64)*prop; + + /* legacy device trees provide the id in the reg attribute */ prop = of_get_property(spe, "reg", &proplen); if (proplen == 4) return (u64)*prop; -- cgit v1.2.3 From 62ee68e3bcb0d056aae5b36dea0388ca25572cdf Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 21 Aug 2007 10:06:22 +0800 Subject: [POWERPC] spufs: Fix update of mailbox status register during backed wbox write When a process writes into the inbound spu mailbox (wbox) while the context is saved, we accidentally break the contents of the mb_stat_R register by clearing other entries of the mailbox status register. This can cause the user side to hang. This change fixes the problem by only altering the appropriate bits of the mailbox status register during a backing-store write. Signed-off-by: Arnd Bergmann Signed-off-by: Jeremy Kerr Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/cell/spufs/backing_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/spufs/backing_ops.c b/arch/powerpc/platforms/cell/spufs/backing_ops.c index 07a0e815abf..ec01214e51e 100644 --- a/arch/powerpc/platforms/cell/spufs/backing_ops.c +++ b/arch/powerpc/platforms/cell/spufs/backing_ops.c @@ -162,7 +162,8 @@ static int spu_backing_wbox_write(struct spu_context *ctx, u32 data) BUG_ON(avail != (4 - slot)); ctx->csa.spu_mailbox_data[slot] = data; ctx->csa.spu_chnlcnt_RW[29] = ++slot; - ctx->csa.prob.mb_stat_R = (((4 - slot) & 0xff) << 8); + ctx->csa.prob.mb_stat_R &= ~(0x00ff00); + ctx->csa.prob.mb_stat_R |= (((4 - slot) & 0xff) << 8); gen_spu_event(ctx, MFC_SPU_MAILBOX_WRITTEN_EVENT); ret = 4; } else { -- cgit v1.2.3 From ada83daab31c3ec35845785482124373a62f430c Mon Sep 17 00:00:00 2001 From: Andre Detsch Date: Tue, 21 Aug 2007 10:06:22 +0800 Subject: [POWERPC] spufs: Don't call spu_run_init from spu_reacquire_runnable This fixes a major bug which was happening when a SPU thread advances its execution right after being restored to a SPU. A potentially outdated NPC value was being (re)written to the SPU. So, spu_run_init, in this case, was either not doing anything relevant, or breaking the execution of the SPU thread. This fixes a common problem of losing a mailbox write when it was done to a saved context. Signed-off-by: Andre Detsch Signed-off-by: Jeremy Kerr Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/cell/spufs/run.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index 6abdd8fe209..958f10e90fd 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c @@ -193,11 +193,7 @@ static int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc, if (ret) return ret; - ret = spu_run_init(ctx, npc); - if (ret) { - spu_release(ctx); - return ret; - } + spuctx_switch_state(ctx, SPU_UTIL_USER); return 0; } -- cgit v1.2.3 From fc43dca9e75b87d24a16d5be7b497e83837d9d31 Mon Sep 17 00:00:00 2001 From: Masakazu Mokuno Date: Wed, 29 Aug 2007 20:30:25 +0900 Subject: [POWERPC] PS3: Fix bug where the major version part is not compared Fix the bug that the major version part of the firmware version number is ignored in the comparison done by ps3_compare_firmware_version because the difference of two 64-bit quantities is returned as an int. Signed-off-by: Masakazu Mokuno Acked-by: Geoff Levand Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/ps3/setup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c index 2952b22f1c8..609945dbe39 100644 --- a/arch/powerpc/platforms/ps3/setup.c +++ b/arch/powerpc/platforms/ps3/setup.c @@ -63,7 +63,8 @@ int ps3_compare_firmware_version(u16 major, u16 minor, u16 rev) x.minor = minor; x.rev = rev; - return (ps3_firmware_version.raw - x.raw); + return (ps3_firmware_version.raw > x.raw) - + (ps3_firmware_version.raw < x.raw); } EXPORT_SYMBOL_GPL(ps3_compare_firmware_version); -- cgit v1.2.3 From b7f90a406ff72d6698b619210c205e3375dd099a Mon Sep 17 00:00:00 2001 From: Masato Noguchi Date: Fri, 7 Sep 2007 18:28:27 +1000 Subject: [POWERPC] cell/PS3: Fix a bug that causes the PS3 to hang on the SPU Class 0 interrupt. The Cell BE Architecture spec states that the SPU MFC Class 0 interrupt is edge-triggered. The current spu interrupt handler assumes this behavior and does not clear the interrupt status. The PS3 hypervisor visualizes all SPU interrupts as level, and on return from the interrupt handler the hypervisor will deliver a new virtual interrupt for any unmasked interrupts which for which the status has not been cleared. This fix clears the interrupt status in the interrupt handler. Signed-off-by: Masato Noguchi Signed-off-by: Geoff Levand Signed-off-by: Jeremy Kerr Acked-by: Arnd Bergmann Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/cell/spu_base.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index 095a30304c5..106d2921e2d 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c @@ -236,27 +236,34 @@ static irqreturn_t spu_irq_class_0(int irq, void *data) { struct spu *spu; + unsigned long stat, mask; spu = data; - spu->class_0_pending = 1; + + mask = spu_int_mask_get(spu, 0); + stat = spu_int_stat_get(spu, 0); + stat &= mask; + + spin_lock(&spu->register_lock); + spu->class_0_pending |= stat; + spin_unlock(&spu->register_lock); + spu->stop_callback(spu); + spu_int_stat_clear(spu, 0, stat); + return IRQ_HANDLED; } int spu_irq_class_0_bottom(struct spu *spu) { - unsigned long stat, mask; unsigned long flags; - - spu->class_0_pending = 0; + unsigned long stat; spin_lock_irqsave(&spu->register_lock, flags); - mask = spu_int_mask_get(spu, 0); - stat = spu_int_stat_get(spu, 0); - - stat &= mask; + stat = spu->class_0_pending; + spu->class_0_pending = 0; if (stat & 1) /* invalid DMA alignment */ __spu_trap_dma_align(spu); @@ -267,7 +274,6 @@ spu_irq_class_0_bottom(struct spu *spu) if (stat & 4) /* error on SPU */ __spu_trap_error(spu); - spu_int_stat_clear(spu, 0, stat); spin_unlock_irqrestore(&spu->register_lock, flags); return (stat & 0x7) ? -EIO : 0; -- cgit v1.2.3 From ef8034d01a080e81488e9cf74052acf1e2a37bd0 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Fri, 7 Sep 2007 18:28:27 +1000 Subject: [POWERPC] cell/PS3: Always set master run control bit in mfc_sr1_set At present, running any SPE program on the ps3 will trigger a BUG_ON when spufs_run_spu tries to clear the master run control bit, as lv1 does not make the master run control available to Linux. This change makes SPE apps work again by disabling changes to the master run control on PS3. Although we don't have the facility to disable a SPE with supervisor-level privileges, it's better than hitting the BUG_ON unconditionally. Signed-off-by: Jeremy Kerr Acked-by: Masato Noguchi Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/ps3/spu.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c index ac2a4b8a4c1..d1630a074ac 100644 --- a/arch/powerpc/platforms/ps3/spu.c +++ b/arch/powerpc/platforms/ps3/spu.c @@ -505,6 +505,8 @@ static void mfc_sr1_set(struct spu *spu, u64 sr1) static const u64 allowed = ~(MFC_STATE1_LOCAL_STORAGE_DECODE_MASK | MFC_STATE1_PROBLEM_STATE_MASK); + sr1 |= MFC_STATE1_MASTER_RUN_CONTROL_MASK; + BUG_ON((sr1 & allowed) != (spu_pdata(spu)->cache.sr1 & allowed)); spu_pdata(spu)->cache.sr1 = sr1; -- cgit v1.2.3 From d51dd3de87026cb0ea1ea5f873f08e930053bfc5 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 6 Sep 2007 18:14:57 +0200 Subject: [POWERPC] cell/PS3: Ignore storage devices that are still being probed On PS3, A storage device may show up in the repository before the hypervisor has finished probing: - If its type is not yet known, it shows up as PS3_DEV_TYPE_STOR_DUMMY, - If its regions are being probed, it shows up as having zero regions. If any of these happen, consider the device not yet present. The storage probe thread will retry later. This fixes the timing-dependent problem where a kernel booted from FLASH ROM sometimes cannot find the hard disk. Signed-off-by: Geert Uytterhoeven Acked-by: Geoff Levand Signed-off-by: Paul Mackerras --- arch/powerpc/platforms/ps3/platform.h | 1 + arch/powerpc/platforms/ps3/repository.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/ps3/platform.h b/arch/powerpc/platforms/ps3/platform.h index 87d52060fec..2eb8f92704b 100644 --- a/arch/powerpc/platforms/ps3/platform.h +++ b/arch/powerpc/platforms/ps3/platform.h @@ -83,6 +83,7 @@ enum ps3_dev_type { PS3_DEV_TYPE_STOR_ROM = TYPE_ROM, /* 5 */ PS3_DEV_TYPE_SB_GPIO = 6, PS3_DEV_TYPE_STOR_FLASH = TYPE_RBC, /* 14 */ + PS3_DEV_TYPE_STOR_DUMMY = 32, PS3_DEV_TYPE_NOACCESS = 255, }; diff --git a/arch/powerpc/platforms/ps3/repository.c b/arch/powerpc/platforms/ps3/repository.c index 8cc37cfea0f..1c94824f7b6 100644 --- a/arch/powerpc/platforms/ps3/repository.c +++ b/arch/powerpc/platforms/ps3/repository.c @@ -349,6 +349,35 @@ int ps3_repository_find_device(struct ps3_repository_device *repo) return result; } + if (tmp.bus_type == PS3_BUS_TYPE_STORAGE) { + /* + * A storage device may show up in the repository before the + * hypervisor has finished probing its type and regions + */ + unsigned int num_regions; + + if (tmp.dev_type == PS3_DEV_TYPE_STOR_DUMMY) { + pr_debug("%s:%u storage device not ready\n", __func__, + __LINE__); + return -ENODEV; + } + + result = ps3_repository_read_stor_dev_num_regions(tmp.bus_index, + tmp.dev_index, + &num_regions); + if (result) { + pr_debug("%s:%d read_stor_dev_num_regions failed\n", + __func__, __LINE__); + return result; + } + + if (!num_regions) { + pr_debug("%s:%u storage device has no regions yet\n", + __func__, __LINE__); + return -ENODEV; + } + } + result = ps3_repository_read_dev_id(tmp.bus_index, tmp.dev_index, &tmp.dev_id); -- cgit v1.2.3 From 2af8569dc9f29c303bf4aa012d991afcfaeed0c3 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Mon, 10 Sep 2007 14:30:33 -0500 Subject: [POWERPC] 8{5,6}xx: Fix build issue with !CONFIG_PCI We needed some ifdef CONFIG_PCI protection for pcibios_fixup so we can build !CONFIG_PCI. Signed-off-by: Kumar Gala --- arch/powerpc/platforms/85xx/mpc8544_ds.c | 2 ++ arch/powerpc/platforms/85xx/mpc85xx_cds.c | 2 +- arch/powerpc/platforms/85xx/mpc85xx_mds.c | 2 ++ arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 2 ++ 4 files changed, 7 insertions(+), 1 deletion(-) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/85xx/mpc8544_ds.c b/arch/powerpc/platforms/85xx/mpc8544_ds.c index 0f834d8be44..48983bc56d4 100644 --- a/arch/powerpc/platforms/85xx/mpc8544_ds.c +++ b/arch/powerpc/platforms/85xx/mpc8544_ds.c @@ -178,7 +178,9 @@ define_machine(mpc8544_ds) { .probe = mpc8544_ds_probe, .setup_arch = mpc8544_ds_setup_arch, .init_IRQ = mpc8544_ds_pic_init, +#ifdef CONFIG_PCI .pcibios_fixup_bus = fsl_pcibios_fixup_bus, +#endif .get_irq = mpic_get_irq, .restart = mpc85xx_restart, .calibrate_decr = generic_calibrate_decr, diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c index 6a171e9abf7..2d4cb784760 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c @@ -351,10 +351,10 @@ define_machine(mpc85xx_cds) { .get_irq = mpic_get_irq, #ifdef CONFIG_PCI .restart = mpc85xx_cds_restart, + .pcibios_fixup_bus = fsl_pcibios_fixup_bus, #else .restart = mpc85xx_restart, #endif .calibrate_decr = generic_calibrate_decr, .progress = udbg_progress, - .pcibios_fixup_bus = fsl_pcibios_fixup_bus, }; diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c index be25ecd911b..7ca7e676f1c 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c @@ -207,5 +207,7 @@ define_machine(mpc85xx_mds) { .restart = mpc85xx_restart, .calibrate_decr = generic_calibrate_decr, .progress = udbg_progress, +#ifdef CONFIG_PCI .pcibios_fixup_bus = fsl_pcibios_fixup_bus, +#endif }; diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index 56b27caf7a2..47aafa76c93 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c @@ -250,5 +250,7 @@ define_machine(mpc86xx_hpcn) { .time_init = mpc86xx_time_init, .calibrate_decr = generic_calibrate_decr, .progress = udbg_progress, +#ifdef CONFIG_PCI .pcibios_fixup_bus = fsl_pcibios_fixup_bus, +#endif }; -- cgit v1.2.3 From fb4f0e8832e0075849b41b65f6bb9fdfa7593b99 Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Mon, 10 Sep 2007 14:57:34 -0500 Subject: [POWERPC] Enable GENERIC_ISA_DMA if FSL_ULI1575 to fix compile issue Since the ULI1575 has a ISA bus we need to enable the generic ISA dma support for drivers that might expect it. Without this we get compile errors like the following: ound/built-in.o: In function `claim_dma_lock': /home/galak/git/linux-8572/include/asm/dma.h:189: undefined reference to `dma_spin_lock' /home/galak/git/linux-8572/include/asm/dma.h:189: undefined reference to `dma_spin_lock' sound/built-in.o: In function `release_dma_lock': /home/galak/git/linux-8572/include/asm/dma.h:195: undefined reference to `dma_spin_lock' sound/built-in.o: In function `claim_dma_lock': /home/galak/git/linux-8572/include/asm/dma.h:189: undefined reference to `dma_spin_lock' /home/galak/git/linux-8572/include/asm/dma.h:189: undefined reference to `dma_spin_lock' sound/built-in.o:/home/galak/git/linux-8572/include/asm/dma.h:195: more undefined references to `dma_spin_lock' follow make: *** [.tmp_vmlinux1] Error 1 Signed-off-by: Kumar Gala --- arch/powerpc/platforms/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/powerpc/platforms') diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig index cfc24974159..19d4628edf7 100644 --- a/arch/powerpc/platforms/Kconfig +++ b/arch/powerpc/platforms/Kconfig @@ -285,6 +285,7 @@ config AXON_RAM config FSL_ULI1575 bool default n + select GENERIC_ISA_DMA help Supports for the ULI1575 PCIe south bridge that exists on some Freescale reference boards. The boards all use the ULI in pretty -- cgit v1.2.3