[PATCH v10 15/59] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode

2023-02-01 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 v10 37/59] hw/xen: Implement EVTCHNOP_bind_vcpu

2023-02-01 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 v10 38/59] hw/xen: Implement EVTCHNOP_reset

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

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

2023-02-01 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 v10 07/59] xen-platform: exclude vfio-pci from the PCI platform unplug

2023-02-01 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 v10 28/59] i386/xen: Add support for Xen event channel delivery to vCPU

2023-02-01 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 v10 47/59] i386/xen: handle PV timer hypercalls

2023-02-01 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 v10 53/59] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests

2023-02-01 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 have sufficient wit to map them in any other unused part of their guest address space. So include it by default for minimal surprise factor.

[PATCH v10 06/59] i386/hvm: Set Xen vCPU ID in KVM

2023-02-01 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 v10 00/59] Xen HVM support under KVM

2023-02-01 Thread David Woodhouse
It turns out that after some combination of header cleanups in upstream and refinements of this patch series and the other parts that are waiting in the wings to be sent next, we *can* get away with dropping the current Xen headers over the top of the existing partial set in include/hw/xen. We had

[PATCH v10 36/59] hw/xen: Implement EVTCHNOP_bind_interdomain

2023-02-01 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 v10 43/59] hw/xen: Add xen_gnttab device for grant table emulation

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

[PATCH v10 05/59] i386/kvm: handle Xen HVM cpuid leaves

2023-02-01 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 v10 41/59] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback

2023-02-01 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

[PATCH v10 50/59] hw/xen: Add backend implementation of interdomain event channel support

2023-02-01 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 v10 59/59] i386/xen: Document Xen HVM emulation

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

[PATCH v10 54/59] i386/xen: Implement HYPERVISOR_physdev_op

2023-02-01 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 +

Re: [PATCH] x86: fix q35 kernel measurements broken due to rng seeding

2023-02-01 Thread Daniel P . Berrangé
On Wed, Feb 01, 2023 at 08:57:10AM -0500, James Bottomley wrote: > The origin commit for rng seeding 67f7e426e5 ("hw/i386: pass RNG seed > via setup_data entry") modifies the kernel image file to append a > random seed. Obviously this makes the hash of the kernel file > non-deterministic and so br

[PATCH v10 17/59] i386/xen: implement HYPERVISOR_memory_op

2023-02-01 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 v10 46/59] hw/xen: Implement GNTTABOP_query_size

2023-02-01 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 v10 19/59] i386/xen: implement HYPERVISOR_hvm_op

2023-02-01 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 v10 12/59] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield

2023-02-01 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 v10 16/59] i386/xen: manage and save/restore Xen guest long_mode setting

2023-02-01 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 v10 31/59] hw/xen: Implement EVTCHNOP_unmask

2023-02-01 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 v10 40/59] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback

2023-02-01 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 v10 32/59] hw/xen: Implement EVTCHNOP_bind_virq

2023-02-01 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

[PATCH v10 10/59] i386/xen: implement HYPERVISOR_xen_version

2023-02-01 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

[RFC PATCH v1 0/8] Look Ma! We made a XenStore

2023-02-01 Thread David Woodhouse
Starts fairly simple; a node tree with some basic refcounting and copy on write semantics. Add in watches to fire when a given subtree gets modified, then transactions which *would* have been a fairly trivial case of keeping the new one and unreffing the old if it wasn't for the fact that we nee

[PATCH v10 29/59] hw/xen: Implement EVTCHNOP_status

2023-02-01 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 Reviewed-by: Paul Durrant --- hw/i386/kvm/xen_evtchn.c | 104 ++ hw/i386/kvm/xen_evtchn.h | 3 ++

[PATCH v10 45/59] i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson

2023-02-01 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 v10 27/59] hw/xen: Add xen_evtchn device for event channel emulation

2023-02-01 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 Reviewed-b

[PATCH v10 25/59] i386/xen: implement HVMOP_set_evtchn_upcall_vector

2023-02-01 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 v10 08/59] xen-platform: allow its creation with XEN_EMULATE mode

2023-02-01 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 v10 33/59] hw/xen: Implement EVTCHNOP_bind_ipi

2023-02-01 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

[RFC PATCH v1 5/8] hw/xen: Watches on XenStore transactions

2023-02-01 Thread David Woodhouse
From: David Woodhouse Firing watches on the nodes that still exist is relatively easy; just walk the tree and look at the nodes with refcount of one. Firing watches on *deleted* nodes is more fun. We add 'modified_in_tx' and 'deleted_in_tx' flags to each node. Nodes with those flags cannot be sh

[PATCH v10 21/59] i386/xen: handle VCPUOP_register_vcpu_info

2023-02-01 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

[RFC PATCH v1 1/8] hw/xen: Add xenstore wire implementation and implementation stubs

2023-02-01 Thread David Woodhouse
From: David Woodhouse This implements the basic wire protocol for the XenStore commands, punting all the actual implementation to xs_impl_* functions which all just return errors for now. Signed-off-by: David Woodhouse --- hw/i386/kvm/meson.build | 1 + hw/i386/kvm/trace-events| 14

[RFC PATCH v1 3/8] hw/xen: Implement XenStore watches

2023-02-01 Thread David Woodhouse
From: David Woodhouse Starts out fairly simple: a hash table of watches based on the path. Except there can be multiple watches on the same path, so the watch ends up being a simple linked list, and the head of that list is in the hash table. Which makes removal a bit of a PITA but it's not so b

[PATCH v10 49/59] i386/xen: handle HVMOP_get_param

2023-02-01 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 v10 42/59] kvm/i386: Add xen-gnttab-max-frames property

2023-02-01 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

[RFC PATCH v1 8/8] hw/xen: Create initial XenStore nodes

2023-02-01 Thread David Woodhouse
From: Paul Durrant Signed-off-by: Paul Durrant Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_xenstore.c | 70 ++ 1 file changed, 70 insertions(+) diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c index 23d6d9b5a8..d72ac7093f 100644 -

Re: [RFC PATCH v2 1/3] hw/cxl: QMP based poison injection support

2023-02-01 Thread Jonathan Cameron via
On Wed, 01 Feb 2023 13:14:06 +0100 Markus Armbruster wrote: > Jonathan Cameron via writes: > > > Inject poison using qmp command cxl-inject-poison to add an entry to the > > poison list. > > > > For now, the poison is not returned CXL.mem reads, but only via the > > mailbox command Get Poison L

[PATCH v10 52/59] hw/xen: Add basic ring handling to xenstore

2023-02-01 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 v10 48/59] i386/xen: Reserve Xen special pages for console, xenstore rings

2023-02-01 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

[PATCH v10 57/59] hw/xen: Support MSI mapping to PIRQ

2023-02-01 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 v10 14/59] xen: Permit --xen-domid argument when accel is KVM

2023-02-01 Thread David Woodhouse
From: Paul Durrant Signed-off-by: Paul Durrant Signed-off-by: David Wooodhouse --- softmmu/vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 9177d95d4e..25d7ee9098 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3362,7 +3362,7 @@ void q

[PATCH v10 35/59] hw/xen: Implement EVTCHNOP_alloc_unbound

2023-02-01 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 v10 18/59] i386/xen: implement XENMEM_add_to_physmap_batch

2023-02-01 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 v10 24/59] i386/xen: implement HYPERVISOR_event_channel_op

2023-02-01 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 v10 34/59] hw/xen: Implement EVTCHNOP_send

2023-02-01 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 v10 44/59] hw/xen: Support mapping grant frames

2023-02-01 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 v10 11/59] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown

2023-02-01 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

[RFC PATCH v1 2/8] hw/xen: Add basic XenStore tree walk and write/read/directory support

2023-02-01 Thread David Woodhouse
From: David Woodhouse This is a fairly simple implementation of a copy-on-write tree. The node walk function starts off at the root, with 'inplace == true'. If it ever encounters a node with a refcount greater than one (including the root node), then that node is shared with other trees, and can

[PATCH v10 51/59] hw/xen: Add xen_xenstore device for xenstore emulation

2023-02-01 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

[RFC PATCH v1 4/8] hw/xen: Implement XenStore transactions

2023-02-01 Thread David Woodhouse
From: David Woodhouse Given that the whole thing supported copy on write from the beginning, transactions end up being fairly simple. On starting a transaction, just take a ref of the existing root; swap it back in on a successful commit. The main tree has a transaction ID too, and we keep a rec

[PATCH v10 56/59] hw/xen: Support GSI mapping to PIRQ

2023-02-01 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

[RFC PATCH v1 7/8] hw/xen: Implement core serialize/deserialize methods for xenstore_impl

2023-02-01 Thread David Woodhouse
From: David Woodhouse In fact I think we want to only serialize the contents of the domain's path in /local/domain/${domid} and leave the rest to be recreated? Will defer to Paul for that. Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_xenstore.c | 25 +- hw/i386/kvm/xenstore_impl.c | 53

[PATCH v10 23/59] i386/xen: handle VCPUOP_register_runstate_memory_area

2023-02-01 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 v10 09/59] i386/xen: handle guest hypercalls

2023-02-01 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 v10 13/59] hw/xen: Add xen_overlay device for emulating shared xenheap pages

2023-02-01 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

Re: [PATCH v5 04/20] scripts/clean-includes: Improve --git commit message

2023-02-01 Thread Juan Quintela
Markus Armbruster wrote: > Juan Quintela writes: > >> Markus Armbruster wrote: >>> Juan Quintela writes: >>> Markus Armbruster wrote: > The script drops #include "qemu/osdep.h" from headers. Mention it in > the commit message it uses for --git. > > Signed-off-by: Markus A

[PATCH v10 26/59] i386/xen: implement HVMOP_set_param

2023-02-01 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 v10 55/59] hw/xen: Implement emulated PIRQ hypercall support

2023-02-01 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 v10 39/59] i386/xen: add monitor commands to test event injection

2023-02-01 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/

Re: [PATCH v2 3/4] qemu-io: add -r option to register I/O buffer

2023-02-01 Thread Stefan Hajnoczi
On Tue, Jan 31, 2023 at 03:23:24PM -0600, Eric Blake wrote: > On Mon, Jan 30, 2023 at 04:54:14PM -0500, Stefan Hajnoczi wrote: > > The blk_register_buf() API is an optimization hint that allows some > > block drivers to avoid I/O buffer housekeeping or bounce buffers. > > > > Add an -r option to r

[PATCH v10 22/59] i386/xen: handle VCPUOP_register_vcpu_time_info

2023-02-01 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 v10 30/59] hw/xen: Implement EVTCHNOP_close

2023-02-01 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 v10 04/59] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support

2023-02-01 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

Re: [PATCH v6 29/36] target/s390x: Copy wout_x1 to wout_x1_P

2023-02-01 Thread Philippe Mathieu-Daudé
On 30/1/23 22:48, Richard Henderson wrote: Make a copy of wout_x1 before modifying it, as wout_x1_P emphasizing that it operates on the out/out2 pair. The insns that use x1_P are data movement that will not change to Int128. Acked-by: Ilya Leoshkevich Signed-off-by: Richard Henderson --- ta

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

2023-02-01 Thread Juan Quintela
Stefan Hajnoczi wrote: > On Tue, Jan 24, 2023, 04:50 Dr. David Alan Gilbert > wrote: [...] >> > I checked how bad the situation is. libvhost-user currently enables >> > LOG_ALL by default. :( >> > >> > So I don't think the front-end can use LOG_ALL alone to determine >> > whether or not migrati

Re: [PATCH v6 1/2] io: Add support for MSG_PEEK for socket channel

2023-02-01 Thread Juan Quintela
"manish.mishra" wrote: > MSG_PEEK peeks at the channel, The data is treated as unread and > the next read shall still return this data. This support is > currently added only for socket class. Extra parameter 'flags' > is added to io_readv calls to pass extra read flags like MSG_PEEK. > > Reviewed

[RFC PATCH v1 6/8] xenstore perms WIP

2023-02-01 Thread David Woodhouse
From: Paul Durrant Store perms as a GList of strings, check permissions. No unit tests yet. Signed-off-by: Paul Durrant Signed-off-by: David Woodhoues --- hw/i386/kvm/xen_xenstore.c | 2 +- hw/i386/kvm/xenstore_impl.c | 237 +--- hw/i386/kvm/xenstore_impl.h

Re: [PATCH v6 2/2] migration: check magic value for deciding the mapping of channels

2023-02-01 Thread Juan Quintela
"manish.mishra" wrote: > Current logic assumes that channel connections on the destination side are > always established in the same order as the source and the first one will > always be the main channel followed by the multifid or post-copy > preemption channel. This may not be always true, as e

Re: [PATCH] x86: fix q35 kernel measurements broken due to rng seeding

2023-02-01 Thread James Bottomley
On Wed, 2023-02-01 at 14:35 +, Daniel P. Berrangé wrote: > On Wed, Feb 01, 2023 at 08:57:10AM -0500, James Bottomley wrote: > > The origin commit for rng seeding 67f7e426e5 ("hw/i386: pass RNG > > seed > > via setup_data entry") modifies the kernel image file to append a > > random seed.  Obvio

Re: [PATCH 0/3] util/userfaultfd: Support /dev/userfaultfd

2023-02-01 Thread Peter Xu
On Wed, Feb 01, 2023 at 08:55:01AM +0100, Michal Prívozník wrote: > On 1/31/23 22:01, Peter Xu wrote: > > I'll wait 1-2 more days to see whether Michal has anything to comment. > > Yeah, we can go with your patches and leave FD passing for future work. > It's orthogonal after all. > > In the end

Re: [PATCH v6 0/2] check magic value for deciding the mapping of channels

2023-02-01 Thread Juan Quintela
"manish.mishra" wrote: > Hi Everyone, > > I was just checking if it was not missed in holidays and was received. :) Queued. Sorry for the delay.

Re: [PATCH 02/25] aspeed: Add Supermicro X11 SPI machine type

2023-02-01 Thread Guenter Roeck
On 1/31/23 23:49, Cédric Le Goater wrote: On 2/1/23 06:39, Joel Stanley wrote: On Thu, 19 Jan 2023 at 12:36, Cédric Le Goater wrote: From: Guenter Roeck supermicrox11-bmc is configured with ast2400-a1 SoC. This does not match the Supermicro documentation for X11 BMCs, and it does not match

Re: [PATCH v6 19/36] target/arm: Use tcg_gen_atomic_cmpxchg_i128 for CASP

2023-02-01 Thread Philippe Mathieu-Daudé
On 30/1/23 22:48, Richard Henderson wrote: Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-Id: <20221112042555.2622152-3-richard.hender...@linaro.org> --- target/arm/helper-a64.h| 2 -- target/arm/helper-a64.c| 43 --- target/arm/translat

Re: [PATCH] x86: fix q35 kernel measurements broken due to rng seeding

2023-02-01 Thread Jason A. Donenfeld
This is already fixed via the patch that MST just sent in his pull. So wait a few days for that to be merged and it'll be all set. No need for this patch here. Do not merge. On Wed, Feb 1, 2023, 08:57 James Bottomley wrote: > The origin commit for rng seeding 67f7e426e5 ("hw/i386: pass RNG seed

Re: [PATCH] x86: fix q35 kernel measurements broken due to rng seeding

2023-02-01 Thread Jason A. Donenfeld
This patch is not needed. It is already fixed in a pending pull. Do not merge. On Wed, Feb 1, 2023, 09:57 James Bottomley wrote: > On Wed, 2023-02-01 at 14:35 +, Daniel P. Berrangé wrote: > > On Wed, Feb 01, 2023 at 08:57:10AM -0500, James Bottomley wrote: > > > The origin commit for rng see

Re: [PATCH] x86: fix q35 kernel measurements broken due to rng seeding

2023-02-01 Thread Daniel P . Berrangé
On Wed, Feb 01, 2023 at 09:56:35AM -0500, James Bottomley wrote: > On Wed, 2023-02-01 at 14:35 +, Daniel P. Berrangé wrote: > > On Wed, Feb 01, 2023 at 08:57:10AM -0500, James Bottomley wrote: > > > The origin commit for rng seeding 67f7e426e5 ("hw/i386: pass RNG > > > seed > > > via setup_data

Re: [PATCH] x86: fix q35 kernel measurements broken due to rng seeding

2023-02-01 Thread James Bottomley
On Wed, 2023-02-01 at 10:10 -0500, Jason A. Donenfeld wrote: > This is already fixed via the patch that MST just sent in his pull. > So wait a few days for that to be merged and it'll be all set. > > No need for this patch here. Do not merge. If it's not a secret, would it be too much trouble to

[PATCH v3 1/4] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF

2023-02-01 Thread Stefan Hajnoczi
When a write request is converted into a write zeroes request by the detect-zeroes= feature, it is no longer associated with an I/O buffer. The BDRV_REQ_REGISTERED_BUF flag doesn't make sense without an I/O buffer and must be cleared because bdrv_co_do_pwrite_zeroes() fails with -EINVAL when it's s

[PATCH v3 4/4] iotests/detect-zeroes-registered-buf: add new test

2023-02-01 Thread Stefan Hajnoczi
This regression test demonstrates that detect-zeroes works with registered buffers. Bug details: https://gitlab.com/qemu-project/qemu/-/issues/1404 Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- .../tests/detect-zeroes-registered-buf| 58 +++ .../tests/detect

[PATCH v3 2/4] qemu-io: use BdrvRequestFlags instead of int

2023-02-01 Thread Stefan Hajnoczi
The block layer APIs use BdrvRequestFlags while qemu-io code uses int. Although the code compiles and runs fine, BdrvRequestFlags is clearer because it differentiates between other types of flags like bdrv_open() flags. This is purely refactoring. Reviewed-by: Eric Blake Signed-off-by: Stefan Ha

[PATCH v3 3/4] qemu-io: add -r option to register I/O buffer

2023-02-01 Thread Stefan Hajnoczi
The blk_register_buf() API is an optimization hint that allows some block drivers to avoid I/O buffer housekeeping or bounce buffers. Add an -r option to register the I/O buffer so that qemu-io can be used to test the blk_register_buf() API. The next commit will add a test that uses the new option

[PATCH v3 0/4] block: fix detect-zeroes= with BDRV_REQ_REGISTERED_BUF

2023-02-01 Thread Stefan Hajnoczi
v3: - Restore alphabetical order in getopt strings [Eric] v2: - Add comment explaining unbalanced error code path in qemu_io_alloc_from_file() [Eric] - List options alphabetically in help output [Eric] - Add Tested-by/Reviewed-by - CC qemu-stable on the fix The first patch fixes a regression in

[PATCH] target/riscv: Add RVV registers to log

2023-02-01 Thread Ivan Klokov
Added QEMU option 'rvv' to add RISC-V RVV registers to log like regular regs. Signed-off-by: Ivan Klokov --- accel/tcg/cpu-exec.c | 5 + include/hw/core/cpu.h | 2 ++ include/qemu/log.h| 3 ++- target/riscv/cpu.c| 49 ++- util/log.c

Re: [RFC v3 16/18] vfio/iommufd: Implement the iommufd backend

2023-02-01 Thread Eric Auger
Hi Jason, On 2/1/23 00:30, Jason Gunthorpe wrote: > On Tue, Jan 31, 2023 at 09:53:03PM +0100, Eric Auger wrote: >> From: Yi Liu >> >> Add the iommufd backend. The IOMMUFD container class is implemented >> based on the new /dev/iommu user API. This backend obviously depends >> on CONFIG_IOMMUFD. >

Re: [PATCH 1/9] Updated the FSF address in file hw/sh4/sh7750_regs.h

2023-02-01 Thread Markus Armbruster
I recommend to squash all the patches in this series into a single one. Khadija Kamran writes: > Signed-off-by: Khadija Kamran > --- The text below this line will not become part of the commit message. Please move it above your Signed-off-by: line. > The Free Software Foundation moved to a ne

Re: [PATCH v9 4/5] riscv: Introduce satp mode hw capabilities

2023-02-01 Thread Frank Chang
On Tue, Jan 31, 2023 at 10:36 PM Alexandre Ghiti wrote: > Currently, the max satp mode is set with the only constraint that it must > be > implemented in QEMU, i.e. set in valid_vm_1_10_[32|64]. > > But we actually need to add another level of constraint: what the hw is > actually capable of, bec

[PULL v4 00/38] Block layer patches

2023-02-01 Thread Kevin Wolf
The following changes since commit 13356edb87506c148b163b8c7eb0695647d00c2a: Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into staging (2023-01-24 09:45:33 +) are available in the Git repository at: https://repo.or.cz/qemu/kevin.git tags/for-upstream for you to fe

Re: [RFC PATCH v2 1/3] hw/cxl: QMP based poison injection support

2023-02-01 Thread Markus Armbruster
Jonathan Cameron writes: > On Wed, 01 Feb 2023 13:14:06 +0100 > Markus Armbruster wrote: [...] >> Both commit message and doc comment are rather terse. >> >> The commit message should make the case for the feature: why do we want >> it? This typically involves explaining the problem(s) it so

Re: [PULL 00/35] Testing, docs, semihosting and plugin updates

2023-02-01 Thread Peter Maydell
On Thu, 26 Jan 2023 at 11:22, Alex Bennée wrote: > > The following changes since commit 13356edb87506c148b163b8c7eb0695647d00c2a: > > Merge tag 'block-pull-request' of https://gitlab.com/stefanha/qemu into > staging (2023-01-24 09:45:33 +) > > are available in the Git repository at: > > h

Re: no more pullreq processing til February

2023-02-01 Thread Peter Maydell
On Fri, 27 Jan 2023 at 12:39, Kevin Wolf wrote: > If it worked well enough for Stefan, I think it would be worth trying to > batch some pull requests going forward. What is the downside of it? If > CI fails and flaky tests seem to be at fault, I assume you just re-run > the job, no matter whether

[PATCH v4 3/9] igb: add ICR_RXDW

2023-02-01 Thread Sriram Yagnaraman
IGB uses RXDW ICR bit to indicate that rx descriptor has been written back. This is the same as RXT0 bit in older HW. Signed-off-by: Sriram Yagnaraman --- hw/net/e1000x_regs.h | 4 hw/net/igb_core.c| 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/net/e1000x_regs.

[PATCH v4 2/9] igb: handle PF/VF reset properly

2023-02-01 Thread Sriram Yagnaraman
Use PFRSTD to reset RSTI bit for VFs, and raise VFLRE interrupt when VF is reset. Signed-off-by: Sriram Yagnaraman --- hw/net/igb_core.c | 33 + hw/net/igb_regs.h | 3 +++ hw/net/trace-events | 2 ++ 3 files changed, 26 insertions(+), 12 deletions(-) diff -

Re: [PATCH 1/9] Updated the FSF address in file hw/sh4/sh7750_regs.h

2023-02-01 Thread Khadija Kamran
Okay I understand now. I will do all these changes and send another email. On Wed, 1 Feb 2023, 8:47 pm Markus Armbruster, wrote: > I recommend to squash all the patches in this series into a single one. > > Khadija Kamran writes: > > > Signed-off-by: Khadija Kamran > > --- > > The text below t

Re: [PATCH] x86: fix q35 kernel measurements broken due to rng seeding

2023-02-01 Thread Dov Murik
Hi Jason, James, On 01/02/2023 17:24, James Bottomley wrote: > On Wed, 2023-02-01 at 10:10 -0500, Jason A. Donenfeld wrote: >> This is already fixed via the patch that MST just sent in his pull. >> So wait a few days for that to be merged and it'll be all set. >> >> No need for this patch here. D

Re: [PATCH] x86: fix q35 kernel measurements broken due to rng seeding

2023-02-01 Thread Peter Maydell
On Wed, 1 Feb 2023 at 15:25, James Bottomley wrote: > > On Wed, 2023-02-01 at 10:10 -0500, Jason A. Donenfeld wrote: > > This is already fixed via the patch that MST just sent in his pull. > > So wait a few days for that to be merged and it'll be all set. > > > > No need for this patch here. Do no

<    1   2   3   4   >