1. 06 12月, 2017 1 次提交
    • N
      powerpc/64s: Initialize ISAv3 MMU registers before setting partition table · 371b8044
      Nicholas Piggin 提交于
      kexec can leave MMU registers set when booting into a new kernel,
      the PIDR (Process Identification Register) in particular. The boot
      sequence does not zero PIDR, so it only gets set when CPUs first
      switch to a userspace processes (until then it's running a kernel
      thread with effective PID = 0).
      
      This leaves a window where a process table entry and page tables are
      set up due to user processes running on other CPUs, that happen to
      match with a stale PID. The CPU with that PID may cause speculative
      accesses that address quadrant 0 (aka userspace addresses), which will
      result in cached translations and PWC (Page Walk Cache) for that
      process, on a CPU which is not in the mm_cpumask and so they will not
      be invalidated properly.
      
      The most common result is the kernel hanging in infinite page fault
      loops soon after kexec (usually in schedule_tail, which is usually the
      first non-speculative quadrant 0 access to a new PID) due to a stale
      PWC. However being a stale translation error, it could result in
      anything up to security and data corruption problems.
      
      Fix this by zeroing out PIDR at boot and kexec.
      
      Fixes: 7e381c0f ("powerpc/mm/radix: Add mmu context handling callback for radix")
      Cc: stable@vger.kernel.org # v4.7+
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      371b8044
  2. 11 7月, 2017 1 次提交
    • N
      powerpc/powernv: Fix local TLB flush for boot and MCE on POWER9 · 41d0c2ec
      Nicholas Piggin 提交于
      There are two cases outside the normal address space management
      where a CPU's local TLB is to be flushed:
      
        1. Host boot; in case something has left stale entries in the
           TLB (e.g., kexec).
      
        2. Machine check; to clean corrupted TLB entries.
      
      CPU state restore from deep idle states also flushes the TLB.
      However this seems to be a side effect of reusing the boot code to set
      CPU state, rather than a requirement itself.
      
      The current flushing has a number of problems with ISA v3.0B:
      
      - The current radix mode of the MMU is not taken into account. tlbiel
        is undefined if the R field does not match the current radix mode.
      
      - ISA v3.0B hash must flush the partition and process table caches.
      
      - ISA v3.0B radix must flush partition and process scoped translations,
        partition and process table caches, and also the page walk cache.
      
      Add POWER9 cases to handle these, with radix vs hash determined by the
      host MMU mode.
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Reviewed-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      41d0c2ec
  3. 03 5月, 2017 1 次提交
  4. 26 4月, 2017 1 次提交
    • N
      powerpc/64s: Revert setting of LPCR[LPES] on POWER9 · 8bf8f2e8
      Nicholas Piggin 提交于
      The XIVE enablement patches included a change to set the LPES (Logical
      Partitioning Environment Selector) bit (bit # 3) in LPCR (Logical Partitioning
      Control Register) on POWER9 hosts. This bit sets external interrupts to guest
      delivery mode, which uses SRR0/1. The host's EE interrupt handler is written to
      expect HSRR0/1 (for earlier CPUs). This should be fine because XIVE is
      configured not to deliver EEs to the host (Hypervisor Virtulization Interrupt is
      used instead) so the EE handler should never be executed.
      
      However a bug in interrupt controller code, hardware, or odd configuration of a
      simulator could result in the host getting an EE incorrectly. Keeping the EE
      delivery mode matching the host EE handler prevents strange crashes due to using
      the wrong exception registers.
      
      KVM will configure the LPCR to set LPES prior to running a guest so that EEs are
      delivered to the guest using SRR0/1.
      
      Fixes: 08a1e650 ("powerpc: Fixup LPCR:PECE and HEIC setting on POWER9")
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      [mpe: Massage change log to avoid referring to LPES0 which is now renamed LPES]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      8bf8f2e8
  5. 19 4月, 2017 1 次提交
    • N
      powerpc/64s: Revert setting of LPCR[LPES] on POWER9 · 8d1b48ef
      Nicholas Piggin 提交于
      The XIVE enablement patches included a change to set the LPES (Logical
      Partitioning Environment Selector) bit (bit # 3) in LPCR (Logical Partitioning
      Control Register) on POWER9 hosts. This bit sets external interrupts to guest
      delivery mode, which uses SRR0/1. The host's EE interrupt handler is written to
      expect HSRR0/1 (for earlier CPUs). This should be fine because XIVE is
      configured not to deliver EEs to the host (Hypervisor Virtulization Interrupt is
      used instead) so the EE handler should never be executed.
      
      However a bug in interrupt controller code, hardware, or odd configuration of a
      simulator could result in the host getting an EE incorrectly. Keeping the EE
      delivery mode matching the host EE handler prevents strange crashes due to using
      the wrong exception registers.
      
      KVM will configure the LPCR to set LPES prior to running a guest so that EEs are
      delivered to the guest using SRR0/1.
      
      Fixes: 08a1e650 ("powerpc: Fixup LPCR:PECE and HEIC setting on POWER9")
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      [mpe: Massage change log to avoid referring to LPES0 which is now renamed LPES]
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      8d1b48ef
  6. 10 4月, 2017 1 次提交
  7. 23 2月, 2017 1 次提交
  8. 25 11月, 2016 1 次提交
  9. 23 11月, 2016 1 次提交
  10. 22 11月, 2016 1 次提交
  11. 17 7月, 2016 1 次提交
  12. 05 7月, 2016 1 次提交
  13. 03 3月, 2016 1 次提交
  14. 22 2月, 2016 2 次提交
  15. 17 3月, 2015 1 次提交
  16. 11 6月, 2014 1 次提交
  17. 07 4月, 2014 1 次提交
  18. 05 12月, 2013 1 次提交
  19. 24 5月, 2013 1 次提交
  20. 02 5月, 2013 2 次提交
  21. 26 4月, 2013 2 次提交
  22. 18 4月, 2013 1 次提交
    • M
      powerpc: Setup in HFSCR for POWER8 · 2a3563b0
      Michael Neuling 提交于
      Setup the HFSCR (Hypervisor Facility Status and Control Register) for POWER8
      when running HV=1.  The HFSCR is the same as the FSCR except it's for
      hypervisors.  It controls the available of various facilities in OS and
      userspace levels.  It also indicates the cause of a hypervisor facility
      unavailable interrupt (although we are not using this here).
      
      This patch sets the facilities Linux knows about incase the firmware doesn't.
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NMichael Ellerman <michael@ellerman.id.au>
      2a3563b0
  23. 05 3月, 2013 2 次提交
  24. 08 2月, 2013 1 次提交
  25. 15 11月, 2012 4 次提交
  26. 12 7月, 2011 2 次提交
    • P
      powerpc, KVM: Split HVMODE_206 cpu feature bit into separate HV and architecture bits · 969391c5
      Paul Mackerras 提交于
      This replaces the single CPU_FTR_HVMODE_206 bit with two bits, one to
      indicate that we have a usable hypervisor mode, and another to indicate
      that the processor conforms to PowerISA version 2.06.  We also add
      another bit to indicate that the processor conforms to ISA version 2.01
      and set that for PPC970 and derivatives.
      
      Some PPC970 chips (specifically those in Apple machines) have a
      hypervisor mode in that MSR[HV] is always 1, but the hypervisor mode
      is not useful in the sense that there is no way to run any code in
      supervisor mode (HV=0 PR=0).  On these processors, the LPES0 and LPES1
      bits in HID4 are always 0, and we use that as a way of detecting that
      hypervisor mode is not useful.
      
      Where we have a feature section in assembly code around code that
      only applies on POWER7 in hypervisor mode, we use a construct like
      
      END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
      
      The definition of END_FTR_SECTION_IFSET is such that the code will
      be enabled (not overwritten with nops) only if all bits in the
      provided mask are set.
      
      Note that the CPU feature check in __tlbie() only needs to check the
      ARCH_206 bit, not the HVMODE bit, because __tlbie() can only get called
      if we are running bare-metal, i.e. in hypervisor mode.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      969391c5
    • P
      powerpc: Set up LPCR for running guest partitions · 923c53ca
      Paul Mackerras 提交于
      In hypervisor mode, the LPCR controls several aspects of guest
      partitions, including virtual partition memory mode, and also controls
      whether the hypervisor decrementer interrupts are enabled.  This sets
      up LPCR at boot time so that guest partitions will use a virtual real
      memory area (VRMA) composed of 16MB large pages, and hypervisor
      decrementer interrupts are disabled.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NAlexander Graf <agraf@suse.de>
      923c53ca
  27. 20 4月, 2011 4 次提交