[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.5 v10 17/19] xen/arm: Enable the compilation of mem_access and mem_event on ARM.
This patch sets up the infrastructure to support mem_access and mem_event on ARM and turns on compilation. We define the required XSM functions. Signed-off-by: Tamas K Lengyel <tklengyel@xxxxxxxxxxxxx> Acked-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Reviewed-by: Julien Grall <julien.grall@xxxxxxxxxx> --- v8: All MEM_* flags have been converted to HAS_* and moved into config/*.mk v3: Wrap mem_event related functions in XSM into #ifdef HAS_MEM_ACCESS blocks. Update XSM hooks in flask to properly wire it up on ARM. v2: Add CONFIG_MEM_PAGING and CONFIG_MEM_SHARING definitions and use them instead of CONFIG_X86. Split domctl copy-back and p2m type definitions into separate patches and move this patch to the end of the series. --- config/arm32.mk | 1 + config/arm64.mk | 1 + xen/include/xsm/dummy.h | 26 ++++++++++++++------------ xen/include/xsm/xsm.h | 29 +++++++++++++++++------------ xen/xsm/dummy.c | 7 +++++-- xen/xsm/flask/hooks.c | 33 ++++++++++++++++++++------------- 6 files changed, 58 insertions(+), 39 deletions(-) diff --git a/config/arm32.mk b/config/arm32.mk index 4f83a63..26b8abd 100644 --- a/config/arm32.mk +++ b/config/arm32.mk @@ -13,6 +13,7 @@ HAS_PL011 := y HAS_EXYNOS4210 := y HAS_OMAP := y HAS_NS16550 := y +HAS_MEM_ACCESS := y # Use only if calling $(LD) directly. LDFLAGS_DIRECT += -EL diff --git a/config/arm64.mk b/config/arm64.mk index 4e57b3a..9c4c147 100644 --- a/config/arm64.mk +++ b/config/arm64.mk @@ -8,6 +8,7 @@ CFLAGS += #-marm -march= -mcpu= etc HAS_PL011 := y HAS_NS16550 := y +HAS_MEM_ACCESS := y # Use only if calling $(LD) directly. LDFLAGS_DIRECT += -EL diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index df55e70..f20e89c 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -513,6 +513,20 @@ static XSM_INLINE int xsm_hvm_param_nested(XSM_DEFAULT_ARG struct domain *d) return xsm_default_action(action, current->domain, d); } +#ifdef HAS_MEM_ACCESS +static XSM_INLINE int xsm_mem_event_control(XSM_DEFAULT_ARG struct domain *d, int mode, int op) +{ + XSM_ASSERT_ACTION(XSM_PRIV); + return xsm_default_action(action, current->domain, d); +} + +static XSM_INLINE int xsm_mem_event_op(XSM_DEFAULT_ARG struct domain *d, int op) +{ + 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) { @@ -556,18 +570,6 @@ static XSM_INLINE int xsm_hvm_ioreq_server(XSM_DEFAULT_ARG struct domain *d, int return xsm_default_action(action, current->domain, d); } -static XSM_INLINE int xsm_mem_event_control(XSM_DEFAULT_ARG struct domain *d, int mode, int op) -{ - XSM_ASSERT_ACTION(XSM_PRIV); - return xsm_default_action(action, current->domain, d); -} - -static XSM_INLINE int xsm_mem_event_op(XSM_DEFAULT_ARG struct domain *d, int op) -{ - XSM_ASSERT_ACTION(XSM_DM_PRIV); - return xsm_default_action(action, current->domain, d); -} - static XSM_INLINE int xsm_mem_sharing_op(XSM_DEFAULT_ARG struct domain *d, struct domain *cd, int op) { XSM_ASSERT_ACTION(XSM_DM_PRIV); diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index 6c1c079..4ce089f 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -141,6 +141,11 @@ struct xsm_operations { int (*hvm_param_nested) (struct domain *d); int (*get_vnumainfo) (struct domain *d); +#ifdef HAS_MEM_ACCESS + int (*mem_event_control) (struct domain *d, int mode, int op); + int (*mem_event_op) (struct domain *d, int op); +#endif + #ifdef CONFIG_X86 int (*do_mca) (void); int (*shadow_control) (struct domain *d, uint32_t op); @@ -149,8 +154,6 @@ struct xsm_operations { int (*hvm_set_pci_link_route) (struct domain *d); int (*hvm_inject_msi) (struct domain *d); int (*hvm_ioreq_server) (struct domain *d, int op); - int (*mem_event_control) (struct domain *d, int mode, int op); - int (*mem_event_op) (struct domain *d, int op); int (*mem_sharing_op) (struct domain *d, struct domain *cd, int op); int (*apic) (struct domain *d, int cmd); int (*memtype) (uint32_t access); @@ -540,6 +543,18 @@ static inline int xsm_get_vnumainfo (xsm_default_t def, struct domain *d) return xsm_ops->get_vnumainfo(d); } +#ifdef HAS_MEM_ACCESS +static inline int xsm_mem_event_control (xsm_default_t def, struct domain *d, int mode, int op) +{ + return xsm_ops->mem_event_control(d, mode, op); +} + +static inline int xsm_mem_event_op (xsm_default_t def, struct domain *d, int op) +{ + return xsm_ops->mem_event_op(d, op); +} +#endif + #ifdef CONFIG_X86 static inline int xsm_do_mca(xsm_default_t def) { @@ -576,16 +591,6 @@ static inline int xsm_hvm_ioreq_server (xsm_default_t def, struct domain *d, int return xsm_ops->hvm_ioreq_server(d, op); } -static inline int xsm_mem_event_control (xsm_default_t def, struct domain *d, int mode, int op) -{ - return xsm_ops->mem_event_control(d, mode, op); -} - -static inline int xsm_mem_event_op (xsm_default_t def, struct domain *d, int op) -{ - return xsm_ops->mem_event_op(d, op); -} - static inline int xsm_mem_sharing_op (xsm_default_t def, struct domain *d, struct domain *cd, int op) { return xsm_ops->mem_sharing_op(d, cd, op); diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index 0826a8b..8eb3050 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -118,6 +118,11 @@ void xsm_fixup_ops (struct xsm_operations *ops) set_to_dummy_if_null(ops, remove_from_physmap); set_to_dummy_if_null(ops, map_gmfn_foreign); +#ifdef HAS_MEM_ACCESS + set_to_dummy_if_null(ops, mem_event_control); + set_to_dummy_if_null(ops, mem_event_op); +#endif + #ifdef CONFIG_X86 set_to_dummy_if_null(ops, do_mca); set_to_dummy_if_null(ops, shadow_control); @@ -126,8 +131,6 @@ void xsm_fixup_ops (struct xsm_operations *ops) set_to_dummy_if_null(ops, hvm_set_pci_link_route); set_to_dummy_if_null(ops, hvm_inject_msi); set_to_dummy_if_null(ops, hvm_ioreq_server); - set_to_dummy_if_null(ops, mem_event_control); - set_to_dummy_if_null(ops, mem_event_op); set_to_dummy_if_null(ops, mem_sharing_op); set_to_dummy_if_null(ops, apic); set_to_dummy_if_null(ops, platform_op); diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index df05566..8de5e49 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -577,6 +577,9 @@ static int flask_domctl(struct domain *d, int cmd) case XEN_DOMCTL_iomem_permission: case XEN_DOMCTL_memory_mapping: case XEN_DOMCTL_set_target: +#ifdef HAS_MEM_ACCESS + case XEN_DOMCTL_mem_event_op: +#endif #ifdef CONFIG_X86 /* These have individual XSM hooks (arch/x86/domctl.c) */ case XEN_DOMCTL_shadow_op: @@ -584,7 +587,6 @@ static int flask_domctl(struct domain *d, int cmd) case XEN_DOMCTL_bind_pt_irq: case XEN_DOMCTL_unbind_pt_irq: case XEN_DOMCTL_ioport_mapping: - case XEN_DOMCTL_mem_event_op: /* These have individual XSM hooks (drivers/passthrough/iommu.c) */ case XEN_DOMCTL_get_device_group: case XEN_DOMCTL_test_assign_device: @@ -1189,6 +1191,18 @@ static int flask_deassign_device(struct domain *d, uint32_t machine_bdf) } #endif /* HAS_PASSTHROUGH && HAS_PCI */ +#ifdef HAS_MEM_ACCESS +static int flask_mem_event_control(struct domain *d, int mode, int op) +{ + return current_has_perm(d, SECCLASS_HVM, HVM__MEM_EVENT); +} + +static int flask_mem_event_op(struct domain *d, int op) +{ + return current_has_perm(d, SECCLASS_HVM, HVM__MEM_EVENT); +} +#endif /* HAS_MEM_ACCESS */ + #ifdef CONFIG_X86 static int flask_do_mca(void) { @@ -1299,16 +1313,6 @@ static int flask_hvm_ioreq_server(struct domain *d, int op) return current_has_perm(d, SECCLASS_HVM, HVM__HVMCTL); } -static int flask_mem_event_control(struct domain *d, int mode, int op) -{ - return current_has_perm(d, SECCLASS_HVM, HVM__MEM_EVENT); -} - -static int flask_mem_event_op(struct domain *d, int op) -{ - return current_has_perm(d, SECCLASS_HVM, HVM__MEM_EVENT); -} - static int flask_mem_sharing_op(struct domain *d, struct domain *cd, int op) { int rc = current_has_perm(cd, SECCLASS_HVM, HVM__MEM_SHARING); @@ -1577,6 +1581,11 @@ static struct xsm_operations flask_ops = { .deassign_device = flask_deassign_device, #endif +#ifdef HAS_MEM_ACCESS + .mem_event_control = flask_mem_event_control, + .mem_event_op = flask_mem_event_op, +#endif + #ifdef CONFIG_X86 .do_mca = flask_do_mca, .shadow_control = flask_shadow_control, @@ -1585,8 +1594,6 @@ static struct xsm_operations flask_ops = { .hvm_set_pci_link_route = flask_hvm_set_pci_link_route, .hvm_inject_msi = flask_hvm_inject_msi, .hvm_ioreq_server = flask_hvm_ioreq_server, - .mem_event_control = flask_mem_event_control, - .mem_event_op = flask_mem_event_op, .mem_sharing_op = flask_mem_sharing_op, .apic = flask_apic, .platform_op = flask_platform_op, -- 2.1.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |