Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: qemu/qemu
base: cd666e49210d
Choose a base ref
...
head repository: qemu/qemu
compare: fcf58d6f20d2
Choose a head ref
  • 12 commits
  • 12 files changed
  • 9 contributors

Commits on Sep 20, 2023

  1. include/exec: Provide the tswap() functions for target independent co…

    …de, too
    
    In some cases of target independent code, it would be useful to have access
    to the functions that swap endianess in case it differs between guest and
    host. Thus re-implement the tswapXX() functions in a new header that can be
    included separately. The check whether the swapping is needed continues to
    be done at compile-time for target specific code, while it is done at
    run-time in target-independent code.
    
    Message-Id: <20230411183418.1640500-3-thuth@redhat.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 24be336)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (trivial change needed for the next commit 058096f
     "hw/char/riscv_htif: Fix the console syscall on big endian hosts")
    huth authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    aeb931d View commit details
    Browse the repository at this point in the history
  2. hw/char/riscv_htif: Fix the console syscall on big endian hosts

    Values that have been read via cpu_physical_memory_read() from the
    guest's memory have to be swapped in case the host endianess differs
    from the guest.
    
    Fixes: a6e13e3 ("riscv_htif: Support console output via proxy syscall")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230721094720.902454-3-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 058096f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (Mjt: context fix in hw/char/riscv_htif.c for #include)
    huth authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    a57e4cc View commit details
    Browse the repository at this point in the history
  3. hw/intc: Fix upper/lower mtime write calculation

    When writing the upper mtime, we should keep the original lower mtime
    whose value is given by cpu_riscv_read_rtc() instead of
    cpu_riscv_read_rtc_raw(). The same logic applies to writes to lower mtime.
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-1-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit e0922b7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Jason Chien authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    fd1a0c8 View commit details
    Browse the repository at this point in the history
  4. hw/intc: Make rtc variable names consistent

    The variables whose values are given by cpu_riscv_read_rtc() should be named
    "rtc". The variables whose value are given by cpu_riscv_read_rtc_raw()
    should be named "rtc_r".
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-2-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9382a9e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Jason Chien authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    c00a9ec View commit details
    Browse the repository at this point in the history
  5. linux-user/riscv: Use abi type for target_ucontext

    We should not use types dependend on host arch for target_ucontext.
    This bug is found when run rv32 applications.
    
    Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-ID: <20230811055438.1945-1-zhiwei_liu@linux.alibaba.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit ae7d4d6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    romanheros authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    9bac2bc View commit details
    Browse the repository at this point in the history
  6. hw/riscv: virt: Fix riscv,pmu DT node path

    On a dtb dumped from the virt machine, dt-validate complains:
    soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
            from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
    That's pretty cryptic, but running the dtb back through dtc produces
    something a lot more reasonable:
    Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property
    
    Moving the riscv,pmu node out of the soc bus solves the problem.
    
    Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-ID: <20230727-groom-decline-2c57ce42841c@spud>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9ff3140)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    ConchuOD authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    e94ea3c View commit details
    Browse the repository at this point in the history
  7. target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0

    In the same emulated RISC-V host, the 'host' KVM CPU takes 4 times
    longer to boot than the 'rv64' KVM CPU.
    
    The reason is an unintended behavior of riscv_cpu_satp_mode_finalize()
    when satp_mode.supported = 0, i.e. when cpu_init() does not set
    satp_mode_max_supported(). satp_mode_max_from_map(map) does:
    
    31 - __builtin_clz(map)
    
    This means that, if satp_mode.supported = 0, satp_mode_supported_max
    wil be '31 - 32'. But this is C, so satp_mode_supported_max will gladly
    set it to UINT_MAX (4294967295). After that, if the user didn't set a
    satp_mode, set_satp_mode_default_map(cpu) will make
    
    cfg.satp_mode.map = cfg.satp_mode.supported
    
    So satp_mode.map = 0. And then satp_mode_map_max will be set to
    satp_mode_max_from_map(cpu->cfg.satp_mode.map), i.e. also UINT_MAX. The
    guard "satp_mode_map_max > satp_mode_supported_max" doesn't protect us
    here since both are UINT_MAX.
    
    And finally we have 2 loops:
    
            for (int i = satp_mode_map_max - 1; i >= 0; --i) {
    
    Which are, in fact, 2 loops from UINT_MAX -1 to -1. This is where the
    extra delay when booting the 'host' CPU is coming from.
    
    Commit 43d1de3 already set a precedence for satp_mode.supported = 0
    in a different manner. We're doing the same here. If supported == 0,
    interpret as 'the CPU wants the OS to handle satp mode alone' and skip
    satp_mode_finalize().
    
    We'll also put a guard in satp_mode_max_from_map() to assert out if map
    is 0 since the function is not ready to deal with it.
    
    Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
    Fixes: 6f23aae ("riscv: Allow user to set the satp mode")
    Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Message-ID: <20230817152903.694926-1-dbarboza@ventanamicro.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 3a2fc23)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    danielhb authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    1805e05 View commit details
    Browse the repository at this point in the history
  8. target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes

    When the rule-lock bypass (RLB) bit is set in the mseccfg CSR, the PMP
    configuration lock bits must not apply. While this behavior is
    implemented for the pmpcfgX CSRs, this bit is not respected for
    changes to the pmpaddrX CSRs. This patch ensures that pmpaddrX CSR
    writes work even on locked regions when the global rule-lock bypass is
    enabled.
    
    Signed-off-by: Leon Schuermann <leons@opentitan.org>
    Reviewed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230829215046.1430463-1-leon@is.currently.online>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 4e3adce)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Leon Schuermann authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    70c97e7 View commit details
    Browse the repository at this point in the history
  9. hw/tpm: TIS on sysbus: Remove unsupport ppi command line option

    The ppi command line option for the TIS device on sysbus never worked
    and caused an immediate segfault. Remove support for it since it also
    needs support in the firmware and needs testing inside the VM.
    
    Reproducer with the ppi=on option passed:
    
    qemu-system-aarch64 \
       -machine virt,gic-version=3 \
       -m 4G  \
       -nographic -no-acpi \
       -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
       -tpmdev emulator,id=tpm0,chardev=chrtpm \
       -device tpm-tis-device,tpmdev=tpm0,ppi=on
    [...]
    Segmentation fault (core dumped)
    
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Message-id: 20230713171955.149236-1-stefanb@linux.ibm.com
    (cherry picked from commit 4c46fe2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    stefanberger authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    36540b3 View commit details
    Browse the repository at this point in the history
  10. ui: fix crash when there are no active_console

    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    812	    return con->hw_ops->ui_info != NULL;
    (gdb) bt
    #0  0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    #1  0x00005555558a44b1 in protocol_client_msg (vs=0x5555578c76c0, data=0x5555581e93f0 <incomplete sequence \373>, len=24) at ../ui/vnc.c:2585
    #2  0x00005555558a19ac in vnc_client_read (vs=0x5555578c76c0) at ../ui/vnc.c:1607
    #3  0x00005555558a1ac2 in vnc_client_io (ioc=0x5555581eb0e0, condition=G_IO_IN, opaque=0x5555578c76c0) at ../ui/vnc.c:1635
    
    Fixes:
    https://issues.redhat.com/browse/RHEL-2600
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Albert Esteve <aesteve@redhat.com>
    (cherry picked from commit 48a35e1)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    elmarco authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    6c57543 View commit details
    Browse the repository at this point in the history
  11. s390x/ap: fix missing subsystem reset registration

    A subsystem reset contains a reset of AP resources which has been
    missing.  Adding the AP bridge to the list of device types that need
    reset fixes this issue.
    
    Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
    Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
    Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
    Fixes: a51b315 ("s390x/ap: base Adjunct Processor (AP) object model")
    Message-ID: <20230823142219.1046522-2-seiden@linux.ibm.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 297ec01)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    frankjaa authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    0ef930a View commit details
    Browse the repository at this point in the history
  12. tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR

    Replace select() with poll() to fix a crash when QEMU has a large number
    of FDs. Also use RETRY_ON_EINTR to avoid unnecessary errors due to EINTR.
    
    Cc: qemu-stable@nongnu.org
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2020133
    Fixes: 56a3c24 ("tpm: Probe for connected TPM 1.2 or TPM 2")
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    (cherry picked from commit 8e32ddf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    elmarco authored and Michael Tokarev committed Sep 20, 2023
    Copy the full SHA
    fcf58d6 View commit details
    Browse the repository at this point in the history