From: Michal Privoznik <mprivozn(a)redhat.com>
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(a)redhat.com>
Signed-off-by: Haibin Huang <haibin.huang(a)intel.com>
---
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