spufs: map mmio space as guarded into user space
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/5 spufs: map mmio space as guarded into user space
From: Benjamin Herrenschmidt <[email protected]>
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.
arch/powerpc/platforms/cell/spufs/file.c +5 -5
@@ -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 ;
--
PATCH 2/5 spufs: fix MFC command queue purge
In reply to a message not in the archiveFrom: Benjamin Herrenschmidt <[email protected]>
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.
arch/powerpc/platforms/cell/spufs/switch.c +4 -2
@@ -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 ); }
--
PATCH 3/5 spufs: fix memory hotplug dependency
In reply to a message not in the archiveFrom: Geoff Levand <[email protected]>
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.
arch/powerpc/platforms/cell/Kconfig +1 -1
@@ -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
--
PATCH 4/5 spufs: fix class0 interrupt assignment
In reply to a message not in the archiveThe class zero interrupt handling for spus
was confusing alignment and error interrupts,
so swap them.
arch/powerpc/platforms/cell/spu_base.c +4 -4
@@ -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);
--
PATCH 5/5 spufs: fix spufs_mfc_flush prototype
In reply to a message not in the archiveThe prototype for the flush file operation now has another argument in 2.6.18.
arch/powerpc/platforms/cell/spufs/file.c +2 -2
@@ -1150,7 +1150,7 @@ static unsigned int spufs_mfc_poll(strucreturn 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)
--
Re: [PATCH 5/5] spufs: fix spufs_mfc_flush prototype
Quoted 2 lines · On Friday 23 June 2006 20:57, [email protected] 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 <><