mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
cpu_ppc64: add support for host-model on POWER10
Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
38dba6a02e
commit
316de7eb12
@ -88,22 +88,22 @@ ppc64CheckCompatibilityMode(const char *host_model,
|
||||
if (!compat_mode)
|
||||
return VIR_CPU_COMPARE_IDENTICAL;
|
||||
|
||||
/* Valid host CPUs: POWER6, POWER7, POWER8, POWER9 */
|
||||
/* Valid host CPUs: POWER6, POWER7, POWER8, POWER9, POWER10 */
|
||||
if (!STRPREFIX(host_model, "POWER") ||
|
||||
!(tmp = (char *) host_model + strlen("POWER")) ||
|
||||
virStrToLong_i(tmp, NULL, 10, &host) < 0 ||
|
||||
host < 6 || host > 9) {
|
||||
host < 6 || host > 10) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s",
|
||||
_("Host CPU does not support compatibility modes"));
|
||||
return VIR_CPU_COMPARE_ERROR;
|
||||
}
|
||||
|
||||
/* Valid compatibility modes: power6, power7, power8, power9 */
|
||||
/* Valid compatibility modes: power6, power7, power8, power9, power10 */
|
||||
if (!STRPREFIX(compat_mode, "power") ||
|
||||
!(tmp = (char *) compat_mode + strlen("power")) ||
|
||||
virStrToLong_i(tmp, NULL, 10, &compat) < 0 ||
|
||||
compat < 6 || compat > 9) {
|
||||
compat < 6 || compat > 10) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unknown compatibility mode %s"),
|
||||
compat_mode);
|
||||
|
@ -0,0 +1,31 @@
|
||||
LC_ALL=C \
|
||||
PATH=/bin \
|
||||
HOME=/tmp/lib/domain--1-QEMUGuest1 \
|
||||
USER=test \
|
||||
LOGNAME=test \
|
||||
XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
|
||||
XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
|
||||
XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
||||
/usr/bin/qemu-system-ppc64 \
|
||||
-name guest=QEMUGuest1,debug-threads=on \
|
||||
-S \
|
||||
-object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
|
||||
-machine pseries,usb=off,dump-guest-core=off,max-cpu-compat=power10,memory-backend=ppc_spapr.ram \
|
||||
-accel kvm \
|
||||
-cpu host \
|
||||
-m 256 \
|
||||
-object '{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":268435456}' \
|
||||
-overcommit mem-lock=off \
|
||||
-smp 4,sockets=4,cores=1,threads=1 \
|
||||
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||
-display none \
|
||||
-no-user-config \
|
||||
-nodefaults \
|
||||
-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
|
||||
-mon chardev=charmonitor,id=monitor,mode=control \
|
||||
-rtc base=utc \
|
||||
-no-shutdown \
|
||||
-boot strict=on \
|
||||
-audiodev '{"id":"audio1","driver":"none"}' \
|
||||
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
||||
-msg timestamp=on
|
@ -0,0 +1 @@
|
||||
the CPU is incompatible with host CPU
|
19
tests/qemuxml2argvdata/pseries-cpu-compat-power10.xml
Normal file
19
tests/qemuxml2argvdata/pseries-cpu-compat-power10.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<domain type='kvm'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219100</memory>
|
||||
<currentMemory unit='KiB'>219100</currentMemory>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
<os>
|
||||
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||
</os>
|
||||
<cpu mode='host-model'>
|
||||
<model>power10</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||
<controller type='usb' model='none'/>
|
||||
<memballoon model="none"/>
|
||||
</devices>
|
||||
</domain>
|
@ -2239,6 +2239,10 @@ mymain(void)
|
||||
QEMU_CPU_DEF_POWER8);
|
||||
DO_TEST_CAPS_LATEST_PPC64_HOSTCPU("pseries-cpu-compat-power9",
|
||||
QEMU_CPU_DEF_POWER9);
|
||||
DO_TEST_CAPS_LATEST_PPC64_HOSTCPU_FAILURE("pseries-cpu-compat-power10",
|
||||
QEMU_CPU_DEF_POWER9);
|
||||
DO_TEST_CAPS_LATEST_PPC64_HOSTCPU("pseries-cpu-compat-power10",
|
||||
QEMU_CPU_DEF_POWER10);
|
||||
|
||||
qemuTestSetHostArch(&driver, VIR_ARCH_NONE);
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
<domain type='kvm'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory unit='KiB'>219100</memory>
|
||||
<currentMemory unit='KiB'>219100</currentMemory>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
<os>
|
||||
<type arch='ppc64' machine='pseries'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<cpu mode='host-model' check='partial'>
|
||||
<model fallback='allow'>power10</model>
|
||||
</cpu>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu-system-ppc64</emulator>
|
||||
<controller type='usb' index='0' model='none'/>
|
||||
<controller type='pci' index='0' model='pci-root'>
|
||||
<model name='spapr-pci-host-bridge'/>
|
||||
<target index='0'/>
|
||||
</controller>
|
||||
<audio id='1' type='none'/>
|
||||
<memballoon model='none'/>
|
||||
<panic model='pseries'/>
|
||||
</devices>
|
||||
</domain>
|
@ -1286,6 +1286,7 @@ mymain(void)
|
||||
DO_TEST("smartcard-controller", QEMU_CAPS_CCID_EMULATED);
|
||||
|
||||
DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-compat-power9", "ppc64");
|
||||
DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-compat-power10", "ppc64");
|
||||
DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-compat", "ppc64");
|
||||
DO_TEST_CAPS_ARCH_LATEST("pseries-cpu-exact", "ppc64");
|
||||
|
||||
|
@ -114,6 +114,15 @@ static virCPUDef cpuPower9Data = {
|
||||
.threads = 1,
|
||||
};
|
||||
|
||||
static virCPUDef cpuPower10Data = {
|
||||
.type = VIR_CPU_TYPE_HOST,
|
||||
.arch = VIR_ARCH_PPC64,
|
||||
.model = (char *) "POWER10",
|
||||
.sockets = 1,
|
||||
.cores = 16,
|
||||
.threads = 1,
|
||||
};
|
||||
|
||||
static virCPUDef cpuAarch64Data = {
|
||||
.type = VIR_CPU_TYPE_HOST,
|
||||
.arch = VIR_ARCH_AARCH64,
|
||||
@ -154,6 +163,8 @@ testUtilsHostCpusGetDefForModel(const char *model)
|
||||
return virCPUDefCopy(&cpuPower8Data);
|
||||
else if (STREQ(model, "POWER9"))
|
||||
return virCPUDefCopy(&cpuPower9Data);
|
||||
else if (STREQ(model, "POWER10"))
|
||||
return virCPUDefCopy(&cpuPower10Data);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ static virCPUDef *cpuDefault;
|
||||
static virCPUDef *cpuHaswell;
|
||||
static virCPUDef *cpuPower8;
|
||||
static virCPUDef *cpuPower9;
|
||||
static virCPUDef *cpuPower10;
|
||||
|
||||
|
||||
static const char *qemu_emulators[VIR_ARCH_LAST] = {
|
||||
@ -308,6 +309,7 @@ qemuTestGetCPUDef(qemuTestCPUDef d)
|
||||
case QEMU_CPU_DEF_HASWELL: return cpuHaswell;
|
||||
case QEMU_CPU_DEF_POWER8: return cpuPower8;
|
||||
case QEMU_CPU_DEF_POWER9: return cpuPower9;
|
||||
case QEMU_CPU_DEF_POWER10: return cpuPower10;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@ -391,6 +393,7 @@ void qemuTestDriverFree(virQEMUDriver *driver)
|
||||
virCPUDefFree(cpuHaswell);
|
||||
virCPUDefFree(cpuPower8);
|
||||
virCPUDefFree(cpuPower9);
|
||||
virCPUDefFree(cpuPower10);
|
||||
}
|
||||
|
||||
|
||||
@ -581,7 +584,8 @@ int qemuTestDriverInit(virQEMUDriver *driver)
|
||||
if (!(cpuDefault = virCPUDefCopy(&cpuDefaultData)) ||
|
||||
!(cpuHaswell = virCPUDefCopy(&cpuHaswellData)) ||
|
||||
!(cpuPower8 = virCPUDefCopy(&cpuPower8Data)) ||
|
||||
!(cpuPower9 = virCPUDefCopy(&cpuPower9Data)))
|
||||
!(cpuPower9 = virCPUDefCopy(&cpuPower9Data)) ||
|
||||
!(cpuPower10 = virCPUDefCopy(&cpuPower10Data)))
|
||||
return -1;
|
||||
|
||||
if (virMutexInit(&driver->lock) < 0)
|
||||
|
@ -72,6 +72,7 @@ typedef enum {
|
||||
QEMU_CPU_DEF_HASWELL,
|
||||
QEMU_CPU_DEF_POWER8,
|
||||
QEMU_CPU_DEF_POWER9,
|
||||
QEMU_CPU_DEF_POWER10,
|
||||
} qemuTestCPUDef;
|
||||
|
||||
struct testQemuArgs {
|
||||
|
Loading…
Reference in New Issue
Block a user