[PULL 36/38] iotests/106, 214, 308: Read only one size line

2023-01-20 Thread Kevin Wolf
From: Hanna Reitz These tests read size information (sometimes disk size, sometimes virtual size) from qemu-img info's output. Once qemu-img starts printing info about child nodes, we are going to see multiple instances of that per image, but these tests are only interested in the first one, so

[PULL 08/38] qcow2: Fix theoretical corruption in store_bitmap() error path

2023-01-20 Thread Kevin Wolf
In order to write the bitmap table to the image file, it is converted to big endian. If the write fails, it is passed to clear_bitmap_table() to free all of the clusters it had allocated before. However, if we don't convert it back to native endianness first, we'll free things at a wrong offset. I

[PULL 22/38] block: Convert bdrv_eject() to co_wrapper

2023-01-20 Thread Kevin Wolf
From: Emanuele Giuseppe Esposito bdrv_eject() is categorized as an I/O function, and it currently doesn't run in a coroutine. We should let it take a graph rdlock since it traverses the block nodes graph, which however is only possible in a coroutine. The only caller of this function is blk_ejec

[PULL 23/38] block: Convert bdrv_lock_medium() to co_wrapper

2023-01-20 Thread Kevin Wolf
From: Emanuele Giuseppe Esposito bdrv_lock_medium() is categorized as an I/O function, and it currently doesn't run in a coroutine. We should let it take a graph rdlock since it traverses the block nodes graph, which however is only possible in a coroutine. The only caller of this function is bl

[PULL 33/38] block/qapi: Introduce BlockGraphInfo

2023-01-20 Thread Kevin Wolf
From: Hanna Reitz Introduce a new QAPI type BlockGraphInfo and an associated bdrv_query_block_graph_info() function that recursively gathers BlockNodeInfo objects through a block graph. A follow-up patch is going to make "qemu-img info" use this to print information about all nodes that are (usu

Re: [RFC PATCH 2/2] hw/sd: skip double power-up in sd_vmstate_pre_load()

2023-01-20 Thread Philippe Mathieu-Daudé
+David / Juan / Peter for migration and timers. On 20/1/23 13:01, Daniel Henrique Barboza wrote: At this moment any migration with the RISC-V sifive_u machine fails with the following error: qemu-system-riscv64: ../hw/sd/sd.c:297: sd_ocr_powerup: Assertion `!FIELD_EX32(sd->ocr, OCR, CARD_POWER_

Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode

2023-01-20 Thread Alexandre Ghiti
On Fri, Jan 20, 2023 at 10:53 AM Andrew Jones wrote: > > On Fri, Jan 20, 2023 at 09:46:05AM +1000, Alistair Francis wrote: > > On Thu, Jan 19, 2023 at 11:00 PM Alexandre Ghiti > > wrote: > > > > > > Hi Alistair, Andrew, > > > > > > On Thu, Jan 19, 2023 at 1:25 AM Alistair Francis > > > wrote:

Re: QEMU iotest 267 failure / assertion in migration code

2023-01-20 Thread Thomas Huth
On 18/01/2023 19.02, Dr. David Alan Gilbert wrote: * Thomas Huth (th...@redhat.com) wrote: Hi! I just ran "make check" in a build directory where I did not compile qemu-system-x86_64, and got a failure with iotest 267. Re-running the "check" script directly got me some more information: $

Re: [PULL 0/5] tcg patch queue

2023-01-20 Thread Thomas Huth
On 20/01/2023 11.53, Ilya Leoshkevich wrote: On Fri, 2023-01-20 at 10:41 +0100, Thomas Huth wrote: On 16/01/2023 23.36, Richard Henderson wrote: The following changes since commit fb7e7990342e59cf67dbd895c1a1e3fb1741df7a:    tests/qtest/qom-test: Do not print tested properties by default (202

Re: [PATCH 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB

2023-01-20 Thread Cédric Le Goater
On 1/20/23 13:28, Philippe Mathieu-Daudé wrote: The M2S-FG484 SOM uses a 16 MiB SPI flash (Spansion S25FL128SDPBHICO). Since the test asset is bigger, truncate it to the correct size to avoid when running the test_arm_emcraft_sf2 test: qemu-system-arm: device requires 16777216 bytes, block b

Re: [PATCH 1/2] tests/avocado: Factor file_truncate() helper out

2023-01-20 Thread Cédric Le Goater
On 1/20/23 13:28, Philippe Mathieu-Daudé wrote: Factor file_truncate() helper out of image_pow2ceil_expand() for reuse. Signed-off-by: Philippe Mathieu-Daudé > --- tests/avocado/boot_linux_console.py | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/avoc

[PATCH v3 0/4] Nested virtualization fixes for QEMU

2023-01-20 Thread Anup Patel
This series mainly includes fixes discovered while developing nested virtualization running on QEMU. These patches can also be found in the riscv_nested_fixes_v3 branch at: https://github.com/avpatel/qemu.git Changes since v2: - Dropped PATCH1 since it is already merged - Rebased on latest risc

[PATCH v3 4/4] target/riscv: Ensure opcode is saved for all relevant instructions

2023-01-20 Thread Anup Patel
We should call decode_save_opc() for all relevant instructions which can potentially generate a virtual instruction fault or a guest page fault because generating transformed instruction upon guest page fault expects opcode to be available. Without this, hypervisor will see transformed instruction

[PATCH v3 3/4] target/riscv: No need to re-start QEMU timer when timecmp == UINT64_MAX

2023-01-20 Thread Anup Patel
The time CSR will wrap-around immediately after reaching UINT64_MAX so we don't need to re-start QEMU timer when timecmp == UINT64_MAX in riscv_timer_write_timecmp(). Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/time_helper.c | 24 1 file cha

[PATCH v3 2/4] target/riscv: Don't clear mask in riscv_cpu_update_mip() for VSTIP

2023-01-20 Thread Anup Patel
Instead of clearing mask in riscv_cpu_update_mip() for VSTIP, we should call riscv_cpu_update_mip() with mask == 0 from timer_helper.c for VSTIP. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/cpu_helper.c |

[PATCH v3 1/4] target/riscv: Update VS timer whenever htimedelta changes

2023-01-20 Thread Anup Patel
The htimedelta[h] CSR has impact on the VS timer comparison so we should call riscv_timer_write_timecmp() whenever htimedelta changes. Fixes: 3ec0fe18a31f ("target/riscv: Add vstimecmp suppor") Signed-off-by: Anup Patel Reviewed-by: Alistair Francis --- target/riscv/csr.c | 16

[PATCH v8 30/58] hw/xen: Implement EVTCHNOP_unmask

2023-01-20 Thread David Woodhouse
From: David Woodhouse This finally comes with a mechanism for actually injecting events into the guest vCPU, with all the atomic-test-and-set that's involved in setting the bit in the shinfo, then the index in the vcpu_info, and injecting either the lapic vector as MSI, or letting KVM inject the

[PATCH v8 38/58] i386/xen: add monitor commands to test event injection

2023-01-20 Thread David Woodhouse
From: Joao Martins Specifically add listing, injection of event channels. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Acked-by: Dr. David Alan Gilbert --- hmp-commands.hx | 29 + hw/i386/kvm/xen_evtchn.c | 137 +++ include/

[PATCH v8 25/58] i386/xen: implement HVMOP_set_param

2023-01-20 Thread David Woodhouse
From: Ankur Arora This is the hook for adding the HVM_PARAM_CALLBACK_IRQ parameter in a subsequent commit. Signed-off-by: Ankur Arora Signed-off-by: Joao Martins [dwmw2: Split out from another commit] Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-emu.c | 3

[PATCH v8 46/58] i386/xen: handle PV timer hypercalls

2023-01-20 Thread David Woodhouse
From: Joao Martins Introduce support for one shot and periodic mode of Xen PV timers, whereby timer interrupts come through a special virq event channel with deadlines being set through: 1) set_timer_op hypercall (only oneshot) 2) vcpu_op hypercall for {set,stop}_{singleshot,periodic}_timer hype

[PATCH v8 12/58] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield

2023-01-20 Thread David Woodhouse
From: David Woodhouse They both do the same thing and just call sched_yield. This is enough to stop the Linux guest panicking when running on a host kernel which doesn't intercept SCHEDOP_poll and lets it reach userspace. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i38

[PATCH v8 56/58] hw/xen: Support GSI mapping to PIRQ

2023-01-20 Thread David Woodhouse
From: David Woodhouse If I advertise XENFEAT_hvm_pirqs then a guest now boots successfully as long as I tell it 'pci=nomsi'. [root@localhost ~]# cat /proc/interrupts CPU0 0: 52 IO-APIC 2-edge timer 1: 16 xen-pirq 1-ioapic-edge i8042 4: 1534 xe

[PATCH v8 58/58] kvm/i386: Add xen-evtchn-max-pirq property

2023-01-20 Thread David Woodhouse
From: David Woodhouse The default number of PIRQs is set to 256 to avoid issues with 32-bit MSI devices. Allow it to be increased if the user desires. Signed-off-by: David Woodhouse --- accel/kvm/kvm-all.c | 1 + hw/i386/kvm/xen_evtchn.c | 21 +++-- include/sysemu/kvm_i

[PATCH v8 34/58] hw/xen: Implement EVTCHNOP_alloc_unbound

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 32 hw/i386/kvm/xen_evtchn.h | 2 ++ target/i386/kvm/xen-emu.c | 15 +++ 3 files changed, 49 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen

[PATCH v8 48/58] i386/xen: handle HVMOP_get_param

2023-01-20 Thread David Woodhouse
From: Joao Martins Which is used to fetch xenstore PFN and port to be used by the guest. This is preallocated by the toolstack when guest will just read those and use it straight away. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse --- target/i386/kvm/xen-emu.c | 39 ++

[PATCH v8 06/58] i386/hvm: Set Xen vCPU ID in KVM

2023-01-20 Thread David Woodhouse
From: David Woodhouse There are (at least) three different vCPU ID number spaces. One is the internal KVM vCPU index, based purely on which vCPU was chronologically created in the kernel first. If userspace threads are all spawned and create their KVM vCPUs in essentially random order, then the K

[PATCH v8 52/58] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests

2023-01-20 Thread David Woodhouse
From: David Woodhouse It isn't strictly mandatory but Linux guests at least will only map their grant tables over the dummy BAR that it provides, and don't sufficient wit to map them in any other unused part of their guest address space. So include it by default for minimal surprise factor. As I

[PATCH v8 15/58] i386/xen: manage and save/restore Xen guest long_mode setting

2023-01-20 Thread David Woodhouse
From: David Woodhouse Xen will "latch" the guest's 32-bit or 64-bit ("long mode") setting when the guest writes the MSR to fill in the hypercall page, or when the guest sets the event channel callback in HVM_PARAM_CALLBACK_IRQ. KVM handles the former and sets the kernel's long_mode flag accordin

[PATCH v8 41/58] kvm/i386: Add xen-gnttab-max-frames property

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- accel/kvm/kvm-all.c | 1 + include/sysemu/kvm_int.h | 1 + include/sysemu/kvm_xen.h | 1 + target/i386/kvm/kvm.c | 34 ++ target/i386/kvm/xen-emu.c | 6 ++ 5 files changed, 43 insertions

[PATCH v8 04/58] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support

2023-01-20 Thread David Woodhouse
From: David Woodhouse This just initializes the basic Xen support in KVM for now. Only permitted on TYPE_PC_MACHINE because that's where the sysbus devices for Xen heap overlay, event channel, grant tables and other stuff will exist. There's no point having the basic hypercall support if nothing

[PATCH v8 37/58] hw/xen: Implement EVTCHNOP_reset

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 29 + hw/i386/kvm/xen_evtchn.h | 3 +++ target/i386/kvm/xen-emu.c | 17 + 3 files changed, 49 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen

[PATCH v8 35/58] hw/xen: Implement EVTCHNOP_bind_interdomain

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 78 +++ hw/i386/kvm/xen_evtchn.h | 2 + target/i386/kvm/xen-emu.c | 16 3 files changed, 96 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_

[PATCH v8 43/58] hw/xen: Support mapping grant frames

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_gnttab.c | 74 ++- hw/i386/kvm/xen_overlay.c | 2 +- hw/i386/kvm/xen_overlay.h | 2 ++ 3 files changed, 76 insertions(+), 2 deletions(-) diff --git a/hw/i386/kvm/xen_gnttab.c b/hw/i3

[PATCH v8 53/58] i386/xen: Document Xen HVM emulation

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- docs/system/i386/xen.rst| 50 + docs/system/target-i386.rst | 1 + 2 files changed, 51 insertions(+) create mode 100644 docs/system/i386/xen.rst diff --git a/docs/system/i386/xen.rst b/docs/syste

[PATCH v8 40/58] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback

2023-01-20 Thread David Woodhouse
From: David Woodhouse The guest is permitted to specify an arbitrary domain/bus/device/function and INTX pin from which the callback IRQ shall appear to have come. In QEMU we can only easily do this for devices that actually exist, and even that requires us "knowing" that it's a PCMachine in ord

Re: [PULL 00/17] Monitor patches for 2023-01-19

2023-01-20 Thread Peter Maydell
On Thu, 19 Jan 2023 at 13:27, Markus Armbruster wrote: > > The following changes since commit 7ec8aeb6048018680c06fb9205c01ca6bda08846: > > Merge tag 'pull-tpm-2023-01-17-1' of > https://github.com/stefanberger/qemu-tpm into staging (2023-01-17 15:47:53 > +) > > are available in the Git re

[PATCH v8 14/58] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode

2023-01-20 Thread David Woodhouse
From: David Woodhouse The xen_overlay device (and later similar devices for event channels and grant tables) need to be instantiated. Do this from a kvm_type method on the PC machine derivatives, since KVM is only way to support Xen emulation for now. Signed-off-by: David Woodhouse Reviewed-by:

[PATCH v8 39/58] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback

2023-01-20 Thread David Woodhouse
From: David Woodhouse The GSI callback (and later PCI_INTX) is a level triggered interrupt. It is asserted when an event channel is delivered to vCPU0, and is supposed to be cleared when the vcpu_info->evtchn_upcall_pending field for vCPU0 is cleared again. Thankfully, Xen does *not* assert the

[PATCH v8 22/58] i386/xen: handle VCPUOP_register_runstate_memory_area

2023-01-20 Thread David Woodhouse
From: Joao Martins Allow guest to setup the vcpu runstates which is used as steal clock. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/cpu.h | 1 + target/i386/kvm/xen-emu.c | 57 +++ target/i

[PATCH v8 51/58] hw/xen: Add basic ring handling to xenstore

2023-01-20 Thread David Woodhouse
From: David Woodhouse Extract requests, return ENOSYS to all of them. This is enough to allow older Linux guests to boot, as they need *something* back but it doesn't matter much what. In the first instance we're likely to wire this up over a UNIX socket to an actual xenstored implementation, bu

[PATCH v8 08/58] xen-platform: allow its creation with XEN_EMULATE mode

2023-01-20 Thread David Woodhouse
From: Joao Martins The only thing we need to fix to make this build is the PIO hack which sets the BIOS memory areas to R/W v.s. R/O. Theoretically we could hook that up to the PAM registers on the emulated PIIX, but in practice nobody cares, so just leave it doing nothing. Now it builds without

[PATCH v8 26/58] hw/xen: Add xen_evtchn device for event channel emulation

2023-01-20 Thread David Woodhouse
From: David Woodhouse Include basic support for setting HVM_PARAM_CALLBACK_IRQ to the global vector method HVM_PARAM_CALLBACK_TYPE_VECTOR, which is handled in-kernel by raising the vector whenever the vCPU's vcpu_info->evtchn_upcall_pending flag is set. Signed-off-by: David Woodhouse --- hw/i3

[PATCH v8 19/58] i386/xen: implement HYPERVISOR_vcpu_op

2023-01-20 Thread David Woodhouse
From: Joao Martins This is simply when guest tries to register a vcpu_info and since vcpu_info placement is optional in the minimum ABI therefore we can just fail with -ENOSYS Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-emu.c |

[PATCH v8 57/58] hw/xen: Support MSI mapping to PIRQ

2023-01-20 Thread David Woodhouse
From: David Woodhouse The way that Xen handles MSI PIRQs is kind of awful. There is a special MSI message which targets a PIRQ. The vector in the low bits of data must be zero. The low 8 bits of the PIRQ# are in the destination ID field, the extended destination ID field is unused, and instead t

[PATCH v8 54/58] i386/xen: Implement HYPERVISOR_physdev_op

2023-01-20 Thread David Woodhouse
From: David Woodhouse Just hook up the basic hypercalls to stubs in xen_evtchn.c for now. Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 25 hw/i386/kvm/xen_evtchn.h | 11 target/i386/kvm/xen-compat.h | 19 ++ target/i386/kvm/xen-emu.c| 118 +

[PATCH v8 49/58] hw/xen: Add backend implementation of interdomain event channel support

2023-01-20 Thread David Woodhouse
From: David Woodhouse The provides the QEMU side of interdomain event channels, allowing events to be sent to/from the guest. The API mirrors libxenevtchn, and in time both this and the real Xen one will be available through ops structures so that the PV backend drivers can use the correct one a

[PATCH v8 33/58] hw/xen: Implement EVTCHNOP_send

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 180 ++ hw/i386/kvm/xen_evtchn.h | 2 + target/i386/kvm/xen-emu.c | 12 +++ 3 files changed, 194 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_ev

[PATCH v8 28/58] hw/xen: Implement EVTCHNOP_status

2023-01-20 Thread David Woodhouse
From: David Woodhouse This adds the basic structure for maintaining the port table and reporting the status of ports therein. Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 104 ++ hw/i386/kvm/xen_evtchn.h | 3 ++ include/sysemu/kvm_xen.h

[PATCH 00/58] Xen HVM support under KVM

2023-01-20 Thread David Woodhouse
Apologies for the second posting in a week, but I'm away next week and (I hope!) we're *so* close now. I won't also repost the [RFC] set on top, but it's still there in the tree at https://git.infradead.org/users/dwmw2/qemu.git/shortlog/refs/heads/xenfv where you can see we're on the cusp of havi

[PATCH v8 11/58] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown

2023-01-20 Thread David Woodhouse
From: Joao Martins It allows to shutdown itself via hypercall with any of the 3 reasons: 1) self-reboot 2) shutdown 3) crash Implementing SCHEDOP_shutdown sub op let us handle crashes gracefully rather than leading to triple faults if it remains unimplemented. In addition, the SHUTDOWN_so

[PATCH v8 42/58] hw/xen: Add xen_gnttab device for grant table emulation

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/meson.build | 1 + hw/i386/kvm/xen_gnttab.c | 110 ++ hw/i386/kvm/xen_gnttab.h | 18 +++ hw/i386/pc.c | 2 + target/i386/kvm/xen-emu.c | 3 ++ 5 files changed, 13

[PATCH v8 05/58] i386/kvm: handle Xen HVM cpuid leaves

2023-01-20 Thread David Woodhouse
From: Joao Martins Introduce support for emulating CPUID for Xen HVM guests. It doesn't make sense to advertise the KVM leaves to a Xen guest, so do Xen unconditionally when the xen-version machine property is set. Signed-off-by: Joao Martins [dwmw2: Obtain xen_version from KVM property, make i

[PATCH v8 55/58] hw/xen: Implement emulated PIRQ hypercall support

2023-01-20 Thread David Woodhouse
From: David Woodhouse This wires up the basic infrastructure but the actual interrupts aren't there yet, so don't advertise it to the guest. Signed-off-by: David Woodhouse --- hw/i386/kvm/trace-events | 4 + hw/i386/kvm/trace.h | 1 + hw/i386/kvm/xen_evtchn.c | 300

[PATCH v8 09/58] i386/xen: handle guest hypercalls

2023-01-20 Thread David Woodhouse
From: Joao Martins This means handling the new exit reason for Xen but still crashing on purpose. As we implement each of the hypercalls we will then return the right return code. Signed-off-by: Joao Martins [dwmw2: Add CPL to hypercall tracing, disallow hypercalls from CPL > 0] Signed-off-by:

[PATCH v8 36/58] hw/xen: Implement EVTCHNOP_bind_vcpu

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 40 +++ hw/i386/kvm/xen_evtchn.h | 2 ++ target/i386/kvm/xen-emu.c | 12 3 files changed, 54 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm

[PATCH v8 50/58] hw/xen: Add xen_xenstore device for xenstore emulation

2023-01-20 Thread David Woodhouse
From: David Woodhouse Just the basic shell, with the event channel hookup. It only dumps the buffer for now; a real ring implmentation will come in a subsequent patch. Signed-off-by: David Woodhouse --- hw/i386/kvm/meson.build| 1 + hw/i386/kvm/xen_evtchn.c | 1 + hw/i386/kvm/xen_xen

[PATCH v8 23/58] i386/xen: implement HYPERVISOR_event_channel_op

2023-01-20 Thread David Woodhouse
From: Joao Martins Signed-off-by: Joao Martins [dwmw2: Ditch event_channel_op_compat which was never available to HVM guests] Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-emu.c | 25 + 1 file changed, 25 insertions(+) diff --git a/t

[PATCH v8 03/58] xen: Add XEN_DISABLED mode and make it default

2023-01-20 Thread David Woodhouse
From: David Woodhouse Also set XEN_ATTACH mode in xen_init() to reflect the truth; not that anyone ever cared before. It was *only* ever checked in xen_init_pv() before. Suggested-by: Paolo Bonzini Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- accel/xen/xen-all.c | 2 ++ incl

[PATCH v8 24/58] i386/xen: implement HVMOP_set_evtchn_upcall_vector

2023-01-20 Thread David Woodhouse
From: Ankur Arora The HVMOP_set_evtchn_upcall_vector hypercall sets the per-vCPU upcall vector, to be delivered to the local APIC just like an MSI (with an EOI). This takes precedence over the system-wide delivery method set by the HVMOP_set_param hypercall with HVM_PARAM_CALLBACK_IRQ. It's used

[PATCH v8 17/58] i386/xen: implement XENMEM_add_to_physmap_batch

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-compat.h | 24 + target/i386/kvm/xen-emu.c| 69 2 files changed, 93 insertions(+) diff --git a/target/i386/kvm/xen-compat.h b/target/i386

[PATCH v8 44/58] i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_gnttab.c | 31 hw/i386/kvm/xen_gnttab.h | 5 target/i386/kvm/xen-emu.c | 60 +++ 3 files changed, 96 insertions(+) diff --git a/hw/i386/kvm/xen_gnttab.c b/h

[PATCH v8 10/58] i386/xen: implement HYPERVISOR_xen_version

2023-01-20 Thread David Woodhouse
From: Joao Martins This is just meant to serve as an example on how we can implement hypercalls. xen_version specifically since Qemu does all kind of feature controllability. So handling that here seems appropriate. Signed-off-by: Joao Martins [dwmw2: Implement kvm_gva_rw() safely] Signed-off-b

[PATCH v8 02/58] xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation

2023-01-20 Thread David Woodhouse
From: David Woodhouse The XEN_EMU option will cover core Xen support in target/, which exists only for x86 with KVM today but could theoretically also be implemented on Arm/Aarch64 and with TCG or other accelerators (if anyone wants to run the gauntlet of struct layout compatibility, errno mappin

[PATCH v8 27/58] i386/xen: Add support for Xen event channel delivery to vCPU

2023-01-20 Thread David Woodhouse
From: David Woodhouse The kvm_xen_inject_vcpu_callback_vector() function will either deliver the per-vCPU local APIC vector (as an MSI), or just kick the vCPU out of the kernel to trigger KVM's automatic delivery of the global vector. Support for asserting the GSI/PCI_INTX callbacks will come lat

[PATCH v8 29/58] hw/xen: Implement EVTCHNOP_close

2023-01-20 Thread David Woodhouse
From: David Woodhouse It calls an internal close_port() helper which will also be used from EVTCHNOP_reset and will actually do the work to disconnect/unbind a port once any of that is actually implemented in the first place. That in turn calls a free_port() internal function which will be in er

[PATCH v8 16/58] i386/xen: implement HYPERVISOR_memory_op

2023-01-20 Thread David Woodhouse
From: Joao Martins Specifically XENMEM_add_to_physmap with space XENMAPSPACE_shared_info to allow the guest to set its shared_info page. Signed-off-by: Joao Martins [dwmw2: Use the xen_overlay device, add compat support] Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i38

[PATCH v8 07/58] xen-platform: exclude vfio-pci from the PCI platform unplug

2023-01-20 Thread David Woodhouse
From: Joao Martins Such that PCI passthrough devices work for Xen emulated guests. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- hw/i386/xen/xen_platform.c | 18 +++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/hw/i3

[PATCH v8 45/58] hw/xen: Implement GNTTABOP_query_size

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_gnttab.c | 19 +++ hw/i386/kvm/xen_gnttab.h | 2 ++ target/i386/kvm/xen-emu.c | 16 +++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/hw/i386/kvm/xen_gnttab.c b/hw/i386/kvm/

[PATCH v8 32/58] hw/xen: Implement EVTCHNOP_bind_ipi

2023-01-20 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 69 +++ hw/i386/kvm/xen_evtchn.h | 2 ++ target/i386/kvm/xen-emu.c | 15 + 3 files changed, 86 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xe

[PATCH v8 21/58] i386/xen: handle VCPUOP_register_vcpu_time_info

2023-01-20 Thread David Woodhouse
From: Joao Martins In order to support Linux vdso in Xen. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/cpu.h | 1 + target/i386/kvm/xen-emu.c | 100 +- target/i386/machine.c | 1 + 3 f

[PATCH v8 47/58] i386/xen: Reserve Xen special pages for console, xenstore rings

2023-01-20 Thread David Woodhouse
From: David Woodhouse Xen has eight frames at 0xfeff8000 for this; we only really need two for now and KVM puts the identity map at 0xfeffc000, so limit ourselves to four. Signed-off-by: David Woodhouse --- include/sysemu/kvm_xen.h | 8 target/i386/kvm/xen-emu.c | 10 ++ 2 f

Re: [PATCH v5 2/2] riscv: Allow user to set the satp mode

2023-01-20 Thread Andrew Jones
On Fri, Jan 20, 2023 at 01:44:41PM +0100, Alexandre Ghiti wrote: > On Fri, Jan 20, 2023 at 10:53 AM Andrew Jones wrote: > > > > On Fri, Jan 20, 2023 at 09:46:05AM +1000, Alistair Francis wrote: > > > On Thu, Jan 19, 2023 at 11:00 PM Alexandre Ghiti > > > wrote: > > > > > > > > Hi Alistair, Andre

[PATCH v8 20/58] i386/xen: handle VCPUOP_register_vcpu_info

2023-01-20 Thread David Woodhouse
From: Joao Martins Handle the hypercall to set a per vcpu info, and also wire up the default vcpu_info in the shared_info page for the first 32 vCPUs. To avoid deadlock within KVM a vCPU thread must set its *own* vcpu_info rather than it being set from the context in which the hypercall is invok

[PATCH v8 13/58] hw/xen: Add xen_overlay device for emulating shared xenheap pages

2023-01-20 Thread David Woodhouse
From: David Woodhouse For the shared info page and for grant tables, Xen shares its own pages from the "Xen heap" to the guest. The guest requests that a given page from a certain address space (XENMAPSPACE_shared_info, etc.) be mapped to a given GPA using the XENMEM_add_to_physmap hypercall. To

[PATCH v8 18/58] i386/xen: implement HYPERVISOR_hvm_op

2023-01-20 Thread David Woodhouse
From: Joao Martins This is when guest queries for support for HVMOP_pagetable_dying. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-emu.c | 17 + 1 file changed, 17 insertions(+) diff --git a/target/i386/kvm/xen-e

[PATCH v8 31/58] hw/xen: Implement EVTCHNOP_bind_virq

2023-01-20 Thread David Woodhouse
From: David Woodhouse Add the array of virq ports to each vCPU so that we can deliver timers, debug ports, etc. Global virqs are allocated against vCPU 0 initially, but can be migrated to other vCPUs (when we implement that). The kernel needs to know about VIRQ_TIMER in order to accelerate timer

Re: [PATCH v2 01/12] block: Improve empty format-specific info dump

2023-01-20 Thread Hanna Czenczek
On 19.01.23 15:00, Kevin Wolf wrote: Am 20.06.2022 um 18:26 hat Hanna Reitz geschrieben: When a block driver supports obtaining format-specific information, but that object only contains optional fields, it is possible that none of them are present, so that dump_qobject() (called by bdrv_image_i

[PATCH v2 0/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB

2023-01-20 Thread Philippe Mathieu-Daudé
The M2S-FG484 SOM SPI flash is 16MiB. Truncate the file provided with the Avocado test to avoid: qemu-system-arm: device requires 16777216 bytes, block backend provides 67108864 bytes before merging the "m25p80: Improve error when the backend file size does not match the device" patch: https://

Re: [PATCH v2 03/12] block/vmdk: Change extent info type

2023-01-20 Thread Hanna Czenczek
On 19.01.23 16:20, Kevin Wolf wrote: Am 20.06.2022 um 18:26 hat Hanna Reitz geschrieben: VMDK's implementation of .bdrv_get_specific_info() returns information about its extent files, ostensibly in the form of ImageInfo objects. However, it does not get this information through bdrv_query_image_

[PATCH v2 2/2] tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB

2023-01-20 Thread Philippe Mathieu-Daudé
The M2S-FG484 SOM uses a 16 MiB SPI flash (Spansion S25FL128SDPBHICO). Since the test asset is bigger, truncate it to the correct size to avoid when running the test_arm_emcraft_sf2 test: qemu-system-arm: device requires 16777216 bytes, block backend provides 67108864 bytes Add comment regard

[PATCH v2 1/2] tests/avocado: Factor file_truncate() helper out

2023-01-20 Thread Philippe Mathieu-Daudé
Factor file_truncate() helper out of image_pow2ceil_expand() for reuse. Signed-off-by: Philippe Mathieu-Daudé --- tests/avocado/boot_linux_console.py | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_

Re: [PATCH v2 00/12] qemu-img info: Show protocol-level information

2023-01-20 Thread Hanna Czenczek
On 19.01.23 21:12, Kevin Wolf wrote: Am 08.12.2022 um 13:24 hat Hanna Reitz geschrieben: On 20.06.22 18:26, Hanna Reitz wrote: Hi, This series is a v2 to: https://lists.nongnu.org/archive/html/qemu-block/2022-05/msg00042.html Ping, it looks like this still applies (to the master branch and k

[PATCH 1/4] oslib: introduce new qemu_prealloc_mem_with_timeout() api

2023-01-20 Thread Daniil Tatianin
This helper allows limiting the maximum amount time to be spent preallocating a block of memory, which is important on systems that might have unpredictable page allocation delays because of possible fragmentation or other reasons specific to the backend. It also exposes a way to register a callba

[PATCH 4/4] backends/hostmem: add an ability to make prealloc timeout fatal

2023-01-20 Thread Daniil Tatianin
This is controlled via the new 'prealloc-timeout-fatal' property and can be useful for cases when we cannot afford to not preallocate all guest pages while being time constrained. Signed-off-by: Daniil Tatianin --- backends/hostmem.c | 38 ++ include/sys

[PATCH v0 0/4] backends/hostmem: add an ability to specify prealloc timeout

2023-01-20 Thread Daniil Tatianin
This series introduces new qemu_prealloc_mem_with_timeout() api, which allows limiting the maximum amount of time to be spent on memory preallocation. It also adds prealloc statistics collection that is exposed via an optional timeout handler. This new api is then utilized by hostmem for guest RAM

[PATCH 3/4] backends/hostmem: add an ability to specify prealloc timeout

2023-01-20 Thread Daniil Tatianin
Use the new qemu_prealloc_mem_with_timeout api so that we can limit the maximum amount of time to be spent preallocating guest RAM. We also emit a warning from the timeout handler detailing the current prealloc progress and letting the user know that it was exceeded. The timeout is set to zero (no

[PATCH 2/4] backends/hostmem: move memory region preallocation logic into a helper

2023-01-20 Thread Daniil Tatianin
...so that we don't have to duplicate it in multiple places throughout the file. Signed-off-by: Daniil Tatianin --- backends/hostmem.c | 38 -- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 747e78

Re: MSYS2 and libfdt

2023-01-20 Thread Marc-André Lureau
Hi Thomas On Fri, Jan 20, 2023 at 12:31 PM Thomas Huth wrote: > > On 19/01/2023 09.56, Marc-André Lureau wrote: > > Hi > > > > On Thu, Jan 19, 2023 at 12:31 PM Thomas Huth wrote: > >> > >> > >>Hi all, > >> > >> in some spare minutes, I started playing with a patch to try to remove the > >> d

Re: [PATCH] vhost-user-fs: add capability to allow migration

2023-01-20 Thread Michael S. Tsirkin
On Thu, Jan 19, 2023 at 03:45:06PM +0200, Anton Kuchin wrote: > On 19/01/2023 14:51, Michael S. Tsirkin wrote: > > On Sun, Jan 15, 2023 at 07:09:03PM +0200, Anton Kuchin wrote: > > > Now any vhost-user-fs device makes VM unmigratable, that also prevents > > > qemu update without stopping the VM. In

[PATCH 0/2] vhost-user: Remove the nested event loop to unbreak the DPDK use case

2023-01-20 Thread Greg Kurz
The nested event loop was introduced in QEMU 6.0 to allow servicing of requests coming from the slave channel while waiting for an ack from the back-end on the master socket. It turns out this is fragile and breaks if the servicing of the slave channel causes a new message to be sent on the master

Re: [PATCH v2 01/12] block: Improve empty format-specific info dump

2023-01-20 Thread Kevin Wolf
Am 20.01.2023 um 14:35 hat Hanna Czenczek geschrieben: > On 19.01.23 15:00, Kevin Wolf wrote: > > Am 20.06.2022 um 18:26 hat Hanna Reitz geschrieben: > > > When a block driver supports obtaining format-specific information, but > > > that object only contains optional fields, it is possible that no

Re: [PATCH v14 10/11] qapi/s390/cpu topology: POLARITY_CHANGE qapi event

2023-01-20 Thread Pierre Morel
On 1/20/23 12:56, Thomas Huth wrote: On 18/01/2023 18.09, Pierre Morel wrote: On 1/12/23 12:52, Thomas Huth wrote: On 05/01/2023 15.53, Pierre Morel wrote: ...>>> +# OK +# Emitted when the guest asks to change the polarity. +# +# @polarity: polarity specified by the guest Please elab

[PATCH v2 0/7] hw/cxl: RAS error emulation and injection

2023-01-20 Thread Jonathan Cameron via
v2: Thanks to Mike Maslenkin for review. - Fix wrong parameter type to ct3d_qmp_cor_err_to_cxl() - Rework use of CXLError local variable in ct3d_reg_write() to improve code readability. CXL error reporting is complex. This series only covers the protocol related errors reported via PCIE AER - Ir

[PATCH v2 1/7] hw/pci/aer: Implement PCI_ERR_UNCOR_MASK register

2023-01-20 Thread Jonathan Cameron via
This register in AER should be both writeable and should have a default value with a couple of the errors masked including the Uncorrectable Internal Error used by CXL for it's error reporting. Signed-off-by: Jonathan Cameron --- hw/pci/pcie_aer.c | 4 include/hw/pci/pcie_regs.h |

[PATCH v2 2/7] hw/pci/aer: Add missing routing for AER errors

2023-01-20 Thread Jonathan Cameron via
PCIe r6.0 Figure 6-3 "Pseudo Logic Diagram for Selected Error Message Control and Status Bits" includes a right hand branch under "All PCI Express devices" that allows for messages to be generated or sent onwards without SERR# being set as long as the appropriate per error class bit in the PCIe Dev

Re: [PATCH v2 1/2] tests/avocado: Factor file_truncate() helper out

2023-01-20 Thread Cédric Le Goater
On 1/20/23 14:43, Philippe Mathieu-Daudé wrote: Factor file_truncate() helper out of image_pow2ceil_expand() for reuse. Signed-off-by: Philippe Mathieu-Daudé --- tests/avocado/boot_linux_console.py | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/avocad

[PATCH v2 3/7] hw/pci-bridge/cxl_root_port: Wire up AER

2023-01-20 Thread Jonathan Cameron via
We are missing necessary config write handling for AER emulation in the CXL root port. Add it based on pcie_root_port.c Signed-off-by: Jonathan Cameron --- hw/pci-bridge/cxl_root_port.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/pci-bridge/cxl_root_port.c b/hw/pci-bridge/cxl_root_

[PATCH v2 4/7] hw/pci-bridge/cxl_root_port: Wire up MSI

2023-01-20 Thread Jonathan Cameron via
Done to avoid fixing ACPI route description of traditional PCI interrupts on q35 and because we should probably move with the times anyway. Signed-off-by: Jonathan Cameron --- hw/pci-bridge/cxl_root_port.c | 61 +++ 1 file changed, 61 insertions(+) diff --git a/h

[PATCH v2 5/7] hw/mem/cxl-type3: Add AER extended capability

2023-01-20 Thread Jonathan Cameron via
This enables AER error injection to function as expected. It is intended as a building block in enabling CXL RAS error injection in the following patches. Signed-off-by: Jonathan Cameron --- hw/mem/cxl_type3.c | 13 + 1 file changed, 13 insertions(+) diff --git a/hw/mem/cxl_type3.c

[PATCH v2 6/7] hw/pci/aer: Make PCIE AER error injection facility available for other emulation to use.

2023-01-20 Thread Jonathan Cameron via
This infrastructure will be reused for CXL RAS error injection in patches that follow. Signed-off-by: Jonathan Cameron --- hw/pci/pci-internal.h | 1 - include/hw/pci/pcie_aer.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/pci/pci-internal.h b/hw/pci/pci-internal.h

<    1   2   3   >