guest: Set optimal arm CPU defaults

If doing arm kvm, use cpu=host. Otherwise, specify cortex-a57 for aarch64
so we actually get a 64bit cpu
This commit is contained in:
Cole Robinson 2014-09-23 16:16:35 -04:00
parent c4162f6708
commit 42ac7a3036
3 changed files with 23 additions and 9 deletions

View File

@ -15,6 +15,9 @@
<apic/>
<pae/>
</features>
<cpu mode="custom" match="exact">
<model>cortex-a57</model>
</cpu>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>

View File

@ -15,6 +15,9 @@
<apic/>
<pae/>
</features>
<cpu mode="custom" match="exact">
<model>cortex-a57</model>
</cpu>
<clock offset="utc"/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>

View File

@ -748,19 +748,27 @@ class Guest(XMLBuilder):
def _set_cpu_defaults(self):
self.cpu.set_topology_defaults(self.vcpus)
if (not self.conn.is_test() and not
(self.conn.is_qemu() and self.type == "kvm")):
return
if not self.os.is_x86():
return
if self.os.arch != self.conn.caps.host.cpu.arch:
return
if self.cpu.special_mode_was_set:
if not self.conn.is_test() and not self.conn.is_qemu():
return
if self.cpu.get_xml_config().strip():
# User already configured CPU
return
self.cpu.set_special_mode(self.x86_cpu_default)
if self.os.is_arm_machvirt() and self.type == "kvm":
# Should be host-passthrough, but the libvirt support is
# incomplete for arm cpu
self.cpu.model = "host"
elif self.os.is_arm64() and self.os.is_arm_machvirt():
# -M virt defaults to a 32bit CPU, even if using aarch64
self.cpu.model = "cortex-a57"
elif self.os.is_x86() and self.type == "kvm":
if self.os.arch != self.conn.caps.host.cpu.arch:
return
if self.cpu.special_mode_was_set:
return
self.cpu.set_special_mode(self.x86_cpu_default)
def _set_feature_defaults(self):
if self.os.is_container():