[PATCH v16 7/9] qemu_namespace: Create SGX related nodes in domain's namespace

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

 



From: Michal Privoznik <mprivozn@xxxxxxxxxx>

This is similar to the previous commit. SGX memory backend needs
to access /dev/sgx_vepc and /dev/sgx_provision. Create these
nodes in domain's private /dev when required by domain's config.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
Signed-off-by: Haibin Huang <haibin.huang@xxxxxxxxx>
---
 src/qemu/qemu_namespace.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c
index 311c66d46e..4a96460122 100644
--- a/src/qemu/qemu_namespace.c
+++ b/src/qemu/qemu_namespace.c
@@ -358,11 +358,23 @@ static int
 qemuDomainSetupMemory(virDomainMemoryDef *mem,
                       GSList **paths)
 {
-    if (mem->model != VIR_DOMAIN_MEMORY_MODEL_NVDIMM &&
-        mem->model != VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM)
-        return 0;
+    switch (mem->model) {
+    case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
+    case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
+        *paths = g_slist_prepend(*paths, g_strdup(mem->nvdimmPath));
+        break;
+
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
+        *paths = g_slist_prepend(*paths, g_strdup(QEMU_DEV_SGX_VEPVC));
+        *paths = g_slist_prepend(*paths, g_strdup(QEMU_DEV_SGX_PROVISION));
+        break;
 
-    *paths = g_slist_prepend(*paths, g_strdup(mem->nvdimmPath));
+    case VIR_DOMAIN_MEMORY_MODEL_NONE:
+    case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+    case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_MEM:
+    case VIR_DOMAIN_MEMORY_MODEL_LAST:
+        break;
+    }
 
     return 0;
 }
-- 
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