public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] spufs: map mmio space as guarded into user space
       [not found] <20060623185746.037897000@klappe.arndb.de>
@ 2006-06-23 18:57 ` arnd
  2006-06-23 18:57 ` [PATCH 2/5] spufs: fix MFC command queue purge arnd
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: arnd @ 2006-06-23 18:57 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, cbe-oss-dev, linux-kernel, Benjamin Herrenschmidt

[-- Attachment #1: spufs-map-guarded.diff --]
[-- Type: text/plain, Size: 1999 bytes --]

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

This fixes a bug where we don't properly map SPE MMIO space as guarded,
causing various test cases to fail, probably due to write combining and other
niceties caused by the lack of the G bit.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Index: linus-2.6/arch/powerpc/platforms/cell/spufs/file.c
===================================================================
--- linus-2.6.orig/arch/powerpc/platforms/cell/spufs/file.c
+++ linus-2.6/arch/powerpc/platforms/cell/spufs/file.c
@@ -204,7 +204,7 @@ static int spufs_cntl_mmap(struct file *
 
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
-				     | _PAGE_NO_CACHE);
+				     | _PAGE_NO_CACHE | _PAGE_GUARDED);
 
 	vma->vm_ops = &spufs_cntl_mmap_vmops;
 	return 0;
@@ -675,7 +675,7 @@ static int spufs_signal1_mmap(struct fil
 
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
-				     | _PAGE_NO_CACHE);
+				     | _PAGE_NO_CACHE | _PAGE_GUARDED);
 
 	vma->vm_ops = &spufs_signal1_mmap_vmops;
 	return 0;
@@ -762,7 +762,7 @@ static int spufs_signal2_mmap(struct fil
 	/* FIXME: */
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
-				     | _PAGE_NO_CACHE);
+				     | _PAGE_NO_CACHE | _PAGE_GUARDED);
 
 	vma->vm_ops = &spufs_signal2_mmap_vmops;
 	return 0;
@@ -850,7 +850,7 @@ static int spufs_mss_mmap(struct file *f
 
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
-				     | _PAGE_NO_CACHE);
+				     | _PAGE_NO_CACHE | _PAGE_GUARDED);
 
 	vma->vm_ops = &spufs_mss_mmap_vmops;
 	return 0;
@@ -899,7 +899,7 @@ static int spufs_mfc_mmap(struct file *f
 
 	vma->vm_flags |= VM_RESERVED;
 	vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
-				     | _PAGE_NO_CACHE);
+				     | _PAGE_NO_CACHE | _PAGE_GUARDED);
 
 	vma->vm_ops = &spufs_mfc_mmap_vmops;
 	return 0;

--


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

* [PATCH 2/5] spufs: fix MFC command queue purge
       [not found] <20060623185746.037897000@klappe.arndb.de>
  2006-06-23 18:57 ` [PATCH 1/5] spufs: map mmio space as guarded into user space arnd
@ 2006-06-23 18:57 ` arnd
  2006-06-23 18:57 ` [PATCH 3/5] spufs: fix memory hotplug dependency arnd
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: arnd @ 2006-06-23 18:57 UTC (permalink / raw)
  To: paulus
  Cc: linuxppc-dev, cbe-oss-dev, linux-kernel, Benjamin Herrenschmidt,
	Arnd Bergmann

[-- Attachment #1: spufs-dma-status.diff --]
[-- Type: text/plain, Size: 1787 bytes --]

From: Benjamin Herrenschmidt <benh@kernel.crashing.org>

In the context save/restore code, the SPU MFC command queue purge
code has a bug:

static inline void wait_purge_complete(struct spu_state *csa, struct
				       spu *spu)
{
    struct spu_priv2 __iomem *priv2 = spu->priv2;

    /* Save, Step 28:
     *     Poll MFC_CNTL[Ps] until value '11' is
     *     read
     *      (purge complete).
     */
    POLL_WHILE_FALSE(in_be64(&priv2->mfc_control_RW)
		     & MFC_CNTL_PURGE_DMA_COMPLETE);
}

This will exit as soon as _one_ of the 2 bits that compose
MFC_CNTL_PURGE_DMA_COMPLETE is set, and one of them happens to be
"purge in progress"...  which means that we'll happily continue
restoring the MFC while it's being purged at the same time.

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/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
@@ -464,7 +464,8 @@ static inline void wait_purge_complete(s
 	 *     Poll MFC_CNTL[Ps] until value '11' is read
 	 *     (purge complete).
 	 */
-	POLL_WHILE_FALSE(in_be64(&priv2->mfc_control_RW) &
+	POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) &
+			 MFC_CNTL_PURGE_DMA_STATUS_MASK) ==
 			 MFC_CNTL_PURGE_DMA_COMPLETE);
 }
 
@@ -1028,7 +1029,8 @@ static inline void wait_suspend_mfc_comp
 	 * Restore, Step 47.
 	 *     Poll MFC_CNTL[Ss] until 11 is returned.
 	 */
-	POLL_WHILE_FALSE(in_be64(&priv2->mfc_control_RW) &
+	POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) &
+			 MFC_CNTL_SUSPEND_DMA_STATUS_MASK) ==
 			 MFC_CNTL_SUSPEND_COMPLETE);
 }
 

--


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

* [PATCH 3/5] spufs: fix memory hotplug dependency
       [not found] <20060623185746.037897000@klappe.arndb.de>
  2006-06-23 18:57 ` [PATCH 1/5] spufs: map mmio space as guarded into user space arnd
  2006-06-23 18:57 ` [PATCH 2/5] spufs: fix MFC command queue purge arnd
@ 2006-06-23 18:57 ` arnd
  2006-06-23 18:57 ` [PATCH 4/5] spufs: fix class0 interrupt assignment arnd
  2006-06-23 18:57 ` [PATCH 5/5] spufs: fix spufs_mfc_flush prototype arnd
  4 siblings, 0 replies; 6+ messages in thread
From: arnd @ 2006-06-23 18:57 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, cbe-oss-dev, linux-kernel, Geoff Levand,
	Arnd Bergmann

[-- Attachment #1: spufs-fix-hotplug.diff --]
[-- Type: text/plain, Size: 940 bytes --]

From: Geoff Levand <geoffrey.levand@am.sony.com>

spufs_base.c calls __add_pages, which depends on CONFIG_MEMORY_HOTPLUG.

Moved the selection of CONFIG_MEMORY_HOTPLUG from CONFIG_SPUFS_MMAP
to CONFIG_SPU_FS.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>

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
@@ -6,6 +6,7 @@ config SPU_FS
 	default m
 	depends on PPC_CELL
 	select SPU_BASE
+	select MEMORY_HOTPLUG
 	help
 	  The SPU file system is used to access Synergistic Processing
 	  Units on machines implementing the Broadband Processor
@@ -18,7 +19,6 @@ config SPU_BASE
 config SPUFS_MMAP
 	bool
 	depends on SPU_FS && SPARSEMEM
-	select MEMORY_HOTPLUG
 	default y
 
 config CBE_RAS

--


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

* [PATCH 4/5] spufs: fix class0 interrupt assignment
       [not found] <20060623185746.037897000@klappe.arndb.de>
                   ` (2 preceding siblings ...)
  2006-06-23 18:57 ` [PATCH 3/5] spufs: fix memory hotplug dependency arnd
@ 2006-06-23 18:57 ` arnd
  2006-06-23 18:57 ` [PATCH 5/5] spufs: fix spufs_mfc_flush prototype arnd
  4 siblings, 0 replies; 6+ messages in thread
From: arnd @ 2006-06-23 18:57 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, cbe-oss-dev, linux-kernel, Arnd Bergmann

[-- Attachment #1: spufs-correct-dma-exceptions.diff --]
[-- Type: text/plain, Size: 809 bytes --]

The class zero interrupt handling for spus
was confusing alignment and error interrupts,
so swap them.

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
@@ -168,12 +168,12 @@ spu_irq_class_0_bottom(struct spu *spu)
 
 	stat &= mask;
 
-	if (stat & 1) /* invalid MFC DMA */
-		__spu_trap_invalid_dma(spu);
-
-	if (stat & 2) /* invalid DMA alignment */
+	if (stat & 1) /* invalid DMA alignment */
 		__spu_trap_dma_align(spu);
 
+	if (stat & 2) /* invalid MFC DMA */
+		__spu_trap_invalid_dma(spu);
+
 	if (stat & 4) /* error on SPU */
 		__spu_trap_error(spu);
 

--


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

* [PATCH 5/5] spufs: fix spufs_mfc_flush prototype
       [not found] <20060623185746.037897000@klappe.arndb.de>
                   ` (3 preceding siblings ...)
  2006-06-23 18:57 ` [PATCH 4/5] spufs: fix class0 interrupt assignment arnd
@ 2006-06-23 18:57 ` arnd
  2006-06-25 23:48   ` Arnd Bergmann
  4 siblings, 1 reply; 6+ messages in thread
From: arnd @ 2006-06-23 18:57 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, cbe-oss-dev, linux-kernel, Arnd Bergmann

[-- Attachment #1: spufs-flush.diff --]
[-- Type: text/plain, Size: 893 bytes --]

The prototype for the flush file operation now has another
argument in 2.6.18.

Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Index: linus-2.6/arch/powerpc/platforms/cell/spufs/file.c
===================================================================
--- linus-2.6.orig/arch/powerpc/platforms/cell/spufs/file.c
+++ linus-2.6/arch/powerpc/platforms/cell/spufs/file.c
@@ -1150,7 +1150,7 @@ static unsigned int spufs_mfc_poll(struc
 	return mask;
 }
 
-static int spufs_mfc_flush(struct file *file)
+static int spufs_mfc_flush(struct file *file, fl_owner_t id)
 {
 	struct spu_context *ctx = file->private_data;
 	int ret;
@@ -1176,7 +1176,7 @@ out:
 static int spufs_mfc_fsync(struct file *file, struct dentry *dentry,
 			   int datasync)
 {
-	return spufs_mfc_flush(file);
+	return spufs_mfc_flush(file, 0);
 }
 
 static int spufs_mfc_fasync(int fd, struct file *file, int on)

--


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

* Re: [PATCH 5/5] spufs: fix spufs_mfc_flush prototype
  2006-06-23 18:57 ` [PATCH 5/5] spufs: fix spufs_mfc_flush prototype arnd
@ 2006-06-25 23:48   ` Arnd Bergmann
  0 siblings, 0 replies; 6+ messages in thread
From: Arnd Bergmann @ 2006-06-25 23:48 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: paulus, cbe-oss-dev, linux-kernel

On Friday 23 June 2006 20:57, arnd@arndb.de wrote:
> The prototype for the flush file operation now has another
> argument in 2.6.18.

Al Viro already submitted this one, please ignore it.

	Arnd <><

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

end of thread, other threads:[~2006-06-25 23:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20060623185746.037897000@klappe.arndb.de>
2006-06-23 18:57 ` [PATCH 1/5] spufs: map mmio space as guarded into user space arnd
2006-06-23 18:57 ` [PATCH 2/5] spufs: fix MFC command queue purge arnd
2006-06-23 18:57 ` [PATCH 3/5] spufs: fix memory hotplug dependency arnd
2006-06-23 18:57 ` [PATCH 4/5] spufs: fix class0 interrupt assignment arnd
2006-06-23 18:57 ` [PATCH 5/5] spufs: fix spufs_mfc_flush prototype arnd
2006-06-25 23:48   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox