* [PATCH 1/5] spufs: Disable local interrupts for SPE hash_page calls.
2006-04-07 15:01 [PATCH 0/5] cell: recent bug fixes arnd
@ 2006-04-06 22:00 ` arnd
2006-04-06 22:00 ` [PATCH 2/5] powerpc: fix 64k pages on non-hypervisor arnd
` (3 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: arnd @ 2006-04-06 22:00 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann
This patch disables and saves local interrupts during
hash_page processing for SPE contexts.
We have to do it explicitly in the spu_irq_class_1_bottom
function. For the interrupt handlers, we get the behaviour
implicitly by using SA_INTERRUPT to disable interrupts while
in the handler.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
---
Index: linus-2.6/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linus-2.6.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linus-2.6/arch/powerpc/platforms/cell/spu_base.c
@@ -306,19 +306,19 @@ spu_request_irqs(struct spu *spu)
snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0", spu->number);
ret = request_irq(irq_base + spu->isrc,
- spu_irq_class_0, 0, spu->irq_c0, spu);
+ spu_irq_class_0, SA_INTERRUPT, spu->irq_c0, spu);
if (ret)
goto out;
snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1", spu->number);
ret = request_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc,
- spu_irq_class_1, 0, spu->irq_c1, spu);
+ spu_irq_class_1, SA_INTERRUPT, spu->irq_c1, spu);
if (ret)
goto out1;
snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2", spu->number);
ret = request_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc,
- spu_irq_class_2, 0, spu->irq_c2, spu);
+ spu_irq_class_2, SA_INTERRUPT, spu->irq_c2, spu);
if (ret)
goto out2;
goto out;
@@ -487,10 +487,14 @@ int spu_irq_class_1_bottom(struct spu *s
ea = spu->dar;
dsisr = spu->dsisr;
if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) {
+ u64 flags;
+
access = (_PAGE_PRESENT | _PAGE_USER);
access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL;
+ local_irq_save(flags);
if (hash_page(ea, access, 0x300) != 0)
error |= CLASS1_ENABLE_STORAGE_FAULT_INTR;
+ local_irq_restore(flags);
}
if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) {
if ((ret = spu_handle_mm_fault(spu)) != 0)
--
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 2/5] powerpc: fix 64k pages on non-hypervisor
2006-04-07 15:01 [PATCH 0/5] cell: recent bug fixes arnd
2006-04-06 22:00 ` [PATCH 1/5] spufs: Disable local interrupts for SPE hash_page calls arnd
@ 2006-04-06 22:00 ` arnd
2006-04-06 22:00 ` [PATCH 3/5] spufs: set up correct SLB entries for 64k pages arnd
` (2 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: arnd @ 2006-04-06 22:00 UTC (permalink / raw)
To: Paul Mackerras; +Cc: Arnd Bergmann, linuxppc-dev, cbe-oss-dev
The page size encoding passed to tlbie is incorrect for
new-style large pages. This fixes it.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linus-2.6/arch/powerpc/mm/hash_native_64.c
===================================================================
--- linus-2.6.orig/arch/powerpc/mm/hash_native_64.c
+++ linus-2.6/arch/powerpc/mm/hash_native_64.c
@@ -52,7 +52,7 @@ static inline void __tlbie(unsigned long
default:
penc = mmu_psize_defs[psize].penc;
va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
- va |= (0x7f >> (8 - penc)) << 12;
+ va |= penc << 12;
asm volatile("tlbie %0,1" : : "r" (va) : "memory");
break;
}
@@ -74,7 +74,7 @@ static inline void __tlbiel(unsigned lon
default:
penc = mmu_psize_defs[psize].penc;
va &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
- va |= (0x7f >> (8 - penc)) << 12;
+ va |= penc << 12;
asm volatile(".long 0x7c000224 | (%0 << 11) | (1 << 21)"
: : "r"(va) : "memory");
break;
--
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 3/5] spufs: set up correct SLB entries for 64k pages
2006-04-07 15:01 [PATCH 0/5] cell: recent bug fixes arnd
2006-04-06 22:00 ` [PATCH 1/5] spufs: Disable local interrupts for SPE hash_page calls arnd
2006-04-06 22:00 ` [PATCH 2/5] powerpc: fix 64k pages on non-hypervisor arnd
@ 2006-04-06 22:00 ` arnd
2006-04-06 22:00 ` [PATCH 4/5] powerpc: export symbols for page size selection arnd
2006-04-06 22:00 ` [PATCH 5/5] cell: enable CPU_FTR_CI_LARGE_PAGE arnd
4 siblings, 0 replies; 13+ messages in thread
From: arnd @ 2006-04-06 22:00 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann
spufs currently knows only 4k pages and 16M hugetlb
pages. Make it use the regular methods for deciding on
the SLB bits.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linus-2.6/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linus-2.6.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linus-2.6/arch/powerpc/platforms/cell/spu_base.c
@@ -71,7 +71,7 @@ static int __spu_trap_data_seg(struct sp
{
struct spu_priv2 __iomem *priv2 = spu->priv2;
struct mm_struct *mm = spu->mm;
- u64 esid, vsid;
+ u64 esid, vsid, llp;
pr_debug("%s\n", __FUNCTION__);
@@ -91,9 +91,14 @@ static int __spu_trap_data_seg(struct sp
}
esid = (ea & ESID_MASK) | SLB_ESID_V;
- vsid = (get_vsid(mm->context.id, ea) << SLB_VSID_SHIFT) | SLB_VSID_USER;
+#ifdef CONFIG_HUGETLB_PAGE
if (in_hugepage_area(mm->context, ea))
- vsid |= SLB_VSID_L;
+ llp = mmu_psize_defs[mmu_huge_psize].sllp;
+ else
+#endif
+ llp = mmu_psize_defs[mmu_virtual_psize].sllp;
+ vsid = (get_vsid(mm->context.id, ea) << SLB_VSID_SHIFT) |
+ SLB_VSID_USER | llp;
out_be64(&priv2->slb_index_W, spu->slb_replace);
out_be64(&priv2->slb_vsid_RW, vsid);
Index: linus-2.6/arch/powerpc/platforms/cell/spufs/switch.c
===================================================================
--- linus-2.6.orig/arch/powerpc/platforms/cell/spufs/switch.c
+++ linus-2.6/arch/powerpc/platforms/cell/spufs/switch.c
@@ -718,13 +718,15 @@ static inline void invalidate_slbs(struc
static inline void get_kernel_slb(u64 ea, u64 slb[2])
{
- slb[0] = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
- slb[1] = (ea & ESID_MASK) | SLB_ESID_V;
+ u64 llp;
- /* Large pages are used for kernel text/data, but not vmalloc. */
- if (cpu_has_feature(CPU_FTR_16M_PAGE)
- && REGION_ID(ea) == KERNEL_REGION_ID)
- slb[0] |= SLB_VSID_L;
+ if (REGION_ID(ea) == KERNEL_REGION_ID)
+ llp = mmu_psize_defs[mmu_linear_psize].sllp;
+ else
+ llp = mmu_psize_defs[mmu_virtual_psize].sllp;
+ slb[0] = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) |
+ SLB_VSID_KERNEL | llp;
+ slb[1] = (ea & ESID_MASK) | SLB_ESID_V;
}
static inline void load_mfc_slb(struct spu *spu, u64 slb[2], int slbe)
Index: linus-2.6/arch/powerpc/platforms/cell/Kconfig
===================================================================
--- linus-2.6.orig/arch/powerpc/platforms/cell/Kconfig
+++ linus-2.6/arch/powerpc/platforms/cell/Kconfig
@@ -22,7 +22,7 @@ config SPU_FS
config SPUFS_MMAP
bool
- depends on SPU_FS && SPARSEMEM && !PPC_64K_PAGES
+ depends on SPU_FS && SPARSEMEM
default y
endmenu
--
^ permalink raw reply [flat|nested] 13+ messages in thread* [PATCH 4/5] powerpc: export symbols for page size selection
2006-04-07 15:01 [PATCH 0/5] cell: recent bug fixes arnd
` (2 preceding siblings ...)
2006-04-06 22:00 ` [PATCH 3/5] spufs: set up correct SLB entries for 64k pages arnd
@ 2006-04-06 22:00 ` arnd
2006-04-07 15:28 ` Christoph Hellwig
2006-04-06 22:00 ` [PATCH 5/5] cell: enable CPU_FTR_CI_LARGE_PAGE arnd
4 siblings, 1 reply; 13+ messages in thread
From: arnd @ 2006-04-06 22:00 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann
We need access to some symbols in powerpc memory management
from spufs in order to create proper SLB entries.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linus-2.6/arch/powerpc/mm/hash_utils_64.c
===================================================================
--- linus-2.6.orig/arch/powerpc/mm/hash_utils_64.c
+++ linus-2.6/arch/powerpc/mm/hash_utils_64.c
@@ -85,16 +85,26 @@ extern unsigned long dart_tablebase;
#endif /* CONFIG_U3_DART */
static unsigned long _SDR1;
-struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
hpte_t *htab_address;
unsigned long htab_size_bytes;
unsigned long htab_hash_mask;
+
+struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
+EXPORT_SYMBOL_GPL(mmu_psize_defs);
+
int mmu_linear_psize = MMU_PAGE_4K;
+EXPORT_SYMBOL_GPL(mmu_linear_psize);
+
int mmu_virtual_psize = MMU_PAGE_4K;
+EXPORT_SYMBOL_GPL(mmu_virtual_psize);
+
#ifdef CONFIG_HUGETLB_PAGE
int mmu_huge_psize = MMU_PAGE_16M;
+EXPORT_SYMBOL_GPL(mmu_huge_psize);
+
unsigned int HPAGE_SHIFT;
+EXPORT_SYMBOL_GPL(HPAGE_SHIFT);
#endif
/* There are definitions of page sizes arrays to be used when none
--
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH 4/5] powerpc: export symbols for page size selection
2006-04-06 22:00 ` [PATCH 4/5] powerpc: export symbols for page size selection arnd
@ 2006-04-07 15:28 ` Christoph Hellwig
2006-04-07 15:42 ` Olof Johansson
2006-04-11 1:21 ` Benjamin Herrenschmidt
0 siblings, 2 replies; 13+ messages in thread
From: Christoph Hellwig @ 2006-04-07 15:28 UTC (permalink / raw)
To: arnd; +Cc: linuxppc-dev, Paul Mackerras, cbe-oss-dev, Arnd Bergmann
On Fri, Apr 07, 2006 at 12:00:04AM +0200, arnd@arndb.de wrote:
> We need access to some symbols in powerpc memory management
> from spufs in order to create proper SLB entries.
One more reason to disallow modular spufs..
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/5] powerpc: export symbols for page size selection
2006-04-07 15:28 ` Christoph Hellwig
@ 2006-04-07 15:42 ` Olof Johansson
2006-04-07 15:54 ` [Cbe-oss-dev] " Geoff Levand
2006-04-07 16:03 ` Arnd Bergmann
2006-04-11 1:21 ` Benjamin Herrenschmidt
1 sibling, 2 replies; 13+ messages in thread
From: Olof Johansson @ 2006-04-07 15:42 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linuxppc-dev, Paul Mackerras, cbe-oss-dev, Arnd Bergmann
On Fri, Apr 07, 2006 at 05:28:13PM +0200, Christoph Hellwig wrote:
> On Fri, Apr 07, 2006 at 12:00:04AM +0200, arnd@arndb.de wrote:
> > We need access to some symbols in powerpc memory management
> > from spufs in order to create proper SLB entries.
>
> One more reason to disallow modular spufs..
Yeah, what's the need for that, really? It needs to know so much of
kernel internals that it's getting silly to allow it to be a module.
-Olof
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Cbe-oss-dev] [PATCH 4/5] powerpc: export symbols for page size selection
2006-04-07 15:42 ` Olof Johansson
@ 2006-04-07 15:54 ` Geoff Levand
2006-04-07 16:03 ` Arnd Bergmann
1 sibling, 0 replies; 13+ messages in thread
From: Geoff Levand @ 2006-04-07 15:54 UTC (permalink / raw)
To: Olof Johansson; +Cc: Arnd Bergmann, linuxppc-dev, cbe-oss-dev
Olof Johansson wrote:
> On Fri, Apr 07, 2006 at 05:28:13PM +0200, Christoph Hellwig wrote:
>> On Fri, Apr 07, 2006 at 12:00:04AM +0200, arnd@arndb.de wrote:
>> > We need access to some symbols in powerpc memory management
>> > from spufs in order to create proper SLB entries.
>>
>> One more reason to disallow modular spufs..
>
> Yeah, what's the need for that, really? It needs to know so much of
> kernel internals that it's getting silly to allow it to be a module.
We never used that feature either...
-Geoff
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Cbe-oss-dev] [PATCH 4/5] powerpc: export symbols for page size selection
2006-04-07 15:42 ` Olof Johansson
2006-04-07 15:54 ` [Cbe-oss-dev] " Geoff Levand
@ 2006-04-07 16:03 ` Arnd Bergmann
2006-04-07 16:20 ` Olof Johansson
1 sibling, 1 reply; 13+ messages in thread
From: Arnd Bergmann @ 2006-04-07 16:03 UTC (permalink / raw)
To: cbe-oss-dev; +Cc: linuxppc-dev
On Friday 07 April 2006 17:42, Olof Johansson wrote:
> Yeah, what's the need for that, really? It needs to know so much of
> kernel internals that it's getting silly to allow it to be a module.
>
It's still quite handy to have the actual file system as a module,
because
a) the module is rather bloated atm, it's about 200kb including the
embedded spu code that it runs for context switch. I don't want
to burden the generic distros with that
b) It simplifies development a bit to not have to reload the whole
kernel when making changes. Booting with all the HW debugger stuff
enabled takes quite a bit of time, especially when you have to
tunnel the binaries through our internal network ;-).
We currently have two modules, and the base module has most of the
stuff that has dependencies on exported symbols. The binary is
25k on my system (with some debugging options enabled).
How about if I do a patch that always includes the base but not
the actual file system?
Arnd <><
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Cbe-oss-dev] [PATCH 4/5] powerpc: export symbols for page size selection
2006-04-07 16:03 ` Arnd Bergmann
@ 2006-04-07 16:20 ` Olof Johansson
2006-04-07 16:49 ` Arnd Bergmann
0 siblings, 1 reply; 13+ messages in thread
From: Olof Johansson @ 2006-04-07 16:20 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linuxppc-dev, cbe-oss-dev
On Fri, Apr 07, 2006 at 06:03:01PM +0200, Arnd Bergmann wrote:
> On Friday 07 April 2006 17:42, Olof Johansson wrote:
> > Yeah, what's the need for that, really? It needs to know so much of
> > kernel internals that it's getting silly to allow it to be a module.
>
> How about if I do a patch that always includes the base but not
> the actual file system?
Sounds like a decent tradeoff.
-Olof
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Cbe-oss-dev] [PATCH 4/5] powerpc: export symbols for page size selection
2006-04-07 16:20 ` Olof Johansson
@ 2006-04-07 16:49 ` Arnd Bergmann
0 siblings, 0 replies; 13+ messages in thread
From: Arnd Bergmann @ 2006-04-07 16:49 UTC (permalink / raw)
To: cbe-oss-dev; +Cc: linuxppc-dev, Mark Nutter
On Friday 07 April 2006 18:20, Olof Johansson wrote:
> On Fri, Apr 07, 2006 at 06:03:01PM +0200, Arnd Bergmann wrote:
> > On Friday 07 April 2006 17:42, Olof Johansson wrote:
> > > Yeah, what's the need for that, really? It needs to know so much of
> > > kernel internals that it's getting silly to allow it to be a module.
> >
> > How about if I do a patch that always includes the base but not
> > the actual file system?
>
> Sounds like a decent tradeoff.
>
Unfortunately, this one doesn't get rid of the need to have the
exports, since the context switch code also needs mmu_psize_defs
and the associated objects. I think I have to come up with
a different change for that, but I don't mind putting the base
stuff into the kernel in the first place.
Mark has some changes to the file layout pending that will
impact this as well. I first need to see how that works out
together.
The patch to make the base non-modular is trivial, so we might
as well apply it now.
Arnd <><
Index: linus-2.6/arch/powerpc/platforms/cell/Makefile
===================================================================
--- linus-2.6.orig/arch/powerpc/platforms/cell/Makefile
+++ linus-2.6/arch/powerpc/platforms/cell/Makefile
@@ -2,15 +2,13 @@ obj-y += interrupt.o iommu.o setup.o s
obj-y += pervasive.o
obj-$(CONFIG_SMP) += smp.o
-obj-$(CONFIG_SPU_FS) += spu-base.o spufs/
-
-spu-base-y += spu_base.o spu_priv1.o
+obj-$(CONFIG_SPU_FS) += spufs/
# needed only when building loadable spufs.ko
spufs-modular-$(CONFIG_SPU_FS) += spu_syscalls.o
obj-y += $(spufs-modular-m)
# always needed in kernel
-spufs-builtin-$(CONFIG_SPU_FS) += spu_callbacks.o
+spufs-builtin-$(CONFIG_SPU_FS) += spu_callbacks.o spu_base.o spu_priv1.o
obj-y += $(spufs-builtin-y) $(spufs-builtin-m)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Cbe-oss-dev] [PATCH 4/5] powerpc: export symbols for page size selection
2006-04-07 15:28 ` Christoph Hellwig
2006-04-07 15:42 ` Olof Johansson
@ 2006-04-11 1:21 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 13+ messages in thread
From: Benjamin Herrenschmidt @ 2006-04-11 1:21 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann
On Fri, 2006-04-07 at 17:28 +0200, Christoph Hellwig wrote:
> On Fri, Apr 07, 2006 at 12:00:04AM +0200, arnd@arndb.de wrote:
> > We need access to some symbols in powerpc memory management
> > from spufs in order to create proper SLB entries.
>
> One more reason to disallow modular spufs..
Why ? It's not problem as long as they are exported GPL only ...
Ben.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 5/5] cell: enable CPU_FTR_CI_LARGE_PAGE
2006-04-07 15:01 [PATCH 0/5] cell: recent bug fixes arnd
` (3 preceding siblings ...)
2006-04-06 22:00 ` [PATCH 4/5] powerpc: export symbols for page size selection arnd
@ 2006-04-06 22:00 ` arnd
4 siblings, 0 replies; 13+ messages in thread
From: arnd @ 2006-04-06 22:00 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev, cbe-oss-dev, Arnd Bergmann
Reflect the fact that the Cell Broadband Engine supports 64k
pages by adding the bit to the CPU features.
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
---
Index: linus-2.6/include/asm-powerpc/cputable.h
===================================================================
--- linus-2.6.orig/include/asm-powerpc/cputable.h
+++ linus-2.6/include/asm-powerpc/cputable.h
@@ -323,7 +323,7 @@ extern void do_cpu_ftr_fixups(unsigned l
#define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \
CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
- CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO)
+ CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE)
#define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \
CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2)
#endif
--
^ permalink raw reply [flat|nested] 13+ messages in thread