[PATCH] ppc/ppc405: Fix TLB flushing

Cédric Le Goater posted 1 patch 2 weeks ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220113151919.1193124-1-clg@kaod.org
Maintainers: Daniel Henrique Barboza <danielhb413@gmail.com>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, "Cédric Le Goater" <clg@kaod.org>
target/ppc/mmu_helper.c | 2 ++
1 file changed, 2 insertions(+)

[PATCH] ppc/ppc405: Fix TLB flushing

Posted by Cédric Le Goater 2 weeks ago
Commit cd0c6f473532 did not take into account 405 CPUs when adding
support to batching of TCG tlb flushes. Set the TLB_NEED_LOCAL_FLUSH
flags when the SPR_40x_PID is switched and when the TLB updated.

Cc: Thomas Huth <thuth@redhat.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Fabiano Rosas <farosas@linux.ibm.com>
Fixes: cd0c6f473532 ("ppc: Do some batching of TCG tlb flushes")
Signed-off-by: Cédric Le Goater <clg@kaod.org>
 target/ppc/mmu_helper.c | 2 ++
 1 file changed, 2 insertions(+)

    It's alive ! Thanks to all :) 
    printk: console [ttyS0] enabled
    ef600300.serial: ttyS1 at MMIO 0xef600300 (irq = 17, base_baud = 119047) is a 16550
    brd: module loaded
    libphy: Fixed MDIO Bus: probed
    e1000: Intel(R) PRO/1000 Network Driver
    e1000: Copyright (c) 1999-2006 Intel Corporation.
    e1000 0008:00:01.0: enabling device (0000 -> 0003)
    e1000 0008:00:01.0 eth0: (PCI:33MHz:32-bit) 52:54:00:12:34:56
    e1000 0008:00:01.0 eth0: Intel(R) PRO/1000 Network Connection
    drmem: No dynamic reconfiguration memory found
    Freeing unused kernel image (initmem) memory: 152K
    Kernel memory protection not selected by kernel config.
    Run /init as init process
    process '/bin/busybox' started with executable stack
    Starting syslogd: OK
    Starting klogd: OK
    Running sysctl: OK
    Saving random seed: random: dd: uninitialized urandom read (512 bytes read)
    Starting network: e1000 0008:00:01.0 eth0: Unable to allocate interrupt Error: -22
    ip: SIOCSIFFLAGS: Invalid argument
    Welcome to Buildroot
    buildroot login: root
    Jan  1 00:00:18 login[123]: root login on 'ttyS0'
    # cat /proc/cpuinfo
    processor    : 0
    cpu        : 405EP
    clock        : 133.333333MHz
    revision    : 9.80 (pvr 5121 0950)
    bogomips    : 266.66
    timebase    : 133333333
    platform    : PowerPC 40x Platform
    model        : est,hotfoot
    Memory        : 128 MB
    # poweroff
    # Stopping network: ifdown: interface eth0 not configured
    Saving random seed: random: dd: uninitialized urandom read (512 bytes read)
    Stopping klogd: OK
    Stopping syslogd: start-stop-daemon: warning: killing process 45: No such process
    umount: devtmpfs busy - remounted read-only
    umount: can't unmount /: Invalid argument
    The system is going down NOW!
    Sent SIGTERM to all processes
    Sent SIGKILL to all processes
    Requesting system poweroff
    reboot: System halted
    System Halted, OK to turn off power
    QEMU 6.2.50 monitor - type 'help' for more information

diff --git a/target/ppc/mmu_helper.c b/target/ppc/mmu_helper.c
index 59df6952aea1..ccca16979965 100644
--- a/target/ppc/mmu_helper.c
+++ b/target/ppc/mmu_helper.c
@@ -682,6 +682,7 @@ target_ulong helper_4xx_tlbre_hi(CPUPPCState *env, target_ulong entry)
     ret |= size << PPC4XX_TLBHI_SIZE_SHIFT;
     env->spr[SPR_40x_PID] = tlb->PID;
+    env->tlb_need_flush |= TLB_NEED_LOCAL_FLUSH;
     return ret;
@@ -794,6 +795,7 @@ void helper_4xx_tlbwe_lo(CPUPPCState *env, target_ulong entry,
                   tlb->prot & PAGE_WRITE ? 'w' : '-',
                   tlb->prot & PAGE_EXEC ? 'x' : '-',
                   tlb->prot & PAGE_VALID ? 'v' : '-', (int)tlb->PID);
+    env->tlb_need_flush |= TLB_NEED_LOCAL_FLUSH;
 target_ulong helper_4xx_tlbsx(CPUPPCState *env, target_ulong address)