1. 20 1月, 2018 1 次提交
  2. 18 1月, 2018 1 次提交
    • P
      KVM: PPC: Book3S HV: Improve handling of debug-trigger HMIs on POWER9 · d075745d
      Paul Mackerras 提交于
      Hypervisor maintenance interrupts (HMIs) are generated by various
      causes, signalled by bits in the hypervisor maintenance exception
      register (HMER).  In most cases calling OPAL to handle the interrupt
      is the correct thing to do, but the "debug trigger" HMIs signalled by
      PPC bit 17 (bit 46) of HMER are used to invoke software workarounds
      for hardware bugs, and OPAL does not have any code to handle this
      cause.  The debug trigger HMI is used in POWER9 DD2.0 and DD2.1 chips
      to work around a hardware bug in executing vector load instructions to
      cache inhibited memory.  In POWER9 DD2.2 chips, it is generated when
      conditions are detected relating to threads being in TM (transactional
      memory) suspended mode when the core SMT configuration needs to be
      reconfigured.
      
      The kernel currently has code to detect the vector CI load condition,
      but only when the HMI occurs in the host, not when it occurs in a
      guest.  If a HMI occurs in the guest, it is always passed to OPAL, and
      then we always re-sync the timebase, because the HMI cause might have
      been a timebase error, for which OPAL would re-sync the timebase, thus
      removing the timebase offset which KVM applied for the guest.  Since
      we don't know what OPAL did, we don't know whether to subtract the
      timebase offset from the timebase, so instead we re-sync the timebase.
      
      This adds code to determine explicitly what the cause of a debug
      trigger HMI will be.  This is based on a new device-tree property
      under the CPU nodes called ibm,hmi-special-triggers, if it is
      present, or otherwise based on the PVR (processor version register).
      The handling of debug trigger HMIs is pulled out into a separate
      function which can be called from the KVM guest exit code.  If this
      function handles and clears the HMI, and no other HMI causes remain,
      then we skip calling OPAL and we proceed to subtract the guest
      timebase offset from the timebase.
      
      The overall handling for HMIs that occur in the host (i.e. not in a
      KVM guest) is largely unchanged, except that we now don't set the flag
      for the vector CI load workaround on DD2.2 processors.
      
      This also removes a BUG_ON in the KVM code.  BUG_ON is generally not
      useful in KVM guest entry/exit code since it is difficult to handle
      the resulting trap gracefully.
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      d075745d
  3. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  4. 31 8月, 2017 2 次提交
  5. 10 8月, 2017 3 次提交
  6. 03 8月, 2017 1 次提交
  7. 11 7月, 2017 1 次提交
  8. 09 5月, 2017 1 次提交
  9. 23 4月, 2017 1 次提交
    • N
      powerpc/64s: Fix POWER9 machine check handler from stop state · 1945bc45
      Nicholas Piggin 提交于
      The ISA specifies power save wakeup due to a machine check exception can
      cause a machine check interrupt (rather than the usual system reset
      interrupt).
      
      The machine check handler copes with this by doing low level machine
      check recovery without restoring full state from idle, then queues up a
      machine check event for logging, then directly executes the same idle
      instruction it woke from. This minimises the work done before recovery
      is performed.
      
      The problem is that it requires machine specific instructions and
      knowledge of the book3s idle code. Currently it only has code to handle
      POWER8 idle, so POWER9 crashes when trying to execute the P8 idle
      instructions which don't exist in ISAv3.0B.
      
      cpu 0x0: Vector: e40 (Emulation Assist) at [c0000000008f3810]
          pc: c000000000008380: machine_check_handle_early+0x130/0x2f0
          lr: c00000000053a098: stop_loop+0x68/0xd0
          sp: c0000000008f3a90
         msr: 9000000000081001
        current = 0xc0000000008a1080
        paca    = 0xc00000000ffd0000   softe: 0        irq_happened: 0x01
          pid   = 0, comm = swapper/0
      
      Instead of going to sleep after recovery, do the usual idle wakeup and
      state restoration by calling into the normal idle wakeup path. This
      reuses the normal idle wakeup paths.
      Reviewed-by: NGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Reviewed-by: NMahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>
      Signed-off-by: NNicholas Piggin <npiggin@gmail.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      1945bc45
  10. 13 4月, 2017 1 次提交
  11. 10 4月, 2017 1 次提交
  12. 09 2月, 2017 1 次提交
  13. 31 1月, 2017 1 次提交
  14. 27 1月, 2017 1 次提交
    • C
      powerpc/8xx: Perf events on PPC 8xx · 75b82472
      Christophe Leroy 提交于
      This patch has been reworked since RFC version. In the RFC, this patch
      was preceded by a patch clearing MSR RI for all PPC32 at all time at
      exception prologs. Now MSR RI clearing is done only when this 8xx perf
      events functionality is compiled in, it is therefore limited to 8xx
      and merged inside this patch.
      Other main changes have been to take into account detailed review from
      Peter Zijlstra. The instructions counter has been reworked to behave
      as a free running counter like the three other counters.
      
      The 8xx has no PMU, however some events can be emulated by other means.
      
      This patch implements the following events (as reported by 'perf list'):
        cpu-cycles OR cycles				[Hardware event]
        instructions					[Hardware event]
        dTLB-load-misses				[Hardware cache event]
        iTLB-load-misses				[Hardware cache event]
      
      'cycles' event is implemented using the timebase clock. Timebase clock
      corresponds to CPU clock divided by 16, so number of cycles is
      approximatly 16 times the number of TB ticks
      
      On the 8xx, TLB misses are handled by software. It is therefore
      easy to count all TLB misses each time the TLB miss exception is
      called.
      
      'instructions' is calculated by using instruction watchpoint counter.
      This patch sets counter A to count instructions at address greater
      than 0, hence we count all instructions executed while MSR RI bit is
      set. The counter is set to the maximum which is 0xffff. Every 65535
      instructions, debug instruction breakpoint exception fires. The
      exception handler increments a counter in memory which then
      represent the upper part of the instruction counter. We therefore
      end up with a 48 bits counter. In order to avoid unnecessary overhead
      while no perf event is active, this counter is started when the first
      event referring to this counter is added, and the counter is stopped
      when the last event referring to it is deleted. In order to properly
      support breakpoint exceptions, MSR RI bit has to be unset in exception
      epilogs in order to avoid breakpoint exceptions during critical
      sections during changes to SRR0 and SRR1 would be problematic.
      
      All counters are handled as free running counters.
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NScott Wood <oss@buserror.net>
      75b82472
  15. 25 1月, 2017 1 次提交
  16. 23 11月, 2016 3 次提交
  17. 22 11月, 2016 2 次提交
  18. 14 11月, 2016 1 次提交
  19. 04 10月, 2016 1 次提交
  20. 27 9月, 2016 1 次提交
    • T
      KVM: PPC: Book3s PR: Allow access to unprivileged MMCR2 register · fa73c3b2
      Thomas Huth 提交于
      The MMCR2 register is available twice, one time with number 785
      (privileged access), and one time with number 769 (unprivileged,
      but it can be disabled completely). In former times, the Linux
      kernel was using the unprivileged register 769 only, but since
      commit 8dd75ccb ("powerpc: Use privileged SPR number
      for MMCR2"), it uses the privileged register 785 instead.
      The KVM-PR code then of course also switched to use the SPR 785,
      but this is causing older guest kernels to crash, since these
      kernels still access 769 instead. So to support older kernels
      with KVM-PR again, we have to support register 769 in KVM-PR, too.
      
      Fixes: 8dd75ccb
      Cc: stable@vger.kernel.org # v3.10+
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NPaul Mackerras <paulus@ozlabs.org>
      fa73c3b2
  21. 25 9月, 2016 1 次提交
    • C
      powerpc/8xx: use SPRN_EIE and SPRN_EID to enable/disable interrupts · 834e5a69
      Christophe Leroy 提交于
      The 8xx has two special registers called EID (External Interrupt
      Disable) and EIE (External Interrupt Enable) for clearing/setting
      EE in MSR. It avoids the three instructions set mfmsr/ori/mtmsr or
      mfmsr/rlwinm/mtmsr and it avoids using a general register.
      
      We just have to write something in the special register to change MSR EE
      bit. So we write r0 into the register, regardless of r0 value.
      
      Writing to one of those two special registers also set the MSR RI bit,
      but this bit is only unset during beginning of exception prolog and end
      of exception epilog. When executing C-functions MSR RI is always set.
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NScott Wood <oss@buserror.net>
      834e5a69
  22. 13 9月, 2016 1 次提交
  23. 01 8月, 2016 1 次提交
  24. 19 7月, 2016 1 次提交
  25. 17 7月, 2016 2 次提交
  26. 15 7月, 2016 1 次提交
    • S
      powerpc/powernv: Add platform support for stop instruction · bcef83a0
      Shreyas B. Prabhu 提交于
      POWER ISA v3 defines a new idle processor core mechanism. In summary,
       a) new instruction named stop is added. This instruction replaces
      	instructions like nap, sleep, rvwinkle.
       b) new per thread SPR named Processor Stop Status and Control Register
      	(PSSCR) is added which controls the behavior of stop instruction.
      
      PSSCR layout:
      ----------------------------------------------------------
      | PLS | /// | SD | ESL | EC | PSLL | /// | TR | MTL | RL |
      ----------------------------------------------------------
      0      4     41   42    43   44     48    54   56    60
      
      PSSCR key fields:
      	Bits 0:3  - Power-Saving Level Status. This field indicates the lowest
      	power-saving state the thread entered since stop instruction was last
      	executed.
      
      	Bit 42 - Enable State Loss
      	0 - No state is lost irrespective of other fields
      	1 - Allows state loss
      
      	Bits 44:47 - Power-Saving Level Limit
      	This limits the power-saving level that can be entered into.
      
      	Bits 60:63 - Requested Level
      	Used to specify which power-saving level must be entered on executing
      	stop instruction
      
      This patch adds support for stop instruction and PSSCR handling.
      Reviewed-by: NGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: NShreyas B. Prabhu <shreyas@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      bcef83a0
  27. 14 7月, 2016 1 次提交
  28. 09 7月, 2016 1 次提交
  29. 05 7月, 2016 1 次提交
    • O
      powerpc/timer: Large Decrementer support · 79901024
      Oliver O'Halloran 提交于
      Power ISAv3 adds a large decrementer (LD) mode which increases the size
      of the decrementer register. The size of the enlarged decrementer
      register is between 32 and 64 bits with the exact size being dependent
      on the implementation. When in LD mode, reads are sign extended to 64
      bits and a decrementer exception is raised when the high bit is set (i.e
      the value goes below zero). Writes however are truncated to the physical
      register width so some care needs to be taken to ensure that the high
      bit is not set when reloading the decrementer. This patch adds support
      for using the LD inside the host kernel on processors that support it.
      
      When LD mode is supported firmware will supply the ibm,dec-bits property
      for CPU nodes to allow the kernel to determine the maximum decrementer
      value. Enabling LD mode is a hypervisor privileged operation so the kernel
      can only enable it manually when running in hypervisor mode. Guests that
      support LD mode can request it using the "ibm,client-architecture-support"
      firmware call (not implemented in this patch) or some other platform
      specific method. If this property is not supplied then the traditional
      decrementer width of 32 bit is assumed and LD mode will not be enabled.
      
      This patch was based on initial work by Jack Miller.
      Signed-off-by: NOliver O'Halloran <oohall@gmail.com>
      Signed-off-by: NBalbir Singh <bsingharora@gmail.com>
      Acked-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      79901024
  30. 21 6月, 2016 1 次提交
    • J
      powerpc: Load Monitor Register Support · bd3ea317
      Jack Miller 提交于
      This enables new registers, LMRR and LMSER, that can trigger an EBB in
      userspace code when a monitored load (via the new ldmx instruction)
      loads memory from a monitored space. This facility is controlled by a
      new FSCR bit, LM.
      
      This patch disables the FSCR LM control bit on task init and enables
      that bit when a load monitor facility unavailable exception is taken
      for using it. On context switch, this bit is then used to determine
      whether the two relevant registers are saved and restored. This is
      done lazily for performance reasons.
      Signed-off-by: NJack Miller <jack@codezen.org>
      Signed-off-by: NMichael Neuling <mikey@neuling.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      bd3ea317
  31. 31 5月, 2016 2 次提交
  32. 01 5月, 2016 1 次提交