lkml.org 
[lkml]   [2021]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.12 473/677] powerpc/64s: Fix hash fault to use TRAP accessor
    Date
    From: Nicholas Piggin <npiggin@gmail.com>

    [ Upstream commit 1479e3d3b7559133b0a107772b5841e9c2cad450 ]

    Hash faults use the trap vector to decide whether this is an
    instruction or data fault. This should use the TRAP accessor
    rather than open access regs->trap.

    This won't cause a problem at the moment because 64s only uses
    trap flags for system call interrupts (the norestart flag), but
    that could change if any other trap flags get used in future.

    Fixes: a4922f5442e7e ("powerpc/64s: move the hash fault handling logic to C")
    Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20210316105205.407767-1-npiggin@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    arch/powerpc/mm/book3s64/hash_utils.c | 4 ++--
    1 file changed, 2 insertions(+), 2 deletions(-)

    diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
    index 581b20a2feaf..7719995323c3 100644
    --- a/arch/powerpc/mm/book3s64/hash_utils.c
    +++ b/arch/powerpc/mm/book3s64/hash_utils.c
    @@ -1545,10 +1545,10 @@ DEFINE_INTERRUPT_HANDLER_RET(__do_hash_fault)
    if (user_mode(regs) || (region_id == USER_REGION_ID))
    access &= ~_PAGE_PRIVILEGED;

    - if (regs->trap == 0x400)
    + if (TRAP(regs) == 0x400)
    access |= _PAGE_EXEC;

    - err = hash_page_mm(mm, ea, access, regs->trap, flags);
    + err = hash_page_mm(mm, ea, access, TRAP(regs), flags);
    if (unlikely(err < 0)) {
    // failed to instert a hash PTE due to an hypervisor error
    if (user_mode(regs)) {
    --
    2.30.2


    \
     
     \ /
      Last update: 2021-05-12 22:53    [W:4.042 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site