1. 09 5月, 2008 1 次提交
  2. 29 4月, 2008 1 次提交
    • P
      [POWERPC] Add fast little-endian switch system call · 745a14cc
      Paul Mackerras 提交于
      This adds a system call on 64-bit platforms for switching between
      little-endian and big-endian modes that is much faster than doing a
      prctl call.  This system call is handled as a special case right at
      the start of the system call entry code, and because it is a special
      case, it uses a system call number which is out of the range of
      normal system calls, namely 0x1ebe.
      
      Measurements with lmbench on a 4.2GHz POWER6 showed no measurable
      change in the speed of normal system calls with this patch.
      
      Switching endianness with this new system call takes around 60ns on a
      4.2GHz POWER6, compared with around 300ns to switch endian mode with a
      prctl.  This can provide a significant performance advantage for
      emulators for little-endian architectures that want to switch between
      big-endian and little-endian mode frequently, e.g. because they are
      generating instructions sequences on the fly and they want to run
      those sequences in little-endian mode.
      
      The other thing about this system call is that it doesn't clobber as
      many registers as a normal system call.  It only clobbers r12.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      745a14cc
  3. 18 4月, 2008 1 次提交
  4. 17 4月, 2008 1 次提交
  5. 14 4月, 2008 1 次提交
    • P
      [POWERPC] Fix handling of unrecoverable SLB miss interrupts · 320787c7
      Paul Mackerras 提交于
      If an SLB miss interrupt happens while the RI bit of MSR is zero, we
      can't just return, because RI being zero indicates that SRR0/SRR1
      potentially had live values in them, and the process of taking an
      interrupt overwrites them.
      
      This should never happen, but if it does, we try to print a nice oops
      message.  That doesn't work, however, because the code at unrecov_slb
      assumes that the MMU has been turned on, but we call it with the MMU
      off (and have done so since the SLB miss handler was rewritten to run
      without turning the MMU on) -- except on iSeries, where everything runs
      with the MMU on.
      
      This fixes it by adding the necessary code to turn the MMU on if
      necessary.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      320787c7
  6. 03 4月, 2008 1 次提交
    • B
      [POWERPC] Fix iSeries hard irq enabling regression · ff3da2e0
      Benjamin Herrenschmidt 提交于
      A subtle bug sneaked into iSeries recently.  On this platform, we must
      not normally clear MSR:EE (the hardware external interrupt enable)
      except for short periods of time.  Taking an interrupt while
      soft-disabled doesn't cause us to clear it for example.
      
      The iSeries kernel expects to mostly run with MSR:EE enabled at all
      times except in a few exception entry/exit code paths.  Thus
      local_irq_enable() doesn't check if it needs to hard-enable as it
      expects this to be unnecessary on iSeries.
      
      However, hard_irq_disable() _does_ cause MSR:EE to be cleared,
      including on iSeries.  A call to it was recently added to the
      context switch code, thus causing interrupts to become disabled
      for a long periods of time, causing the iSeries watchdog to kick
      in under some circumstances and other nasty things.
      
      This patch fixes it by making local_irq_enable() properly re-enable
      MSR:EE on iSeries.  It basically removes a return statement here
      to make iSeries use the same code path as everybody else.  That does
      mean that we might occasionally get spurious decrementer interrupts
      but I don't think that matters.
      
      Another option would have been to make hard_irq_disable() a nop
      on iSeries but I didn't like it much, in case we have good reasons
      to hard-disable.
      
      Part of the patch is fixes to make sure the hard_enabled PACA field
      is properly set on iSeries as it used not to be before, since it
      was mostly unused.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      ff3da2e0
  7. 24 1月, 2008 1 次提交
    • P
      [POWERPC] Provide a way to protect 4k subpages when using 64k pages · fa28237c
      Paul Mackerras 提交于
      Using 64k pages on 64-bit PowerPC systems makes life difficult for
      emulators that are trying to emulate an ISA, such as x86, which use a
      smaller page size, since the emulator can no longer use the MMU and
      the normal system calls for controlling page protections.  Of course,
      the emulator can emulate the MMU by checking and possibly remapping
      the address for each memory access in software, but that is pretty
      slow.
      
      This provides a facility for such programs to control the access
      permissions on individual 4k sub-pages of 64k pages.  The idea is
      that the emulator supplies an array of protection masks to apply to a
      specified range of virtual addresses.  These masks are applied at the
      level where hardware PTEs are inserted into the hardware page table
      based on the Linux PTEs, so the Linux PTEs are not affected.  Note
      that this new mechanism does not allow any access that would otherwise
      be prohibited; it can only prohibit accesses that would otherwise be
      allowed.  This new facility is only available on 64-bit PowerPC and
      only when the kernel is configured for 64k pages.
      
      The masks are supplied using a new subpage_prot system call, which
      takes a starting virtual address and length, and a pointer to an array
      of protection masks in memory.  The array has a 32-bit word per 64k
      page to be protected; each 32-bit word consists of 16 2-bit fields,
      for which 0 allows any access (that is otherwise allowed), 1 prevents
      write accesses, and 2 or 3 prevent any access.
      
      Implicit in this is that the regions of the address space that are
      protected are switched to use 4k hardware pages rather than 64k
      hardware pages (on machines with hardware 64k page support).  In fact
      the whole process is switched to use 4k hardware pages when the
      subpage_prot system call is used, but this could be improved in future
      to switch only the affected segments.
      
      The subpage protection bits are stored in a 3 level tree akin to the
      page table tree.  The top level of this tree is stored in a structure
      that is appended to the top level of the page table tree, i.e., the
      pgd array.  Since it will often only be 32-bit addresses (below 4GB)
      that are protected, the pointers to the first four bottom level pages
      are also stored in this structure (each bottom level page contains the
      protection bits for 1GB of address space), so the protection bits for
      addresses below 4GB can be accessed with one fewer loads than those
      for higher addresses.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      fa28237c
  8. 08 11月, 2007 1 次提交
  9. 12 10月, 2007 1 次提交
    • P
      [POWERPC] Use 1TB segments · 1189be65
      Paul Mackerras 提交于
      This makes the kernel use 1TB segments for all kernel mappings and for
      user addresses of 1TB and above, on machines which support them
      (currently POWER5+, POWER6 and PA6T).
      
      We detect that the machine supports 1TB segments by looking at the
      ibm,processor-segment-sizes property in the device tree.
      
      We don't currently use 1TB segments for user addresses < 1T, since
      that would effectively prevent 32-bit processes from using huge pages
      unless we also had a way to revert to using 256MB segments.  That
      would be possible but would involve extra complications (such as
      keeping track of which segment size was used when HPTEs were inserted)
      and is not addressed here.
      
      Parts of this patch were originally written by Ben Herrenschmidt.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      1189be65
  10. 19 9月, 2007 3 次提交
  11. 13 9月, 2007 1 次提交
  12. 22 8月, 2007 4 次提交
  13. 10 8月, 2007 1 次提交
  14. 26 7月, 2007 1 次提交
  15. 28 6月, 2007 1 次提交
  16. 24 4月, 2007 1 次提交
  17. 13 4月, 2007 1 次提交
  18. 09 3月, 2007 1 次提交
  19. 07 2月, 2007 1 次提交
    • L
      [POWERPC] Fix performance monitor exception · 449d846d
      Livio Soares 提交于
      To the issue: some point during 2.6.20 development, Paul Mackerras
      introduced the "lazy IRQ  disabling" patch (very cool work,  BTW).
      In that patch, the performance monitor unit exception was marked as
      "maskable", in the sense that if interrupts were soft-disabled, that
      exception could be ignored.  This broke my PowerPC profiling code.
      The symptom that I see is that a varying number of interrupts
      (from 0 to $n$, typically closer to 0) get delivered, when, in
      reality, it should always be very close to $n$.
      
      The issue stems from the way masking is being done.   Masking in
      this fashion seems to  work well with the decrementer and external
      interrupts, because they are raised again until "really"  handled.
      For the PMU, however, this does not apply (at least on my Xserver
      machine with a 970FX processor).  If the PMU exception is not handled,
      it will _not_ be re-raised (at least on my machine).  The documentation
      states that the PMXE bit in MMCR0 is set to 0 when the PMU exception
      is raised.  However, software must re-set the bit to re-enable PMU
      exceptions.  If the exception is ignored (as currently) not only is
      that interrupt lost, but because software does not re-set PMXE, the
      PMU registers are "frozen" forever.
      
      [This patch means that performance monitor exceptions are taken and
      handled even if irqs are off, as long as some other interrupt hasn't
      come along and caused interrupts to be hard-disabled.  In this sense
      the PMU exception becomes like an NMI.  The oprofile code for most
      powerpc processors does nothing that is unsafe in an NMI context, but
      the Cell oprofile code does a spin_lock_irqsave.  However, that turns
      out to be OK because Cell doesn't actually use the performance
      monitor exception; performance monitor interrupts come in as a
      regular interrupt on Cell, so will be disabled when irqs are off.
       -- paulus.]
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      449d846d
  20. 04 12月, 2006 1 次提交
  21. 13 11月, 2006 1 次提交
  22. 02 11月, 2006 1 次提交
  23. 26 10月, 2006 1 次提交
  24. 25 10月, 2006 1 次提交
  25. 18 10月, 2006 1 次提交
    • P
      [POWERPC] Make sure interrupt enable gets restored properly · b0a779de
      Paul Mackerras 提交于
      The lazy IRQ disable patch missed a couple of places where the
      interrupt enable flags need to be restored correctly.  First, we
      weren't restoring the paca->hard_enabled flag on interrupt exit.
      Instead of saving it on entry, we compute it from the MSR_EE bit
      in the MSR we are restoring at exit.  Secondly, the MMU hash miss
      code was clearing both paca->soft_enabled and paca->hard_enabled
      but not restoring them in the case where hash_page was able to
      resolve the miss from the Linux page tables.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      b0a779de
  26. 16 10月, 2006 1 次提交
    • P
      [POWERPC] Lazy interrupt disabling for 64-bit machines · d04c56f7
      Paul Mackerras 提交于
      This implements a lazy strategy for disabling interrupts.  This means
      that local_irq_disable() et al. just clear the 'interrupts are
      enabled' flag in the paca.  If an interrupt comes along, the interrupt
      entry code notices that interrupts are supposed to be disabled, and
      clears the EE bit in SRR1, clears the 'interrupts are hard-enabled'
      flag in the paca, and returns.  This means that interrupts only
      actually get disabled in the processor when an interrupt comes along.
      
      When interrupts are enabled by local_irq_enable() et al., the code
      sets the interrupts-enabled flag in the paca, and then checks whether
      interrupts got hard-disabled.  If so, it also sets the EE bit in the
      MSR to hard-enable the interrupts.
      
      This has the potential to improve performance, and also makes it
      easier to make a kernel that can boot on iSeries and on other 64-bit
      machines, since this lazy-disable strategy is very similar to the
      soft-disable strategy that iSeries already uses.
      
      This version renames paca->proc_enabled to paca->soft_enabled, and
      changes a couple of soft-disables in the kexec code to hard-disables,
      which should fix the crash that Michael Ellerman saw.  This doesn't
      yet use a reserved CR field for the soft_enabled and hard_enabled
      flags.  This applies on top of Stephen Rothwell's patches to make it
      possible to build a combined iSeries/other kernel.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      d04c56f7
  27. 03 10月, 2006 1 次提交
  28. 13 9月, 2006 1 次提交
  29. 25 8月, 2006 1 次提交
    • O
      [POWERPC] Cleanup CPU inits · f39b7a55
      Olof Johansson 提交于
      Cleanup CPU inits a bit more, Geoff Levand already did some earlier.
      
      * Move CPU state save to cpu_setup, since cpu_setup is only ever done
        on cpu 0 on 64-bit and save is never done more than once.
      * Rename __restore_cpu_setup to __restore_cpu_ppc970 and add
        function pointers to the cputable to use instead. Powermac always
        has 970 so no need to check there.
      * Rename __970_cpu_preinit to __cpu_preinit_ppc970 and check PVR before
        calling it instead of in it, it's too early to use cputable.
      * Rename pSeries_secondary_smp_init to generic_secondary_smp_init since
        everyone but powermac and iSeries use it.
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      f39b7a55
  30. 29 7月, 2006 1 次提交
    • O
      [POWERPC] force 64bit mode in fwnmi handlers to workaround firmware bugs · 9fc0a92c
      Olaf Hering 提交于
      The firmware of POWER4 and JS20 systems does not switch the cpu to 64bit
      mode when the registered system_reset and machine_check handlers get called.
      If a 32bit process runs on that cpu at the time of the event, the cpu
      remains in 32bit mode. xmon and kdump can not deal with it, the result is
      an error like 'Bad kernel stack pointer fff2aad0 at 3200'.
      xmon just loses some register info, but booting the kdump kernel usually fails.
      
      Both handlers are not hot paths.  Duplicate the EXCEPTION_PROLOG_PSERIES macro
      and add two instructions to switch to 64bit:
      
       li     r11,5;
       rldimi r10,r11,61,0;
      Signed-off-by: NOlaf Hering <olh@suse.de>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      9fc0a92c
  31. 01 7月, 2006 1 次提交
  32. 29 6月, 2006 1 次提交
    • M
      [POWERPC] Make sure smp_processor_id works very early in boot · 33dbcf72
      Michael Ellerman 提交于
      There's a small period early in boot where we don't know which cpu we're
      running on. That's ok, except that it means we have no paca, or more
      correctly that our paca pointer points somewhere random.
      
      So that we can safely call things like smp_processor_id(), we need a paca,
      so just assume we're on cpu 0. No code should _write_ to the paca before
      we've set the correct one up.
      
      We setup the proper paca after we've scanned the flat device tree in
      early_setup(), so there's no need to do it again in start_here_common.
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      33dbcf72
  33. 28 6月, 2006 3 次提交