1. 23 4月, 2014 2 次提交
  2. 15 1月, 2014 1 次提交
  3. 30 12月, 2013 2 次提交
  4. 11 10月, 2013 1 次提交
  5. 14 8月, 2013 1 次提交
  6. 26 4月, 2013 1 次提交
    • M
      powerpc: Add isync to copy_and_flush · 29ce3c50
      Michael Neuling 提交于
      In __after_prom_start we copy the kernel down to zero in two calls to
      copy_and_flush.  After the first call (copy from 0 to copy_to_here:)
      we jump to the newly copied code soon after.
      
      Unfortunately there's no isync between the copy of this code and the
      jump to it.  Hence it's possible that stale instructions could still be
      in the icache or pipeline before we branch to it.
      
      We've seen this on real machines and it's results in no console output
      after:
        calling quiesce...
        returning from prom_init
      
      The below adds an isync to ensure that the copy and flushing has
      completed before any branching to the new instructions occurs.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      29ce3c50
  7. 10 1月, 2013 2 次提交
    • J
      powerpc/kexec: Add kexec "hold" support for Book3e processors · 96f013fe
      Jimi Xenidis 提交于
      Motivation:
      IBM Blue Gene/Q comes with some very strange firmware that I'm trying to get out
      of using in the kernel.  So instead I spin all the threads in the boot wrapper
      (using the firmware) and have them enter the kexec stub, pre-translated at the
      virtual "linear" address, never touching firmware again.
      
      This works strategy works wonderfully, but I need the following patch in the
      kexec stub. I believe it should not effect Book3S and Book3E does not appear
      to be here yet so I'd love to get any criticisms up front.
      
      This patch adds two items:
      
      1) Book3e requires that GPR4 survive the "hold" process, so we make
         sure that happens.
      2) Book3e has no real mode, and the hold code exploits this.  Since
         these processors ares always translated, we arrange for the kexeced
         threads to enter the hold code using the normal kernel linear mapping.
      Signed-off-by: NJimi Xenidis <jimix@pobox.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      96f013fe
    • A
      powerpc: Build kernel with -mcmodel=medium · 1fbe9cf2
      Anton Blanchard 提交于
      Finally remove the two level TOC and build with -mcmodel=medium.
      
      Unfortunately we can't build modules with -mcmodel=medium due to
      the tricks the kernel module loader plays with percpu data:
      
      # -mcmodel=medium breaks modules because it uses 32bit offsets from
      # the TOC pointer to create pointers where possible. Pointers into the
      # percpu data area are created by this method.
      #
      # The kernel module loader relocates the percpu data section from the
      # original location (starting with 0xd...) to somewhere in the base
      # kernel percpu data space (starting with 0xc...). We need a full
      # 64bit relocation for this to work, hence -mcmodel=large.
      
      On older kernels we fall back to the two level TOC (-mminimal-toc)
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      1fbe9cf2
  8. 15 11月, 2012 3 次提交
    • M
      powerpc: Add relocation on exception vector handlers · c1fb6816
      Michael Neuling 提交于
      POWER8/v2.07 allows exceptions to be taken with the MMU still on.
      
      A new set of exception vectors is added at 0xc000_0000_0000_4xxx.  When the HW
      takes us here, MSR IR/DR will be set already and we no longer need a costly
      RFID to turn the MMU back on again.
      
      The original 0x0 based exception vectors remain for when the HW can't leave the
      MMU on.  Examples of this are when we can't trust the current MMU mappings,
      like when we are changing from guest to hypervisor (HV 0 -> 1) or when the MMU
      was off already.  In these cases the HW will take us to the original 0x0 based
      exception vectors with the MMU off as before.
      
      This uses the new macros added previously too implement these new execption
      vectors at 0xc000_0000_0000_4xxx.  We exit these exception vectors using
      mflr/blr (rather than mtspr SSR0/RFID), since we don't need the costly MMU
      switch anymore.
      
      This moves the __end_interrupts marker down past these new 0x4000 vectors since
      they will need to be copied down to 0x0 when the kernel is not at 0x0.
      Signed-off-by: NMatt Evans <matt@ozlabs.org>
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      c1fb6816
    • A
      powerpc: Fix CONFIG_RELOCATABLE=y CONFIG_CRASH_DUMP=n build · 11ee7e99
      Anton Blanchard 提交于
      If we build a kernel with CONFIG_RELOCATABLE=y CONFIG_CRASH_DUMP=n,
      the kernel fails when we run at a non zero offset. It turns out
      we were incorrectly wrapping some of the relocatable kernel code
      with CONFIG_CRASH_DUMP.
      Signed-off-by: NAnton Blanchard <anton@samba.org>
      Cc: <stable@kernel.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      11ee7e99
    • B
      powerpc/powernv: Fix OPAL debug entry · ab7f961a
      Benjamin Herrenschmidt 提交于
      OPAL provides the firmware base/entry in registers at boot time
      for debugging purposes. We had a bug in the code trying to stash
      these into the appropriate kernel globals (a line of code was
      probably dropped by accident back when this was merged)
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ab7f961a
  9. 09 3月, 2012 2 次提交
    • B
      powerpc: Rework lazy-interrupt handling · 7230c564
      Benjamin Herrenschmidt 提交于
      The current implementation of lazy interrupts handling has some
      issues that this tries to address.
      
      We don't do the various workarounds we need to do when re-enabling
      interrupts in some cases such as when returning from an interrupt
      and thus we may still lose or get delayed decrementer or doorbell
      interrupts.
      
      The current scheme also makes it much harder to handle the external
      "edge" interrupts provided by some BookE processors when using the
      EPR facility (External Proxy) and the Freescale Hypervisor.
      
      Additionally, we tend to keep interrupts hard disabled in a number
      of cases, such as decrementer interrupts, external interrupts, or
      when a masked decrementer interrupt is pending. This is sub-optimal.
      
      This is an attempt at fixing it all in one go by reworking the way
      we do the lazy interrupt disabling from the ground up.
      
      The base idea is to replace the "hard_enabled" field with a
      "irq_happened" field in which we store a bit mask of what interrupt
      occurred while soft-disabled.
      
      When re-enabling, either via arch_local_irq_restore() or when returning
      from an interrupt, we can now decide what to do by testing bits in that
      field.
      
      We then implement replaying of the missed interrupts either by
      re-using the existing exception frame (in exception exit case) or via
      the creation of a new one from an assembly trampoline (in the
      arch_local_irq_enable case).
      
      This removes the need to play with the decrementer to try to create
      fake interrupts, among others.
      
      In addition, this adds a few refinements:
      
       - We no longer  hard disable decrementer interrupts that occur
      while soft-disabled. We now simply bump the decrementer back to max
      (on BookS) or leave it stopped (on BookE) and continue with hard interrupts
      enabled, which means that we'll potentially get better sample quality from
      performance monitor interrupts.
      
       - Timer, decrementer and doorbell interrupts now hard-enable
      shortly after removing the source of the interrupt, which means
      they no longer run entirely hard disabled. Again, this will improve
      perf sample quality.
      
       - On Book3E 64-bit, we now make the performance monitor interrupt
      act as an NMI like Book3S (the necessary C code for that to work
      appear to already be present in the FSL perf code, notably calling
      nmi_enter instead of irq_enter). (This also fixes a bug where BookE
      perfmon interrupts could clobber r14 ... oops)
      
       - We could make "masked" decrementer interrupts act as NMIs when doing
      timer-based perf sampling to improve the sample quality.
      
      Signed-off-by-yet: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      ---
      
      v2:
      
      - Add hard-enable to decrementer, timer and doorbells
      - Fix CR clobber in masked irq handling on BookE
      - Make embedded perf interrupt act as an NMI
      - Add a PACA_HAPPENED_EE_EDGE for use by FSL if they want
        to retrigger an interrupt without preventing hard-enable
      
      v3:
      
       - Fix or vs. ori bug on Book3E
       - Fix enabling of interrupts for some exceptions on Book3E
      
      v4:
      
       - Fix resend of doorbells on return from interrupt on Book3E
      
      v5:
      
       - Rebased on top of my latest series, which involves some significant
      rework of some aspects of the patch.
      
      v6:
       - 32-bit compile fix
       - more compile fixes with various .config combos
       - factor out the asm code to soft-disable interrupts
       - remove the C wrapper around preempt_schedule_irq
      
      v7:
       - Fix a bug with hard irq state tracking on native power7
      7230c564
    • B
      powerpc: Remove legacy iSeries bits from assembly files · 4f8cf36f
      Benjamin Herrenschmidt 提交于
      This removes the various bits of assembly in the kernel entry,
      exception handling and SLB management code that were specific
      to running under the legacy iSeries hypervisor which is no
      longer supported.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      4f8cf36f
  10. 20 9月, 2011 3 次提交
    • B
      powerpc/powernv: Support for OPAL console · daea1175
      Benjamin Herrenschmidt 提交于
      This adds a udbg and an hvc console backend for supporting a console
      using the OPAL console interfaces.
      
      On OPAL v1 we have hvc0 mapped to whatever console the system was
      configured for (network or hvsi serial port) via the service
      processor.
      
      On OPAL v2 we have hvcN mapped to the Nth console provided by OPAL
      which generally corresponds to:
      
      	hvc0 : network console (raw protocol)
      	hvc1 : serial port S1 (hvsi)
      	hvc2 : serial port S2 (hvsi)
      
      Note: At this point, early debug console only works with OPAL v1
      and shouldn't be enabled in a normal kernel.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      daea1175
    • B
      powerpc/powernv: Add OPAL takeover from PowerVM · 27f44888
      Benjamin Herrenschmidt 提交于
      On machines supporting the OPAL firmware version 1, the system
      is initially booted under pHyp. We then use a special hypercall
      to verify if OPAL is available and if it is, we then trigger
      a "takeover" which disables pHyp and loads the OPAL runtime
      firmware, giving control to the kernel in hypervisor mode.
      
      This patch add the necessary code to detect that the OPAL takeover
      capability is present when running under PowerVM (aka pHyp) and
      perform said takeover to get hypervisor control of the processor.
      
      To perform the takeover, we must first use RTAS (within Open
      Firmware runtime environment) to start all processors & threads,
      in order to give control to OPAL on all of them. We then call
      the takeover hypercall on everybody, OPAL will re-enter the kernel
      main entry point passing it a flat device-tree.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      27f44888
    • B
      powerpc/powernv: Don't clobber r9 in relative_toc() · e550592e
      Benjamin Herrenschmidt 提交于
      With OPAL, r8 and r9 will be used to pass the OPAL base and entry
      for debugging purposes (those informations are also in the
      device-tree). We don't want to clobber those registers that
      early.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      e550592e
  11. 17 6月, 2011 1 次提交
  12. 19 5月, 2011 1 次提交
    • M
      powerpc: Don't search for paca in freed memory · 768d18ad
      Milton Miller 提交于
      Starting with 1426d5a3 (powerpc:
      Dynamically allocate pacas) we free the memory for pacas beyond
      cpu_possible, but we failed to update the loop the secondary cpus use
      to find their paca.  If the system has running cpu threads for which
      the kernel did not allocate a paca for they will search the memory that
      was freed.  For instance this could happen when the device tree for
      a kdump kernel was not updated after a cpu hotplug, or the kernel is
      running with more cpus than the kernel was configured.
      
      Since c1854e00 (powerpc: Set nr_cpu_ids
      early and use it to free PACAs) we set nr_cpu_ids before telling the
      cpus to advance, so use that to limit the search.
      
      We can't reference nr_cpu_ids without CONFIG_SMP because it is defined
      as 1 instead of a memory location, but any extra threads should be sent
      to kexec_wait in that case anyways, so make that explicit and remove
      the search loop for UP.
      
      Note to stable: The fix also requires
      c1854e00 (powerpc: Set
      nr_cpu_ids early and use it to free PACAs) to function.  Also
      9d07bc84 (Properly handshake CPUs going
      out of boot spin loop) affects the second chunk, specifically the branch
      target was 3b before and is 4b after that patch, and there was a blank
      line before the #ifdef CONFIG_SMP that was removed
      
      Cc: <stable@kernel.org> # .34.x: c1854e00 powerpc: Set nr_cpu_ids early
      Cc: <stable@kernel.org> # .34.x
      Signed-off-by: NMilton Miller <miltonm@bga.com>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      768d18ad
  13. 27 4月, 2011 1 次提交
  14. 20 4月, 2011 4 次提交
  15. 01 4月, 2011 1 次提交
    • B
      powerpc/pmac/smp: Properly NAP offlined CPU on G5 · 62cc67b9
      Benjamin Herrenschmidt 提交于
      The current code soft-disables, and then goes to NAP mode which
      turns interrupts on. That means that if an interrupt occurs, we
      will hit the masked interrupt code path which isn't what we want,
      as it will return with EE off, which will either get us out of
      NAP mode, or fail to enter it (according to spec).
      
      Instead, let's just rely on the fact that it is safe to take
      decrementer interrupts on an offline CPU and leave interrupts
      enabled. We can also get rid of the special case in asm for
      power4_cpu_offline_powersave() and just use power4_idle().
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      62cc67b9
  16. 31 3月, 2011 1 次提交
  17. 09 12月, 2010 1 次提交
  18. 29 11月, 2010 1 次提交
  19. 24 10月, 2010 1 次提交
  20. 31 8月, 2010 1 次提交
    • M
      powerpc: Don't use kernel stack with translation off · 54a83404
      Michael Neuling 提交于
      In f761622e we changed
      early_setup_secondary so it's called using the proper kernel stack
      rather than the emergency one.
      
      Unfortunately, this stack pointer can't be used when translation is off
      on PHYP as this stack pointer might be outside the RMO.  This results in
      the following on all non zero cpus:
        cpu 0x1: Vector: 300 (Data Access) at [c00000001639fd10]
            pc: 000000000001c50c
            lr: 000000000000821c
            sp: c00000001639ff90
           msr: 8000000000001000
           dar: c00000001639ffa0
         dsisr: 42000000
          current = 0xc000000016393540
          paca    = 0xc000000006e00200
            pid   = 0, comm = swapper
      
      The original patch was only tested on bare metal system, so it never
      caught this problem.
      
      This changes __secondary_start so that we calculate the new stack
      pointer but only start using it after we've called early_setup_secondary.
      
      With this patch, the above problem goes away.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      54a83404
  21. 24 8月, 2010 1 次提交
    • M
      powerpc: Initialise paca->kstack before early_setup_secondary · f761622e
      Matt Evans 提交于
      As early setup calls down to slb_initialize(), we must have kstack
      initialised before checking "should we add a bolted SLB entry for our kstack?"
      
      Failing to do so means stack access requires an SLB miss exception to refill
      an entry dynamically, if the stack isn't accessible via SLB(0) (kernel text
      & static data).  It's not always allowable to take such a miss, and
      intermittent crashes will result.
      
      Primary CPUs don't have this issue; an SLB entry is not bolted for their
      stack anyway (as that lives within SLB(0)).  This patch therefore only
      affects the init of secondaries.
      Signed-off-by: NMatt Evans <matt@ozlabs.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      f761622e
  22. 17 5月, 2010 1 次提交
  23. 09 3月, 2010 2 次提交
  24. 05 11月, 2009 1 次提交
  25. 20 8月, 2009 3 次提交
    • B
      powerpc: Remaining 64-bit Book3E support · 2d27cfd3
      Benjamin Herrenschmidt 提交于
      This contains all the bits that didn't fit in previous patches :-) This
      includes the actual exception handlers assembly, the changes to the
      kernel entry, other misc bits and wiring it all up in Kconfig.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      2d27cfd3
    • B
      powerpc: Use names rather than numbers for SPRGs (v2) · ee43eb78
      Benjamin Herrenschmidt 提交于
      The kernel uses SPRG registers for various purposes, typically in
      low level assembly code as scratch registers or to hold per-cpu
      global infos such as the PACA or the current thread_info pointer.
      
      We want to be able to easily shuffle the usage of those registers
      as some implementations have specific constraints realted to some
      of them, for example, some have userspace readable aliases, etc..
      and the current choice isn't always the best.
      
      This patch should not change any code generation, and replaces the
      usage of SPRN_SPRGn everywhere in the kernel with a named replacement
      and adds documentation next to the definition of the names as to
      what those are used for on each processor family.
      
      The only parts that still use the original numbers are bits of KVM
      or suspend/resume code that just blindly needs to save/restore all
      the SPRGs.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      ee43eb78
    • B
      powerpc: Rename exception.h to exception-64s.h · 8aa34ab8
      Benjamin Herrenschmidt 提交于
      The file include/asm/exception.h contains definitions
      that are specific to exception handling on 64-bit server
      type processors.
      
      This renames the file to exception-64s.h to reflect that
      fact and avoid confusion.
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      8aa34ab8
  26. 09 6月, 2009 1 次提交