[PATCH v5 00/10] tracing: remove dynamic vcpu state
by Alex Bennée
Hi Stefan,
The references dynamic vcpu tracing support was removed when the
original TCG trace points where removed. However there was still a
legacy of dynamic trace state to track this in cpu.h and extra hash
variables to track TBs. While the removed vcpu tracepoints are not in
generated code (or helpers) they still bring in a bunch of machinery
to manage the state so I've pulled them out. We keep and rename one
(cpu_reset) to a static trace points which dump vcpu->index as it is
useful to f4bug.
v5 added f4bug's rb, minor reword of state and rth's suggested tweak for xxhash
Please queue into your tree.
Alex Bennée (10):
*-user: remove the guest_user_syscall tracepoints
trace-events: remove the remaining vcpu trace events
trace: remove vcpu_id from the TraceEvent structure
scripts/qapi: document the tool that generated the file
qapi: make the vcpu parameters deprecated for 8.1
trace: remove code that depends on setting vcpu
trace: remove control-vcpu.h
tcg: remove the final vestiges of dstate
hw/9pfs: use qemu_xxhash4
accel/tcg: include cs_base in our hash calculations
docs/about/deprecated.rst | 9 +++
qapi/trace.json | 40 ++++++-------
accel/tcg/tb-hash.h | 6 +-
include/exec/exec-all.h | 3 -
include/hw/core/cpu.h | 5 --
include/qemu/xxhash.h | 23 +++++--
include/user/syscall-trace.h | 4 --
trace/control-internal.h | 10 ----
trace/control-vcpu.h | 63 --------------------
trace/control.h | 48 ---------------
trace/event-internal.h | 2 -
accel/tcg/cpu-exec.c | 7 +--
accel/tcg/tb-maint.c | 5 +-
accel/tcg/translate-all.c | 6 --
bsd-user/freebsd/os-syscall.c | 2 -
hw/9pfs/9p.c | 5 +-
hw/core/cpu-common.c | 6 +-
stubs/trace-control.c | 13 ----
trace/control-target.c | 109 +++-------------------------------
trace/control.c | 28 ---------
trace/qmp.c | 76 +++---------------------
trace/trace-hmp-cmds.c | 18 +-----
util/qsp.c | 2 +-
hw/core/trace-events | 3 +
scripts/qapi/gen.py | 8 ++-
scripts/tracetool/format/c.py | 6 --
scripts/tracetool/format/h.py | 16 +----
trace-events | 50 ----------------
28 files changed, 86 insertions(+), 487 deletions(-)
delete mode 100644 trace/control-vcpu.h
--
2.39.2
1 year, 6 months
[libvirt PATCH 1/2] sync_qemu_models_i386.py: Fix complaint from flake8
by Tim Wiederhake
Line was too long.
Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/cpu_map/sync_qemu_models_i386.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_models_i386.py
index 37bbe6d09e..4974b30b43 100755
--- a/src/cpu_map/sync_qemu_models_i386.py
+++ b/src/cpu_map/sync_qemu_models_i386.py
@@ -208,7 +208,8 @@ def read_builtin_x86_defs(filename):
"""Extract content between begin_mark and end_mark from file `filename` as
string, while expanding shorthand macros like "I486_FEATURES"."""
- begin_mark = re.compile("^static( const)? X86CPUDefinition builtin_x86_defs\\[\\] = {$")
+ begin_mark = re.compile(
+ "^static( const)? X86CPUDefinition builtin_x86_defs\\[\\] = {$")
end_mark = "};\n"
shorthand = re.compile("^#define ([A-Z0-9_]+_FEATURES) (.*)$")
lines = list()
--
2.39.2
1 year, 6 months
[libvirt PATCH 00/15] Sync cpu features with qemu
by Tim Wiederhake
This brings libvirt in sync qith qemu commit
886c0453cbf10eebd42a9ccf89c3e46eb389c357.
Tim Wiederhake (15):
cpu_map: Add missing feature "amd-psfd"
cpu_map: Add missing feature "amx-fp16"
cpu_map: Add missing feature "auto-ibrs"
cpu_map: Add missing feature "avx-ifma"
cpu_map: Add missing feature "avx-ne-convert"
cpu_map: Add missing feature "avx-vnni-int8"
cpu_map: Add missing feature "cmpccxadd"
cpu_map: Add missing feature "fb-clear"
cpu_map: Add missing feature "flush-l1d"
cpu_map: Add missing feature "lfence-always-serializing"
cpu_map: Add missing feature "no-nested-data-bp"
cpu_map: Add missing feature "null-sel-clr-base"
cpu_map: Add missing feature "prefetchiti"
cpu_map: Add missing feature "stibp-always-on"
cpu_map: Add missing feature "vnmi"
src/cpu_map/x86_features.xml | 48 +++++++++++++++++++
.../x86_64-cpuid-Atom-P5362-disabled.xml | 2 +-
.../x86_64-cpuid-Atom-P5362-guest.xml | 1 +
.../x86_64-cpuid-Atom-P5362-host.xml | 1 +
.../x86_64-cpuid-Cooperlake-disabled.xml | 2 +-
.../x86_64-cpuid-Cooperlake-guest.xml | 1 +
.../x86_64-cpuid-Cooperlake-host.xml | 1 +
.../x86_64-cpuid-Core-i7-7600U-disabled.xml | 2 +-
.../x86_64-cpuid-Core-i7-7600U-guest.xml | 1 +
.../x86_64-cpuid-Core-i7-7600U-host.xml | 1 +
.../x86_64-cpuid-Core-i7-8550U-disabled.xml | 2 +-
.../x86_64-cpuid-Core-i7-8550U-guest.xml | 1 +
.../x86_64-cpuid-Core-i7-8550U-host.xml | 1 +
.../x86_64-cpuid-Core-i7-8700-disabled.xml | 2 +-
.../x86_64-cpuid-Core-i7-8700-guest.xml | 1 +
.../x86_64-cpuid-Core-i7-8700-host.xml | 1 +
.../x86_64-cpuid-Ice-Lake-Server-disabled.xml | 2 +-
.../x86_64-cpuid-Ice-Lake-Server-guest.xml | 1 +
.../x86_64-cpuid-Ice-Lake-Server-host.xml | 1 +
.../x86_64-cpuid-Xeon-E3-1225-v5-disabled.xml | 2 +-
.../x86_64-cpuid-Xeon-E3-1225-v5-guest.xml | 1 +
.../x86_64-cpuid-Xeon-E3-1225-v5-host.xml | 1 +
.../x86_64-cpuid-Xeon-E5-2650-disabled.xml | 1 +
.../x86_64-cpuid-Xeon-E5-2650-guest.xml | 1 +
.../x86_64-cpuid-Xeon-E5-2650-host.xml | 1 +
.../x86_64-cpuid-Xeon-E7540-disabled.xml | 1 +
.../x86_64-cpuid-Xeon-E7540-guest.xml | 1 +
.../x86_64-cpuid-Xeon-E7540-host.xml | 1 +
.../x86_64-cpuid-Xeon-Gold-6130-disabled.xml | 2 +-
.../x86_64-cpuid-Xeon-Gold-6130-guest.xml | 1 +
.../x86_64-cpuid-Xeon-Gold-6130-host.xml | 1 +
...6_64-cpuid-Xeon-Platinum-8268-disabled.xml | 2 +-
.../x86_64-cpuid-Xeon-Platinum-8268-guest.xml | 1 +
.../x86_64-cpuid-Xeon-Platinum-8268-host.xml | 1 +
...6_64-cpuid-Xeon-Platinum-9242-disabled.xml | 2 +-
.../x86_64-cpuid-Xeon-Platinum-9242-guest.xml | 1 +
.../x86_64-cpuid-Xeon-Platinum-9242-host.xml | 1 +
37 files changed, 84 insertions(+), 10 deletions(-)
--
2.39.2
1 year, 6 months
[PATCH 0/3] docs: newapi.xsl: Generate more docs (enums & typedefs)
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (3):
docs: newapi.xsl: Generate docs on generic typedefs
docs: newapi.xsl: Generate overall docs for enums too
docs: Clarify values reported by virDomainMemoryStats()
docs/newapi.xsl | 25 +++++++++++++++++++++++++
include/libvirt/libvirt-domain.h | 3 ++-
2 files changed, 27 insertions(+), 1 deletion(-)
--
2.39.3
1 year, 6 months
[libvirt 1/2] cpu_map: Add SapphireRapids CPU model
by Lin Yang
Introduced in QEMU by commit v8.0.0-7eb061b06e.
Signed-off-by: Lin Yang <lin.a.yang(a)intel.com>
---
src/cpu_map/index.xml | 1 +
src/cpu_map/meson.build | 1 +
src/cpu_map/x86_SapphireRapids.xml | 116 +++++++++++++++++++++++++++++
3 files changed, 118 insertions(+)
create mode 100644 src/cpu_map/x86_SapphireRapids.xml
diff --git a/src/cpu_map/index.xml b/src/cpu_map/index.xml
index deae92552f..0187016c1c 100644
--- a/src/cpu_map/index.xml
+++ b/src/cpu_map/index.xml
@@ -56,6 +56,7 @@
<include filename='x86_Icelake-Server-noTSX.xml'/>
<include filename='x86_Cooperlake.xml'/>
<include filename='x86_Snowridge.xml'/>
+ <include filename='x86_SapphireRapids.xml'/>
<!-- AMD CPUs -->
<include filename='x86_athlon.xml'/>
diff --git a/src/cpu_map/meson.build b/src/cpu_map/meson.build
index 55c3703006..fa83b23474 100644
--- a/src/cpu_map/meson.build
+++ b/src/cpu_map/meson.build
@@ -72,6 +72,7 @@ cpumap_data = [
'x86_qemu64.xml',
'x86_SandyBridge-IBRS.xml',
'x86_SandyBridge.xml',
+ 'x86_SapphireRapids.xml',
'x86_Skylake-Client-IBRS.xml',
'x86_Skylake-Client-noTSX-IBRS.xml',
'x86_Skylake-Client.xml',
diff --git a/src/cpu_map/x86_SapphireRapids.xml b/src/cpu_map/x86_SapphireRapids.xml
new file mode 100644
index 0000000000..2297feeeca
--- /dev/null
+++ b/src/cpu_map/x86_SapphireRapids.xml
@@ -0,0 +1,116 @@
+<cpus>
+ <model name='SapphireRapids'>
+ <decode host='on' guest='on'/>
+ <signature family='6' model='143'/>
+ <vendor name='Intel'/>
+ <feature name='3dnowprefetch'/>
+ <feature name='abm'/>
+ <feature name='adx'/>
+ <feature name='aes'/>
+ <feature name='amx-bf16'/>
+ <feature name='amx-int8'/>
+ <feature name='amx-tile'/>
+ <feature name='apic'/>
+ <feature name='arat'/>
+ <feature name='arch-capabilities'/>
+ <feature name='avx'/>
+ <feature name='avx-vnni'/>
+ <feature name='avx2'/>
+ <feature name='avx512-bf16'/>
+ <feature name='avx512-fp16'/>
+ <feature name='avx512-vpopcntdq'/>
+ <feature name='avx512bitalg'/>
+ <feature name='avx512bw'/>
+ <feature name='avx512cd'/>
+ <feature name='avx512dq'/>
+ <feature name='avx512f'/>
+ <feature name='avx512ifma'/>
+ <feature name='avx512vbmi'/>
+ <feature name='avx512vbmi2'/>
+ <feature name='avx512vl'/>
+ <feature name='avx512vnni'/>
+ <feature name='bmi1'/>
+ <feature name='bmi2'/>
+ <feature name='bus-lock-detect'/>
+ <feature name='clflush'/>
+ <feature name='clflushopt'/>
+ <feature name='clwb'/>
+ <feature name='cmov'/>
+ <feature name='cx16'/>
+ <feature name='cx8'/>
+ <feature name='de'/>
+ <feature name='erms'/>
+ <feature name='f16c'/>
+ <feature name='fma'/>
+ <feature name='fpu'/>
+ <feature name='fsgsbase'/>
+ <feature name='fsrc'/>
+ <feature name='fsrm'/>
+ <feature name='fsrs'/>
+ <feature name='fxsr'/>
+ <feature name='fzrm'/>
+ <feature name='gfni'/>
+ <feature name='hle'/>
+ <feature name='ibrs-all'/>
+ <feature name='invpcid'/>
+ <feature name='la57'/>
+ <feature name='lahf_lm'/>
+ <feature name='lm'/>
+ <feature name='mca'/>
+ <feature name='mce'/>
+ <feature name='mds-no'/>
+ <feature name='mmx'/>
+ <feature name='movbe'/>
+ <feature name='msr'/>
+ <feature name='mtrr'/>
+ <feature name='nx'/>
+ <feature name='pae'/>
+ <feature name='pat'/>
+ <feature name='pcid'/>
+ <feature name='pclmuldq'/>
+ <feature name='pdpe1gb'/>
+ <feature name='pge'/>
+ <feature name='pku'/>
+ <feature name='pni'/>
+ <feature name='popcnt'/>
+ <feature name='pschange-mc-no'/>
+ <feature name='pse'/>
+ <feature name='pse36'/>
+ <feature name='rdctl-no'/>
+ <feature name='rdpid'/>
+ <feature name='rdrand'/>
+ <feature name='rdseed'/>
+ <feature name='rdtscp'/>
+ <feature name='rtm'/>
+ <feature name='sep'/>
+ <feature name='serialize'/>
+ <feature name='sha-ni'/>
+ <feature name='skip-l1dfl-vmentry'/>
+ <feature name='smap'/>
+ <feature name='smep'/>
+ <feature name='spec-ctrl'/>
+ <feature name='ssbd'/>
+ <feature name='sse'/>
+ <feature name='sse2'/>
+ <feature name='sse4.1'/>
+ <feature name='sse4.2'/>
+ <feature name='ssse3'/>
+ <feature name='syscall'/>
+ <feature name='taa-no'/>
+ <feature name='tsc'/>
+ <feature name='tsc-deadline'/>
+ <feature name='tsx-ldtrk'/>
+ <feature name='umip'/>
+ <feature name='vaes'/>
+ <feature name='vme'/>
+ <feature name='vpclmulqdq'/>
+ <feature name='wbnoinvd'/>
+ <feature name='x2apic'/>
+ <feature name='xfd'/>
+ <feature name='xgetbv1'/>
+ <feature name='xsave'/>
+ <feature name='xsavec'/>
+ <feature name='xsaveopt'/>
+ <feature name='xsaves'/>
+ </model>
+</cpus>
--
2.25.1
1 year, 6 months
[PATCH v4 00/10] tracing: remove dynamic vcpu state
by Alex Bennée
Hi Stefan,
The references dynamic vcpu tracing support was removed when the
original TCG trace points where removed. However there was still a
legacy of dynamic trace state to track this in cpu.h and extra hash
variables to track TBs. While the removed vcpu tracepoints are not in
generated code (or helpers) they still bring in a bunch of machinery
to manage the state so I've pulled them out. We keep and rename one
(cpu_reset) to a static trace points which dump vcpu->index as it is
useful to f4bug.
v4 addressed Markus's comments on QAPI bits and other fixes during re-base.
Please queue into your tree.
Alex Bennée (10):
*-user: remove the guest_user_syscall tracepoints
trace-events: remove the remaining vcpu trace events
trace: remove vcpu_id from the TraceEvent structure
scripts/qapi: document the tool that generated the file
qapi: make the vcpu parameters deprecated for 8.1
trace: remove code that depends on setting vcpu
trace: remove control-vcpu.h
tcg: remove the final vestiges of dstate
hw/9pfs: use qemu_xxhash4
accel/tcg: include cs_base in our hash calculations
docs/about/deprecated.rst | 9 +++
qapi/trace.json | 38 ++++++------
accel/tcg/tb-hash.h | 6 +-
include/exec/exec-all.h | 3 -
include/hw/core/cpu.h | 5 --
include/qemu/xxhash.h | 23 +++++--
include/user/syscall-trace.h | 4 --
trace/control-internal.h | 10 ----
trace/control-vcpu.h | 63 --------------------
trace/control.h | 48 ---------------
trace/event-internal.h | 2 -
accel/tcg/cpu-exec.c | 7 +--
accel/tcg/tb-maint.c | 5 +-
accel/tcg/translate-all.c | 6 --
bsd-user/freebsd/os-syscall.c | 2 -
hw/9pfs/9p.c | 5 +-
hw/core/cpu-common.c | 6 +-
stubs/trace-control.c | 13 ----
trace/control-target.c | 109 +++-------------------------------
trace/control.c | 28 ---------
trace/qmp.c | 76 +++---------------------
trace/trace-hmp-cmds.c | 17 +-----
util/qsp.c | 2 +-
hw/core/trace-events | 3 +
scripts/qapi/gen.py | 8 ++-
scripts/tracetool/format/c.py | 6 --
scripts/tracetool/format/h.py | 16 +----
trace-events | 50 ----------------
28 files changed, 86 insertions(+), 484 deletions(-)
delete mode 100644 trace/control-vcpu.h
--
2.39.2
1 year, 6 months
[PATCH] hostdev:Introduce vDPA device to hostdev subsystem as a new subtype
by libai
The following is the xml of vdpa device:
<devices>
<hostdev mode='subsystem' type='vdpa'>
<source dev='/dev/vhost-vdpa-0'/>
</hostdev>
</devices>
And the command line passed to QEMU is as follows:
-device {"driver":"vhost-vdpa-device-pci","vhostdev":"/dev/vhost-vdpa-0"}
This solution is selected according to the previous discussion
on the solution of supporting the vDPA device.
For details, see the following:
https://listman.redhat.com/archives/libvir-list/2023-March/239018.html
Signed-off-by: libai <libai12(a)huawei.com>
---
src/conf/domain_audit.c | 4 +++
src/conf/domain_conf.c | 47 +++++++++++++++++++++++++++++++++
src/conf/domain_conf.h | 6 +++++
src/conf/domain_validate.c | 1 +
src/conf/virconftypes.h | 2 ++
src/qemu/qemu_command.c | 19 +++++++++++++
src/qemu/qemu_command.h | 3 +++
src/qemu/qemu_domain.c | 6 +++++
src/qemu/qemu_hotplug.c | 1 +
src/qemu/qemu_migration.c | 2 ++
src/qemu/qemu_validate.c | 2 ++
src/security/security_dac.c | 2 ++
src/security/security_selinux.c | 2 ++
13 files changed, 97 insertions(+)
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index ae875188bd..6906ce7ade 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -344,6 +344,7 @@ virDomainAuditHostdev(virDomainObj *vm, virDomainHostdevDef *hostdev,
virDomainHostdevSubsysSCSI *scsisrc = &hostdev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIVHost *hostsrc = &hostdev->source.subsys.u.scsi_host;
virDomainHostdevSubsysMediatedDev *mdevsrc = &hostdev->source.subsys.u.mdev;
+ virDomainHostdevSubsysVDPA *vdpasrc = &hostdev->source.subsys.u.vdpa;
virUUIDFormat(vm->def->uuid, uuidstr);
if (!(vmname = virAuditEncode("vm", vm->def->name))) {
@@ -383,6 +384,9 @@ virDomainAuditHostdev(virDomainObj *vm, virDomainHostdevDef *hostdev,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
address = g_strdup(mdevsrc->uuidstr);
break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
+ address = g_strdup(vdpasrc->devpath);
+ break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
default:
VIR_WARN("Unexpected hostdev type while encoding audit message: %d",
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b03a3ff011..e8f6d1457b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1047,6 +1047,7 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys,
"scsi",
"scsi_host",
"mdev",
+ "vdpa",
);
VIR_ENUM_IMPL(virDomainHostdevSubsysPCIBackend,
@@ -2641,6 +2642,9 @@ virDomainHostdevDefClear(virDomainHostdevDef *def)
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
g_clear_pointer(&def->source.subsys.u.pci.origstates, virBitmapFree);
break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
+ VIR_FREE(def->source.subsys.u.vdpa.devpath);
+ break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
@@ -6160,6 +6164,22 @@ virDomainHostdevSubsysMediatedDevDefParseXML(virDomainHostdevDef *def,
return 0;
}
+static int
+virDomainHostdevSubsysVDPADefParseXML(xmlNodePtr sourcenode,
+ virDomainHostdevDef *def)
+{
+ g_autofree char *devpath = NULL;
+ virDomainHostdevSubsysVDPA *vdpa = &def->source.subsys.u.vdpa;
+
+ if(!(devpath = virXMLPropString(sourcenode, "dev"))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("Missing 'dev' attribute for element <source>"));
+ return -1;
+ }
+ vdpa->devpath = g_steal_pointer(&devpath);
+ return 0;
+}
+
static int
virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
xmlXPathContextPtr ctxt,
@@ -6317,6 +6337,11 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
if (virDomainHostdevSubsysMediatedDevDefParseXML(def, ctxt) < 0)
return -1;
break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
+ if (virDomainHostdevSubsysVDPADefParseXML(sourcenode, def) < 0) {
+ return -1;
+ }
+ break;
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -12979,6 +13004,7 @@ virDomainHostdevDefParseXML(virDomainXMLOption *xmlopt,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
break;
}
@@ -14101,6 +14127,13 @@ virDomainHostdevMatchSubsys(virDomainHostdevDef *a,
return 0;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
return virDomainHostdevMatchSubsysMediatedDev(a, b);
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
+ if (STREQ(a->source.subsys.u.vdpa.devpath,
+ b->source.subsys.u.vdpa.devpath)) {
+ return 1;
+ } else {
+ return 0;
+ }
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
return 0;
}
@@ -23290,6 +23323,16 @@ virDomainHostdevDefFormatSubsysMdev(virBuffer *buf,
virXMLFormatElement(buf, "source", NULL, &sourceChildBuf);
}
+static void
+virDomainHostdevDefFormatSubsysVDPA(virBuffer *buf,
+ virDomainHostdevDef *def)
+{
+ g_auto(virBuffer) sourceAttrBuf = VIR_BUFFER_INITIALIZER;
+ virDomainHostdevSubsysVDPA *vdpasrc = &def->source.subsys.u.vdpa;
+ virBufferAsprintf(&sourceAttrBuf, " dev='%s'", vdpasrc->devpath);
+ virXMLFormatElement(buf, "source", &sourceAttrBuf, NULL);
+}
+
static int
virDomainHostdevDefFormatSubsys(virBuffer *buf,
@@ -23317,6 +23360,10 @@ virDomainHostdevDefFormatSubsys(virBuffer *buf,
virDomainHostdevDefFormatSubsysMdev(buf, def);
return 0;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
+ virDomainHostdevDefFormatSubsysVDPA(buf, def);
+ return 0;
+
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
default:
virReportEnumRangeError(virDomainHostdevSubsysType, def->source.subsys.type);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 511067a050..ade8b0edec 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -197,6 +197,7 @@ typedef enum {
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI,
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST,
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV,
+ VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA,
VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
} virDomainHostdevSubsysType;
@@ -289,6 +290,10 @@ struct _virDomainHostdevSubsysMediatedDev {
virTristateSwitch ramfb;
};
+struct _virDomainHostdevSubsysVDPA {
+ char *devpath; /* vDPA device path */
+};
+
typedef enum {
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE,
VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST,
@@ -323,6 +328,7 @@ struct _virDomainHostdevSubsys {
virDomainHostdevSubsysSCSI scsi;
virDomainHostdevSubsysSCSIVHost scsi_host;
virDomainHostdevSubsysMediatedDev mdev;
+ virDomainHostdevSubsysVDPA vdpa;
} u;
};
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index e04b85fee4..4af84c4f0c 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2214,6 +2214,7 @@ virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev)
}
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
break;
}
diff --git a/src/conf/virconftypes.h b/src/conf/virconftypes.h
index e07f967814..1756c54e7a 100644
--- a/src/conf/virconftypes.h
+++ b/src/conf/virconftypes.h
@@ -120,6 +120,8 @@ typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys;
typedef struct _virDomainHostdevSubsysMediatedDev virDomainHostdevSubsysMediatedDev;
+typedef struct _virDomainHostdevSubsysVDPA virDomainHostdevSubsysVDPA;
+
typedef struct _virDomainHostdevSubsysPCI virDomainHostdevSubsysPCI;
typedef struct _virDomainHostdevSubsysSCSI virDomainHostdevSubsysSCSI;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4ca93bf3dc..121214f4d5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4958,6 +4958,18 @@ qemuBuildHostdevMediatedDevProps(const virDomainDef *def,
return g_steal_pointer(&props);
}
+virJSONValue *
+qemuBuildHostdevVDPADevProps(virDomainHostdevDef *dev)
+{
+ g_autoptr(virJSONValue) props = NULL;
+ virDomainHostdevSubsysVDPA *vdpasrc = &dev->source.subsys.u.vdpa;
+ if (virJSONValueObjectAdd(&props,
+ "s:driver", "vhost-vdpa-device-pci",
+ "s:vhostdev", vdpasrc->devpath,
+ NULL) < 0)
+ return NULL;
+ return g_steal_pointer(&props);
+}
qemuBlockStorageSourceAttachData *
qemuBuildHostdevSCSIDetachPrepare(virDomainHostdevDef *hostdev,
@@ -5154,6 +5166,13 @@ qemuBuildHostdevCommandLine(virCommand *cmd,
return -1;
break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
+ if (!(devprops = qemuBuildHostdevVDPADevProps(hostdev)))
+ return -1;
+ if (qemuBuildDeviceCommandlineFromJSON(cmd, devprops, def, qemuCaps) < 0)
+ return -1;
+ break;
+
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
break;
}
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 5fdb138030..dff18350b5 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -198,6 +198,9 @@ virJSONValue *
qemuBuildHostdevMediatedDevProps(const virDomainDef *def,
virDomainHostdevDef *dev);
+virJSONValue *
+qemuBuildHostdevVDPADevProps(virDomainHostdevDef *dev);
+
virJSONValue *
qemuBuildRedirdevDevProps(const virDomainDef *def,
virDomainRedirdevDef *dev);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 63b13b6875..0cd485a459 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10533,6 +10533,8 @@ qemuDomainGetHostdevPath(virDomainHostdevDef *dev,
virDomainHostdevSubsysSCSI *scsisrc = &dev->source.subsys.u.scsi;
virDomainHostdevSubsysSCSIVHost *hostsrc = &dev->source.subsys.u.scsi_host;
virDomainHostdevSubsysMediatedDev *mdevsrc = &dev->source.subsys.u.mdev;
+ virDomainHostdevSubsysVDPA *vdpasrc = &dev->source.subsys.u.vdpa;
+
g_autoptr(virUSBDevice) usb = NULL;
g_autoptr(virSCSIDevice) scsi = NULL;
g_autoptr(virSCSIVHostDevice) host = NULL;
@@ -10603,6 +10605,10 @@ qemuDomainGetHostdevPath(virDomainHostdevDef *dev,
if (!(tmpPath = virMediatedDeviceGetIOMMUGroupDev(mdevsrc->uuidstr)))
return -1;
+ perm = VIR_CGROUP_DEVICE_RW;
+ break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
+ tmpPath = g_strdup(vdpasrc->devpath);
perm = VIR_CGROUP_DEVICE_RW;
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 5072798cb7..7d89899223 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -4546,6 +4546,7 @@ qemuDomainRemoveHostDevice(virQEMUDriver *driver,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
qemuDomainRemoveMediatedDevice(driver, vm, hostdev);
break;
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
break;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index ed41a03851..9220ef1ab1 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1295,6 +1295,8 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+ /* The vDPA devices don't support migration for now */
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
_("cannot migrate a domain with <hostdev mode='subsystem' type='%1$s'>"),
virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index b8d5e9bd74..ea3d4e1a39 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2566,6 +2566,8 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev,
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
return qemuValidateDomainMdevDef(hostdev, def, qemuCaps);
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
+ break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
default:
virReportEnumRangeError(virDomainHostdevSubsysType,
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index c7dc145621..24f3de5d15 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1313,6 +1313,7 @@ virSecurityDACSetHostdevLabel(virSecurityManager *mgr,
break;
}
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
ret = 0;
break;
@@ -1469,6 +1470,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManager *mgr,
break;
}
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
ret = 0;
break;
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index e3e6a6115f..5cb6612fbc 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -2265,6 +2265,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManager *mgr,
break;
}
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
ret = 0;
break;
@@ -2493,6 +2494,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManager *mgr,
break;
}
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_VDPA:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
ret = 0;
break;
--
2.33.0
1 year, 6 months
[PATCH 0/4] conf, qemu: add loader type='none'
by Daniel Henrique Barboza
Hi,
Fedora Rawhide for RISC-V requires '-bios none' to properly boot
because its kernel is overwriting the default OpenSBI binary QEMU uses,
causing the following error:
$ sudo ./run tools/virsh start --console riscv-fedora
error: Failed to start domain 'riscv-fedora'
error: internal error: process exited while connecting to monitor: 2023-03-20T17:31:02.650862Z qemu-system-riscv64: Some ROM regions are overlapping
These ROM regions might have been loaded by direct user request or by default.
They could be BIOS/firmware images, a guest kernel, initrd or some other file loaded into guest memory.
Check whether you intended to load all this guest code, and whether it has been built to load to the correct addresses.
Other archs, such as PPC64 pseries, also requires "-bios none" if the
user wants QEMU to not load any default firmware.
At this moment libvirt doesn't support this option in the official API,
meaning we need to go to the <qemu:commandline> route to allow the
domain to boot, tainting it. And with a chance of weird interactions
with firmware autoselect.
These patches add official XML support for '-bios none' for QEMU domains
using a XML as follows:
<os>
<loader type='none'/>
(...)
</os>
The pre-conditions of this format are (1) no loader->path and (2) only
manual autoselect. Everything else is already covered by libvirt as
corner cases of existing firmware features.
Daniel Henrique Barboza (4):
conf: add loader type 'none'
qemu: handle bios 'none' case in qemuFirmwareFillDomain()
qemu, tests: add -bios none command line
docs: Document loader 'none' attribute
docs/formatdomain.rst | 7 +++++
src/conf/domain_conf.c | 5 +--
src/conf/domain_validate.c | 2 +-
src/conf/schemas/domaincommon.rng | 1 +
src/qemu/qemu_command.c | 6 ++++
src/qemu/qemu_firmware.c | 10 ++++++
.../firmware-bios-none.riscv64-latest.args | 31 +++++++++++++++++++
tests/qemuxml2argvdata/firmware-bios-none.xml | 18 +++++++++++
tests/qemuxml2argvtest.c | 2 ++
9 files changed, 79 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/firmware-bios-none.riscv64-latest.args
create mode 100644 tests/qemuxml2argvdata/firmware-bios-none.xml
--
2.39.2
1 year, 6 months
[PATCH] nodedev: update transient mdevs
by Boris Fiuczynski
Instead of updating defined mdevs only add another update for active
devices as well to cover transient mdev devices as well.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2143158
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
---
src/node_device/node_device_driver.c | 31 ++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 3cac25a10c..a2d0600560 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -1636,6 +1636,24 @@ virMdevctlListDefined(virNodeDeviceDef ***devs, char **errmsg)
}
+static int
+virMdevctlListActive(virNodeDeviceDef ***devs, char **errmsg)
+{
+ int status;
+ g_autofree char *output = NULL;
+ g_autoptr(virCommand) cmd = nodeDeviceGetMdevctlListCommand(false, &output, errmsg);
+
+ if (virCommandRun(cmd, &status) < 0 || status != 0) {
+ return -1;
+ }
+
+ if (!output)
+ return -1;
+
+ return nodeDeviceParseMdevctlJSON(output, devs);
+}
+
+
typedef struct _virMdevctlForEachData virMdevctlForEachData;
struct _virMdevctlForEachData {
int ndefs;
@@ -1699,6 +1717,8 @@ int
nodeDeviceUpdateMediatedDevices(void)
{
g_autofree virNodeDeviceDef **defs = NULL;
+ g_autofree virNodeDeviceDef **act_defs = NULL;
+ int act_ndefs = 0;
g_autofree char *errmsg = NULL;
g_autofree char *mdevctl = NULL;
virMdevctlForEachData data = { 0, };
@@ -1725,6 +1745,17 @@ nodeDeviceUpdateMediatedDevices(void)
if (nodeDeviceUpdateMediatedDevice(defs[i]) < 0)
return -1;
+ /* Update active/transient mdev devices */
+ if ((act_ndefs = virMdevctlListActive(&act_defs, &errmsg)) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to query mdevs from mdevctl: %1$s"), errmsg);
+ return -1;
+ }
+
+ for (i = 0; i < act_ndefs; i++)
+ if (nodeDeviceUpdateMediatedDevice(act_defs[i]) < 0)
+ return -1;
+
return 0;
}
--
2.39.0
1 year, 6 months
[PATCH 0/4] qemu: Start emulator thread with more generous cpuset.mems
by Michal Privoznik
*** BLURB HERE ***
Michal Prívozník (4):
qemuProcessSetupPid: Use @numatune variable more
qemu: Start emulator thread with more generous cpuset.mems
qemu: Start emulator thread with more generous mbind()
qemu_hotplug: Temporarily allow emulator thread to access other NUMA
nodes during mem hotplug
src/qemu/qemu_domain.c | 26 +++++++++++++++++++
src/qemu/qemu_domain.h | 5 ++++
src/qemu/qemu_hotplug.c | 8 ++++++
src/qemu/qemu_process.c | 56 +++++++++++++++++++++++++++--------------
src/qemu/qemu_process.h | 3 +++
5 files changed, 79 insertions(+), 19 deletions(-)
--
2.39.3
1 year, 6 months