From: Lin Yang <lin.a.y...@intel.com>

<devices>
  ...
  <memory model='sgx-epc'>
    <target>
      <size unit='KiB'>512</size>
    </target>
  </memory>
  ...
</devices>
---
 docs/schemas/domaincommon.rng    | 1 +
 src/conf/domain_conf.c           | 4 ++++
 src/conf/domain_conf.h           | 1 +
 src/qemu/qemu_command.c          | 1 +
 src/qemu/qemu_domain.c           | 2 ++
 src/security/security_apparmor.c | 1 +
 src/security/security_dac.c      | 2 ++
 src/security/security_selinux.c  | 2 ++
 8 files changed, 14 insertions(+)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 0d0dcbc5ce..afe0d3074a 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -5909,6 +5909,7 @@
         <choice>
           <value>dimm</value>
           <value>nvdimm</value>
+          <value>sgx-epc</value>
         </choice>
       </attribute>
       <optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ef67efa1da..fbffde23fb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1316,6 +1316,7 @@ VIR_ENUM_IMPL(virDomainMemoryModel,
               "",
               "dimm",
               "nvdimm",
+              "sgx-epc",
 );
 
 VIR_ENUM_IMPL(virDomainShmemModel,
@@ -16644,6 +16645,7 @@ virDomainMemorySourceDefParseXML(xmlNodePtr node,
 
         break;
 
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
         break;
@@ -18472,6 +18474,7 @@ virDomainMemoryFindByDefInternal(virDomainDefPtr def,
                 continue;
             break;
 
+        case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
         case VIR_DOMAIN_MEMORY_MODEL_NONE:
         case VIR_DOMAIN_MEMORY_MODEL_LAST:
             break;
@@ -27631,6 +27634,7 @@ virDomainMemorySourceDefFormat(virBufferPtr buf,
             virBufferAddLit(buf, "<pmem/>\n");
         break;
 
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
         break;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 011bf66cb4..1d095852a4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2262,6 +2262,7 @@ typedef enum {
     VIR_DOMAIN_MEMORY_MODEL_NONE,
     VIR_DOMAIN_MEMORY_MODEL_DIMM, /* dimm hotpluggable memory device */
     VIR_DOMAIN_MEMORY_MODEL_NVDIMM, /* nvdimm memory device */
+    VIR_DOMAIN_MEMORY_MODEL_SGX_EPC, /* SGX enclave page cache */
 
     VIR_DOMAIN_MEMORY_MODEL_LAST
 } virDomainMemoryModel;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 01812cd39b..4a1d0c3e9e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3351,6 +3351,7 @@ qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr mem,
 
         break;
 
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
         break;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c440c79e1d..55c874da16 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -8402,6 +8402,7 @@ qemuDomainDefValidateMemoryHotplugDevice(const 
virDomainMemoryDef *mem,
         }
         break;
 
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
         return -1;
@@ -8489,6 +8490,7 @@ qemuDomainDefValidateMemoryHotplug(const virDomainDef 
*def,
             needNvdimmCap = true;
             break;
 
+        case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
         case VIR_DOMAIN_MEMORY_MODEL_NONE:
         case VIR_DOMAIN_MEMORY_MODEL_LAST:
             break;
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index eea37dca83..c3e5c4a4e7 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -701,6 +701,7 @@ AppArmorSetMemoryLabel(virSecurityManagerPtr mgr,
         return reload_profile(mgr, def, mem->nvdimmPath, true);
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
     case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
         break;
     }
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index dd701ef28b..7d9472aa28 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1896,6 +1896,7 @@ virSecurityDACRestoreMemoryLabel(virSecurityManagerPtr 
mgr,
         break;
 
     case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
         ret = 0;
@@ -2078,6 +2079,7 @@ virSecurityDACSetMemoryLabel(virSecurityManagerPtr mgr,
         break;
 
     case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
         ret = 0;
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index cc8fb1099c..b2fe4ea96b 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -1587,6 +1587,7 @@ virSecuritySELinuxSetMemoryLabel(virSecurityManagerPtr 
mgr,
 
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
     case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
         break;
     }
@@ -1613,6 +1614,7 @@ 
virSecuritySELinuxRestoreMemoryLabel(virSecurityManagerPtr mgr,
         break;
 
     case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+    case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
         ret = 0;
-- 
2.17.1

Reply via email to