mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-06 11:49:29 +00:00
qemu: format kernel_irqchip on the command line
Add kernel_irqchip=split/on to the QEMU command line and a capability that looks for it in query-command-line-options output. For the 'split' option, use a version check since it cannot be reasonably probed. https://bugzilla.redhat.com/show_bug.cgi?id=1427005
This commit is contained in:
parent
8023b21a95
commit
6b5c6314b2
@ -366,6 +366,9 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
|
||||
"query-named-block-nodes",
|
||||
"cpu-cache",
|
||||
"qemu-xhci",
|
||||
|
||||
"kernel-irqchip", /* 255 */
|
||||
"kernel-irqchip.split",
|
||||
);
|
||||
|
||||
|
||||
@ -3130,6 +3133,7 @@ static struct virQEMUCapsCommandLineProps virQEMUCapsCommandLine[] = {
|
||||
{ "drive", "throttling.bps-total-max-length", QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH },
|
||||
{ "drive", "throttling.group", QEMU_CAPS_DRIVE_IOTUNE_GROUP },
|
||||
{ "spice", "rendernode", QEMU_CAPS_SPICE_RENDERNODE },
|
||||
{ "machine", "kernel_irqchip", QEMU_CAPS_MACHINE_KERNEL_IRQCHIP },
|
||||
};
|
||||
|
||||
static int
|
||||
@ -4742,6 +4746,10 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
|
||||
if (qemuCaps->version >= 2004050)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
|
||||
/* no way to query if -machine kernel_irqchip supports split */
|
||||
if (qemuCaps->version >= 2006000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT);
|
||||
|
||||
if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -404,6 +404,10 @@ typedef enum {
|
||||
QEMU_CAPS_CPU_CACHE, /* -cpu supports host-cache-info and l3-cache properties */
|
||||
QEMU_CAPS_DEVICE_QEMU_XHCI, /* -device qemu-xhci */
|
||||
|
||||
/* 255 */
|
||||
QEMU_CAPS_MACHINE_KERNEL_IRQCHIP, /* -machine kernel_irqchip */
|
||||
QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT, /* -machine kernel_irqchip=split */
|
||||
|
||||
QEMU_CAPS_LAST /* this must always be the last item */
|
||||
} virQEMUCapsFlags;
|
||||
|
||||
|
@ -7422,6 +7422,31 @@ qemuBuildMachineCommandLine(virCommandPtr cmd,
|
||||
}
|
||||
}
|
||||
|
||||
if (def->features[VIR_DOMAIN_FEATURE_IOAPIC] == VIR_TRISTATE_SWITCH_ON) {
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("I/O APIC tuning is not supported by this "
|
||||
"QEMU binary"));
|
||||
goto cleanup;
|
||||
}
|
||||
switch (def->ioapic) {
|
||||
case VIR_DOMAIN_IOAPIC_QEMU:
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("split I/O APIC is not supported by this "
|
||||
"QEMU binary"));
|
||||
goto cleanup;
|
||||
}
|
||||
virBufferAddLit(&buf, ",kernel_irqchip=split");
|
||||
break;
|
||||
case VIR_DOMAIN_IOAPIC_KVM:
|
||||
virBufferAddLit(&buf, ",kernel_irqchip=on");
|
||||
break;
|
||||
case VIR_DOMAIN_IOAPIC_LAST:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
virCommandAddArgBuffer(cmd, &buf);
|
||||
}
|
||||
|
||||
|
@ -2806,6 +2806,22 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefVerifyFeatures(const virDomainDef *def)
|
||||
{
|
||||
if (def->features[VIR_DOMAIN_FEATURE_IOAPIC] == VIR_TRISTATE_SWITCH_ON &&
|
||||
!ARCH_IS_X86(def->os.arch)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("I/O APIC tuning is not supported "
|
||||
"for '%s' architecture"),
|
||||
virArchToString(def->os.arch));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
@ -2861,6 +2877,9 @@ qemuDomainDefPostParse(virDomainDefPtr def,
|
||||
|
||||
qemuDomainDefEnableDefaultFeatures(def, qemuCaps);
|
||||
|
||||
if (qemuDomainDefVerifyFeatures(def) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainRecheckInternalPaths(def, cfg, parseFlags) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -140,6 +140,7 @@
|
||||
<flag name='display'/>
|
||||
<flag name='vhost-scsi'/>
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<version>1005003</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -145,6 +145,7 @@
|
||||
<flag name='display'/>
|
||||
<flag name='vhost-scsi'/>
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<version>1006000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -147,6 +147,7 @@
|
||||
<flag name='display'/>
|
||||
<flag name='vhost-scsi'/>
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<version>1007000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -163,6 +163,7 @@
|
||||
<flag name='vhost-scsi'/>
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<version>2001001</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -185,6 +185,7 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<version>2004000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -191,6 +191,7 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<version>2005000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -168,6 +168,8 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2006000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -168,6 +168,8 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2006000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -162,6 +162,8 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2006000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -200,6 +200,8 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2006000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -130,6 +130,8 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2007000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -202,6 +202,8 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2007000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package> (v2.7.0)</package>
|
||||
|
@ -132,6 +132,8 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2007093</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package></package>
|
||||
|
@ -203,6 +203,8 @@
|
||||
<flag name='query-cpu-definitions'/>
|
||||
<flag name='block-write-threshold'/>
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2008000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package> (v2.8.0)</package>
|
||||
|
@ -210,6 +210,8 @@
|
||||
<flag name='query-named-block-nodes'/>
|
||||
<flag name='cpu-cache'/>
|
||||
<flag name='qemu-xhci'/>
|
||||
<flag name='kernel-irqchip'/>
|
||||
<flag name='kernel-irqchip.split'/>
|
||||
<version>2009000</version>
|
||||
<kvmVersion>0</kvmVersion>
|
||||
<package> (v2.9.0)</package>
|
||||
|
19
tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.args
Normal file
19
tests/qemuxml2argvdata/qemuxml2argv-intel-iommu-ioapic.args
Normal file
@ -0,0 +1,19 @@
|
||||
LC_ALL=C \
|
||||
PATH=/bin \
|
||||
HOME=/home/test \
|
||||
USER=test \
|
||||
LOGNAME=test \
|
||||
QEMU_AUDIO_DRV=none \
|
||||
/usr/bin/qemu-system-x86_64 \
|
||||
-name QEMUGuest1 \
|
||||
-S \
|
||||
-machine q35,accel=kvm,kernel_irqchip=split \
|
||||
-m 214 \
|
||||
-smp 1,sockets=1,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
-nographic \
|
||||
-nodefaults \
|
||||
-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
|
||||
-no-acpi \
|
||||
-boot c \
|
||||
-device intel-iommu
|
@ -2509,6 +2509,11 @@ mymain(void)
|
||||
DO_TEST("intel-iommu-machine",
|
||||
QEMU_CAPS_MACHINE_OPT,
|
||||
QEMU_CAPS_MACHINE_IOMMU);
|
||||
DO_TEST("intel-iommu-ioapic",
|
||||
QEMU_CAPS_MACHINE_OPT,
|
||||
QEMU_CAPS_MACHINE_KERNEL_IRQCHIP,
|
||||
QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT,
|
||||
QEMU_CAPS_DEVICE_INTEL_IOMMU);
|
||||
|
||||
DO_TEST("cpu-hotplug-startup", QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user