Skip to content

Commit 67fa46a

Browse files
ianm-nvNathanChenNVIDIA
authored andcommitted
NVIDIA: SAUCE: virtinst: add shared-mec support for CCA guests
Add support for the shared-mec attribute in CCA launch security configuration. This allows users to control whether CCA Realms use shared or private Memory Encryption Contexts (MECs). Usage: --launchSecurity type=cca,sharedMec=on # Use shared MEC --launchSecurity type=cca,sharedMec=off # Use private MEC --launchSecurity type=cca # QEMU default (shared) The sharedMec attribute maps to the libvirt XML shared-mec attribute and the QEMU rme-guest shared-mec property. Signed-off-by: Ian May <ianm@nvidia.com>
1 parent 1e0fd8c commit 67fa46a

4 files changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<domain type="qemu">
2+
<name>test-aarch64-launch-security-cca-shared-mec</name>
3+
<uuid>915218db-98d8-43b2-81f3-c054a6ff8961</uuid>
4+
<memory>2097152</memory>
5+
<currentMemory>2097152</currentMemory>
6+
<vcpu>1</vcpu>
7+
<os firmware="efi">
8+
<type arch="aarch64" machine="virt">hvm</type>
9+
<boot dev="hd"/>
10+
</os>
11+
<features>
12+
<acpi/>
13+
</features>
14+
<cpu mode="maximum"/>
15+
<clock offset="utc"/>
16+
<devices>
17+
<emulator>/usr/bin/qemu-system-aarch64</emulator>
18+
<controller type="usb" model="qemu-xhci" ports="15"/>
19+
<controller type="pci" model="pcie-root"/>
20+
<controller type="pci" model="pcie-root-port"/>
21+
<controller type="pci" model="pcie-root-port"/>
22+
<controller type="pci" model="pcie-root-port"/>
23+
<controller type="pci" model="pcie-root-port"/>
24+
<controller type="pci" model="pcie-root-port"/>
25+
<controller type="pci" model="pcie-root-port"/>
26+
<controller type="pci" model="pcie-root-port"/>
27+
<controller type="pci" model="pcie-root-port"/>
28+
<controller type="pci" model="pcie-root-port"/>
29+
<controller type="pci" model="pcie-root-port"/>
30+
<controller type="pci" model="pcie-root-port"/>
31+
<controller type="pci" model="pcie-root-port"/>
32+
<controller type="pci" model="pcie-root-port"/>
33+
<controller type="pci" model="pcie-root-port"/>
34+
<interface type="network">
35+
<source network="default"/>
36+
<mac address="52:54:00:73:8c:4a"/>
37+
</interface>
38+
<console type="pty"/>
39+
<channel type="spicevmc">
40+
<target type="virtio" name="com.redhat.spice.0"/>
41+
</channel>
42+
<input type="tablet" bus="usb"/>
43+
<input type="keyboard" bus="usb"/>
44+
<tpm>
45+
<backend type="emulator"/>
46+
</tpm>
47+
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
48+
<image compression="off"/>
49+
</graphics>
50+
<sound model="ich9"/>
51+
<video>
52+
<model type="ramfb"/>
53+
</video>
54+
</devices>
55+
<launchSecurity type="cca" shared-mec="yes"/>
56+
</domain>
57+

tests/test_cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,11 @@ def add_compare(self, cat, args, compbase, **kwargs):
19081908
"aarch64-launch-security-cca",
19091909
prerun_check="11.9.0",
19101910
)
1911+
c.add_compare(
1912+
"--boot uefi --machine virt --launchSecurity type=cca,sharedMec=on",
1913+
"aarch64-launch-security-cca-shared-mec",
1914+
prerun_check="11.9.0",
1915+
)
19111916

19121917

19131918
######################

virtinst/cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5333,6 +5333,7 @@ def _virtcli_class_init(cls):
53335333
cls.add_arg("measurementAlgo", "measurementAlgo")
53345334
cls.add_arg("personalizationValue", "personalizationValue")
53355335
cls.add_arg("measurementLog", "measurementLog", is_onoff=True)
5336+
cls.add_arg("sharedMec", "sharedMec", is_onoff=True)
53365337

53375338

53385339
###########################

virtinst/domain/launch_security.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class DomainLaunchSecurity(XMLBuilder):
3030
measurementAlgo = XMLProperty("./measurement-algo")
3131
personalizationValue = XMLProperty("./personalization-value")
3232
measurementLog = XMLProperty("./@measurement-log", is_yesno=True)
33+
sharedMec = XMLProperty("./@shared-mec", is_yesno=True)
3334

3435
def _set_defaults_sev(self, guest):
3536
if not guest.os.is_q35() or not guest.is_uefi():

0 commit comments

Comments
 (0)