if ( rc )
return rc;
- rc = xsm_vm_event_op(XSM_DM_PRIV, d, XENMEM_paging_op);
+ rc = xsm_mem_paging(XSM_DM_PRIV, d);
if ( rc )
goto out;
if ( rc )
return rc;
- rc = xsm_vm_event_op(XSM_DM_PRIV, d, XENMEM_sharing_op);
+ rc = xsm_mem_sharing(XSM_DM_PRIV, d);
if ( rc )
goto out;
if ( !p2m_mem_access_sanity_check(d) )
goto out;
- rc = xsm_vm_event_op(XSM_DM_PRIV, d, XENMEM_access_op);
+ rc = xsm_mem_access(XSM_DM_PRIV, d);
if ( rc )
goto out;
return xsm_default_action(action, current->domain, d);
}
-static XSM_INLINE int xsm_vm_event_op(XSM_DEFAULT_ARG struct domain *d, int op)
+#ifdef HAS_MEM_ACCESS
+static XSM_INLINE int xsm_mem_access(XSM_DEFAULT_ARG struct domain *d)
{
XSM_ASSERT_ACTION(XSM_DM_PRIV);
return xsm_default_action(action, current->domain, d);
}
+#endif
+
+#ifdef HAS_MEM_PAGING
+static XSM_INLINE int xsm_mem_paging(XSM_DEFAULT_ARG struct domain *d)
+{
+ XSM_ASSERT_ACTION(XSM_DM_PRIV);
+ return xsm_default_action(action, current->domain, d);
+}
+#endif
+
+#ifdef HAS_MEM_SHARING
+static XSM_INLINE int xsm_mem_sharing(XSM_DEFAULT_ARG struct domain *d)
+{
+ XSM_ASSERT_ACTION(XSM_DM_PRIV);
+ return xsm_default_action(action, current->domain, d);
+}
+#endif
#ifdef CONFIG_X86
static XSM_INLINE int xsm_do_mca(XSM_DEFAULT_VOID)
int (*get_vnumainfo) (struct domain *d);
int (*vm_event_control) (struct domain *d, int mode, int op);
- int (*vm_event_op) (struct domain *d, int op);
+
+#ifdef HAS_MEM_ACCESS
+ int (*mem_access) (struct domain *d);
+#endif
+
+#ifdef HAS_MEM_PAGING
+ int (*mem_paging) (struct domain *d);
+#endif
+
+#ifdef HAS_MEM_SHARING
+ int (*mem_sharing) (struct domain *d);
+#endif
#ifdef CONFIG_X86
int (*do_mca) (void);
return xsm_ops->vm_event_control(d, mode, op);
}
-static inline int xsm_vm_event_op (xsm_default_t def, struct domain *d, int op)
+#ifdef HAS_MEM_ACCESS
+static inline int xsm_mem_access (xsm_default_t def, struct domain *d)
{
- return xsm_ops->vm_event_op(d, op);
+ return xsm_ops->mem_access(d);
}
+#endif
+
+#ifdef HAS_MEM_PAGING
+static inline int xsm_mem_paging (xsm_default_t def, struct domain *d)
+{
+ return xsm_ops->mem_paging(d);
+}
+#endif
+
+#ifdef HAS_MEM_SHARING
+static inline int xsm_mem_sharing (xsm_default_t def, struct domain *d)
+{
+ return xsm_ops->mem_sharing(d);
+}
+#endif
#ifdef CONFIG_X86
static inline int xsm_do_mca(xsm_default_t def)
set_to_dummy_if_null(ops, map_gmfn_foreign);
set_to_dummy_if_null(ops, vm_event_control);
- set_to_dummy_if_null(ops, vm_event_op);
+
+#ifdef HAS_MEM_ACCESS
+ set_to_dummy_if_null(ops, mem_access);
+#endif
+
+#ifdef HAS_MEM_PAGING
+ set_to_dummy_if_null(ops, mem_paging);
+#endif
+
+#ifdef HAS_MEM_SHARING
+ set_to_dummy_if_null(ops, mem_sharing);
+#endif
#ifdef CONFIG_X86
set_to_dummy_if_null(ops, do_mca);
return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__VM_EVENT);
}
-static int flask_vm_event_op(struct domain *d, int op)
+#ifdef HAS_MEM_ACCESS
+static int flask_mem_access(struct domain *d)
{
- return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__VM_EVENT);
+ return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_ACCESS);
+}
+#endif
+
+#ifdef HAS_MEM_PAGING
+static int flask_mem_paging(struct domain *d)
+{
+ return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_PAGING);
+}
+#endif
+
+#ifdef HAS_MEM_SHARING
+static int flask_mem_sharing(struct domain *d)
+{
+ return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_SHARING);
}
+#endif
#if defined(HAS_PASSTHROUGH) && defined(HAS_PCI)
static int flask_get_device_group(uint32_t machine_bdf)
.get_vnumainfo = flask_get_vnumainfo,
.vm_event_control = flask_vm_event_control,
- .vm_event_op = flask_vm_event_op,
+
+#ifdef HAS_MEM_ACCESS
+ .mem_access = flask_mem_access,
+#endif
+
+#ifdef HAS_MEM_PAGING
+ .mem_paging = flask_mem_paging,
+#endif
+
+#ifdef HAS_MEM_SHARING
+ .mem_sharing = flask_mem_sharing,
+#endif
#ifdef CONFIG_COMPAT
.do_compat_op = compat_flask_op,
# XEN_DOMCTL_monitor_op
# XEN_DOMCTL_vm_event_op
vm_event
+# XENMEM_access_op
+ mem_access
+# XENMEM_paging_op
+ mem_paging
+# XENMEM_sharing_op
+ mem_sharing
}
# Similar to class domain, but primarily contains domctls related to HVM domains