1. 05 10月, 2006 1 次提交
    • A
      [POWERPC] spufs: implement error event delivery to user space · 9add11da
      Arnd Bergmann 提交于
      This tries to fix spufs so we have an interface closer to what is
      specified in the man page for events returned in the third argument of
      spu_run.
      
      Fortunately, libspe has never been using the returned contents of that
      register, as they were the same as the return code of spu_run (duh!).
      
      Unlike the specification that we never implemented correctly, we now
      require a SPU_CREATE_EVENTS_ENABLED flag passed to spu_create, in
      order to get the new behavior. When this flag is not passed, spu_run
      will simply ignore the third argument now.
      Signed-off-by: NArnd Bergmann <arnd.bergmann@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      9add11da
  2. 27 3月, 2006 2 次提交
    • M
      [PATCH] spufs: enable SPE problem state MMIO access. · 6df10a82
      Mark Nutter 提交于
      This patch is layered on top of CONFIG_SPARSEMEM
      and is patterned after direct mapping of LS.
      
      This patch allows mmap() of the following regions:
      "mfc", which represents the area from [0x3000 - 0x3fff];
      "cntl", which represents the area from [0x4000 - 0x4fff];
      "signal1" which begins at offset 0x14000; "signal2" which
      begins at offset 0x1c000.
      
      The signal1 & signal2 files may be mmap()'d by regular user
      processes.  The cntl and mfc file, on the other hand, may
      only be accessed if the owning process has CAP_SYS_RAWIO,
      because they have the potential to confuse the kernel
      with regard to parallel access to the same files with
      regular file operations: the kernel always holds a spinlock
      when accessing registers in these areas to serialize them,
      which can not be guaranteed with user mmaps,
      Signed-off-by: NArnd Bergmann <arnd.bergmann@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      6df10a82
    • A
      [PATCH] spufs: implement mfc access for PPE-side DMA · a33a7d73
      Arnd Bergmann 提交于
      This patch adds a new file called 'mfc' to each spufs directory.
      The file accepts DMA commands that are a subset of what would
      be legal DMA commands for problem state register access. Upon
      reading the file, a bitmask is returned with the completed
      tag groups set.
      
      The file is meant to be used from an abstraction in libspe
      that is added by a different patch.
      
      From the kernel perspective, this means a process can now
      offload a memory copy from or into an SPE local store
      without having to run code on the SPE itself.
      
      The transfer will only be performed while the SPE is owned
      by one thread that is waiting in the spu_run system call
      and the data will be transferred into that thread's
      address space, independent of which thread started the
      transfer.
      Signed-off-by: NArnd Bergmann <arnd.bergmann@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      a33a7d73
  3. 09 1月, 2006 11 次提交
    • A
      [PATCH] spufs: fix sparse warnings · 6ff730c3
      Arnd Bergmann 提交于
      One local variable is missing an __iomem modifier,
      in another place, we pass a completely unused argument
      with a missing __user modifier.
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      6ff730c3
    • A
      [PATCH] spufs: move spu_run call to its own file · ce8ab854
      Arnd Bergmann 提交于
      The logic for sys_spu_run keeps growing and it does
      not really belong into file.c any more since we
      moved away from using regular file operations to our
      own syscall.
      
      No functional change in here.
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      ce8ab854
    • A
      [PATCH] spufs: clean up use of bitops · 8837d921
      Arnd Bergmann 提交于
      checking bits manually might not be synchonized with
      the use of set_bit/clear_bit. Make sure we always use
      the correct bitops by removing the unnecessary
      identifiers.
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      8837d921
    • A
      [PATCH] spufs: serialize sys_spu_run per spu · 5ef8224a
      Arnd Bergmann 提交于
      During an earlier cleanup, we lost the serialization
      of multiple spu_run calls performed on the same
      spu_context. In order to get this back, introduce a
      mutex in the spu_context that is held inside of spu_run.
      
      Noticed by Al Viro.
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      5ef8224a
    • A
      [PATCH] spufs: check for proper file pointer in sys_spu_run · e80358ad
      Arnd Bergmann 提交于
      Only checking for SPUFS_MAGIC is not reliable, because
      it might not be unique in theory. Worse than that,
      we accidentally allow spu_run to be performed on
      any file in spufs, not just those returned from
      spu_create as intended.
      
      Noticed by Al Viro.
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      e80358ad
    • A
      [PATCH] spufs: fix mailbox polling · 3a843d7c
      Arnd Bergmann 提交于
      Handling mailbox interrupts was broken in multiple respects,
      the combination of which was hiding the bugs most of the time.
      
      - The ibox interrupt mask was open initially even though there
        are no waiters on a newly created SPU.
      
      - Acknowledging the mailbox interrupt did not work because
        it is level triggered and the mailbox data is never retrieved
        from inside the interrupt handler.
      
      - The interrupt handler delivered interrupts with a disabled
        mask if another interrupt is triggered for the same class
        but a different mask.
      
      - The poll function did not enable the interrupt if it had not
        been enabled, so we might run into the poll timeout if none of
        the other bugs saved us and no signal was delivered.
      
      We probably still have a similar problem with blocking
      read/write on mailbox files, but that will result in extra
      wakeup in the worst case, not in incorrect behaviour.
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      3a843d7c
    • A
      [PATCH] spufs: Improved SPU preemptability [part 2]. · 2a911f0b
      Arnd Bergmann 提交于
      This patch reduces lock complexity of SPU scheduler, particularly
      for involuntary preemptive switches.  As a result the new code
      does a better job of mapping the highest priority tasks to SPUs.
      
      Lock complexity is reduced by using the system default workqueue
      to perform involuntary saves.  In this way we avoid nasty lock
      ordering problems that the previous code had.  A "minimum timeslice"
      for SPU contexts is also introduced.  The intent here is to avoid
      thrashing.
      
      While the new scheduler does a better job at prioritization it
      still does nothing for fairness.
      
      From: Mark Nutter <mnutter@us.ibm.com>
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      2a911f0b
    • A
      [PATCH] spufs: Improved SPU preemptability. · 5110459f
      Arnd Bergmann 提交于
      This patch makes it easier to preempt an SPU context by
      having the scheduler hold ctx->state_sema for much shorter
      periods of time.
      
      As part of this restructuring, the control logic for the "run"
      operation is moved from arch/ppc64/kernel/spu_base.c to
      fs/spufs/file.c.  Of course the base retains "bottom half"
      handlers for class{0,1} irqs.  The new run loop will re-acquire
      an SPU if preempted.
      
      From: Mark Nutter <mnutter@us.ibm.com>
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      5110459f
    • A
      [PATCH] spufs: cooperative scheduler support · 8b3d6663
      Arnd Bergmann 提交于
      This adds a scheduler for SPUs to make it possible to use
      more logical SPUs than physical ones are present in the
      system.
      
      Currently, there is no support for preempting a running
      SPU thread, they have to leave the SPU by either triggering
      an event on the SPU that causes it to return to the
      owning thread or by sending a signal to it.
      
      This patch also adds operations that enable accessing an SPU
      in either runnable or saved state. We use an RW semaphore
      to protect the state of the SPU from changing underneath
      us, while we are holding it readable. In order to change
      the state, it is acquired writeable and a context save
      or restore is executed before downgrading the semaphore
      to read-only.
      
      From: Mark Nutter <mnutter@us.ibm.com>,
            Uli Weigand <Ulrich.Weigand@de.ibm.com>
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      8b3d6663
    • M
      [PATCH] spufs: switchable spu contexts · 5473af04
      Mark Nutter 提交于
      Add some infrastructure for saving and restoring the context of an
      SPE. This patch creates a new structure that can hold the whole
      state of a physical SPE in memory. It also contains code that
      avoids races during the context switch and the binary code that
      is loaded to the SPU in order to access its registers.
      
      The actual PPE- and SPE-side context switch code are two separate
      patches.
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      5473af04
    • A
      [PATCH] spufs: The SPU file system, base · 67207b96
      Arnd Bergmann 提交于
      This is the current version of the spu file system, used
      for driving SPEs on the Cell Broadband Engine.
      
      This release is almost identical to the version for the
      2.6.14 kernel posted earlier, which is available as part
      of the Cell BE Linux distribution from
      http://www.bsc.es/projects/deepcomputing/linuxoncell/.
      
      The first patch provides all the interfaces for running
      spu application, but does not have any support for
      debugging SPU tasks or for scheduling. Both these
      functionalities are added in the subsequent patches.
      
      See Documentation/filesystems/spufs.txt on how to use
      spufs.
      Signed-off-by: NArnd Bergmann <arndb@de.ibm.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      67207b96