Skip to content

Commit 49afc5f

Browse files
author
Yihuang Yu
committed
feat: auto-detect SEV cbitpos and reduced-phys-bits from host
Automatically detect AMD SEV memory encryption parameters from host CPU when not specified in configuration. - Use coco.sev.get_cbit_position() as default for vm_sev_cbitpos - Use coco.sev.get_reduced_phys_bits() as default for vm_sev_reduced_phys_bits - Parameters can still be overridden via configuration This eliminates manual CPU specification lookup and makes tests portable across different AMD CPU models. Signed-off-by: Yihuang Yu <yihyu@redhat.com>
1 parent 7cbf954 commit 49afc5f

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

virttest/qemu_devices/qcontainer.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
# Internal imports
3535
from virttest import (
3636
arch,
37+
coco,
3738
data_dir,
3839
qemu_storage,
3940
storage,
@@ -3981,10 +3982,12 @@ def _gen_sev_common_props(params):
39813982
Required: cbitpos, reduced-phys-bits
39823983
"""
39833984
sev_common_props = {
3984-
# FIXME: Set the following two properties from sev capabilities
3985-
# if they are not set yet
3986-
"cbitpos": int(params["vm_sev_cbitpos"]),
3987-
"reduced-phys-bits": int(params["vm_sev_reduced_phys_bits"]),
3985+
"cbitpos": params.get_numeric(
3986+
"vm_sev_cbitpos", coco.sev.get_cbit_position()
3987+
),
3988+
"reduced-phys-bits": params.get_numeric(
3989+
"vm_sev_reduced_phys_bits", coco.sev.get_reduced_phys_bits()
3990+
),
39883991
}
39893992

39903993
if params.get("vm_sev_kernel_hashes"):

0 commit comments

Comments
 (0)