[RFC PATCH v2 7/8] qemu: Add general loader support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Intel TDX requires a general loader to hold its firmware TDVF.

Add new loader type VIR_DOMAIN_LOADER_TYPE_GENERIC and
VIR_DOMAIN_OS_DEF_FIRMWARE_GENERIC to support this feature.

XML looks like:

<os>
  <loader type='generic'>/path/to/TDVF-binary</loader>
</os>

Qemu command line looks like:

$QEMU ... \
  -device loader,file=/path/to/TDVF-binary

Signed-off-by: Zhenzhong Duan <zhenzhong.duan@xxxxxxxxx>
---
 docs/schemas/domaincommon.rng | 1 +
 src/conf/domain_conf.c        | 2 ++
 src/conf/domain_conf.h        | 2 ++
 src/qemu/qemu_capabilities.c  | 3 +++
 src/qemu/qemu_command.c       | 5 +++++
 src/qemu/qemu_namespace.c     | 1 +
 6 files changed, 14 insertions(+)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index fd77601886..9d0b51ee12 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -319,6 +319,7 @@
                 <choice>
                   <value>rom</value>
                   <value>pflash</value>
+                  <value>generic</value>
                 </choice>
               </attribute>
             </optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9510aa7b1f..fbbbe708d4 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1311,6 +1311,7 @@ VIR_ENUM_IMPL(virDomainLoader,
               "none",
               "rom",
               "pflash",
+              "generic",
 );
 
 VIR_ENUM_IMPL(virDomainIOAPIC,
@@ -1333,6 +1334,7 @@ VIR_ENUM_IMPL(virDomainOsDefFirmware,
               "none",
               "bios",
               "efi",
+              "generic",
 );
 
 VIR_ENUM_IMPL(virDomainOsDefFirmwareFeature,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index b29045d0c4..99b74683a0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2163,6 +2163,7 @@ typedef enum {
     VIR_DOMAIN_LOADER_TYPE_NONE = 0,
     VIR_DOMAIN_LOADER_TYPE_ROM,
     VIR_DOMAIN_LOADER_TYPE_PFLASH,
+    VIR_DOMAIN_LOADER_TYPE_GENERIC,
 
     VIR_DOMAIN_LOADER_TYPE_LAST
 } virDomainLoader;
@@ -2246,6 +2247,7 @@ typedef enum {
     VIR_DOMAIN_OS_DEF_FIRMWARE_NONE = 0,
     VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS = VIR_DOMAIN_LOADER_TYPE_ROM,
     VIR_DOMAIN_OS_DEF_FIRMWARE_EFI = VIR_DOMAIN_LOADER_TYPE_PFLASH,
+    VIR_DOMAIN_OS_DEF_FIRMWARE_GENERIC = VIR_DOMAIN_LOADER_TYPE_GENERIC,
 
     VIR_DOMAIN_OS_DEF_FIRMWARE_LAST
 } virDomainOsDefFirmware;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index e9906a2f32..d3c30a17e7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5888,6 +5888,9 @@ virQEMUCapsFillDomainLoaderCaps(virDomainCapsLoader *capsLoader,
     VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->type,
                              VIR_DOMAIN_LOADER_TYPE_PFLASH);
 
+    VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->type,
+                             VIR_DOMAIN_LOADER_TYPE_GENERIC);
+
 
     VIR_DOMAIN_CAPS_ENUM_SET(capsLoader->readonly,
                              VIR_TRISTATE_BOOL_YES,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c53b0e237d..99812e37d8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9640,6 +9640,11 @@ qemuBuildDomainLoaderCommandLine(virCommand *cmd,
         qemuBuldDomainLoaderPflashCommandLine(cmd, loader, qemuCaps);
         break;
 
+    case VIR_DOMAIN_LOADER_TYPE_GENERIC:
+        virCommandAddArg(cmd, "-device");
+        virCommandAddArgFormat(cmd, "loader,file=%s", loader->path);
+        break;
+
     case VIR_DOMAIN_LOADER_TYPE_NONE:
     case VIR_DOMAIN_LOADER_TYPE_LAST:
         /* nada */
diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index e902f0eecc..aa635b1375 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -569,6 +569,7 @@ qemuDomainSetupLoader(virDomainObj *vm,
     if (loader) {
         switch ((virDomainLoader) loader->type) {
         case VIR_DOMAIN_LOADER_TYPE_ROM:
+        case VIR_DOMAIN_LOADER_TYPE_GENERIC:
             *paths = g_slist_prepend(*paths, g_strdup(loader->path));
             break;
 
-- 
2.25.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux