[PATCH v2 00/12] Add riscv kvm accel support
by Yifei Jiang
This series adds both riscv32 and riscv64 kvm support, and implements
migration based on riscv.
Because of RISC-V KVM has been merged into the Linux master, so this
series are changed from RFC to patch.
Several steps to use this:
1. Build emulation
$ ./configure --target-list=riscv64-softmmu
$ make -j$(nproc)
2. Build kernel
3. Build QEMU VM
Cross built in riscv toolchain.
$ PKG_CONFIG_LIBDIR=<toolchain pkgconfig path>
$ export PKG_CONFIG_SYSROOT_DIR=<toolchain sysroot path>
$ ./configure --target-list=riscv64-softmmu --enable-kvm \
--cross-prefix=riscv64-linux-gnu- --disable-libiscsi --disable-glusterfs \
--disable-libusb --disable-usb-redir --audio-drv-list= --disable-opengl \
--disable-libxml2
$ make -j$(nproc)
4. Start emulation
$ ./qemu-system-riscv64 -M virt -m 4096M -cpu rv64,x-h=true -nographic \
-name guest=riscv-hyp,debug-threads=on \
-smp 4 \
-bios ./fw_jump.bin \
-kernel ./Image \
-drive file=./hyp.img,format=raw,id=hd0 \
-device virtio-blk-device,drive=hd0 \
-append "root=/dev/vda rw console=ttyS0 earlycon=sbi"
5. Start kvm-acceled QEMU VM in emulation
$ ./qemu-system-riscv64 -M virt,accel=kvm -m 1024M -cpu host -nographic \
-name guest=riscv-guset \
-smp 2 \
-bios none \
-kernel ./Image \
-drive file=./guest.img,format=raw,id=hd0 \
-device virtio-blk-device,drive=hd0 \
-append "root=/dev/vda rw console=ttyS0 earlycon=sbi"
Changes since patch v1
- Rebase on recent commit a216e7cf119c91ffdf5931834a1a030ebea40d70
- Sync-up headers with Linux-5.16-rc4.
- Fixbug in kvm_arch_init_vcpu.
- Create a macro for get and put regs csr.
- Start kernel directly when kvm_enabled.
- Use riscv_cpu_set_irq to inject KVM interrupts.
- Use the Semihosting Console API for RISC-V kvm handle sbi.
- Update vmstate_riscv_cpu version id.
Placing kvm_timer into a subsection.
Changes since RFC v6
- Rebase on recent commit 8627edfb3f1fca24a96a0954148885c3241c10f8
- Sync-up headers with Linux-5.16-rc1
Changes since RFC v5
- Rebase on QEMU v6.1.0-rc1 and kvm-riscv linux v19.
- Move kvm interrupt setting to riscv_cpu_update_mip().
- Replace __u64 with uint64_t.
Changes since RFC v4
- Rebase on QEMU v6.0.0-rc2 and kvm-riscv linux v17.
- Remove time scaling support as software solution is incomplete.
Because it will cause unacceptable performance degradation. and
We will post a better solution.
- Revise according to Alistair's review comments.
- Remove compile time XLEN checks in kvm_riscv_reg_id
- Surround TYPE_RISCV_CPU_HOST definition by CONFIG_KVM and share
it between RV32 and RV64.
- Add kvm-stub.c for reduce unnecessary compilation checks.
- Add riscv_setup_direct_kernel() to direct boot kernel for KVM.
Changes since RFC v3
- Rebase on QEMU v5.2.0-rc2 and kvm-riscv linux v15.
- Add time scaling support(New patches 13, 14 and 15).
- Fix the bug that guest vm can't reboot.
Changes since RFC v2
- Fix checkpatch error at target/riscv/sbi_ecall_interface.h.
- Add riscv migration support.
Changes since RFC v1
- Add separate SBI ecall interface header.
- Add riscv32 kvm accel support.
Yifei Jiang (12):
update-linux-headers: Add asm-riscv/kvm.h
target/riscv: Add target/riscv/kvm.c to place the public kvm interface
target/riscv: Implement function kvm_arch_init_vcpu
target/riscv: Implement kvm_arch_get_registers
target/riscv: Implement kvm_arch_put_registers
target/riscv: Support start kernel directly by KVM
target/riscv: Support setting external interrupt by KVM
target/riscv: Handle KVM_EXIT_RISCV_SBI exit
target/riscv: Add host cpu type
target/riscv: Add kvm_riscv_get/put_regs_timer
target/riscv: Implement virtual time adjusting with vm state changing
target/riscv: Support virtual time context synchronization
hw/riscv/boot.c | 11 +
hw/riscv/virt.c | 54 ++-
include/hw/riscv/boot.h | 1 +
linux-headers/asm-riscv/kvm.h | 128 +++++++
linux-headers/linux/kvm.h | 8 +
meson.build | 2 +
target/riscv/cpu.c | 29 +-
target/riscv/cpu.h | 11 +
target/riscv/kvm-stub.c | 30 ++
target/riscv/kvm.c | 528 +++++++++++++++++++++++++++++
target/riscv/kvm_riscv.h | 25 ++
target/riscv/machine.c | 37 +-
target/riscv/meson.build | 1 +
target/riscv/sbi_ecall_interface.h | 72 ++++
14 files changed, 918 insertions(+), 19 deletions(-)
create mode 100644 linux-headers/asm-riscv/kvm.h
create mode 100644 target/riscv/kvm-stub.c
create mode 100644 target/riscv/kvm.c
create mode 100644 target/riscv/kvm_riscv.h
create mode 100644 target/riscv/sbi_ecall_interface.h
--
2.19.1
2 years, 11 months
[PATCH 0/7] Polkit tty agent fixes
by Martin Kletzander
Apart from fixing bz 1945501 [0] there are some small changes/fixes to some of
the polkit code.
[0] https://bugzilla.redhat.com/show_bug.cgi?id=1945501
Martin Kletzander (7):
virsh: Remove needless variable
util: Tiny reword fix in comment
util: Add virPolkitAgentAvailable
virsh: Do not try connecting first time without polkit agent
util: Report errors in all code paths in virPolkitAgentCreate
util: Check for pkttyagent availability properly
util: Make client-side polkit work even with polkit disabled
src/libvirt_private.syms | 1 +
src/util/virpolkit.c | 202 ++++++++++++++++++++++-----------------
src/util/virpolkit.h | 1 +
tools/virsh.c | 14 ++-
4 files changed, 127 insertions(+), 91 deletions(-)
--
2.34.0
2 years, 11 months
[PATCH] virt-host-validate: Fix IOMMU output on S390
by Boris Fiuczynski
Commit 93e9e92c1e eliminated the option for skipping but left code in
the s390 check which makes use of a skip. This leads to an output
without result destroying the correct format. e.g.
QEMU: Checking for hardware virtualization : PASS
QEMU: Checking if device /dev/kvm exists : PASS
QEMU: Checking if device /dev/kvm is accessible : PASS
QEMU: Checking if device /dev/vhost-net exists : PASS
QEMU: Checking if device /dev/net/tun exists : PASS
QEMU: Checking for cgroup 'cpu' controller support : PASS
QEMU: Checking for cgroup 'cpuacct' controller support : PASS
QEMU: Checking for cgroup 'cpuset' controller support : PASS
QEMU: Checking for cgroup 'memory' controller support : PASS
QEMU: Checking for cgroup 'devices' controller support : PASS
QEMU: Checking for cgroup 'blkio' controller support : PASS
QEMU: Checking for device assignment IOMMU support : QEMU: Checking for secure guest support : PASS
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
tools/virt-host-validate-common.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index 647ed7b48b..1cb9d206b5 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -378,11 +378,17 @@ int virHostValidateIOMMU(const char *hvname,
* devices (which is quite usual on s390x). If there are
* no PCI devices the directory is still there but is
* empty. */
- if (!virDirOpen(&dir, "/sys/bus/pci/devices"))
- return 0;
+ if (!virDirOpen(&dir, "/sys/bus/pci/devices")) {
+ virHostMsgFail(VIR_HOST_VALIDATE_NOTE,
+ "Skipped - PCI support disabled");
+ return VIR_HOST_VALIDATE_FAILURE(VIR_HOST_VALIDATE_NOTE);
+ }
rc = virDirRead(dir, &dent, NULL);
- if (rc <= 0)
- return 0;
+ if (rc <= 0) {
+ virHostMsgFail(VIR_HOST_VALIDATE_NOTE,
+ "Skipped - No PCI devices are online");
+ return VIR_HOST_VALIDATE_FAILURE(VIR_HOST_VALIDATE_NOTE);
+ }
virHostMsgPass();
} else {
virHostMsgFail(level,
--
2.31.1
2 years, 11 months
[PATCH v5 0/3] remove sysconfig files
by Olaf Hering
fix path to sysconfig file in NEWS.rst (jfehlig)
rebased to 85574319952af2cf538d185bd58e4ed3edc7a3e8
Olaf Hering (3):
libvirt.spec: relocate pre script of daemon-driver-qemu
remove sysconfig files
NEWS: mention removal of sysconfig
NEWS.rst | 10 +++
docs/daemons.rst | 20 +++++
docs/remote.html.in | 6 +-
libvirt.spec.in | 99 +++++++++++++++++--------
src/ch/meson.build | 5 --
src/ch/virtchd.service.in | 1 +
src/ch/virtchd.sysconf | 3 -
src/interface/meson.build | 5 --
src/interface/virtinterfaced.service.in | 1 +
src/interface/virtinterfaced.sysconf | 3 -
src/libxl/meson.build | 5 --
src/libxl/virtxend.service.in | 1 +
src/libxl/virtxend.sysconf | 3 -
src/locking/meson.build | 5 --
src/locking/virtlockd.service.in | 1 +
src/locking/virtlockd.sysconf | 3 -
src/logging/meson.build | 5 --
src/logging/virtlogd.sysconf | 3 -
src/lxc/meson.build | 5 --
src/lxc/virtlxcd.service.in | 1 +
src/lxc/virtlxcd.sysconf | 3 -
src/meson.build | 16 ----
src/network/meson.build | 5 --
src/network/virtnetworkd.service.in | 1 +
src/network/virtnetworkd.sysconf | 3 -
src/node_device/meson.build | 5 --
src/node_device/virtnodedevd.service.in | 1 +
src/node_device/virtnodedevd.sysconf | 3 -
src/nwfilter/meson.build | 5 --
src/nwfilter/virtnwfilterd.service.in | 1 +
src/nwfilter/virtnwfilterd.sysconf | 3 -
src/qemu/meson.build | 5 --
src/qemu/virtqemud.service.in | 7 ++
src/qemu/virtqemud.sysconf | 12 ---
src/remote/libvirtd.service.in | 7 ++
src/remote/libvirtd.sysconf | 21 ------
src/remote/meson.build | 10 ---
src/remote/virtproxyd.service.in | 1 +
src/remote/virtproxyd.sysconf | 3 -
src/secret/meson.build | 5 --
src/secret/virtsecretd.service.in | 1 +
src/secret/virtsecretd.sysconf | 3 -
src/storage/meson.build | 5 --
src/storage/virtstoraged.service.in | 1 +
src/storage/virtstoraged.sysconf | 3 -
src/vbox/meson.build | 5 --
src/vbox/virtvboxd.service.in | 1 +
src/vbox/virtvboxd.sysconf | 3 -
src/vz/meson.build | 5 --
src/vz/virtvzd.service.in | 1 +
src/vz/virtvzd.sysconf | 3 -
tools/libvirt-guests.sh.in | 40 ++++++++++
tools/libvirt-guests.sysconf | 50 -------------
tools/meson.build | 6 --
54 files changed, 167 insertions(+), 262 deletions(-)
delete mode 100644 src/ch/virtchd.sysconf
delete mode 100644 src/interface/virtinterfaced.sysconf
delete mode 100644 src/libxl/virtxend.sysconf
delete mode 100644 src/locking/virtlockd.sysconf
delete mode 100644 src/logging/virtlogd.sysconf
delete mode 100644 src/lxc/virtlxcd.sysconf
delete mode 100644 src/network/virtnetworkd.sysconf
delete mode 100644 src/node_device/virtnodedevd.sysconf
delete mode 100644 src/nwfilter/virtnwfilterd.sysconf
delete mode 100644 src/qemu/virtqemud.sysconf
delete mode 100644 src/remote/libvirtd.sysconf
delete mode 100644 src/remote/virtproxyd.sysconf
delete mode 100644 src/secret/virtsecretd.sysconf
delete mode 100644 src/storage/virtstoraged.sysconf
delete mode 100644 src/vbox/virtvboxd.sysconf
delete mode 100644 src/vz/virtvzd.sysconf
delete mode 100644 tools/libvirt-guests.sysconf
2 years, 11 months
[PATCH 0/4] vsh-table: Various small improvements
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (4):
vshtabletest: Fix potential memleak
vsh-table: Hide vshTableRow typedef
vsh-table.h: Modernize declarations
vsh-table: Ensure NULL terminated arguments to vshTable*()
tests/vshtabletest.c | 6 ++++--
tools/vsh-table.c | 1 +
tools/vsh-table.h | 22 ++++++++++++++++------
3 files changed, 21 insertions(+), 8 deletions(-)
--
2.32.0
2 years, 11 months
[PATCH v2 0/6] qemu: Explicitly forbid live changing nodeset for strict numatune
by Michal Privoznik
v2 of:
https://listman.redhat.com/archives/libvir-list/2021-December/msg00708.html
diff to v1:
- Wrote documentation, per Pavel's request
- Wrote a completer
Michal Prívozník (6):
manpages: Document 'restrictive' mode for numatune
virsh-completer: Provide completer for numatune --mode
qemu: Allow VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE in
qemuDomainSetNumaParamsLive()
qemu: Explicitly forbid live changing nodeset for strict numatune
qemu_command: do use host-nodes for system memory
NEWS: Document recent numatune change
NEWS.rst | 8 ++++
docs/formatdomain.rst | 3 ++
docs/manpages/virsh.rst | 10 ++---
src/libvirt-domain.c | 7 ++++
src/qemu/qemu_command.c | 3 +-
src/qemu/qemu_driver.c | 37 +++++++++++++------
.../numatune-system-memory.x86_64-latest.args | 2 +-
tools/virsh-completer-domain.c | 20 ++++++++++
tools/virsh-completer-domain.h | 5 +++
tools/virsh-domain.c | 1 +
10 files changed, 76 insertions(+), 20 deletions(-)
--
2.32.0
2 years, 11 months
[PATCH] qemucapabilitiesdata: Fix command name in caps_3.0.0.ppc64.replies
by Michal Privoznik
Under the qemucapabilitiesdata we have a replies file for
QEMU-3.0.0.ppc64. At least we think so. In fact, the file
contains replies from a development snapshot release that
predates 3.0.0 (specifically it's v2.12.0-1689-g518d23a) and as
such does not reflect any change that was made to QEMU after the
snapshot and before the official relase. One of such changes was
renaming 'exit-preconfig' command to 'x-exit-preconfig' (QEMU
commit v3.0.0-rc1~21^2~3). Ideally, we would just regenerate
capabilities using the official release but since this is a PPC64
machine and pretty old version anyway let's just fix the command
name.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies
index 3df67b71de..c12ee7814e 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.replies
@@ -1296,7 +1296,7 @@
"arg-type": "0"
},
{
- "name": "exit-preconfig",
+ "name": "x-exit-preconfig",
"ret-type": "0",
"allow-oob": false,
"allow-preconfig": true,
@@ -12327,7 +12327,7 @@
"name": "system_wakeup"
},
{
- "name": "exit-preconfig"
+ "name": "x-exit-preconfig"
},
{
"name": "cont"
--
2.32.0
2 years, 11 months
[PATCH] qemuGetSEVInfoToParams: Reformat to standard coding style
by Peter Krempa
The function was formatted weirdly which prompted additions to conform
to the unusual style.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_driver.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bae8b7c39b..372e1360b5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -19901,30 +19901,30 @@ qemuGetSEVInfoToParams(virQEMUCaps *qemuCaps,
virCheckFlags(VIR_TYPED_PARAM_STRING_OKAY, -1);
if (virTypedParamsAddString(&sevParams, &n, &maxpar,
- VIR_NODE_SEV_PDH, sev->pdh) < 0)
+ VIR_NODE_SEV_PDH, sev->pdh) < 0)
return -1;
if (virTypedParamsAddString(&sevParams, &n, &maxpar,
- VIR_NODE_SEV_CERT_CHAIN, sev->cert_chain) < 0)
+ VIR_NODE_SEV_CERT_CHAIN, sev->cert_chain) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&sevParams, &n, &maxpar,
- VIR_NODE_SEV_CBITPOS, sev->cbitpos) < 0)
+ VIR_NODE_SEV_CBITPOS, sev->cbitpos) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&sevParams, &n, &maxpar,
- VIR_NODE_SEV_REDUCED_PHYS_BITS,
- sev->reduced_phys_bits) < 0)
+ VIR_NODE_SEV_REDUCED_PHYS_BITS,
+ sev->reduced_phys_bits) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&sevParams, &n, &maxpar,
- VIR_NODE_SEV_MAX_GUESTS,
- sev->max_guests) < 0)
+ VIR_NODE_SEV_MAX_GUESTS,
+ sev->max_guests) < 0)
goto cleanup;
if (virTypedParamsAddUInt(&sevParams, &n, &maxpar,
- VIR_NODE_SEV_MAX_ES_GUESTS,
- sev->max_es_guests) < 0)
+ VIR_NODE_SEV_MAX_ES_GUESTS,
+ sev->max_es_guests) < 0)
goto cleanup;
*params = g_steal_pointer(&sevParams);
--
2.31.1
2 years, 11 months
[PATCH 0/3] qemu: Explicitly forbid changing nodeset for strict numatune
by Michal Privoznik
See 2/3 for explanation.
Michal Prívozník (3):
qemu: Allow VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE in
qemuDomainSetNumaParamsLive()
qemu: Explicitly forbid changing nodeset for strict numatune
qemu_command: do use host-nodes for system memory
src/qemu/qemu_command.c | 3 +-
src/qemu/qemu_driver.c | 37 +++++++++++++------
.../numatune-system-memory.x86_64-latest.args | 2 +-
3 files changed, 27 insertions(+), 15 deletions(-)
--
2.32.0
2 years, 11 months
[PATCH 0/2] conf: Don't crash when one of disks is missing
by Peter Krempa
Peter Krempa (2):
virDomainDiskInsert: Don't access NULL disk target
qemuxml2argvtest: disk-missing-target: Add two disks with same bus
src/conf/domain_conf.c | 1 +
tests/qemuxml2argvdata/disk-missing-target-invalid.xml | 3 +++
2 files changed, 4 insertions(+)
--
2.31.1
2 years, 11 months