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: 3c99de0aa7f3
Choose a base ref
...
head repository: qemu/qemu
compare: d256f730cd98
Choose a head ref
  • 11 commits
  • 8 files changed
  • 9 contributors

Commits on Sep 11, 2023

  1. virtio: Drop out of coroutine context in virtio_load()

    virtio_load() as a whole should run in coroutine context because it
    reads from the migration stream and we don't want this to block.
    
    However, it calls virtio_set_features_nocheck() and devices don't
    expect their .set_features callback to run in a coroutine and therefore
    call functions that may not be called in coroutine context. To fix this,
    drop out of coroutine context for calling virtio_set_features_nocheck().
    
    Without this fix, the following crash was reported:
    
      #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
      #1  0x00007efc738c05d3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
      #2  0x00007efc73873d26 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #3  0x00007efc738477f3 in __GI_abort () at abort.c:79
      #4  0x00007efc7384771b in __assert_fail_base (fmt=0x7efc739dbcb8 "", assertion=assertion@entry=0x560aebfbf5cf "!qemu_in_coroutine()",
         file=file@entry=0x560aebfcd2d4 "../block/graph-lock.c", line=line@entry=275, function=function@entry=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:92
      #5  0x00007efc7386ccc6 in __assert_fail (assertion=0x560aebfbf5cf "!qemu_in_coroutine()", file=0x560aebfcd2d4 "../block/graph-lock.c", line=275,
         function=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:101
      #6  0x0000560aebcd8dd6 in bdrv_register_buf ()
      #7  0x0000560aeb97ed97 in ram_block_added.llvm ()
      #8  0x0000560aebb8303f in ram_block_add.llvm ()
      #9  0x0000560aebb834fa in qemu_ram_alloc_internal.llvm ()
      #10 0x0000560aebb2ac98 in vfio_region_mmap ()
      #11 0x0000560aebb3ea0f in vfio_bars_register ()
      #12 0x0000560aebb3c628 in vfio_realize ()
      #13 0x0000560aeb90f0c2 in pci_qdev_realize ()
      #14 0x0000560aebc40305 in device_set_realized ()
      #15 0x0000560aebc48e07 in property_set_bool.llvm ()
      #16 0x0000560aebc46582 in object_property_set ()
      #17 0x0000560aebc4cd58 in object_property_set_qobject ()
      #18 0x0000560aebc46ba7 in object_property_set_bool ()
      #19 0x0000560aeb98b3ca in qdev_device_add_from_qdict ()
      #20 0x0000560aebb1fbaf in virtio_net_set_features ()
      #21 0x0000560aebb46b51 in virtio_set_features_nocheck ()
      #22 0x0000560aebb47107 in virtio_load ()
      #23 0x0000560aeb9ae7ce in vmstate_load_state ()
      #24 0x0000560aeb9d2ee9 in qemu_loadvm_state_main ()
      #25 0x0000560aeb9d45e1 in qemu_loadvm_state ()
      #26 0x0000560aeb9bc32c in process_incoming_migration_co.llvm ()
      #27 0x0000560aebeace56 in coroutine_trampoline.llvm ()
    
    Cc: qemu-stable@nongnu.org
    Buglink: https://issues.redhat.com/browse/RHEL-832
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    Message-ID: <20230905145002.46391-3-kwolf@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 92e2e6a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    Kevin Wolf authored and Michael Tokarev committed Sep 11, 2023
    Copy the full SHA
    d07885e View commit details
    Browse the repository at this point in the history
  2. arm64: Restore trapless ptimer access

    Due to recent KVM changes, QEMU is setting a ptimer offset resulting
    in unintended trap and emulate access and a consequent performance
    hit. Filter out the PTIMER_CNT register to restore trapless ptimer
    access.
    
    Quoting Andrew Jones:
    
    Simply reading the CNT register and writing back the same value is
    enough to set an offset, since the timer will have certainly moved
    past whatever value was read by the time it's written.  QEMU
    frequently saves and restores all registers in the get-reg-list array,
    unless they've been explicitly filtered out (with Linux commit
    680232a94c12, KVM_REG_ARM_PTIMER_CNT is now in the array). So, to
    restore trapless ptimer accesses, we need a QEMU patch to filter out
    the register.
    
    See
    https://lore.kernel.org/kvmarm/gsntttsonus5.fsf@coltonlewis-kvm.c.googlers.com/T/#m0770023762a821db2a3f0dd0a7dc6aa54e0d0da9
    for additional context.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
    Signed-off-by: Colton Lewis <coltonlewis@google.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Tested-by: Colton Lewis <coltonlewis@google.com>
    Message-id: 20230831190052.129045-1-coltonlewis@google.com
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 682814e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    coltonlewis authored and Michael Tokarev committed Sep 11, 2023
    Copy the full SHA
    0524a2d View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2023

  1. hw/char: riscv_htif: Avoid using magic numbers

    The Spike HTIF is poorly documented. The only relevant info we can
    get from the internet is from Andrew Waterman at [1].
    
    Add a comment block before htif_handle_tohost_write() to explain
    the tohost register format, and use meaningful macros instead of
    magic numbers in the codes.
    
    While we are here, correct 2 multi-line comment blocks that have
    wrong format.
    
    Link: riscv-software-src/riscv-isa-sim#364 (comment) [1]
    Signed-off-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-Id: <20221229091828.1945072-2-bmeng@tinylab.org>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 753ae97)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    lbmeng authored and Michael Tokarev committed Sep 12, 2023
    Copy the full SHA
    2d5e9c9 View commit details
    Browse the repository at this point in the history
  2. hw/char: riscv_htif: Use conventional 's' for HTIFState

    QEMU source codes tend to use 's' to represent the hardware state.
    Let's use it for HTIFState.
    
    Signed-off-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-Id: <20221229091828.1945072-5-bmeng@tinylab.org>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit dadee9e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    lbmeng authored and Michael Tokarev committed Sep 12, 2023
    Copy the full SHA
    c85b26d View commit details
    Browse the repository at this point in the history
  3. hw/char/riscv_htif: Fix printing of console characters on big endian …

    …hosts
    
    The character that should be printed is stored in the 64 bit "payload"
    variable. The code currently tries to print it by taking the address
    of the variable and passing this pointer to qemu_chr_fe_write(). However,
    this only works on little endian hosts where the least significant bits
    are stored on the lowest address. To do this in a portable way, we have
    to store the value in an uint8_t variable instead.
    
    Fixes: 5033606 ("RISC-V HTIF Console")
    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>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230721094720.902454-2-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit c255946)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    huth authored and Michael Tokarev committed Sep 12, 2023
    Copy the full SHA
    c0e8e5e View commit details
    Browse the repository at this point in the history
  4. 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 12, 2023
    Copy the full SHA
    550d490 View commit details
    Browse the repository at this point in the history
  5. 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 12, 2023
    Copy the full SHA
    10696f6 View commit details
    Browse the repository at this point in the history
  6. 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 12, 2023
    Copy the full SHA
    189d5bd View commit details
    Browse the repository at this point in the history
  7. 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>
    (Mjt: context adjustment due to 568e061 "hw/riscv/virt.c: rename MachineState 'mc' pointers to 'ms'")
    ConchuOD authored and Michael Tokarev committed Sep 12, 2023
    Copy the full SHA
    8d779e5 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 12, 2023
    Copy the full SHA
    71709aa 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 12, 2023
    Copy the full SHA
    d256f73 View commit details
    Browse the repository at this point in the history