diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in index 045ba939fe..648e3d481e 100644 --- a/docs/formatdomaincaps.html.in +++ b/docs/formatdomaincaps.html.in @@ -154,7 +154,12 @@ ... <cpu> <mode name='host-passthrough' supported='yes'/> - <mode name='host-model' supported='yes'/> + <mode name='host-model' supported='yes'> + <model fallback='allow'>Broadwell</model> + <vendor>Intel</vendor> + <feature policy='disable' name='aes'/> + <feature policy='require' name='vmx'/> + </mode> <mode name='custom' supported='yes'> <model usable='no'>Broadwell</model> <model usable='yes'>Broadwell-noTSX</model> @@ -177,7 +182,19 @@
No mode specific details are provided.
host-model
-
No mode specific details are provided yet.
+
+ If host-model is supported by the hypervisor, the + mode describes the guest CPU which will be used when + starting a domain with host-model CPU. The hypervisor + specifics (such as unsupported CPU models or features, machine type, + etc.) may be accounted for in this guest CPU specification and thus + the CPU can be different from the one shown in host capabilities XML. + This is indicated by the fallback attribute of the + model sub element: allow means not all + specifics were accounted for and thus the CPU a guest will see may + be different; forbid indicates that the CPU a guest will + see should match this CPU definition. +
custom
diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng index 5a605a7e1a..20cbc4e944 100644 --- a/docs/schemas/domaincaps.rng +++ b/docs/schemas/domaincaps.rng @@ -2,6 +2,7 @@ + @@ -94,6 +95,15 @@ host-model + + + + + + + + + diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 9ec416e3b0..beedd70762 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -402,9 +402,19 @@ virDomainCapsCPUFormat(virBufferPtr buf, virCPUModeTypeToString(VIR_CPU_MODE_HOST_PASSTHROUGH), cpu->hostPassthrough ? "yes" : "no"); - virBufferAsprintf(buf, "\n", - virCPUModeTypeToString(VIR_CPU_MODE_HOST_MODEL), - cpu->hostModel ? "yes" : "no"); + virBufferAsprintf(buf, "hostModel) { + virBufferAddLit(buf, "supported='yes'>\n"); + virBufferAdjustIndent(buf, 2); + + virCPUDefFormatBuf(buf, cpu->hostModel, false); + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } else { + virBufferAddLit(buf, "supported='no'/>\n"); + } virBufferAsprintf(buf, "host.arch, qemuCaps->arch)) domCaps->cpu.hostPassthrough = true; - if (qemuCaps->cpuDefinitions && caps->host.cpu) - domCaps->cpu.hostModel = virQEMUCapsGuestIsNative(caps->host.arch, - qemuCaps->arch); + domCaps->cpu.hostModel = virCPUDefCopy(qemuCaps->hostCPUModel); if (qemuCaps->cpuDefinitions && cpuGetModels(domCaps->arch, &models) >= 0) { diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml index b75e86ce5d..eaf6eb6c09 100644 --- a/tests/domaincapsschemadata/full.xml +++ b/tests/domaincapsschemadata/full.xml @@ -21,7 +21,10 @@ - + + host + CPU Vendorrr + Model1 Model2 diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml index 2b17dd0f74..4aa475c1e7 100644 --- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml @@ -20,7 +20,9 @@ - + + Broadwell + Opteron_G5 Opteron_G4 diff --git a/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml index 8a54f9e3fd..796c3afee8 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml @@ -20,7 +20,7 @@ - + pxa262 pxa270-a0 diff --git a/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml index 8d8087fb7c..5a5f82c5d4 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml @@ -20,7 +20,7 @@ - + pxa262 pxa270-a0 diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml index 83c03db465..90b57ffa2a 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml @@ -20,7 +20,7 @@ - + pxa262 pxa270-a0 diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml index 14a087bc1a..962be6f33f 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml @@ -20,7 +20,9 @@ - + + POWER8 + POWER8 POWER7 diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml index 4294c64c59..a8975e8e53 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml @@ -20,7 +20,9 @@ - + + Broadwell + Opteron_G5 Opteron_G4 diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 99971c27d1..e70fa05b68 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -65,8 +65,14 @@ fillAllCaps(virDomainCapsPtr domCaps) virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics; virDomainCapsDeviceVideoPtr video = &domCaps->video; virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev; - domCaps->maxvcpus = 255; + virCPUDef host = { + VIR_CPU_TYPE_HOST, 0, 0, + VIR_ARCH_X86_64, (char *) "host", + NULL, 0, (char *) "CPU Vendorrr", + 0, 0, 0, 0, 0, NULL, + }; + domCaps->maxvcpus = 255; os->supported = true; loader->supported = true; @@ -79,7 +85,7 @@ fillAllCaps(virDomainCapsPtr domCaps) return -1; cpu->hostPassthrough = true; - cpu->hostModel = true; + cpu->hostModel = virCPUDefCopy(&host); if (!(cpu->custom = virDomainCapsCPUModelsNew(3)) || virDomainCapsCPUModelsAdd(cpu->custom, "Model1", -1, VIR_DOMCAPS_CPU_USABLE_UNKNOWN) < 0 ||