[PATCH v4 2/4] qemu: Add command-line to generate SGX EPC memory backend

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

 



From: Lin Yang <lin.a.yang@xxxxxxxxx>

According to the result parsing from xml, add the argument of
SGX EPC memory backend into QEMU command line:

    -object memory-backend-epc,id=mem1,size=<epc_size>K,prealloc \
    -sgx-epc id=epc1,memdev=mem1
---
 src/qemu/qemu_command.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 01812cd39b..2c3785886c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9869,6 +9869,27 @@ qemuBuildVsockCommandLine(virCommandPtr cmd,
 }
 
 
+static int
+qemuBuildSGXCommandLine(virCommandPtr cmd, virDomainSGXDefPtr sgx)
+{
+    g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
+
+    if (!sgx)
+        return 0;
+
+    VIR_DEBUG("sgx->epc_size=%lluKiB", sgx->epc_size);
+
+    virBufferAsprintf(&buf, "memory-backend-epc,id=mem1,size=%lluK,prealloc", sgx->epc_size);
+    virCommandAddArg(cmd, "-object");
+    virCommandAddArgBuffer(cmd, &buf);
+
+    virCommandAddArg(cmd, "-sgx-epc");
+    virCommandAddArg(cmd, "id=epc1,memdev=mem1");
+
+    return 0;
+}
+
+
 /*
  * Constructs a argv suitable for launching qemu with config defined
  * for a given virtual machine.
@@ -10154,6 +10175,9 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
         cfg->logTimestamp)
         virCommandAddArgList(cmd, "-msg", "timestamp=on", NULL);
 
+    if (qemuBuildSGXCommandLine(cmd, def->sgx) < 0)
+        return NULL;
+
     return g_steal_pointer(&cmd);
 }
 
-- 
2.17.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