cli: --cpu: Add maxphysaddr.{mode,bits} options

This commit added support for cpu physical address bits control, It's
useful for VMs with huge amount of ram.

E.g.
--cpu Cascadelake-Server,maxphysaddr.mode=emulate,maxphysaddr.bits=46

Signed-off-by: Lin Ma <lma@suse.com>
This commit is contained in:
Lin Ma 2022-08-19 18:18:50 +08:00 committed by Cole Robinson
parent c22a876e9a
commit fbdf051626
5 changed files with 24 additions and 4 deletions

View File

@ -194,6 +194,7 @@
<bandwidth initiator="0" target="2" cache="1" type="access" value="409600" unit="KiB"/> <bandwidth initiator="0" target="2" cache="1" type="access" value="409600" unit="KiB"/>
</interconnects> </interconnects>
</numa> </numa>
<maxphysaddr mode="emulate" bits="46"/>
</cpu> </cpu>
<clock offset="utc"> <clock offset="utc">
<timer name="pit" tickpolicy="catchup" present="yes"/> <timer name="pit" tickpolicy="catchup" present="yes"/>

View File

@ -17,7 +17,9 @@
<pae/> <pae/>
<vmport state="off"/> <vmport state="off"/>
</features> </features>
<cpu mode="host-passthrough" migratable="on"/> <cpu mode="host-passthrough" migratable="on">
<maxphysaddr mode="passthrough"/>
</cpu>
<clock offset="utc"/> <clock offset="utc"/>
<pm> <pm>
<suspend-to-mem enabled="no"/> <suspend-to-mem enabled="no"/>

View File

@ -511,7 +511,8 @@ numa.interconnects.latency0.initiator=0,numa.interconnects.latency0.target=0,num
numa.interconnects.latency1.initiator=0,numa.interconnects.latency1.target=2,numa.interconnects.latency1.cache=1,numa.interconnects.latency1.type=access,numa.interconnects.latency1.value=10,numa.interconnects.latency1.unit=ns,\ numa.interconnects.latency1.initiator=0,numa.interconnects.latency1.target=2,numa.interconnects.latency1.cache=1,numa.interconnects.latency1.type=access,numa.interconnects.latency1.value=10,numa.interconnects.latency1.unit=ns,\
numa.interconnects.bandwidth0.initiator=0,numa.interconnects.bandwidth0.target=0,numa.interconnects.bandwidth0.type=access,numa.interconnects.bandwidth0.value=204800,\ numa.interconnects.bandwidth0.initiator=0,numa.interconnects.bandwidth0.target=0,numa.interconnects.bandwidth0.type=access,numa.interconnects.bandwidth0.value=204800,\
numa.interconnects.bandwidth1.initiator=0,numa.interconnects.bandwidth1.target=2,numa.interconnects.bandwidth1.cache=1,numa.interconnects.bandwidth1.type=access,numa.interconnects.bandwidth1.value=409600,numa.interconnects.bandwidth1.unit=KiB,\ numa.interconnects.bandwidth1.initiator=0,numa.interconnects.bandwidth1.target=2,numa.interconnects.bandwidth1.cache=1,numa.interconnects.bandwidth1.type=access,numa.interconnects.bandwidth1.value=409600,numa.interconnects.bandwidth1.unit=KiB,\
cache.mode=emulate,cache.level=3 cache.mode=emulate,cache.level=3,\
maxphysaddr.mode=emulate,maxphysaddr.bits=46
--numatune 1,2,3,5-7,^6,mode=strict,\ --numatune 1,2,3,5-7,^6,mode=strict,\
@ -880,7 +881,7 @@ c.add_compare("--pxe "
# Hitting test driver specific output # Hitting test driver specific output
c.add_compare("--connect " + utils.URIs.test_suite + " " c.add_compare("--connect " + utils.URIs.test_suite + " "
"--cpu host-passthrough,migratable=on " # migratable=on is only accepted with host-passthrough "--cpu host-passthrough,migratable=on,maxphysaddr.mode=passthrough " # migratable=on is only accepted with host-passthrough
"--seclabel label=foobar.label,a1,z2,b3,relabel=yes,type=dynamic " # fills in default model=testModel "--seclabel label=foobar.label,a1,z2,b3,relabel=yes,type=dynamic " # fills in default model=testModel
"--tpm default " # --tpm default when domcaps missing "--tpm default " # --tpm default when domcaps missing
"", "",

View File

@ -2386,6 +2386,9 @@ class ParserCPU(VirtCLIParser):
cls.add_arg("cache.level", "cache.level") cls.add_arg("cache.level", "cache.level")
cls.add_arg("cache.mode", "cache.mode") cls.add_arg("cache.mode", "cache.mode")
cls.add_arg("maxphysaddr.mode", "maxphysaddr.mode")
cls.add_arg("maxphysaddr.bits", "maxphysaddr.bits")
# CPU features # CPU features
# These are handled specially in _parse # These are handled specially in _parse
cls.add_arg("force", None, lookup_cb=None, cb=cls.set_feature_cb) cls.add_arg("force", None, lookup_cb=None, cb=cls.set_feature_cb)

View File

@ -102,6 +102,17 @@ class _CPUFeature(XMLBuilder):
policy = XMLProperty("./@policy") policy = XMLProperty("./@policy")
class _CPUMaxphysaddr(XMLBuilder):
"""
Class for generating XML for <cpu> child node <maxphysaddr>.
"""
XML_NAME = "maxphysaddr"
_XML_PROP_ORDER = ["mode", "bits"]
mode = XMLProperty("./@mode")
bits = XMLProperty("./@bits", is_int=True)
############## ##############
# NUMA cells # # NUMA cells #
############## ##############
@ -211,7 +222,7 @@ class DomainCpu(XMLBuilder):
_XML_PROP_ORDER = ["mode", "match", "check", "migratable", _XML_PROP_ORDER = ["mode", "match", "check", "migratable",
"model", "model_fallback", "model_vendor_id", "vendor", "model", "model_fallback", "model_vendor_id", "vendor",
"topology", "cache", "features", "topology", "cache", "features",
"cells", "latencies", "bandwidths"] "cells", "latencies", "bandwidths", "maxphysaddr"]
################## ##################
@ -242,6 +253,8 @@ class DomainCpu(XMLBuilder):
latencies = XMLChildProperty(_NUMALatency, relative_xpath="./numa/interconnects") latencies = XMLChildProperty(_NUMALatency, relative_xpath="./numa/interconnects")
bandwidths = XMLChildProperty(_NUMABandwidth, relative_xpath="./numa/interconnects") bandwidths = XMLChildProperty(_NUMABandwidth, relative_xpath="./numa/interconnects")
maxphysaddr = XMLChildProperty(_CPUMaxphysaddr, is_single=True)
############################# #############################
# Special CPU mode handling # # Special CPU mode handling #