Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_capabilities.c | 24 +- src/qemu/qemu_capabilities.h | 3 +- src/qemu/qemu_driver.c | 7 +- tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 31 +- .../qemu_2.6.0-gicv2-virt.aarch64.xml | 37 +- .../qemu_2.6.0-gicv3-virt.aarch64.xml | 37 +- tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 37 +- tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml | 437 ++++++++++++++++++++- tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 35 +- tests/domaincapstest.c | 56 ++- 10 files changed, 682 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index aeea3a3..7a7ddb8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4194,6 +4194,26 @@ virQEMUCapsFillDomainOSCaps(virDomainCapsOSPtr os, static int +virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, + virQEMUCapsPtr qemuCaps, + virDomainCapsPtr domCaps) +{ + + if (domCaps->virttype == VIR_DOMAIN_VIRT_KVM && + virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch)) + domCaps->cpu.hostPassthrough = true; + + if (qemuCaps->cpuDefinitions && caps && caps->host.cpu) + domCaps->cpu.hostModel = virQEMUCapsGuestIsNative(caps->host.arch, + qemuCaps->arch); + + domCaps->cpu.custom = virObjectRef(qemuCaps->cpuDefinitions); + + return 0; +} + + +static int virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps, const char *machine, virDomainCapsDeviceDiskPtr disk) @@ -4400,7 +4420,8 @@ virQEMUCapsFillDomainFeatureGICCaps(virQEMUCapsPtr qemuCaps, int -virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, +virQEMUCapsFillDomainCaps(virCapsPtr caps, + virDomainCapsPtr domCaps, virQEMUCapsPtr qemuCaps, virFirmwarePtr *firmwares, size_t nfirmwares) @@ -4423,6 +4444,7 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, } if (virQEMUCapsFillDomainOSCaps(os, firmwares, nfirmwares) < 0 || + virQEMUCapsFillDomainCPUCaps(caps, qemuCaps, domCaps) < 0 || virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk) < 0 || virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 || diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 0767a87..9fd38d9 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -494,7 +494,8 @@ int virQEMUCapsInitGuestFromBinary(virCapsPtr caps, virQEMUCapsPtr kvmbinCaps, virArch guestarch); -int virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, +int virQEMUCapsFillDomainCaps(virCapsPtr caps, + virDomainCapsPtr domCaps, virQEMUCapsPtr qemuCaps, virFirmwarePtr *firmwares, size_t nfirmwares); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a424af0..7e4f4e7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18497,6 +18497,7 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn, virDomainCapsPtr domCaps = NULL; int arch = virArchFromHost(); /* virArch */ virQEMUDriverConfigPtr cfg = NULL; + virCapsPtr caps = NULL; virCheckFlags(0, ret); @@ -18505,6 +18506,9 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn, cfg = virQEMUDriverGetConfig(driver); + if (!(caps = virQEMUDriverGetCapabilities(driver, false))) + goto cleanup; + if (qemuHostdevHostSupportsPassthroughLegacy() || qemuHostdevHostSupportsPassthroughVFIO()) virttype = VIR_DOMAIN_VIRT_KVM; @@ -18576,13 +18580,14 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn, if (!(domCaps = virDomainCapsNew(emulatorbin, machine, arch, virttype))) goto cleanup; - if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps, + if (virQEMUCapsFillDomainCaps(caps, domCaps, qemuCaps, cfg->firmwares, cfg->nfirmwares) < 0) goto cleanup; ret = virDomainCapsFormat(domCaps); cleanup: virObjectUnref(cfg); + virObjectUnref(caps); virObjectUnref(domCaps); virObjectUnref(qemuCaps); return ret; diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml index 6da28b0..4ee2f95 100644 --- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml @@ -19,9 +19,34 @@ </loader> </os> <cpu> - <mode name='host-passthrough' supported='no'/> - <mode name='host-model' supported='no'/> - <mode name='custom' supported='no'/> + <mode name='host-passthrough' supported='yes'/> + <mode name='host-model' supported='yes'/> + <mode name='custom' supported='yes'> + <model>Opteron_G5</model> + <model>Opteron_G4</model> + <model>Opteron_G3</model> + <model>Opteron_G2</model> + <model>Opteron_G1</model> + <model>Haswell</model> + <model>SandyBridge</model> + <model>Westmere</model> + <model>Nehalem</model> + <model>Penryn</model> + <model>Conroe</model> + <model>n270</model> + <model>athlon</model> + <model>pentium3</model> + <model>pentium2</model> + <model>pentium</model> + <model>486</model> + <model>coreduo</model> + <model>kvm32</model> + <model>qemu32</model> + <model>kvm64</model> + <model>core2duo</model> + <model>phenom</model> + <model>qemu64</model> + </mode> </cpu> <devices> <disk supported='yes'> 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 ee51684..9e96f47 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0-gicv2-virt.aarch64.xml @@ -19,9 +19,40 @@ </loader> </os> <cpu> - <mode name='host-passthrough' supported='no'/> - <mode name='host-model' supported='no'/> - <mode name='custom' supported='no'/> + <mode name='host-passthrough' supported='yes'/> + <mode name='host-model' supported='yes'/> + <mode name='custom' supported='yes'> + <model>pxa262</model> + <model>pxa270-a0</model> + <model>arm1136</model> + <model>cortex-a15</model> + <model>pxa260</model> + <model>arm1136-r2</model> + <model>pxa261</model> + <model>pxa255</model> + <model>arm926</model> + <model>arm11mpcore</model> + <model>pxa250</model> + <model>ti925t</model> + <model>cortex-a57</model> + <model>sa1110</model> + <model>arm1176</model> + <model>cortex-a53</model> + <model>sa1100</model> + <model>pxa270-c5</model> + <model>cortex-a9</model> + <model>cortex-a8</model> + <model>pxa270-c0</model> + <model>arm1026</model> + <model>pxa270-b1</model> + <model>cortex-m3</model> + <model>cortex-m4</model> + <model>pxa270-b0</model> + <model>arm946</model> + <model>cortex-r5</model> + <model>pxa270-a1</model> + <model>pxa270</model> + </mode> </cpu> <devices> <disk supported='yes'> 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 88cced9..c081b35 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0-gicv3-virt.aarch64.xml @@ -19,9 +19,40 @@ </loader> </os> <cpu> - <mode name='host-passthrough' supported='no'/> - <mode name='host-model' supported='no'/> - <mode name='custom' supported='no'/> + <mode name='host-passthrough' supported='yes'/> + <mode name='host-model' supported='yes'/> + <mode name='custom' supported='yes'> + <model>pxa262</model> + <model>pxa270-a0</model> + <model>arm1136</model> + <model>cortex-a15</model> + <model>pxa260</model> + <model>arm1136-r2</model> + <model>pxa261</model> + <model>pxa255</model> + <model>arm926</model> + <model>arm11mpcore</model> + <model>pxa250</model> + <model>ti925t</model> + <model>cortex-a57</model> + <model>sa1110</model> + <model>arm1176</model> + <model>cortex-a53</model> + <model>sa1100</model> + <model>pxa270-c5</model> + <model>cortex-a9</model> + <model>cortex-a8</model> + <model>pxa270-c0</model> + <model>arm1026</model> + <model>pxa270-b1</model> + <model>cortex-m3</model> + <model>cortex-m4</model> + <model>pxa270-b0</model> + <model>arm946</model> + <model>cortex-r5</model> + <model>pxa270-a1</model> + <model>pxa270</model> + </mode> </cpu> <devices> <disk supported='yes'> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml index 09c0e1c..811d2b7 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml @@ -19,9 +19,40 @@ </loader> </os> <cpu> - <mode name='host-passthrough' supported='no'/> - <mode name='host-model' supported='no'/> - <mode name='custom' supported='no'/> + <mode name='host-passthrough' supported='yes'/> + <mode name='host-model' supported='yes'/> + <mode name='custom' supported='yes'> + <model>pxa262</model> + <model>pxa270-a0</model> + <model>arm1136</model> + <model>cortex-a15</model> + <model>pxa260</model> + <model>arm1136-r2</model> + <model>pxa261</model> + <model>pxa255</model> + <model>arm926</model> + <model>arm11mpcore</model> + <model>pxa250</model> + <model>ti925t</model> + <model>cortex-a57</model> + <model>sa1110</model> + <model>arm1176</model> + <model>cortex-a53</model> + <model>sa1100</model> + <model>pxa270-c5</model> + <model>cortex-a9</model> + <model>cortex-a8</model> + <model>pxa270-c0</model> + <model>arm1026</model> + <model>pxa270-b1</model> + <model>cortex-m3</model> + <model>cortex-m4</model> + <model>pxa270-b0</model> + <model>arm946</model> + <model>cortex-r5</model> + <model>pxa270-a1</model> + <model>pxa270</model> + </mode> </cpu> <devices> <disk supported='yes'> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml b/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml index 40b255e..a0aa811 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64le.xml @@ -19,9 +19,440 @@ </loader> </os> <cpu> - <mode name='host-passthrough' supported='no'/> - <mode name='host-model' supported='no'/> - <mode name='custom' supported='no'/> + <mode name='host-passthrough' supported='yes'/> + <mode name='host-model' supported='yes'/> + <mode name='custom' supported='yes'> + <model>default</model> + <model>ppc</model> + <model>ppc32</model> + <model>ppc64</model> + <model>970mp</model> + <model>970fx</model> + <model>970</model> + <model>POWER8NVL</model> + <model>POWER8</model> + <model>POWER8E</model> + <model>POWER7+</model> + <model>POWER7</model> + <model>POWER5gs</model> + <model>POWER5+</model> + <model>Apollo7PM</model> + <model>7457A</model> + <model>7447A</model> + <model>Apollo7</model> + <model>7457</model> + <model>Apollo6</model> + <model>7455</model> + <model>7445</model> + <model>7451</model> + <model>7441</model> + <model>Vger</model> + <model>7450</model> + <model>7448</model> + <model>Nitro</model> + <model>7410</model> + <model>G4</model> + <model>Max</model> + <model>7400</model> + <model>Goldfinger</model> + <model>755</model> + <model>745</model> + <model>LoneStar</model> + <model>750l</model> + <model>750gx</model> + <model>750fx</model> + <model>750cxe</model> + <model>750cx</model> + <model>750cl</model> + <model>Conan/Doyle</model> + <model>G3</model> + <model>Typhoon</model> + <model>750</model> + <model>Arthur</model> + <model>740</model> + <model>Mach5</model> + <model>Sirocco</model> + <model>604e</model> + <model>Goldeneye</model> + <model>603r</model> + <model>Vaillant</model> + <model>Stretch</model> + <model>603e</model> + <model>Vanilla</model> + <model>601v</model> + <model>601</model> + <model>MPC8560</model> + <model>MPC8555E</model> + <model>MPC8555</model> + <model>MPC8548E</model> + <model>MPC8548</model> + <model>MPC8547E</model> + <model>MPC8545E</model> + <model>MPC8545</model> + <model>MPC8544E</model> + <model>MPC8544</model> + <model>MPC8543E</model> + <model>MPC8543</model> + <model>MPC8541E</model> + <model>MPC8541</model> + <model>MPC8540</model> + <model>MPC8533E</model> + <model>MPC8533</model> + <model>e500v2</model> + <model>e500v1</model> + <model>e500</model> + <model>MPC8347EA</model> + <model>MPC8347E</model> + <model>MPC8347A</model> + <model>MPC8347</model> + <model>e300</model> + <model>e200</model> + <model>MPC8280</model> + <model>MPC8275</model> + <model>MPC8272</model> + <model>MPC8271</model> + <model>MPC8270</model> + <model>MPC8266_HiP4</model> + <model>MPC8266_HiP3</model> + <model>MPC8266</model> + <model>MPC8265_HiP4</model> + <model>MPC8265_HiP3</model> + <model>MPC8265</model> + <model>MPC8264_HiP4</model> + <model>MPC8264_HiP3</model> + <model>MPC8264</model> + <model>MPC8260_HiP4</model> + <model>MPC8260_HiP3</model> + <model>MPC8260</model> + <model>MPC8255_HiP4</model> + <model>MPC8255_HiP3</model> + <model>MPC8255</model> + <model>MPC8250_HiP4</model> + <model>MPC8250_HiP3</model> + <model>MPC8250</model> + <model>MPC8248</model> + <model>MPC8247</model> + <model>MPC8245</model> + <model>MPC8241</model> + <model>PowerQUICC-II</model> + <model>MPC82xx</model> + <model>MPC5200B</model> + <model>MPC5200</model> + <model>MPC52xx</model> + <model>MPC8240</model> + <model>440EP</model> + <model>x2vp50</model> + <model>x2vp7</model> + <model>405GPe</model> + <model>405GP</model> + <model>405CR</model> + <model>405</model> + <model>403</model> + <model>750cl_v1.0</model> + <model>750cxe_v2.1</model> + <model>7457A_v1.2</model> + <model>755_v2.7</model> + <model>MPC8347ET</model> + <model>MPC8545E_v20</model> + <model>750_v2.1</model> + <model>755_v2.2</model> + <model>745_v2.0</model> + <model>7455_v1.0</model> + <model>MPC8547E_v21</model> + <model>STB25</model> + <model>POWER8_v2.0</model> + <model>401G2</model> + <model>MPC8349A</model> + <model>750e</model> + <model>MPC8545_v21</model> + <model>MPC8548_v11</model> + <model>970fx_v2.0</model> + <model>750fx_v2.0</model> + <model>POWER8E_v2.1</model> + <model>Cobra</model> + <model>603p</model> + <model>7400_v2.7</model> + <model>MPC8378E</model> + <model>e500v2_v10</model> + <model>e500mc</model> + <model>603e7v1</model> + <model>970mp_v1.0</model> + <model>MPC8555E_v11</model> + <model>440-Xilinx-w-dfpu</model> + <model>740e</model> + <model>405CRc</model> + <model>7447A_v1.1</model> + <model>MPC8543_v11</model> + <model>MPC8533E_v10</model> + <model>MPC8540_v21</model> + <model>e500v2_v21</model> + <model>e300c1</model> + <model>7400_v2.2</model> + <model>970fx_v1.0</model> + <model>750gx_v1.2</model> + <model>750fx_v1.0</model> + <model>MPC8641</model> + <model>MPC8544E_v10</model> + <model>405D4</model> + <model>7457_v1.1</model> + <model>970fx_v3.0</model> + <model>604e_v2.2</model> + <model>755_v2.6</model> + <model>7410_v1.4</model> + <model>Npe4GS3</model> + <model>745_v2.4</model> + <model>750_v2.0</model> + <model>7445_v3.2</model> + <model>750l_v3.2</model> + <model>MPC8540_v10</model> + <model>750_v1.0</model> + <model>MPC8343A</model> + <model>MPC8378</model> + <model>G2HiP3</model> + <model>750cxe_v3.0</model> + <model>e500_v10</model> + <model>STB03</model> + <model>MPC8567</model> + <model>MPC8545_v20</model> + <model>MPC8548_v10</model> + <model>755_v1.1</model> + <model>603e7v</model> + <model>Npe405H2</model> + <model>750_v3.0</model> + <model>Npe405H</model> + <model>7400_v2.6</model> + <model>405GPa</model> + <model>MPC8548_v21</model> + <model>MPC8541E_v10</model> + <model>750l_v2.2</model> + <model>MPC8555E_v10</model> + <model>7457A_v1.1</model> + <model>e200z6</model> + <model>MPC8379E</model> + <model>e500v2_v20</model> + <model>MPC8347AP</model> + <model>401B2</model> + <model>MPC8349E</model> + <model>755_v2.1</model> + <model>MPC8543_v21</model> + <model>MPC8547E_v20</model> + <model>745_v2.8</model> + <model>7455_v3.4</model> + <model>7448_v1.1</model> + <model>740_v2.2</model> + <model>7400_v1.1</model> + <model>MPC8567E</model> + <model>7441_v2.10</model> + <model>603e_v1.4</model> + <model>G2leGP1</model> + <model>7451_v2.10</model> + <model>MPC8343E</model> + <model>750cx_v2.2</model> + <model>Npe405L</model> + <model>603e7</model> + <model>401A1</model> + <model>MPC8377</model> + <model>7448_v2.1</model> + <model>7441_v2.3</model> + <model>7400_v2.1</model> + <model>405CRb</model> + <model>604</model> + <model>MPC8540_v20</model> + <model>MPC8543_v10</model> + <model>7447A_v1.0</model> + <model>7445_v2.1</model> + <model>e500_v20</model> + <model>750gx_v1.1</model> + <model>MPC8543E_v11</model> + <model>750cxe_v2.4</model> + <model>MPC8548_v20</model> + <model>MPC8347AT</model> + <model>POWER8NVL_v1.0</model> + <model>7457A_v1.0</model> + <model>7457_v1.0</model> + <model>7450_v1.2</model> + <model>MPC8572</model> + <model>755_v2.5</model> + <model>7410_v1.3</model> + <model>745_v2.3</model> + <model>750l_v2.1</model> + <model>405GPR</model> + <model>755_v2.0</model> + <model>MPC8541_v11</model> + <model>401C2</model> + <model>e500v2_v30</model> + <model>7455_v3.3</model> + <model>405EZ</model> + <model>MPC8568E</model> + <model>755_v1.0</model> + <model>603e_v1.3</model> + <model>MPC8560_v10</model> + <model>MPC8560_v21</model> + <model>G2H4</model> + <model>MPC8533_v11</model> + <model>740_v3.1</model> + <model>e200z5</model> + <model>MPC8349</model> + <model>7400_v2.0</model> + <model>405CRa</model> + <model>MPC8543E_v10</model> + <model>MPC8543E_v21</model> + <model>750cxe_v2.3</model> + <model>MPC8543_v20</model> + <model>745_v2.7</model> + <model>403GC</model> + <model>e5500</model> + <model>7448_v1.0</model> + <model>MPC5200_v12</model> + <model>740_v2.1</model> + <model>745_v2.2</model> + <model>7400_v1.0</model> + <model>7410_v1.2</model> + <model>x2vp4</model> + <model>MPC8555_v11</model> + <model>MPC8541_v10</model> + <model>405LP</model> + <model>750fx_v2.3</model> + <model>405EP</model> + <model>601_v2</model> + <model>MPC8544_v11</model> + <model>401D2</model> + <model>MPC8572E</model> + <model>604e_v1.0</model> + <model>750cx_v2.1</model> + <model>MPC5200B_v21</model> + <model>750l_v3.0</model> + <model>e300c4</model> + <model>7448_v2.0</model> + <model>7450_v2.1</model> + <model>G2leGP</model> + <model>750cxe_v3.1b</model> + <model>7400_v2.9</model> + <model>G2GP</model> + <model>603</model> + <model>405GPd</model> + <model>MPC8548E_v11</model> + <model>603e7t</model> + <model>IOP480</model> + <model>750gx_v1.0</model> + <model>MPC8560_v20</model> + <model>405D2</model> + <model>750fl</model> + <model>750l_v2.0</model> + <model>x2vp20</model> + <model>e600</model> + <model>7450_v1.1</model> + <model>755_v2.4</model> + <model>7445_v1.0</model> + <model>G2LS</model> + <model>MPC8543E_v20</model> + <model>7447_v1.1</model> + <model>603e_v2.2</model> + <model>603e_v4</model> + <model>7455_v3.2</model> + <model>740_v2.0</model> + <model>MPC8347P</model> + <model>440EPb</model> + <model>MPC603</model> + <model>603e_v1.2</model> + <model>750fx_v2.2</model> + <model>740_v1.0</model> + <model>MPC8544_v10</model> + <model>601_v1</model> + <model>745_v1.1</model> + <model>POWER7+_v2.1</model> + <model>750cx_v2.0</model> + <model>MPC8347EAP</model> + <model>401E2</model> + <model>MPC8641D</model> + <model>e300c3</model> + <model>MPC8533_v10</model> + <model>7441_v2.1</model> + <model>740_v3.0</model> + <model>POWER5+_v2.1</model> + <model>602</model> + <model>MPC8548E_v10</model> + <model>G2leLS</model> + <model>MPC8343</model> + <model>750cx_v1.0</model> + <model>750cxe_v2.2</model> + <model>604e_v2.4</model> + <model>755_v2.8</model> + <model>MPC8548E_v21</model> + <model>745_v2.6</model> + <model>G2le</model> + <model>403GB</model> + <model>MPC8545E_v21</model> + <model>POWER7_v2.3</model> + <model>750_v2.2</model> + <model>7450_v1.0</model> + <model>MPC5200_v11</model> + <model>755_v2.3</model> + <model>MPC8347EP</model> + <model>7410_v1.1</model> + <model>750gl</model> + <model>403GCX</model> + <model>750p</model> + <model>745_v2.1</model> + <model>7445_v3.4</model> + <model>G2</model> + <model>MPC8555_v10</model> + <model>MPC8347T</model> + <model>603e_v3</model> + <model>970_v2.2</model> + <model>440-Xilinx</model> + <model>740p</model> + <model>MPC5200B_v20</model> + <model>440EPX</model> + <model>603e_v1.1</model> + <model>7451_v2.3</model> + <model>7450_v2.0</model> + <model>7400_v2.8</model> + <model>7455_v2.1</model> + <model>405GPc</model> + <model>MPC8347EAT</model> + <model>970mp_v1.1</model> + <model>603e7v2</model> + <model>604r</model> + <model>7447A_v1.2</model> + <model>MPC8533E_v11</model> + <model>e500v2_v22</model> + <model>401F2</model> + <model>MPC8343EA</model> + <model>7457_v1.2</model> + <model>970fx_v3.1</model> + <model>7447_v1.0</model> + <model>745_v2.5</model> + <model>MPC8548E_v20</model> + <model>MPC8610</model> + <model>403GA</model> + <model>750cxe_v2.4b</model> + <model>MPC5200_v10</model> + <model>7410_v1.0</model> + <model>G2leGP3</model> + <model>603e_v4.1</model> + <model>7445_v3.3</model> + <model>440EPa</model> + <model>970fx_v2.1</model> + <model>MPC8377E</model> + <model>750fx_v2.1</model> + <model>601_v0</model> + <model>STB04</model> + <model>745_v1.0</model> + <model>G2HiP4</model> + <model>750cl_v2.0</model> + <model>750cxr</model> + <model>MPC8349EA</model> + <model>750cxe_v3.1</model> + <model>401</model> + <model>MPC8379</model> + <model>MPC8568</model> + <model>e300c2</model> + <model>750_v3.1</model> + <model>MPC8544E_v11</model> + <model>405GPb</model> + <model>MPC8541E_v11</model> + </mode> </cpu> <devices> <disk supported='yes'> diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml index 6706fec..80101a4 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml @@ -19,9 +19,38 @@ </loader> </os> <cpu> - <mode name='host-passthrough' supported='no'/> - <mode name='host-model' supported='no'/> - <mode name='custom' supported='no'/> + <mode name='host-passthrough' supported='yes'/> + <mode name='host-model' supported='yes'/> + <mode name='custom' supported='yes'> + <model>Opteron_G5</model> + <model>Opteron_G4</model> + <model>Opteron_G3</model> + <model>Opteron_G2</model> + <model>Opteron_G1</model> + <model>Broadwell</model> + <model>Broadwell-noTSX</model> + <model>Haswell</model> + <model>Haswell-noTSX</model> + <model>IvyBridge</model> + <model>SandyBridge</model> + <model>Westmere</model> + <model>Nehalem</model> + <model>Penryn</model> + <model>Conroe</model> + <model>n270</model> + <model>athlon</model> + <model>pentium3</model> + <model>pentium2</model> + <model>pentium</model> + <model>486</model> + <model>coreduo</model> + <model>kvm32</model> + <model>qemu32</model> + <model>kvm64</model> + <model>core2duo</model> + <model>phenom</model> + <model>qemu64</model> + </mode> </cpu> <devices> <disk supported='yes'> diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 907c0ad..10b7452 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -109,6 +109,54 @@ fillAllCaps(virDomainCapsPtr domCaps) #if WITH_QEMU # include "testutilsqemu.h" +static virCPUDef aarch64Cpu = { + 0, 0, 0, 0, NULL, NULL, 0, NULL, 1, 1, 1, 0, 0, NULL, +}; + +static virCPUDef ppc64leCpu = { + VIR_CPU_TYPE_HOST, 0, 0, + VIR_ARCH_PPC64LE, (char *) "POWER8", + NULL, 0, NULL, 1, 1, 1, 0, 0, NULL, +}; + +static virCPUDef x86Cpu = { + VIR_CPU_TYPE_HOST, 0, 0, + VIR_ARCH_X86_64, (char *) "Broadwell", + NULL, 0, NULL, 1, 1, 1, 0, 0, NULL, +}; + +static int +fakeHostCPU(virCapsPtr caps, + virArch arch) +{ + virCPUDefPtr cpu; + + switch (arch) { + case VIR_ARCH_AARCH64: + cpu = &aarch64Cpu; + break; + + case VIR_ARCH_PPC64LE: + cpu = &ppc64leCpu; + break; + + case VIR_ARCH_X86_64: + cpu = &x86Cpu; + break; + + default: + virReportError(VIR_ERR_INTERNAL_ERROR, + "cannot fake host CPU for arch %s", + virArchToString(arch)); + return -1; + } + + if (!(caps->host.cpu = virCPUDefCopy(cpu))) + return -1; + + return 0; +} + static int fillQemuCaps(virDomainCapsPtr domCaps, const char *name, @@ -118,6 +166,7 @@ fillQemuCaps(virDomainCapsPtr domCaps, { int ret = -1; char *path = NULL; + virCapsPtr caps = NULL; virQEMUCapsPtr qemuCaps = NULL; virDomainCapsLoaderPtr loader = &domCaps->os.loader; @@ -136,7 +185,11 @@ fillQemuCaps(virDomainCapsPtr domCaps, virQEMUCapsGetDefaultMachine(qemuCaps)) < 0) goto cleanup; - if (virQEMUCapsFillDomainCaps(domCaps, qemuCaps, + if (!(caps = virCapabilitiesNew(domCaps->arch, false, false)) || + fakeHostCPU(caps, domCaps->arch) < 0) + goto cleanup; + + if (virQEMUCapsFillDomainCaps(caps, domCaps, qemuCaps, cfg->firmwares, cfg->nfirmwares) < 0) goto cleanup; @@ -164,6 +217,7 @@ fillQemuCaps(virDomainCapsPtr domCaps, ret = 0; cleanup: + virObjectUnref(caps); virObjectUnref(qemuCaps); VIR_FREE(path); return ret; -- 2.9.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list