Treat XENMEM_add_to_physmap_range the same as XENMEM_add_to_physmap.
Reported-by: Lars Rasmusson <Lars.Rasmusson@sics.se>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
#include <asm/current.h>
#include <public/memory.h>
#include <xen/sched.h>
+#include <xsm/xsm.h>
struct domain *dom_xen, *dom_io, *dom_cow;
if ( rc != 0 )
return rc;
+ rc = xsm_add_to_physmap(XSM_TARGET, current->domain, d);
+ if ( rc )
+ {
+ rcu_unlock_domain(d);
+ return rc;
+ }
+
rc = xenmem_add_to_physmap_one(d, xatp.space, DOMID_INVALID,
xatp.idx, xatp.gpfn);
if ( rc != 0 )
return rc;
+ rc = xsm_add_to_physmap(XSM_TARGET, current->domain, d);
+ if ( rc )
+ {
+ rcu_unlock_domain(d);
+ return rc;
+ }
+
rc = xenmem_add_to_physmap_range(d, &xatpr);
rcu_unlock_domain(d);
return xsm_default_action(action, current->domain, d);
}
+static XSM_INLINE int xsm_add_to_physmap(XSM_DEFAULT_ARG struct domain *d1, struct domain *d2)
+{
+ XSM_ASSERT_ACTION(XSM_TARGET);
+ return xsm_default_action(action, d1, d2);
+}
+
+static XSM_INLINE int xsm_remove_from_physmap(XSM_DEFAULT_ARG struct domain *d1, struct domain *d2)
+{
+ XSM_ASSERT_ACTION(XSM_TARGET);
+ return xsm_default_action(action, d1, d2);
+}
+
#ifdef CONFIG_X86
static XSM_INLINE int xsm_shadow_control(XSM_DEFAULT_ARG struct domain *d, uint32_t op)
{
return xsm_default_action(action, d, f);
}
-static XSM_INLINE int xsm_add_to_physmap(XSM_DEFAULT_ARG struct domain *d1, struct domain *d2)
-{
- XSM_ASSERT_ACTION(XSM_TARGET);
- return xsm_default_action(action, d1, d2);
-}
-
-static XSM_INLINE int xsm_remove_from_physmap(XSM_DEFAULT_ARG struct domain *d1, struct domain *d2)
-{
- XSM_ASSERT_ACTION(XSM_TARGET);
- return xsm_default_action(action, d1, d2);
-}
-
static XSM_INLINE int xsm_bind_pt_irq(XSM_DEFAULT_ARG struct domain *d, struct xen_domctl_bind_pt_irq *bind)
{
XSM_ASSERT_ACTION(XSM_HOOK);
int (*memory_adjust_reservation) (struct domain *d1, struct domain *d2);
int (*memory_stat_reservation) (struct domain *d1, struct domain *d2);
int (*memory_pin_page) (struct domain *d1, struct domain *d2, struct page_info *page);
+ int (*add_to_physmap) (struct domain *d1, struct domain *d2);
int (*remove_from_physmap) (struct domain *d1, struct domain *d2);
int (*console_io) (struct domain *d, int cmd);
struct domain *f, uint32_t flags);
int (*mmuext_op) (struct domain *d, struct domain *f);
int (*update_va_mapping) (struct domain *d, struct domain *f, l1_pgentry_t pte);
- int (*add_to_physmap) (struct domain *d1, struct domain *d2);
int (*bind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq *bind);
int (*unbind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq *bind);
int (*ioport_permission) (struct domain *d, uint32_t s, uint32_t e, uint8_t allow);
return xsm_ops->memory_pin_page(d1, d2, page);
}
+static inline int xsm_add_to_physmap(xsm_default_t def, struct domain *d1, struct domain *d2)
+{
+ return xsm_ops->add_to_physmap(d1, d2);
+}
+
static inline int xsm_remove_from_physmap(xsm_default_t def, struct domain *d1, struct domain *d2)
{
return xsm_ops->remove_from_physmap(d1, d2);
return xsm_ops->update_va_mapping(d, f, pte);
}
-static inline int xsm_add_to_physmap(xsm_default_t def, struct domain *d1, struct domain *d2)
-{
- return xsm_ops->add_to_physmap(d1, d2);
-}
-
static inline int xsm_bind_pt_irq(xsm_default_t def, struct domain *d,
struct xen_domctl_bind_pt_irq *bind)
{
set_to_dummy_if_null(ops, do_xsm_op);
+ set_to_dummy_if_null(ops, add_to_physmap);
+ set_to_dummy_if_null(ops, remove_from_physmap);
+
#ifdef CONFIG_X86
set_to_dummy_if_null(ops, shadow_control);
set_to_dummy_if_null(ops, hvm_param);
set_to_dummy_if_null(ops, mmu_update);
set_to_dummy_if_null(ops, mmuext_op);
set_to_dummy_if_null(ops, update_va_mapping);
- set_to_dummy_if_null(ops, add_to_physmap);
- set_to_dummy_if_null(ops, remove_from_physmap);
set_to_dummy_if_null(ops, bind_pt_irq);
set_to_dummy_if_null(ops, unbind_pt_irq);
set_to_dummy_if_null(ops, ioport_permission);
return domain_has_xen(current->domain, XEN__TMEM_CONTROL);
}
+static int flask_add_to_physmap(struct domain *d1, struct domain *d2)
+{
+ return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
+}
+
+static int flask_remove_from_physmap(struct domain *d1, struct domain *d2)
+{
+ return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
+}
+
#ifdef CONFIG_X86
static int flask_shadow_control(struct domain *d, uint32_t op)
{
return domain_has_perm(d, f, SECCLASS_MMU, map_perms);
}
-static int flask_add_to_physmap(struct domain *d1, struct domain *d2)
-{
- return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
-}
-
-static int flask_remove_from_physmap(struct domain *d1, struct domain *d2)
-{
- return domain_has_perm(d1, d2, SECCLASS_MMU, MMU__PHYSMAP);
-}
-
static int flask_get_device_group(uint32_t machine_bdf)
{
u32 rsid;
.do_xsm_op = do_flask_op,
+ .add_to_physmap = flask_add_to_physmap,
+ .remove_from_physmap = flask_remove_from_physmap,
+
#ifdef CONFIG_X86
.shadow_control = flask_shadow_control,
.hvm_param = flask_hvm_param,
.mmu_update = flask_mmu_update,
.mmuext_op = flask_mmuext_op,
.update_va_mapping = flask_update_va_mapping,
- .add_to_physmap = flask_add_to_physmap,
- .remove_from_physmap = flask_remove_from_physmap,
.get_device_group = flask_get_device_group,
.test_assign_device = flask_test_assign_device,
.assign_device = flask_assign_device,