linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/16] add hypervisor support for SPU
@ 2006-11-15  9:28 Ishizaki Kou
  2006-11-15 15:47 ` Arnd Bergmann
  2006-11-15 18:26 ` Christoph Hellwig
  0 siblings, 2 replies; 9+ messages in thread
From: Ishizaki Kou @ 2006-11-15  9:28 UTC (permalink / raw)
  To: linuxppc-dev

This patch adds hypervisor support for spu.

Linux(GuestOS) needs to designate SPE ID number when it uses SPE on Beat,
and must read the number from DT.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
---

Index: linux-2.6.19/arch/powerpc/platforms/cell/Kconfig
diff -u linux-2.6.19/arch/powerpc/platforms/cell/Kconfig:1.1.1.1 linux-2.6.19/arch/powerpc/platforms/cell/Kconfig:1.2
--- linux-2.6.19/arch/powerpc/platforms/cell/Kconfig:1.1.1.1	Fri Oct  6 10:40:07 2006
+++ linux-2.6.19/arch/powerpc/platforms/cell/Kconfig	Fri Oct  6 12:26:35 2006
@@ -16,6 +16,10 @@
 	bool
 	default n
 
+config SPU_NEED_SHADOW_INT_MASK
+	bool
+	default n
+
 config CBE_RAS
 	bool "RAS features for bare metal Cell BE"
 	default y
Index: linux-2.6.19/arch/powerpc/platforms/cell/spu_base.c
diff -u linux-2.6.19/arch/powerpc/platforms/cell/spu_base.c:1.1.1.3 linux-2.6.19/arch/powerpc/platforms/cell/spu_base.c:1.6
--- linux-2.6.19/arch/powerpc/platforms/cell/spu_base.c:1.1.1.3	Tue Oct 24 13:35:57 2006
+++ linux-2.6.19/arch/powerpc/platforms/cell/spu_base.c	Tue Nov  7 12:44:38 2006
@@ -38,6 +38,7 @@
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
 #include <asm/mmu_context.h>
+#include <asm/firmware.h>
 
 #include "interrupt.h"
 
@@ -507,6 +508,13 @@
 	return id ? *id : 0;
 }
 
+static int __init find_spu_unit_number(struct device_node *spe)
+{
+	const unsigned int *reg;
+	reg = get_property(spe, "reg", NULL);
+	return reg ? *reg : 0;
+}
+
 static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
 		const char *prop)
 {
@@ -554,10 +562,12 @@
 	int err = 0;
 
 	p = get_property(n, name, &proplen);
-	if (proplen != sizeof (struct address_prop))
+	if (!p || proplen != sizeof (struct address_prop))
 		return NULL;
 
 	prop = p;
+	if (prop->len == 0)
+		return NULL;
 
 	err = cell_spuprop_present(spu, n, name);
 	if (err && (err != -EEXIST))
@@ -788,6 +798,7 @@
 		printk(KERN_WARNING "Check if CONFIG_NUMA is enabled.\n");
 		return -ENODEV;
 	}
+	spu->unit_number = find_spu_unit_number(spe);
 	spu->nid = of_node_to_nid(spe);
 	if (spu->nid == -1)
 		spu->nid = 0;
@@ -805,7 +816,11 @@
 	if (ret)
 		goto out_unmap;
 	spin_lock_init(&spu->register_lock);
-	spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1));
+#ifdef CONFIG_SPU_NEED_SHADOW_INT_MASK
+	spin_lock_init(&spu->int_mask_lock);
+#endif
+	if (!(firmware_has_feature(FW_FEATURE_LPAR)))
+		spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1));
 	spu_mfc_sr1_set(spu, 0x33);
 	mutex_lock(&spu_mutex);
 
Index: linux-2.6.19/arch/powerpc/platforms/cell/spufs/switch.c
diff -u linux-2.6.19/arch/powerpc/platforms/cell/spufs/switch.c:1.1.1.1 linux-2.6.19/arch/powerpc/platforms/cell/spufs/switch.c:1.2
--- linux-2.6.19/arch/powerpc/platforms/cell/spufs/switch.c:1.1.1.1	Fri Oct  6 10:40:08 2006
+++ linux-2.6.19/arch/powerpc/platforms/cell/spufs/switch.c	Fri Oct  6 12:26:35 2006
@@ -48,6 +48,7 @@
 #include <asm/spu_priv1.h>
 #include <asm/spu_csa.h>
 #include <asm/mmu_context.h>
+#include <asm/firmware.h>
 
 #include "spu_save_dump.h"
 #include "spu_restore_dump.h"
@@ -2166,7 +2167,8 @@
 	    MFC_STATE1_RELOCATE_MASK | MFC_STATE1_BUS_TLBIE_MASK;
 
 	/* Set storage description.  */
-	csa->priv1.mfc_sdr_RW = mfspr(SPRN_SDR1);
+	if (!firmware_has_feature(FW_FEATURE_LPAR))
+		csa->priv1.mfc_sdr_RW = mfspr(SPRN_SDR1);
 
 	/* Enable OS-specific set of interrupts. */
 	csa->priv1.int_mask_class0_RW = CLASS0_ENABLE_DMA_ALIGNMENT_INTR |
Index: linux-2.6.19/include/asm-powerpc/spu.h
diff -u linux-2.6.19/include/asm-powerpc/spu.h:1.1.1.1 linux-2.6.19/include/asm-powerpc/spu.h:1.3
--- linux-2.6.19/include/asm-powerpc/spu.h:1.1.1.1	Fri Oct  6 10:43:21 2006
+++ linux-2.6.19/include/asm-powerpc/spu.h	Tue Nov  7 12:44:38 2006
@@ -120,9 +120,14 @@
 	unsigned int irqs[3];
 	u32 isrc;
 	u32 node;
+	u32 unit_number;
 	u64 flags;
 	u64 dar;
 	u64 dsisr;
+#ifdef	CONFIG_SPU_NEED_SHADOW_INT_MASK
+	spinlock_t int_mask_lock;
+	u64 shadow_int_mask_RW[3];
+#endif
 	size_t ls_size;
 	unsigned int slb_replace;
 	struct mm_struct *mm;

^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [PATCH 2/16] add hypervisor support for SPU
@ 2006-11-17 10:33 Ishizaki Kou
  2006-11-17 21:28 ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: Ishizaki Kou @ 2006-11-17 10:33 UTC (permalink / raw)
  To: linuxppc-dev

Hi Arnd-san,

> On Wednesday 15 November 2006 10:28, Ishizaki Kou wrote:
> 
> > +static int __init find_spu_unit_number(struct device_node *spe)
> > +{
> > +       const unsigned int *reg;
> > +       reg = get_property(spe, "reg", NULL);
> > +       return reg ? *reg : 0;
> > +}
> > +
> 
> The unit number shold not be in the 'reg' property any more. With
> the device tree layout we want to migrate to for better OFW compatibility,
> 'reg' should contain the addresses of local store, problem state and priv2
> mappings, in that order.
> 
> Having the function is fine, but your interface needs to be a different
> property.

We don't think that standard binding for SPE exists. Do you have any
proposal? If you have, please send us your binding.

On our device tree, property "reg" has unit number. Addresses are in
property "priv2", "problem" and "local-store". Because of LPAR
environment, property "priv1" does not exist.


> > @@ -805,7 +816,11 @@
> >         if (ret)
> >                 goto out_unmap;
> >         spin_lock_init(&spu->register_lock);
> > -       spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1));
> > +#ifdef CONFIG_SPU_NEED_SHADOW_INT_MASK
> > +       spin_lock_init(&spu->int_mask_lock);
> > +#endif
> > +       if (!(firmware_has_feature(FW_FEATURE_LPAR)))
> > +               spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1));
> >         spu_mfc_sr1_set(spu, 0x33);
> > ...
> >         u32 node;
> > +       u32 unit_number;
> >         u64 flags;
> >         u64 dar;
> >         u64 dsisr;
> > +#ifdef CONFIG_SPU_NEED_SHADOW_INT_MASK
> > +       spinlock_t int_mask_lock;
> > +       u64 shadow_int_mask_RW[3];
> > +#endif
> >         size_t ls_size;
> >         unsigned int slb_replace;
> >         struct mm_struct *mm;
> 
> Not sure what others think about this, but I'd prefer not to have the
> #ifdef here at all. This part is not a fast path, so we can spend the
> few extra bytes and cycles on keeping it in the kernel always.
> 
> The place where it is used should still have a run-time check for whether
> it's running on BEAT.

When Geoff-san's "abstract spu management routines" patch is accepted,
we have to rewrite this code to meet with that patch.
These data and initializer will be moved to platform-dependent files.

Thank you,
Kou Ishizaki
Toshiba

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-11-21 13:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-15  9:28 [PATCH 2/16] add hypervisor support for SPU Ishizaki Kou
2006-11-15 15:47 ` Arnd Bergmann
2006-11-15 18:26 ` Christoph Hellwig
2006-11-15 23:33   ` Arnd Bergmann
2006-11-17 10:45     ` Ishizaki Kou
2006-11-17 14:01       ` Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2006-11-17 10:33 Ishizaki Kou
2006-11-17 21:28 ` Arnd Bergmann
2006-11-21 13:42   ` Ishizaki Kou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).