1. 14 10月, 2018 27 次提交
  2. 13 10月, 2018 8 次提交
    • C
      powerpc/32: Add ioremap_wt() and ioremap_coherent() · 86c391bd
      Christophe Leroy 提交于
      Other arches have ioremap_wt() to map IO areas write-through.
      Implement it on PPC as well in order to avoid drivers using
      __ioremap(_PAGE_WRITETHRU)
      
      Also implement ioremap_coherent() to avoid drivers using
      __ioremap(_PAGE_COHERENT)
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      86c391bd
    • G
      powerpc: Detect the presence of big-cores via "ibm, thread-groups" · 425752c6
      Gautham R. Shenoy 提交于
      On IBM POWER9, the device tree exposes a property array identifed by
      "ibm,thread-groups" which will indicate which groups of threads share
      a particular set of resources.
      
      As of today we only have one form of grouping identifying the group of
      threads in the core that share the L1 cache, translation cache and
      instruction data flow.
      
      This patch adds helper functions to parse the contents of
      "ibm,thread-groups" and populate a per-cpu variable to cache
      information about siblings of each CPU that share the L1, traslation
      cache and instruction data-flow.
      
      It also defines a new global variable named "has_big_cores" which
      indicates if the cores on this configuration have multiple groups of
      threads that share L1 cache.
      
      For each online CPU, it maintains a cpu_smallcore_mask, which
      indicates the online siblings which share the L1-cache with it.
      Signed-off-by: NGautham R. Shenoy <ego@linux.vnet.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      425752c6
    • S
      powerpc/eeh: Cleanup eeh_ops.wait_state() · fef7f905
      Sam Bobroff 提交于
      The wait_state member of eeh_ops does not need to be platform
      dependent; it's just logic around eeh_ops.get_state(). Therefore,
      merge the two (slightly different!) platform versions into a new
      function, eeh_wait_state() and remove the eeh_ops member.
      
      While doing this, also correct:
      * The wait logic, so that it never waits longer than max_wait.
      * The wait logic, so that it never waits less than
        EEH_STATE_MIN_WAIT_TIME.
      * One call site where the result is treated like a bit field before
        it's checked for negative error values.
      * In pseries_eeh_get_state(), rename the "state" parameter to "delay"
        because that's what it is.
      Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      fef7f905
    • S
      powerpc/eeh: Cleanup eeh_pe_state_mark() · e762bb89
      Sam Bobroff 提交于
      Currently, eeh_pe_state_mark() marks a PE (and it's children) with a
      state and then performs additional processing if that state included
      EEH_PE_ISOLATED.
      
      The state parameter is always a constant at the call site, so
      rearrange eeh_pe_state_mark() into two functions and just call the
      appropriate one at each site.
      Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      e762bb89
    • S
      powerpc/eeh: Cleanup eeh_enabled() · 54644927
      Sam Bobroff 提交于
      Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      54644927
    • S
      powerpc/eeh: Cleanup list_head field names · 80e65b00
      Sam Bobroff 提交于
      Instances of struct eeh_pe are placed in a tree structure using the
      fields "child_list" and "child", so place these next to each other
      in the definition.
      
      The field "child" is a list entry, so remove the unnecessary and
      misleading use of the list initializer, LIST_HEAD(), on it.
      
      The eeh_dev struct contains two list entry fields, called "list" and
      "rmv_list". Rename them to "entry" and "rmv_entry" and, as above, stop
      initializing them with LIST_HEAD().
      Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      80e65b00
    • S
      powerpc/eeh: Cleanup unused field in eeh_dev · b95a4606
      Sam Bobroff 提交于
      The 'bus' member of struct eeh_dev is assigned to once but never used,
      so remove it.
      Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      b95a4606
    • S
      powerpc/eeh: Cleanup EEH_POSTPONED_PROBE · bffc0176
      Sam Bobroff 提交于
      Currently a flag, EEH_POSTPONED_PROBE, is used to prevent an incorrect
      message "EEH: No capable adapters found" from being displayed during
      the boot of powernv systems.
      
      It is necessary because, on powernv, the call to eeh_probe_devices()
      made from eeh_init() is too early and EEH can't yet be enabled. A
      second call is made later from eeh_pnv_post_init(), which succeeds.
      
      (On pseries, the first call succeeds because PCI devices are set up
      early enough and no second call is made.)
      
      This can be simplified by moving the early call to eeh_probe_devices()
      from eeh_init() (where it's seen by both platforms) to
      pSeries_final_fixup(), so that each platform only calls
      eeh_probe_devices() once, at a point where it can succeed.
      This is slightly later in the boot sequence, but but still early
      enough and it is now in the same place in the sequence for both
      platforms (the pcibios_fixup hook).
      
      The display of the message can be cleaned up as well, by moving it
      into eeh_probe_devices().
      Signed-off-by: NSam Bobroff <sbobroff@linux.ibm.com>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      bffc0176
  3. 03 10月, 2018 5 次提交
    • B
      powerpc/tm: Remove msr_tm_active() · 5c784c84
      Breno Leitao 提交于
      Currently msr_tm_active() is a wrapper around MSR_TM_ACTIVE() if
      CONFIG_PPC_TRANSACTIONAL_MEM is set, or it is just a function that
      returns false if CONFIG_PPC_TRANSACTIONAL_MEM is not set.
      
      This function is not necessary, since MSR_TM_ACTIVE() just do the same and
      could be used, removing the dualism and simplifying the code.
      
      This patchset remove every instance of msr_tm_active() and replaced it
      by MSR_TM_ACTIVE().
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      5c784c84
    • B
      powerpc/ptrace: Add support for PTRACE_SYSEMU · 5521eb4b
      Breno Leitao 提交于
      This is a patch that adds support for PTRACE_SYSEMU ptrace request in
      PowerPC architecture.
      
      When ptrace(PTRACE_SYSEMU, ...) request is called, it will be handled by
      the arch independent function ptrace_resume(), which will tag the task with
      the TIF_SYSCALL_EMU flag. This flag needs to be handled from a platform
      dependent point of view, which is what this patch does.
      
      This patch adds this task's flag as part of the _TIF_SYSCALL_DOTRACE, which
      is the MACRO that is used to trace syscalls at entrance/exit.
      
      Since TIF_SYSCALL_EMU is now part of _TIF_SYSCALL_DOTRACE, if the task has
      _TIF_SYSCALL_DOTRACE set, it will hit do_syscall_trace_enter() at syscall
      entrance and do_syscall_trace_leave() at syscall leave.
      do_syscall_trace_enter() needs to handle the TIF_SYSCALL_EMU flag properly,
      which will interrupt the syscall executing if TIF_SYSCALL_EMU is set. The
      output values should not be changed, i.e. the return value (r3) should
      contain the original syscall argument on exit.
      
      With this flag set, the syscall is not executed fundamentally, because
      do_syscall_trace_enter() is returning -1 which is bigger than NR_syscall,
      thus, skipping the syscall execution and exiting userspace.
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      5521eb4b
    • B
      powerpc: Redefine TIF_32BITS thread flag · 16d7c69c
      Breno Leitao 提交于
      Moving TIF_32BIT to use bit 20 instead of 4 in the task flag field.
      
      This change is making room for an upcoming new task macro
      (_TIF_SYSCALL_EMU) which is preferred to set a bit in the lower 16-bits
      part of the word.
      
      This upcoming flag macro will take part in a composed macro
      (_TIF_SYSCALL_DOTRACE) which will contain other flags as well, and it is
      preferred that the whole _TIF_SYSCALL_DOTRACE macro only sets the lower 16
      bits of a word, so, it could be handled using immediate operations (as load
      immediate, add immediate, ...) where the immediate operand (SI) is limited
      to 16-bits.
      
      Another possible solution would be using the LOAD_REG_IMMEDIATE() macro
      to load a full 64-bits word immediate, but it takes 5 operations instead of
      one.
      
      Having TIF_32BITS being redefined to use an upper bit is not a problem
      since there is only one place in the assembly code where TIF_32BIT is being
      used, and it could be replaced with an operation with right shift (addis),
      since it is used alone, i.e. not being part of a composed macro, which has
      different bits set, and would require LOAD_REG_IMMEDIATE().
      
      Tested on a 64 bits Big Endian machine running a 32 bits task.
      Signed-off-by: NBreno Leitao <leitao@debian.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      16d7c69c
    • C
      powerpc/64: add stack protector support · 06ec27ae
      Christophe Leroy 提交于
      On PPC64, as register r13 points to the paca_struct at all time,
      this patch adds a copy of the canary there, which is copied at
      task_switch.
      That new canary is then used by using the following GCC options:
      -mstack-protector-guard=tls
      -mstack-protector-guard-reg=r13
      -mstack-protector-guard-offset=offsetof(struct paca_struct, canary))
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      06ec27ae
    • C
      powerpc/32: add stack protector support · c3ff2a51
      Christophe Leroy 提交于
      This functionality was tentatively added in the past
      (commit 6533b7c1 ("powerpc: Initial stack protector
      (-fstack-protector) support")) but had to be reverted
      (commit f2574030 ("powerpc: Revert the initial stack
      protector support") because of GCC implementing it differently
      whether it had been built with libc support or not.
      
      Now, GCC offers the possibility to manually set the
      stack-protector mode (global or tls) regardless of libc support.
      
      This time, the patch selects HAVE_STACKPROTECTOR only if
      -mstack-protector-guard=tls is supported by GCC.
      
      On PPC32, as register r2 points to current task_struct at
      all time, the stack_canary located inside task_struct can be
      used directly by using the following GCC options:
      -mstack-protector-guard=tls
      -mstack-protector-guard-reg=r2
      -mstack-protector-guard-offset=offsetof(struct task_struct, stack_canary))
      
      The protector is disabled for prom_init and bootx_init as
      it is too early to handle it properly.
      
       $ echo CORRUPT_STACK > /sys/kernel/debug/provoke-crash/DIRECT
      [  134.943666] Kernel panic - not syncing: stack-protector: Kernel stack is corrupted in: lkdtm_CORRUPT_STACK+0x64/0x64
      [  134.943666]
      [  134.955414] CPU: 0 PID: 283 Comm: sh Not tainted 4.18.0-s3k-dev-12143-ga3272be41209 #835
      [  134.963380] Call Trace:
      [  134.965860] [c6615d60] [c001f76c] panic+0x118/0x260 (unreliable)
      [  134.971775] [c6615dc0] [c001f654] panic+0x0/0x260
      [  134.976435] [c6615dd0] [c032c368] lkdtm_CORRUPT_STACK_STRONG+0x0/0x64
      [  134.982769] [c6615e00] [ffffffff] 0xffffffff
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      c3ff2a51