• James Hogan's avatar
    MIPS: c-r4k: Fix protected_writeback_scache_line for EVA · 1b764256
    James Hogan authored
    BugLink: https://bugs.launchpad.net/bugs/1878232
    
    commit 0758b116 upstream.
    
    The protected_writeback_scache_line() function is used by
    local_r4k_flush_cache_sigtramp() to flush an FPU delay slot emulation
    trampoline on the userland stack from the caches so it is visible to
    subsequent instruction fetches.
    
    Commit de8974e3 ("MIPS: asm: r4kcache: Add EVA cache flushing
    functions") updated some protected_ cache flush functions to use EVA
    CACHEE instructions via protected_cachee_op(), and commit 83fd4344
    ("MIPS: r4kcache: Add EVA case for protected_writeback_dcache_line") did
    the same thing for protected_writeback_dcache_line(), but
    protected_writeback_scache_line() never got updated. Lets fix that now
    to flush the right user address from the secondary cache rather than
    some arbitrary kernel unmapped address.
    
    This issue was spotted through code inspection, and it seems unlikely to
    be possible to hit this in practice. It theoretically affect EVA kernels
    on EVA capable cores with an L2 cache, where the icache fetches straight
    from RAM (cpu_icache_snoops_remote_store == 0), running a hard float
    userland with FPU disabled (nofpu). That both Malta and Boston platforms
    override cpu_icache_snoops_remote_store to 1 suggests that all MIPS
    cores fetch instructions into icache straight from L2 rather than RAM.
    
    Fixes: de8974e3 ("MIPS: asm: r4kcache: Add EVA cache flushing functions")
    Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
    Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
    Cc: linux-mips@linux-mips.org
    Patchwork: https://patchwork.linux-mips.org/patch/13800/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarIan May <ian.may@canonical.com>
    Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
    1b764256
r4kcache.h 24.9 KB