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

2023-01-28 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 v9 06/58] i386/hvm: Set Xen vCPU ID in KVM

2023-01-28 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 v9 46/58] i386/xen: handle PV timer hypercalls

2023-01-28 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 v9 54/58] i386/xen: Implement HYPERVISOR_physdev_op

2023-01-28 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 v9 57/58] hw/xen: Support MSI mapping to PIRQ

2023-01-28 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 v9 09/58] i386/xen: handle guest hypercalls

2023-01-28 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 v9 07/58] xen-platform: exclude vfio-pci from the PCI platform unplug

2023-01-28 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 v9 40/58] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback

2023-01-28 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 v9 00/58] Xen HVM support under KVM

2023-01-28 Thread David Woodhouse
Very little changed here; I'm largely just nagging. Mostly fixing a race in the legacy GSI event delivery now that we have PV disk backends working and can test it much harder. This series is still just the basic platform support; we do now have a fully internal single-tenant implementation o

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

2023-01-28 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 v9 49/58] hw/xen: Add backend implementation of interdomain event channel support

2023-01-28 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 v9 25/58] i386/xen: implement HVMOP_set_param

2023-01-28 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 v9 50/58] hw/xen: Add xen_xenstore device for xenstore emulation

2023-01-28 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 v9 11/58] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown

2023-01-28 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 v9 42/58] hw/xen: Add xen_gnttab device for grant table emulation

2023-01-28 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 v9 41/58] kvm/i386: Add xen-gnttab-max-frames property

2023-01-28 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 v9 29/58] hw/xen: Implement EVTCHNOP_close

2023-01-28 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 v9 51/58] hw/xen: Add basic ring handling to xenstore

2023-01-28 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 v9 48/58] i386/xen: handle HVMOP_get_param

2023-01-28 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 v9 38/58] i386/xen: add monitor commands to test event injection

2023-01-28 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 v9 31/58] hw/xen: Implement EVTCHNOP_bind_virq

2023-01-28 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 v9 35/58] hw/xen: Implement EVTCHNOP_bind_interdomain

2023-01-28 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 v9 02/58] xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation

2023-01-28 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 v9 05/58] i386/kvm: handle Xen HVM cpuid leaves

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

2023-01-28 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 v9 44/58] i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson

2023-01-28 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 v9 39/58] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback

2023-01-28 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 v9 45/58] hw/xen: Implement GNTTABOP_query_size

2023-01-28 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 v9 56/58] hw/xen: Support GSI mapping to PIRQ

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

2023-01-28 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 v9 36/58] hw/xen: Implement EVTCHNOP_bind_vcpu

2023-01-28 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 v9 12/58] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield

2023-01-28 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 v9 15/58] i386/xen: manage and save/restore Xen guest long_mode setting

2023-01-28 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 v9 18/58] i386/xen: implement HYPERVISOR_hvm_op

2023-01-28 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 v9 43/58] hw/xen: Support mapping grant frames

2023-01-28 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 v9 10/58] i386/xen: implement HYPERVISOR_xen_version

2023-01-28 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 v9 22/58] i386/xen: handle VCPUOP_register_runstate_memory_area

2023-01-28 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 v9 19/58] i386/xen: implement HYPERVISOR_vcpu_op

2023-01-28 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 v9 30/58] hw/xen: Implement EVTCHNOP_unmask

2023-01-28 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 v9 58/58] kvm/i386: Add xen-evtchn-max-pirq property

2023-01-28 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 v9 55/58] hw/xen: Implement emulated PIRQ hypercall support

2023-01-28 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 v9 32/58] hw/xen: Implement EVTCHNOP_bind_ipi

2023-01-28 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 v9 37/58] hw/xen: Implement EVTCHNOP_reset

2023-01-28 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 v9 23/58] i386/xen: implement HYPERVISOR_event_channel_op

2023-01-28 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 v9 16/58] i386/xen: implement HYPERVISOR_memory_op

2023-01-28 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 v9 33/58] hw/xen: Implement EVTCHNOP_send

2023-01-28 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 v9 47/58] i386/xen: Reserve Xen special pages for console, xenstore rings

2023-01-28 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 v9 24/58] i386/xen: implement HVMOP_set_evtchn_upcall_vector

2023-01-28 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 v9 21/58] i386/xen: handle VCPUOP_register_vcpu_time_info

2023-01-28 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 v9 28/58] hw/xen: Implement EVTCHNOP_status

2023-01-28 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 v9 26/58] hw/xen: Add xen_evtchn device for event channel emulation

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

2023-01-28 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 v9 20/58] i386/xen: handle VCPUOP_register_vcpu_info

2023-01-28 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 v9 53/58] i386/xen: Document Xen HVM emulation

2023-01-28 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 v9 03/58] xen: Add XEN_DISABLED mode and make it default

2023-01-28 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 v9 34/58] hw/xen: Implement EVTCHNOP_alloc_unbound

2023-01-28 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 v9 17/58] i386/xen: implement XENMEM_add_to_physmap_batch

2023-01-28 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 v9 52/58] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests

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

Re: [PATCH 00/17] audio: improve callback interface for audio frontends

2023-01-28 Thread Volker Rümelin
Am 22.01.23 um 19:13 schrieb Mark Cave-Ayland: On 15/01/2023 13:45, Volker Rümelin wrote: Am 15.01.23 um 14:08 schrieb Volker Rümelin: Ccing a few more people who might be interested in this patch series. @Mark: After this patch series, the code in your out of tree ASC audio device (and a fe

Re: [PATCH 2/3] virtio: struct VirtQueue introduce reset

2023-01-28 Thread Michael S. Tsirkin
On Sat, Jan 28, 2023 at 03:17:23PM +0800, Xuan Zhuo wrote: > In the current design, we stop the device from operating on the vring > during per-queue reset by resetting the structure VirtQueue. > > But before the reset operation, when recycling some resources, we should > stop referencing new

Re: [PATCH 1/3] virtio: move struct VirtQueue to include file

2023-01-28 Thread Michael S. Tsirkin
On Sat, Jan 28, 2023 at 03:17:22PM +0800, Xuan Zhuo wrote: > This patch move struct VirtQueue into virtio.h. > > In order to implement Queue Reset, we have to record the queue reset > status of in struct VirtQueue and provide it to device. > > Signed-off-by: Xuan Zhuo So add an API please, no n

Re: [PATCH] pci: add enforce_slot_reserved_mask_manual property

2023-01-28 Thread Michael S. Tsirkin
On Fri, Jan 27, 2023 at 10:39:28PM -0500, Chuck Zmudzinski wrote: > On 1/27/2023 8:28 AM, Michael S. Tsirkin wrote: > > On Sun, Jan 15, 2023 at 07:49:51PM -0500, Chuck Zmudzinski wrote: > > > The current reserved slot check in do_pci_register_device(), added with > > > commit 8b8849844fd6 > > > > a

Re: [PATCH v4 01/19] scripts/clean-includes: Fully skip / ignore files

2023-01-28 Thread Michael S. Tsirkin
On Thu, Jan 19, 2023 at 07:59:41AM +0100, Markus Armbruster wrote: > When clean-includes claims to skip or ignore a file, only the part > that sanitizes use of qemu/osdep.h skips the file. The part that > looks for duplicate #include does not, and neither does committing to > Git. > > The latter

Re: [PATCH v4 04/19] bsd-user: Clean up includes

2023-01-28 Thread Michael S. Tsirkin
On Fri, Jan 27, 2023 at 10:01:57AM -0500, Michael S. Tsirkin wrote: > On Fri, Jan 27, 2023 at 02:54:30PM +, Peter Maydell wrote: > > On Thu, 19 Jan 2023 at 14:42, Warner Losh wrote: > > > > > > Also, why didn't you move sys/resource.h and other such files > > > to os-dep.h? I'm struggling to u

Re: [PATCH 1/3] virtio: move struct VirtQueue to include file

2023-01-28 Thread Xuan Zhuo
On Sat, 28 Jan 2023 05:23:46 -0500, "Michael S. Tsirkin" wrote: > On Sat, Jan 28, 2023 at 03:17:22PM +0800, Xuan Zhuo wrote: > > This patch move struct VirtQueue into virtio.h. > > > > In order to implement Queue Reset, we have to record the queue reset > > status of in struct VirtQueue and provi

Re: [PATCH 2/3] virtio: struct VirtQueue introduce reset

2023-01-28 Thread Xuan Zhuo
On Sat, 28 Jan 2023 05:22:05 -0500, "Michael S. Tsirkin" wrote: > On Sat, Jan 28, 2023 at 03:17:23PM +0800, Xuan Zhuo wrote: > > In the current design, we stop the device from operating on the vring > > during per-queue reset by resetting the structure VirtQueue. > > > > But before the reset o

Re: [PATCH qemu v3] x86: don't let decompressed kernel image clobber setup_data

2023-01-28 Thread Michael S. Tsirkin
On Mon, Jan 23, 2023 at 06:37:21AM -0600, Jason A. Donenfeld wrote: > On Mon, Jan 23, 2023 at 6:12 AM Michael S. Tsirkin wrote: > > > > On Sun, Jan 22, 2023 at 08:21:30PM -0800, Eric Biggers wrote: > > > Hi Michael, > > > > > > On Tue, Jan 10, 2023 at 12:50:42PM -0500, Michael S. Tsirkin wrote: >

Re: [PATCH 2/3] virtio: struct VirtQueue introduce reset

2023-01-28 Thread Michael S. Tsirkin
On Sat, Jan 28, 2023 at 06:41:09PM +0800, Xuan Zhuo wrote: > On Sat, 28 Jan 2023 05:22:05 -0500, "Michael S. Tsirkin" > wrote: > > On Sat, Jan 28, 2023 at 03:17:23PM +0800, Xuan Zhuo wrote: > > > In the current design, we stop the device from operating on the vring > > > during per-queue reset

Re: [PATCH v3 05/12] cryptodev: Introduce 'query-cryptodev' QMP command

2023-01-28 Thread Michael S. Tsirkin
On Sat, Jan 28, 2023 at 11:56:26AM +0800, zhenwei pi wrote: > Now we have a QMP command to query crypto devices: > virsh qemu-monitor-command vm '{"execute": "query-cryptodev"}' | jq > { > "return": [ > { > "service": [ > "akcipher", > "mac", > "hash", >

Re: [PATCH v3 00/12] Refactor cryptodev

2023-01-28 Thread Michael S. Tsirkin
On Sat, Jan 28, 2023 at 11:56:21AM +0800, zhenwei pi wrote: > v3 -> v4: > - a small change in > '0005-cryptodev-Introduce-query-cryptodev-QMP-command.patch': > use 'uint32' instead of 'int' to describe CryptodevBackendClient:queue what was the motivation for this change? we generally just use i

Re: Re: [PATCH v3 00/12] Refactor cryptodev

2023-01-28 Thread zhenwei pi
On 1/28/23 19:30, Michael S. Tsirkin wrote: On Sat, Jan 28, 2023 at 11:56:21AM +0800, zhenwei pi wrote: v3 -> v4: - a small change in '0005-cryptodev-Introduce-query-cryptodev-QMP-command.patch': use 'uint32' instead of 'int' to describe CryptodevBackendClient:queue what was the motivation

Re: Re: [PATCH v3 05/12] cryptodev: Introduce 'query-cryptodev' QMP command

2023-01-28 Thread zhenwei pi
On 1/28/23 19:30, Michael S. Tsirkin wrote: On Sat, Jan 28, 2023 at 11:56:26AM +0800, zhenwei pi wrote: Now we have a QMP command to query crypto devices: virsh qemu-monitor-command vm '{"execute": "query-cryptodev"}' | jq { "return": [ { "service": [ "akcipher",

Re: [PATCH v5] Emulate dip switch language layout settings on SUN keyboard

2023-01-28 Thread Henrik Carlqvist
On Sun, 22 Jan 2023 18:07:47 + Mark Cave-Ayland wrote: > Did you see my comments re: OpenBIOS for the earlier version of this patch? Sorry again for missing that comment, I sent a reply ( https://lists.nongnu.org/archive/html/qemu-devel/2023-01/msg05134.html ) I have now unsubscribed from th

Re: [PATCH] pci: add enforce_slot_reserved_mask_manual property

2023-01-28 Thread Chuck Zmudzinski
On 1/28/23 5:26 AM, Michael S. Tsirkin wrote: > On Fri, Jan 27, 2023 at 10:39:28PM -0500, Chuck Zmudzinski wrote: >> On 1/27/2023 8:28 AM, Michael S. Tsirkin wrote: >> > On Sun, Jan 15, 2023 at 07:49:51PM -0500, Chuck Zmudzinski wrote: >> > > The current reserved slot check in do_pci_register_devic

Re: [PATCH v10 7/9] KVM: Update lpage info when private/shared memory are mixed

2023-01-28 Thread Chao Peng
On Fri, Jan 13, 2023 at 11:16:27PM +, Sean Christopherson wrote: > On Fri, Dec 02, 2022, Chao Peng wrote: > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 9a07380f8d3c..5aefcff614d2 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -12362,6 +12362,8 @@ st

Re: [PATCH v10 9/9] KVM: Enable and expose KVM_MEM_PRIVATE

2023-01-28 Thread Chao Peng
On Sat, Jan 14, 2023 at 12:01:01AM +, Sean Christopherson wrote: > On Fri, Dec 02, 2022, Chao Peng wrote: ... > Strongly prefer to use similar logic to existing code that detects wraps: > > mem->restricted_offset + mem->memory_size < > mem->restricted_offset > > This is also w

Re: [PATCH 06/23] target/arm: Make HSTR_EL2 traps take priority over UNDEF-at-EL1

2023-01-28 Thread Peter Maydell
On Sat, 28 Jan 2023 at 01:47, Richard Henderson wrote: > > On 1/27/23 07:54, Peter Maydell wrote: > > +void HELPER(hstr_trap_check)(CPUARMState *env, uint32_t mask, uint32_t > > syndrome) > > +{ > > +if (env->cp15.hstr_el2 & mask) { > > +raise_exception(env, EXCP_UDEF, syndrome, 2); >

Re: [PATCH] pci: add enforce_slot_reserved_mask_manual property

2023-01-28 Thread Michael S. Tsirkin
On Sat, Jan 28, 2023 at 08:20:55AM -0500, Chuck Zmudzinski wrote: > On 1/28/23 5:26 AM, Michael S. Tsirkin wrote: > > On Fri, Jan 27, 2023 at 10:39:28PM -0500, Chuck Zmudzinski wrote: > >> On 1/27/2023 8:28 AM, Michael S. Tsirkin wrote: > >> > On Sun, Jan 15, 2023 at 07:49:51PM -0500, Chuck Zmudzin

[PATCH 8/9] igb: respect VT_CTL ignore MAC field

2023-01-28 Thread Sriram Yagnaraman
Also trace out a warning if replication mode is disabled, since we only support replication mode enabled. Signed-off-by: Sriram Yagnaraman --- hw/net/igb_core.c | 9 + hw/net/trace-events | 2 ++ 2 files changed, 11 insertions(+) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c inde

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

2023-01-28 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/e1000x_regs.h | 1 + hw/net/igb_core.c| 33 + hw/net/trace-events | 2 ++ 3 files changed, 24 insertions(+), 12 deletions(-) diff

[PATCH 9/9] igb: respect VMVIR and VMOLR for VLAN

2023-01-28 Thread Sriram Yagnaraman
Add support for stripping/inserting VLAN for VFs. Signed-off-by: Sriram Yagnaraman --- hw/net/igb_core.c | 100 ++ 1 file changed, 65 insertions(+), 35 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 8e33e15505..96a5c5eca3 100644

[PATCH 5/9] igb: respect E1000_VMOLR_RSSE

2023-01-28 Thread Sriram Yagnaraman
RSS for VFs is only enabled if VMOLR[n].RSSE is set. Signed-off-by: Sriram Yagnaraman --- hw/net/igb_core.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 1eb7ba168f..e4fd4a1a5f 100644 --- a/hw/net/igb_core.c ++

[PATCH 6/9] igb: add ICR_RXDW

2023-01-28 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| 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/net/e1000x_re

[PATCH 7/9] igb: implement VF Tx and Rx stats

2023-01-28 Thread Sriram Yagnaraman
Please note that loopback counters for VM to VM traffic is not implemented yet: VFGOTLBC, VFGPTLBC, VFGORLBC and VFGPRLBC. Signed-off-by: Sriram Yagnaraman --- hw/net/igb_core.c | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/hw/net/igb_core.c

[PATCH 4/9] igb: check oversized packets for VMDq

2023-01-28 Thread Sriram Yagnaraman
Signed-off-by: Sriram Yagnaraman --- hw/net/igb_core.c | 74 ++- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 6bca5459b9..1eb7ba168f 100644 --- a/hw/net/igb_core.c +++ b/hw/net/igb_core.c @@

[PATCH 1/9] MAINTAINERS: Add Sriram Yagnaraman as a igb reviewer

2023-01-28 Thread Sriram Yagnaraman
I would like to review and be informed on changes to igb device Signed-off-by: Sriram Yagnaraman --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index ece23b2b15..7d0e84ce37 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2224,6 +2224,7 @@ F: tests/qt

[PATCH 3/9] igb: implement VFRE and VFTE registers

2023-01-28 Thread Sriram Yagnaraman
Also add checks for RXDCTL/TXDCTL queue enable bits Signed-off-by: Sriram Yagnaraman --- hw/net/igb_core.c | 42 +++--- hw/net/igb_regs.h | 3 ++- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/hw/net/igb_core.c b/hw/net/igb_core.c index 9bd

[PATCH 0/9] igb: add missing feature set from

2023-01-28 Thread Sriram Yagnaraman
Based-on: <20230126111943.38695-1-akihiko.od...@daynix.com> ([PATCH v4 00/13] Introduce igb) Rebased on latest changes from Akihiko, and merged changes from my original patchset: https://lists.gnu.org/archive/html/qemu-devel/2022-12/msg04670.html Sriram Yagnaraman (9): MAINTAINERS: Add Sriram Y

RE: [PATCH v2 00/13] Introduce igb

2023-01-28 Thread Sriram Yagnaraman
> -Original Message- > From: Akihiko Odaki > Sent: Thursday, 26 January 2023 12:32 > To: Sriram Yagnaraman ; Jason Wang > > Cc: Dmitry Fleytman ; Michael S. Tsirkin > ; Marcel Apfelbaum ; > Alex Bennée ; Philippe Mathieu-Daudé > ; Thomas Huth ; Wainer dos Santos > Moschetta ; Beraldo Leal

Re: [PATCH] pci: add enforce_slot_reserved_mask_manual property

2023-01-28 Thread Chuck Zmudzinski
On 1/28/23 2:14 PM, Michael S. Tsirkin wrote: > On Sat, Jan 28, 2023 at 08:20:55AM -0500, Chuck Zmudzinski wrote: >> On 1/28/23 5:26 AM, Michael S. Tsirkin wrote: >> > On Fri, Jan 27, 2023 at 10:39:28PM -0500, Chuck Zmudzinski wrote: >> >> On 1/27/2023 8:28 AM, Michael S. Tsirkin wrote: >> >> > On

Re: [PATCH] pci: add enforce_slot_reserved_mask_manual property

2023-01-28 Thread Mark Cave-Ayland
On 28/01/2023 03:39, Chuck Zmudzinski wrote: On 1/27/2023 8:28 AM, Michael S. Tsirkin wrote: On Sun, Jan 15, 2023 at 07:49:51PM -0500, Chuck Zmudzinski wrote: The current reserved slot check in do_pci_register_device(), added with commit 8b8849844fd6 add ("subject here") please ,is done ev

Re: [PATCH 00/17] audio: improve callback interface for audio frontends

2023-01-28 Thread Mark Cave-Ayland
On 28/01/2023 09:03, Volker Rümelin wrote: Am 22.01.23 um 19:13 schrieb Mark Cave-Ayland: On 15/01/2023 13:45, Volker Rümelin wrote: Am 15.01.23 um 14:08 schrieb Volker Rümelin: Ccing a few more people who might be interested in this patch series. @Mark: After this patch series, the code in

Re: [PATCH] hvf: arm: Add support for GICv3

2023-01-28 Thread Alexander Graf
On 06.01.23 17:37, Peter Maydell wrote: On Mon, 19 Dec 2022 at 22:08, Alexander Graf wrote: We currently only support GICv2 emulation. To also support GICv3, we will need to pass a few system registers into their respective handler functions. This patch adds support for HVF to call into the

[PATCH v2] hvf: arm: Add support for GICv3

2023-01-28 Thread Alexander Graf
We currently only support GICv2 emulation. To also support GICv3, we will need to pass a few system registers into their respective handler functions. This patch adds support for HVF to call into the TCG callbacks for GICv3 system register handlers. This is safe because the GICv3 TCG code is gener

Re: [PATCH 0/4] PCI-related cleanup for ppc/powernv

2023-01-28 Thread Daniel Henrique Barboza
On 1/27/23 09:28, Frederic Barrat wrote: Pretty simple PCI-related cleanup for powernv Frederic Barrat (4): ppc/pnv/pci: Cleanup PnvPHBPecState structure ppc/pnv/pci: Remove duplicate definition of PNV_PHB5_DEVICE_ID ppc/pnv/pci: Update PHB5 version register ppc/pnv/pci: Fix PHB x

Re: [PATCH 0/4] E500 cleanups and enhancements

2023-01-28 Thread Daniel Henrique Barboza
On 1/25/23 10:00, Bernhard Beschow wrote: This series includes some cleanups I came across when working on the ppce500 machine. Furthermore, it enables support for the 'dumpdtb' QMP/HMP command which was missing so far. Bernhard Beschow (4): hw/ppc: Set machine->fdt in e500 machines hw/

Re: [PATCH 15/23] target/arm: Mark up sysregs for HDFGRTR bits 12..63

2023-01-28 Thread Richard Henderson
On 1/27/23 07:54, Peter Maydell wrote: Mark up the sysreg definitions for the registers trapped by HDFGRTR/HDFGWTR bits 12..x. Bits 12..22 and bit 58 are for PMU registers. The remaining bits in HDFGRTR/HDFGWTR are for traps on registers that are part of features we don't implement: Bits 23..3

Re: [PATCH 16/23] target/arm: Mark up sysregs for HFGITR bits 0..11

2023-01-28 Thread Richard Henderson
On 1/27/23 07:55, Peter Maydell wrote: Mark up the sysreg definitions for the system instructions trapped by HFGITR bits 0..11. These bits cover various cache maintenance operations. Signed-off-by: Peter Maydell --- target/arm/cpregs.h | 14 ++ target/arm/helper.c | 28 +++

Re: [PATCH 17/23] target/arm: Mark up sysregs for HFGITR bits 12..17

2023-01-28 Thread Richard Henderson
On 1/27/23 07:55, Peter Maydell wrote: Mark up the sysreg definitions for the system instructions trapped by HFGITR bits 12..17. These bits cover AT address translation instructions. Signed-off-by: Peter Maydell --- target/arm/cpregs.h | 6 ++ target/arm/helper.c | 6 ++ 2 files chan

Re: [PATCH 18/23] target/arm: Mark up sysregs for HFGITR bits 18..47

2023-01-28 Thread Richard Henderson
On 1/27/23 07:55, Peter Maydell wrote: Mark up the sysreg definitions for the system instructions trapped by HFGITR bits 18..47. These bits cover TLBI TLB maintenance instructions. (If we implemented FEAT_XS we would need to trap some of the instructions added by that feature using these bits; b

  1   2   >