30 Dec, 2020

2 commits

  • [ Upstream commit 1817de2f141c718f1a0ae59927ec003e9b144349 ]

    Recently added Power10 prefixed VSX instruction are included
    unconditionally in the kernel. If they are executed on a
    machine without VSX support, it might create issues. Fix that.
    Also fix one mnemonics spelling mistake in comment.

    Fixes: 50b80a12e4cc ("powerpc sstep: Add support for prefixed load/stores")
    Signed-off-by: Ravi Bangoria
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20201011050908.72173-3-ravi.bangoria@linux.ibm.com
    Signed-off-by: Sasha Levin

    Ravi Bangoria
     
  • [ Upstream commit ef6879f8c8053cc3b493f400a06d452d7fb13650 ]

    Unconditional emulation of prefixed instructions will allow
    emulation of them on Power10 predecessors which might cause
    issues. Restrict that.

    Fixes: 3920742b92f5 ("powerpc sstep: Add support for prefixed fixed-point arithmetic")
    Fixes: 50b80a12e4cc ("powerpc sstep: Add support for prefixed load/stores")
    Signed-off-by: Balamuruhan S
    Signed-off-by: Ravi Bangoria
    Reviewed-by: Sandipan Das
    Reviewed-by: Daniel Axtens
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20201011050908.72173-2-ravi.bangoria@linux.ibm.com
    Signed-off-by: Sasha Levin

    Balamuruhan S
     

19 Nov, 2020

2 commits

  • IBM Power9 processors can speculatively operate on data in the L1 cache
    before it has been completely validated, via a way-prediction mechanism. It
    is not possible for an attacker to determine the contents of impermissible
    memory using this method, since these systems implement a combination of
    hardware and software security measures to prevent scenarios where
    protected data could be leaked.

    However these measures don't address the scenario where an attacker induces
    the operating system to speculatively execute instructions using data that
    the attacker controls. This can be used for example to speculatively bypass
    "kernel user access prevention" techniques, as discovered by Anthony
    Steinhauser of Google's Safeside Project. This is not an attack by itself,
    but there is a possibility it could be used in conjunction with
    side-channels or other weaknesses in the privileged code to construct an
    attack.

    This issue can be mitigated by flushing the L1 cache between privilege
    boundaries of concern. This patch flushes the L1 cache after user accesses.

    This is part of the fix for CVE-2020-4788.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Daniel Axtens
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     
  • IBM Power9 processors can speculatively operate on data in the L1 cache
    before it has been completely validated, via a way-prediction mechanism. It
    is not possible for an attacker to determine the contents of impermissible
    memory using this method, since these systems implement a combination of
    hardware and software security measures to prevent scenarios where
    protected data could be leaked.

    However these measures don't address the scenario where an attacker induces
    the operating system to speculatively execute instructions using data that
    the attacker controls. This can be used for example to speculatively bypass
    "kernel user access prevention" techniques, as discovered by Anthony
    Steinhauser of Google's Safeside Project. This is not an attack by itself,
    but there is a possibility it could be used in conjunction with
    side-channels or other weaknesses in the privileged code to construct an
    attack.

    This issue can be mitigated by flushing the L1 cache between privilege
    boundaries of concern. This patch flushes the L1 cache on kernel entry.

    This is part of the fix for CVE-2020-4788.

    Signed-off-by: Nicholas Piggin
    Signed-off-by: Daniel Axtens
    Signed-off-by: Michael Ellerman

    Nicholas Piggin
     

23 Oct, 2020

1 commit

  • Pull initial set_fs() removal from Al Viro:
    "Christoph's set_fs base series + fixups"

    * 'work.set_fs' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs: Allow a NULL pos pointer to __kernel_read
    fs: Allow a NULL pos pointer to __kernel_write
    powerpc: remove address space overrides using set_fs()
    powerpc: use non-set_fs based maccess routines
    x86: remove address space overrides using set_fs()
    x86: make TASK_SIZE_MAX usable from assembly code
    x86: move PAGE_OFFSET, TASK_SIZE & friends to page_{32,64}_types.h
    lkdtm: remove set_fs-based tests
    test_bitmap: remove user bitmap tests
    uaccess: add infrastructure for kernel builds with set_fs()
    fs: don't allow splice read/write without explicit ops
    fs: don't allow kernel reads and writes without iter ops
    sysctl: Convert to iter interfaces
    proc: add a read_iter method to proc proc_ops
    proc: cleanup the compat vs no compat file ops
    proc: remove a level of indentation in proc_get_inode

    Linus Torvalds
     

17 Oct, 2020

1 commit

  • Pull powerpc updates from Michael Ellerman:

    - A series from Nick adding ARCH_WANT_IRQS_OFF_ACTIVATE_MM & selecting
    it for powerpc, as well as a related fix for sparc.

    - Remove support for PowerPC 601.

    - Some fixes for watchpoints & addition of a new ptrace flag for
    detecting ISA v3.1 (Power10) watchpoint features.

    - A fix for kernels using 4K pages and the hash MMU on bare metal
    Power9 systems with > 16TB of RAM, or RAM on the 2nd node.

    - A basic idle driver for shallow stop states on Power10.

    - Tweaks to our sched domains code to better inform the scheduler about
    the hardware topology on Power9/10, where two SMT4 cores can be
    presented by firmware as an SMT8 core.

    - A series doing further reworks & cleanups of our EEH code.

    - Addition of a filter for RTAS (firmware) calls done via sys_rtas(),
    to prevent root from overwriting kernel memory.

    - Other smaller features, fixes & cleanups.

    Thanks to: Alexey Kardashevskiy, Andrew Donnellan, Aneesh Kumar K.V,
    Athira Rajeev, Biwen Li, Cameron Berkenpas, Cédric Le Goater, Christophe
    Leroy, Christoph Hellwig, Colin Ian King, Daniel Axtens, David Dai, Finn
    Thain, Frederic Barrat, Gautham R. Shenoy, Greg Kurz, Gustavo Romero,
    Ira Weiny, Jason Yan, Joel Stanley, Jordan Niethe, Kajol Jain, Konrad
    Rzeszutek Wilk, Laurent Dufour, Leonardo Bras, Liu Shixin, Luca
    Ceresoli, Madhavan Srinivasan, Mahesh Salgaonkar, Nathan Lynch, Nicholas
    Mc Guire, Nicholas Piggin, Nick Desaulniers, Oliver O'Halloran, Pedro
    Miraglia Franco de Carvalho, Pratik Rajesh Sampat, Qian Cai, Qinglang
    Miao, Ravi Bangoria, Russell Currey, Satheesh Rajendran, Scott Cheloha,
    Segher Boessenkool, Srikar Dronamraju, Stan Johnson, Stephen Kitt,
    Stephen Rothwell, Thiago Jung Bauermann, Tyrel Datwyler, Vaibhav Jain,
    Vaidyanathan Srinivasan, Vasant Hegde, Wang Wensheng, Wolfram Sang, Yang
    Yingliang, zhengbin.

    * tag 'powerpc-5.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (228 commits)
    Revert "powerpc/pci: unmap legacy INTx interrupts when a PHB is removed"
    selftests/powerpc: Fix eeh-basic.sh exit codes
    cpufreq: powernv: Fix frame-size-overflow in powernv_cpufreq_reboot_notifier
    powerpc/time: Make get_tb() common to PPC32 and PPC64
    powerpc/time: Make get_tbl() common to PPC32 and PPC64
    powerpc/time: Remove get_tbu()
    powerpc/time: Avoid using get_tbl() and get_tbu() internally
    powerpc/time: Make mftb() common to PPC32 and PPC64
    powerpc/time: Rename mftbl() to mftb()
    powerpc/32s: Remove #ifdef CONFIG_PPC_BOOK3S_32 in head_book3s_32.S
    powerpc/32s: Rename head_32.S to head_book3s_32.S
    powerpc/32s: Setup the early hash table at all time.
    powerpc/time: Remove ifdef in get_dec() and set_dec()
    powerpc: Remove get_tb_or_rtc()
    powerpc: Remove __USE_RTC()
    powerpc: Tidy up a bit after removal of PowerPC 601.
    powerpc: Remove support for PowerPC 601
    powerpc: Remove PowerPC 601
    powerpc: Drop SYNC_601() ISYNC_601() and SYNC()
    powerpc: Remove CONFIG_PPC601_SYNC_FIX
    ...

    Linus Torvalds
     

15 Oct, 2020

1 commit

  • A recent change to the checksum code removed usage of some extra
    arguments, alongside with storage on the stack for those, and the stack
    pointer no longer needed to be adjusted in the function prologue.

    But a left over subtraction wasn't removed in the function epilogue,
    causing the function to return with the stack pointer moved 16 bytes
    away from where it should have. This corrupted local state and lead to
    weird crashes.

    This simply removes the leftover instruction from the epilogue.

    Fixes: 70d65cd555c5 ("ppc: propagate the calling conventions change down to csum_partial_copy_generic()")
    Cc: Al Viro
    Signed-off-by: Jason A. Donenfeld
    Signed-off-by: Linus Torvalds

    Jason A. Donenfeld
     

13 Oct, 2020

1 commit

  • Pull copy_and_csum cleanups from Al Viro:
    "Saner calling conventions for csum_and_copy_..._user() and friends"

    [ Removing 800+ lines of code and cleaning stuff up is good - Linus ]

    * 'work.csum_and_copy' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    ppc: propagate the calling conventions change down to csum_partial_copy_generic()
    amd64: switch csum_partial_copy_generic() to new calling conventions
    sparc64: propagate the calling convention changes down to __csum_partial_copy_...()
    xtensa: propagate the calling conventions change down into csum_partial_copy_generic()
    mips: propagate the calling convention change down into __csum_partial_copy_..._user()
    mips: __csum_partial_copy_kernel() has no users left
    mips: csum_and_copy_{to,from}_user() are never called under KERNEL_DS
    sparc32: propagate the calling conventions change down to __csum_partial_copy_sparc_generic()
    i386: propagate the calling conventions change down to csum_partial_copy_generic()
    sh: propage the calling conventions change down to csum_partial_copy_generic()
    m68k: get rid of zeroing destination on error in csum_and_copy_from_user()
    arm: propagate the calling convention changes down to csum_partial_copy_from_user()
    alpha: propagate the calling convention changes down to csum_partial_copy.c helpers
    saner calling conventions for csum_and_copy_..._user()
    csum_and_copy_..._user(): pass 0xffffffff instead of 0 as initial sum
    csum_partial_copy_nocheck(): drop the last argument
    unify generic instances of csum_partial_copy_nocheck()
    icmp_push_reply(): reorder adding the checksum up
    skb_copy_and_csum_bits(): don't bother with the last argument

    Linus Torvalds
     

06 Oct, 2020

1 commit

  • In reaction to a proposal to introduce a memcpy_mcsafe_fast()
    implementation Linus points out that memcpy_mcsafe() is poorly named
    relative to communicating the scope of the interface. Specifically what
    addresses are valid to pass as source, destination, and what faults /
    exceptions are handled.

    Of particular concern is that even though x86 might be able to handle
    the semantics of copy_mc_to_user() with its common copy_user_generic()
    implementation other archs likely need / want an explicit path for this
    case:

    On Fri, May 1, 2020 at 11:28 AM Linus Torvalds wrote:
    >
    > On Thu, Apr 30, 2020 at 6:21 PM Dan Williams wrote:
    > >
    > > However now I see that copy_user_generic() works for the wrong reason.
    > > It works because the exception on the source address due to poison
    > > looks no different than a write fault on the user address to the
    > > caller, it's still just a short copy. So it makes copy_to_user() work
    > > for the wrong reason relative to the name.
    >
    > Right.
    >
    > And it won't work that way on other architectures. On x86, we have a
    > generic function that can take faults on either side, and we use it
    > for both cases (and for the "in_user" case too), but that's an
    > artifact of the architecture oddity.
    >
    > In fact, it's probably wrong even on x86 - because it can hide bugs -
    > but writing those things is painful enough that everybody prefers
    > having just one function.

    Replace a single top-level memcpy_mcsafe() with either
    copy_mc_to_user(), or copy_mc_to_kernel().

    Introduce an x86 copy_mc_fragile() name as the rename for the
    low-level x86 implementation formerly named memcpy_mcsafe(). It is used
    as the slow / careful backend that is supplanted by a fast
    copy_mc_generic() in a follow-on patch.

    One side-effect of this reorganization is that separating copy_mc_64.S
    to its own file means that perf no longer needs to track dependencies
    for its memcpy_64.S benchmarks.

    [ bp: Massage a bit. ]

    Signed-off-by: Dan Williams
    Signed-off-by: Borislav Petkov
    Reviewed-by: Tony Luck
    Acked-by: Michael Ellerman
    Cc:
    Link: http://lore.kernel.org/r/CAHk-=wjSqtXAqfUJxFtWNwmguFASTgB0dz1dT3V-78Quiezqbg@mail.gmail.com
    Link: https://lkml.kernel.org/r/160195561680.2163339.11574962055305783722.stgit@dwillia2-desk3.amr.corp.intel.com

    Dan Williams
     

18 Sep, 2020

1 commit

  • The check should be performed by the caller. This fixes a compile
    error with W=1.

    ../arch/powerpc/lib/sstep.c: In function ‘mlsd_8lsd_ea’:
    ../arch/powerpc/lib/sstep.c:225:3: error: suggest braces around empty body in an ‘if’ statement [-Werror=empty-body]
    ; /* Invalid form. Should already be checked for by caller! */
    ^

    Signed-off-by: Cédric Le Goater
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200914211007.2285999-4-clg@kaod.org

    Cédric Le Goater
     

15 Sep, 2020

1 commit


09 Sep, 2020

1 commit


21 Aug, 2020

2 commits

  • ... and get rid of the pointless fallback in the wrappers. On error it used
    to zero the unwritten area and calculate the csum of the entire thing. Not
    wanting to do it in assembler part had been very reasonable; doing that in
    the first place, OTOH... In case of an error the caller discards the data
    we'd copied, along with whatever checksum it might've had.

    Signed-off-by: Al Viro

    Al Viro
     
  • All callers of these primitives will
    * discard anything we might've copied in case of error
    * ignore the csum value in case of error
    * always pass 0xffffffff as the initial sum, so the
    resulting csum value (in case of success, that is) will never be 0.

    That suggest the following calling conventions:
    * don't pass err_ptr - just return 0 on error.
    * don't bother with zeroing destination, etc. in case of error
    * don't pass the initial sum - just use 0xffffffff.

    This commit does the minimal conversion in the instances of csum_and_copy_...();
    the changes of actual asm code behind them are done later in the series.
    Note that this asm code is often shared with csum_partial_copy_nocheck();
    the difference is that csum_partial_copy_nocheck() passes 0 for initial
    sum while csum_and_copy_..._user() pass 0xffffffff. Fortunately, we are
    free to pass 0xffffffff in all cases and subsequent patches will use that
    freedom without any special comments.

    A part that could be split off: parisc and uml/i386 claimed to have
    csum_and_copy_to_user() instances of their own, but those were identical
    to the generic one, so we simply drop them. Not sure if it's worth
    a separate commit...

    Signed-off-by: Al Viro

    Al Viro
     

29 Jul, 2020

2 commits

  • Add testcases for divde, divde., divdeu, divdeu. emulated instructions
    to cover few scenarios,
    - with same dividend and divisor to have undefine RT
    for divdeu[.]
    - with divide by zero to have undefine RT for both
    divde[.] and divdeu[.]
    - with negative dividend to cover -|divisor| < r
    Reviewed-by: Sandipan Das
    Acked-by: Naveen N. Rao
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200728130308.1790982-4-bala24@linux.ibm.com

    Balamuruhan S
     
  • This patch adds emulation support for divde, divdeu instructions,
    - Divide Doubleword Extended (divde[.])
    - Divide Doubleword Extended Unsigned (divdeu[.])

    Signed-off-by: Balamuruhan S
    Reviewed-by: Sandipan Das
    Acked-by: Naveen N. Rao
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200728130308.1790982-3-bala24@linux.ibm.com

    Balamuruhan S
     

26 Jul, 2020

4 commits

  • Align it with other architectures and none of the callers has
    been interested its return

    Signed-off-by: Li RongQing
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/1556278590-14727-1-git-send-email-lirongqing@baidu.com

    Li RongQing
     
  • Use is_vmalloc_or_module_addr() instead of is_vmalloc_addr()

    Signed-off-by: Christophe Leroy
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/7d884db0e5a6f521331639d8c0f13e520d5a4fef.1593428200.git.christophe.leroy@csgroup.eu

    Christophe Leroy
     
  • These have shown significantly improved performance and fairness when
    spinlock contention is moderate to high on very large systems.

    With this series including subsequent patches, on a 16 socket 1536
    thread POWER9, a stress test such as same-file open/close from all
    CPUs gets big speedups, 11620op/s aggregate with simple spinlocks vs
    384158op/s (33x faster), where the difference in throughput between
    the fastest and slowest thread goes from 7x to 1.4x.

    Thanks to the fast path being identical in terms of atomics and
    barriers (after a subsequent optimisation patch), single threaded
    performance is not changed (no measurable difference).

    On smaller systems, performance and fairness seems to be generally
    improved. Using dbench on tmpfs as a test (that starts to run into
    kernel spinlock contention), a 2-socket OpenPOWER POWER9 system was
    tested with bare metal and KVM guest configurations. Results can be
    found here:

    https://github.com/linuxppc/issues/issues/305#issuecomment-663487453

    Observations are:

    - Queued spinlocks are equal when contention is insignificant, as
    expected and as measured with microbenchmarks.

    - When there is contention, on bare metal queued spinlocks have better
    throughput and max latency at all points.

    - When virtualised, queued spinlocks are slightly worse approaching
    peak throughput, but significantly better throughput and max latency
    at all points beyond peak, until queued spinlock maximum latency
    rises when clients are 2x vCPUs.

    The regressions haven't been analysed very well yet, there are a lot
    of things that can be tuned, particularly the paravirtualised locking,
    but the numbers already look like a good net win even on relatively
    small systems.

    Signed-off-by: Nicholas Piggin
    Acked-by: Peter Zijlstra (Intel)
    Acked-by: Waiman Long
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200724131423.1362108-4-npiggin@gmail.com

    Nicholas Piggin
     
  • These functions will be used by the queued spinlock implementation,
    and may be useful elsewhere too, so move them out of spinlock.h.

    Signed-off-by: Nicholas Piggin
    Acked-by: Waiman Long
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200724131423.1362108-2-npiggin@gmail.com

    Nicholas Piggin
     

24 Jul, 2020

2 commits

  • When I "fixed" the ppc64e build in Nick's recent patch, I typoed the
    CONFIG symbol, resulting in one that doesn't exist. Fix it to use the
    correct symbol.

    Reported-by: Christophe Leroy
    Fixes: 7fa95f9adaee ("powerpc/64s: system call support for scv/rfscv instructions")
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200724131609.1640533-1-mpe@ellerman.id.au

    Michael Ellerman
     
  • ppc64_book3e_allmodconfig fails with:

    arch/powerpc/lib/test_emulate_step.c: In function 'test_pld':
    arch/powerpc/lib/test_emulate_step.c:113:7: error: implicit declaration of function 'cpu_has_feature'
    113 | if (!cpu_has_feature(CPU_FTR_ARCH_31)) {
    | ^~~~~~~~~~~~~~~

    Add an include of cpu_has_feature.h to fix it.

    Fixes: b6b54b42722a ("powerpc/sstep: Add tests for prefixed integer load/stores")
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200724004109.1461709-1-mpe@ellerman.id.au

    Michael Ellerman
     

23 Jul, 2020

11 commits

  • From Nick's cover letter:

    Linux powerpc new system call instruction and ABI

    System Call Vectored (scv) ABI
    ==============================

    The scv instruction is introduced with POWER9 / ISA3, it comes with an
    rfscv counter-part. The benefit of these instructions is
    performance (trading slower SRR0/1 with faster LR/CTR registers, and
    entering the kernel with MSR[EE] and MSR[RI] left enabled, which can
    reduce MSR updates. The scv instruction has 128 levels (not enough to
    cover the Linux system call space).

    Assignment and advertisement
    ----------------------------
    The proposal is to assign scv levels conservatively, and advertise
    them with HWCAP feature bits as we add support for more.

    Linux has not enabled FSCR[SCV] yet, so executing the scv instruction
    will cause the kernel to log a "SCV facility unavilable" message, and
    deliver a SIGILL with ILL_ILLOPC to the process. Linux has defined a
    HWCAP2 bit PPC_FEATURE2_SCV for SCV support, but does not set it.

    This change allocates the zero level ('scv 0'), advertised with
    PPC_FEATURE2_SCV, which will be used to provide normal Linux system
    calls (equivalent to 'sc').

    Attempting to execute scv with other levels will cause a SIGILL to be
    delivered the same as before, but will not log a "SCV facility
    unavailable" message (because the processor facility is enabled).

    Calling convention
    ------------------
    The proposal is for scv 0 to provide the standard Linux system call
    ABI with the following differences from sc convention[1]:

    - LR is to be volatile across scv calls. This is necessary because the
    scv instruction clobbers LR. From previous discussion, this should
    be possible to deal with in GCC clobbers and CFI.

    - cr1 and cr5-cr7 are volatile. This matches the C ABI and would allow
    the kernel system call exit to avoid restoring the volatile cr
    registers (although we probably still would anyway to avoid
    information leaks).

    - Error handling: The consensus among kernel, glibc, and musl is to
    move to using negative return values in r3 rather than CR0[SO]=1 to
    indicate error, which matches most other architectures, and is
    closer to a function call.

    Notes
    -----
    - r0,r4-r8 are documented as volatile in the ABI, but the kernel patch
    as submitted currently preserves them. This is to leave room for
    deciding which way to go with these. Some small benefit was found by
    preserving them[1] but I'm not convinced it's worth deviating from
    the C function call ABI just for this. Release code should follow
    the ABI.

    Previous discussions:
    https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-April/208691.html
    https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-April/209268.html

    [1] https://github.com/torvalds/linux/blob/master/Documentation/powerpc/syscall64-abi.rst
    [2] https://lists.ozlabs.org/pipermail/linuxppc-dev/2020-April/209263.html

    Michael Ellerman
     
  • fix checkpatch.pl warnings by moving extern declaration from source
    file to headerfile.

    Signed-off-by: Balamuruhan S
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200626095158.1031507-5-bala24@linux.ibm.com

    Balamuruhan S
     
  • retrieve prefix instruction operands RA and pc relative bit R values
    using macros and adopt it in sstep.c and test_emulate_step.c.

    Signed-off-by: Balamuruhan S
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200626095158.1031507-4-bala24@linux.ibm.com

    Balamuruhan S
     
  • testcases for `paddi` instruction to cover the negative case,
    if R is equal to 1 and RA is not equal to 0, the instruction
    form is invalid.

    Signed-off-by: Balamuruhan S
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200626095158.1031507-3-bala24@linux.ibm.com

    Balamuruhan S
     
  • add provision to declare test is a negative scenario, verify
    whether emulation fails and avoid executing it.

    Signed-off-by: Balamuruhan S
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200626095158.1031507-2-bala24@linux.ibm.com

    Balamuruhan S
     
  • There are quite a few places where instructions are printed, this is
    done using a '%x' format specifier. With the introduction of prefixed
    instructions, this does not work well. Currently in these places,
    ppc_inst_val() is used for the value for %x so only the first word of
    prefixed instructions are printed.

    When the instructions are word instructions, only a single word should
    be printed. For prefixed instructions both the prefix and suffix should
    be printed. To accommodate both of these situations, instead of a '%x'
    specifier use '%s' and introduce a helper, __ppc_inst_as_str() which
    returns a char *. The char * __ppc_inst_as_str() returns is buffer that
    is passed to it by the caller.

    It is cumbersome to require every caller of __ppc_inst_as_str() to now
    declare a buffer. To make it more convenient to use __ppc_inst_as_str(),
    wrap it in a macro that uses a compound statement to allocate a buffer
    on the caller's stack before calling it.

    Signed-off-by: Jordan Niethe
    Reviewed-by: Joel Stanley
    Acked-by: Segher Boessenkool
    [mpe: Drop 0x prefix to match most existings uses, especially xmon]
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200602052728.18227-1-jniethe5@gmail.com

    Jordan Niethe
     
  • Use the existing support for testing compute type instructions to test
    Prefixed Add Immediate (paddi). The R bit of the paddi instruction
    controls whether current instruction address is used. Add test cases
    for when R=1 and for R=0. paddi has a 34 bit immediate field formed by
    concatenating si0 and si1. Add tests for the extreme values of this
    field.

    Skip the paddi tests if ISA v3.1 is unsupported.

    Some of these test cases were added by Balamuruhan S.

    Signed-off-by: Jordan Niethe
    [mpe: Fix conflicts with ppc-opcode.h changes, squash in .balign]
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200525025923.19843-5-jniethe5@gmail.com

    Jordan Niethe
     
  • An a array of struct compute_test's are used to declare tests for
    compute instructions. Add a cpu_feature field to struct compute_test as
    an optional way to specify a cpu feature that must be present. If not
    present then skip the test.

    Signed-off-by: Jordan Niethe
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200525025923.19843-4-jniethe5@gmail.com

    Jordan Niethe
     
  • The tests for emulation of compute instructions execute and
    emulate an instruction and then compare the results to verify the
    emulation. In ISA v3.1 there are instructions that operate relative to
    the NIP. Therefore set the NIP in the regs used for the emulated
    instruction to the location of the executed instruction so they will
    give the same result.

    This is a rework of a patch by Balamuruhan S.

    Signed-off-by: Jordan Niethe
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200525025923.19843-3-jniethe5@gmail.com

    Jordan Niethe
     
  • Add tests for the prefixed versions of the floating-point load/stores
    that are currently tested. This includes the following instructions:
    * Prefixed Load Floating-Point Single (plfs)
    * Prefixed Load Floating-Point Double (plfd)
    * Prefixed Store Floating-Point Single (pstfs)
    * Prefixed Store Floating-Point Double (pstfd)

    Skip the new tests if ISA v3.10 is unsupported.

    Signed-off-by: Jordan Niethe
    [mpe: Fix conflicts with ppc-opcode.h changes]
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200525025923.19843-2-jniethe5@gmail.com

    Jordan Niethe
     
  • Add tests for the prefixed versions of the integer load/stores that
    are currently tested. This includes the following instructions:
    * Prefixed Load Doubleword (pld)
    * Prefixed Load Word and Zero (plwz)
    * Prefixed Store Doubleword (pstd)

    Skip the new tests if ISA v3.1 is unsupported.

    Signed-off-by: Jordan Niethe
    [mpe: Fix conflicts with ppc-opcode.h changes]
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200525025923.19843-1-jniethe5@gmail.com

    Jordan Niethe
     

22 Jul, 2020

1 commit

  • Add support for the scv instruction on POWER9 and later CPUs.

    For now this implements the zeroth scv vector 'scv 0', as identical to
    'sc' system calls, with the exception that LR is not preserved, nor
    are volatile CR registers, and error is not indicated with CR0[SO],
    but by returning a negative errno.

    rfscv is implemented to return from scv type system calls. It can not
    be used to return from sc system calls because those are defined to
    preserve LR.

    getpid syscall throughput on POWER9 is improved by 26% (428 to 318
    cycles), largely due to reducing mtmsr and mtspr.

    Signed-off-by: Nicholas Piggin
    [mpe: Fix ppc64e build]
    Signed-off-by: Michael Ellerman
    Link: https://lore.kernel.org/r/20200611081203.995112-3-npiggin@gmail.com

    Nicholas Piggin
     

16 Jul, 2020

3 commits


18 Jun, 2020

2 commits


10 Jun, 2020

1 commit

  • Patch series "mm: consolidate definitions of page table accessors", v2.

    The low level page table accessors (pXY_index(), pXY_offset()) are
    duplicated across all architectures and sometimes more than once. For
    instance, we have 31 definition of pgd_offset() for 25 supported
    architectures.

    Most of these definitions are actually identical and typically it boils
    down to, e.g.

    static inline unsigned long pmd_index(unsigned long address)
    {
    return (address >> PMD_SHIFT) & (PTRS_PER_PMD - 1);
    }

    static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
    {
    return (pmd_t *)pud_page_vaddr(*pud) + pmd_index(address);
    }

    These definitions can be shared among 90% of the arches provided
    XYZ_SHIFT, PTRS_PER_XYZ and xyz_page_vaddr() are defined.

    For architectures that really need a custom version there is always
    possibility to override the generic version with the usual ifdefs magic.

    These patches introduce include/linux/pgtable.h that replaces
    include/asm-generic/pgtable.h and add the definitions of the page table
    accessors to the new header.

    This patch (of 12):

    The linux/mm.h header includes to allow inlining of the
    functions involving page table manipulations, e.g. pte_alloc() and
    pmd_alloc(). So, there is no point to explicitly include
    in the files that include .

    The include statements in such cases are remove with a simple loop:

    for f in $(git grep -l "include ") ; do
    sed -i -e '/include / d' $f
    done

    Signed-off-by: Mike Rapoport
    Signed-off-by: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Borislav Petkov
    Cc: Brian Cain
    Cc: Catalin Marinas
    Cc: Chris Zankel
    Cc: "David S. Miller"
    Cc: Geert Uytterhoeven
    Cc: Greentime Hu
    Cc: Greg Ungerer
    Cc: Guan Xuetao
    Cc: Guo Ren
    Cc: Heiko Carstens
    Cc: Helge Deller
    Cc: Ingo Molnar
    Cc: Ley Foon Tan
    Cc: Mark Salter
    Cc: Matthew Wilcox
    Cc: Matt Turner
    Cc: Max Filippov
    Cc: Michael Ellerman
    Cc: Michal Simek
    Cc: Mike Rapoport
    Cc: Nick Hu
    Cc: Paul Walmsley
    Cc: Richard Weinberger
    Cc: Rich Felker
    Cc: Russell King
    Cc: Stafford Horne
    Cc: Thomas Bogendoerfer
    Cc: Thomas Gleixner
    Cc: Tony Luck
    Cc: Vincent Chen
    Cc: Vineet Gupta
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Link: http://lkml.kernel.org/r/20200514170327.31389-1-rppt@kernel.org
    Link: http://lkml.kernel.org/r/20200514170327.31389-2-rppt@kernel.org
    Signed-off-by: Linus Torvalds

    Mike Rapoport