mbox series

[RFC,00/21] Xen HVM support under KVM

Message ID 20221205173137.607044-1-dwmw2@infradead.org (mailing list archive)
Headers show
Series Xen HVM support under KVM | expand

Message

David Woodhouse Dec. 5, 2022, 5:31 p.m. UTC
In 2019, Joao Martins posted a set of Linux KVM patches¹ which added
support for hosting Xen HVM guests directly under KVM. Referenced from
that post was a qemu git tree² which made use of it.

Now that the core of the kernel support has been merged upstream, I'm
looking at updating the qemu support and potentially getting it merged
too. This is the first attempt at the first round of that, adding the
basics of KVM support with '-machine xenfv' and then just enough of
the hypercall support to register the shared_info and vcpu_info areas
before the guest kernel will panic when it can't use event channels
for IPIs.

Before I go much further, I think it needs all the runtime state (the
shared info page address, etc.) to be correctly live migratable. Some
pointers on how to do that would be welcomed. There's plenty more to
heckle too...

  qemu-system-x86_64 -serial mon:stdio -machine xenfv,xen-version=0x4000a \
         -cpu host,-kvm,+xen,+xen-vapic  -display none \
         -kernel /boot/vmlinuz-5.17.8-200.fc35.x86_64 \
         -append "console=ttyS0,115200 earlyprintk=ttyS0,115200" \
         --trace "kvm_xen*"

¹ https://lore.kernel.org/kvm/20190220201609.28290-1-joao.m.martins@oracle.com/
² https://github.com/jpemartins/qemu/commits/xen-shim-rfc

Ankur Arora (2):
      kvm/ioapic: mark gsi-2 used in ioapic routing init
      i386/xen: handle event channel upcall related hypercalls

David Woodhouse (1):
      i386/xen: Add xen-version machine property and init KVM Xen support

Joao Martins (18):
      include: import xen public headers
      i386/kvm: handle Xen HVM cpuid leaves
      xen-platform-pci: allow its creation with XEN_EMULATE mode
      hw/xen_backend: refactor xen_be_init()
      pc_piix: handle XEN_EMULATE backend init
      xen-platform-pci: register xen-mmio as RAM for XEN_EMULATE
      xen_platform: exclude vfio-pci from the PCI platform unplug
      pc_piix: allow xenfv machine with XEN_EMULATE
      i386/xen: handle guest hypercalls
      i386/xen: implement HYPERCALL_xen_version
      i386/xen: set shared_info page
      i386/xen: implement HYPERVISOR_hvm_op
      i386/xen: implement HYPERVISOR_vcpu_op
      i386/xen: handle register_vcpu_info
      i386/xen: handle register_vcpu_time_memory_area
      i386/xen: handle register_runstate_memory_area
      i386/xen: implement HYPERVISOR_event_channel_op
      i386/xen: implement HYPERVISOR_sched_op

 accel/kvm/kvm-all.c                                |   11 +
 backends/cryptodev-vhost.c                         |    4 +-
 backends/vhost-user.c                              |    4 +-
 hw/block/vhost-user-blk.c                          |   45 +-
 hw/display/next-fb.c                               |    2 +-
 hw/i386/kvm/ioapic.c                               |    1 +
 hw/i386/pc.c                                       |   32 +
 hw/i386/pc_piix.c                                  |   19 +-
 hw/i386/xen/xen_platform.c                         |   37 +-
 hw/loongarch/Kconfig                               |    1 -
 hw/loongarch/acpi-build.c                          |   18 -
 hw/loongarch/virt.c                                |   62 --
 hw/net/vhost_net.c                                 |    8 +-
 hw/nvme/ctrl.c                                     |  182 +++-
 hw/scsi/vhost-scsi-common.c                        |    4 +-
 hw/virtio/trace-events                             |    4 +-
 hw/virtio/vhost-user-fs.c                          |    4 +-
 hw/virtio/vhost-user-gpio.c                        |   26 +-
 hw/virtio/vhost-user-i2c.c                         |    4 +-
 hw/virtio/vhost-user-rng.c                         |    4 +-
 hw/virtio/vhost-user.c                             |   71 --
 hw/virtio/vhost-vsock-common.c                     |    4 +-
 hw/virtio/vhost.c                                  |   44 +-
 hw/xen/xen-legacy-backend.c                        |   62 +-
 include/hw/core/cpu.h                              |    2 +
 include/hw/i386/pc.h                               |    3 +
 include/hw/loongarch/virt.h                        |    5 -
 include/hw/virtio/vhost-user-gpio.h                |   10 -
 include/hw/virtio/vhost-user.h                     |   18 -
 include/hw/virtio/vhost.h                          |    6 +-
 include/hw/virtio/virtio.h                         |   23 +-
 include/hw/xen/xen-legacy-backend.h                |    5 +
 include/standard-headers/xen/arch-x86/cpuid.h      |  118 +++
 include/standard-headers/xen/arch-x86/xen-x86_32.h |  194 ++++
 include/standard-headers/xen/arch-x86/xen-x86_64.h |  241 +++++
 include/standard-headers/xen/arch-x86/xen.h        |  398 ++++++++
 include/standard-headers/xen/event_channel.h       |  388 ++++++++
 include/standard-headers/xen/features.h            |  143 +++
 include/standard-headers/xen/grant_table.h         |  686 +++++++++++++
 include/standard-headers/xen/hvm/hvm_op.h          |  395 ++++++++
 include/standard-headers/xen/hvm/params.h          |  318 ++++++
 include/standard-headers/xen/memory.h              |  754 ++++++++++++++
 include/standard-headers/xen/physdev.h             |  383 +++++++
 include/standard-headers/xen/sched.h               |  202 ++++
 include/standard-headers/xen/trace.h               |  341 +++++++
 include/standard-headers/xen/vcpu.h                |  248 +++++
 include/standard-headers/xen/version.h             |  113 +++
 include/standard-headers/xen/xen-compat.h          |   46 +
 include/standard-headers/xen/xen.h                 | 1049 ++++++++++++++++++++
 include/sysemu/kvm.h                               |    3 +
 include/sysemu/kvm_int.h                           |    3 +
 target/i386/cpu.c                                  |    2 +
 target/i386/cpu.h                                  |   12 +
 target/i386/kvm/kvm.c                              |   95 ++
 target/i386/meson.build                            |    1 +
 target/i386/tcg/decode-new.c.inc                   |    3 +-
 target/i386/tcg/sysemu/excp_helper.c               |   34 +-
 target/i386/trace-events                           |    6 +
 target/i386/xen-proto.h                            |   23 +
 target/i386/xen.c                                  |  578 +++++++++++
 target/i386/xen.h                                  |   28 +
 target/s390x/tcg/cc_helper.c                       |    7 -
 target/s390x/tcg/insn-data.h.inc                   |    2 +-
 tests/qtest/libqos/virtio-gpio.c                   |    3 +-
 tests/qtest/migration-test.c                       |   20 +-
 65 files changed, 7141 insertions(+), 421 deletions(-)