Skip to content

Commit 99ef4ef

Browse files
committed
<fix>[vm]: handle uefi secure boot
set smm state on (requested by uefi secure boot) when secureBoot is true use OVMF_CODE.secboot.fd and copy OVMF_VARS.secboot.fd to nvram directory Resolves: ZSTAC-47508 Change-Id: I6361626b766a787075746c7668786b646f736877 Signed-off-by: AlanJager <ye.zou@zstack.io>
1 parent 92439eb commit 99ef4ef

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

kvmagent/kvmagent/plugins/vm_plugin.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3755,8 +3755,12 @@ def on_x86_64():
37553755
e(os, 'type', 'hvm', attrib={'machine': machine_type})
37563756
# if boot mode is UEFI
37573757
if cmd.bootMode == "UEFI" or cmd.bootMode == "UEFI_WITH_CSM":
3758-
e(os, 'loader', '/usr/share/edk2/ovmf/OVMF_CODE.cc.fd', attrib={'readonly': 'yes', 'type': 'pflash'})
3759-
e(os, 'nvram', '/var/lib/libvirt/qemu/nvram/%s.fd' % cmd.vmInstanceUuid, attrib={'template': '/usr/share/edk2/ovmf/OVMF_VARS.fd'})
3758+
if cmd.secureBoot:
3759+
e(os, 'loader', '/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd', attrib={'readonly': 'yes', 'secure': 'true', 'type': 'pflash'})
3760+
e(os, 'nvram', '/var/lib/libvirt/qemu/nvram/%s.fd' % cmd.vmInstanceUuid, attrib={'template': '/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd'})
3761+
else:
3762+
e(os, 'loader', '/usr/share/edk2/ovmf/OVMF_CODE.cc.fd', attrib={'readonly': 'yes', 'type': 'pflash'})
3763+
e(os, 'nvram', '/var/lib/libvirt/qemu/nvram/%s.fd' % cmd.vmInstanceUuid, attrib={'template': '/usr/share/edk2/ovmf/OVMF_VARS.fd'})
37603764
elif cmd.addons['loaderRom'] is not None:
37613765
e(os, 'loader', cmd.addons['loaderRom'], {'type': 'rom'})
37623766

@@ -3833,8 +3837,8 @@ def make_acpi():
38333837
if get_gic_version(cmd.cpuNum) == 2:
38343838
e(features, "gic", attrib={'version': '2'})
38353839

3836-
3837-
3840+
if cmd.secureBoot:
3841+
e(features, 'smm', None, {'state': 'on'})
38383842

38393843
def make_qemu_commandline():
38403844
if not os.path.exists(QMP_SOCKET_PATH):

0 commit comments

Comments
 (0)