]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
Make MEM_ACCESS configurable
authorStefano Stabellini <sstabellini@kernel.org>
Tue, 31 Jul 2018 15:17:01 +0000 (08:17 -0700)
committerJulien Grall <julien.grall@arm.com>
Thu, 2 Aug 2018 11:24:26 +0000 (12:24 +0100)
Select MEM_ACCESS_ALWAYS_ON on x86 to mark that MEM_ACCESS is not
configurable on x86. Avoid selecting it on ARM.
Rename HAS_MEM_ACCESS to MEM_ACCESS everywhere. Add a prompt and a
description to MEM_ACCESS in xen/common/Kconfig.

The result is that the user-visible option is MEM_ACCESS, and it is
configurable only on ARM (disabled by default). At the moment the
arch-specific mem_access code remains enabled on ARM, even with
MEM_ACCESS=y.

The purpose is to reduce code size. The option doesn't depend on EXPERT
because it would be nice to ecurity-support configurations without
MEM_ACCESS and a non-expert should be able to disable it.

Suggested-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <julien.grall@arm.com>
CC: dgdegra@tycho.nsa.gov
CC: andrew.cooper3@citrix.com
CC: George.Dunlap@eu.citrix.com
CC: ian.jackson@eu.citrix.com
CC: jbeulich@suse.com
CC: julien.grall@arm.com
CC: konrad.wilk@oracle.com
CC: sstabellini@kernel.org
CC: tim@xen.org
CC: wei.liu2@citrix.com
---
Changes in v5:
- change MEM_ACCESS_ALWAYS_ON to bool
- change default for MEM_ACCESS, default y if MEM_ACCESS_ALWAYS_ON

Changes in v4:
- remove HAS_MEM_ACCESS
- move MEM_ACCESS_ALWAYS_ON to common
- combile default and bool to def_bool

Changes in v3:
- keep HAS_MEM_ACCESS to mark that an arch can do MEM_ACCESS
- introduce MEM_ACCESS_ALWAYS_ON
- the main MEM_ACCESS option is in xen/common/Kconfig

Changes in v2:
- patch added

tools/firmware/xen-dir/shim.config
xen/arch/arm/Kconfig
xen/arch/x86/Kconfig
xen/common/Kconfig
xen/common/Makefile
xen/common/domctl.c
xen/include/xen/mem_access.h
xen/include/xsm/dummy.h
xen/include/xsm/xsm.h
xen/xsm/dummy.c
xen/xsm/flask/hooks.c

index 4d5630f87a2e1ab0a6430c95973465d468a2ad00..21d7075bb414ca75a94dcdbb46b6f849c4f03266 100644 (file)
@@ -29,7 +29,7 @@ CONFIG_COMPAT=y
 CONFIG_CORE_PARKING=y
 CONFIG_HAS_ALTERNATIVE=y
 CONFIG_HAS_EX_TABLE=y
-CONFIG_HAS_MEM_ACCESS=y
+CONFIG_MEM_ACCESS=y
 CONFIG_HAS_MEM_PAGING=y
 CONFIG_HAS_MEM_SHARING=y
 CONFIG_HAS_PDX=y
index e8f25ecf1aced7ae5f557c14a7d9b3c3e475bbcf..977b55d3453d74b67c2d9c68494f739d74d66666 100644 (file)
@@ -17,7 +17,6 @@ config ARM
        def_bool y
        select HAS_ALTERNATIVE
        select HAS_DEVICE_TREE
-       select HAS_MEM_ACCESS
        select HAS_PASSTHROUGH
        select HAS_PDX
 
index c75f0526d8224e768a2f5370a5662fdd7372534c..0c5072be1f6239187b4a39ea1113e6556c6d0314 100644 (file)
@@ -15,7 +15,7 @@ config X86
        select HAS_GDBSX
        select HAS_IOPORTS
        select HAS_KEXEC
-       select HAS_MEM_ACCESS
+       select MEM_ACCESS_ALWAYS_ON
        select HAS_MEM_PAGING
        select HAS_MEM_SHARING
        select HAS_NS16550
index d4c0951a24461ce2bba5df8bff3918b1e1991350..cf9b351be668c303f8a74d5160002056408dcc25 100644 (file)
@@ -20,9 +20,17 @@ config HAS_DEVICE_TREE
 config HAS_EX_TABLE
        bool
 
-config HAS_MEM_ACCESS
+config MEM_ACCESS_ALWAYS_ON
        bool
 
+config MEM_ACCESS
+       def_bool MEM_ACCESS_ALWAYS_ON
+       prompt "Memory Access and VM events" if !MEM_ACCESS_ALWAYS_ON
+       ---help---
+
+         Framework to configure memory access types for guests and receive
+         related events in userspace.
+
 config HAS_MEM_PAGING
        bool
 
index b3e0b0ebf4d84937d35475f60470740ff864193a..6a05fffc7a91a56d9f340f295ab01997cd73ca49 100644 (file)
@@ -22,7 +22,7 @@ obj-y += lib.o
 obj-$(CONFIG_NEEDS_LIST_SORT) += list_sort.o
 obj-$(CONFIG_LIVEPATCH) += livepatch.o livepatch_elf.o
 obj-y += lzo.o
-obj-$(CONFIG_HAS_MEM_ACCESS) += mem_access.o
+obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += memory.o
 obj-y += monitor.o
 obj-y += multicall.o
index a1d727091045a8529b6a9343bbf0021b5c2cf1a0..c86dc21e3e43028c7c142c7624d4a57a239607cf 100644 (file)
@@ -1085,7 +1085,7 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         copyback = 1;
         break;
 
-#ifdef CONFIG_HAS_MEM_ACCESS
+#ifdef CONFIG_MEM_ACCESS
     case XEN_DOMCTL_set_access_required:
         if ( unlikely(current->domain == d) ) /* no domain_pause() */
             ret = -EPERM;
index 5ab34c15530b3c979b99507c9b19eebb22e0069f..7e95eab81ca5b133d88c2640dc870897be483668 100644 (file)
@@ -78,7 +78,7 @@ long p2m_set_mem_access_multi(struct domain *d,
  */
 int p2m_get_mem_access(struct domain *d, gfn_t gfn, xenmem_access_t *access);
 
-#ifdef CONFIG_HAS_MEM_ACCESS
+#ifdef CONFIG_MEM_ACCESS
 int mem_access_memop(unsigned long cmd,
                      XEN_GUEST_HANDLE_PARAM(xen_mem_access_op_t) arg);
 #else
@@ -88,7 +88,7 @@ int mem_access_memop(unsigned long cmd,
 {
     return -ENOSYS;
 }
-#endif /* CONFIG_HAS_MEM_ACCESS */
+#endif /* CONFIG_MEM_ACCESS */
 
 #endif /* _XEN_MEM_ACCESS_H */
 
index ff6b2dbf391c1c65466bfeac76e652625524a0a6..b0ac1f66b3de897c931f407167a866b43854675e 100644 (file)
@@ -584,7 +584,7 @@ static XSM_INLINE int xsm_vm_event_control(XSM_DEFAULT_ARG struct domain *d, int
     return xsm_default_action(action, current->domain, d);
 }
 
-#ifdef CONFIG_HAS_MEM_ACCESS
+#ifdef CONFIG_MEM_ACCESS
 static XSM_INLINE int xsm_mem_access(XSM_DEFAULT_ARG struct domain *d)
 {
     XSM_ASSERT_ACTION(XSM_DM_PRIV);
index f0c6fc7e29da5e020da87c64bc8cc9e07753dfc1..7636bcbb42049baa528e6fd0fdf3fe61e5c03701 100644 (file)
@@ -143,7 +143,7 @@ struct xsm_operations {
 
     int (*vm_event_control) (struct domain *d, int mode, int op);
 
-#ifdef CONFIG_HAS_MEM_ACCESS
+#ifdef CONFIG_MEM_ACCESS
     int (*mem_access) (struct domain *d);
 #endif
 
@@ -582,7 +582,7 @@ static inline int xsm_vm_event_control (xsm_default_t def, struct domain *d, int
     return xsm_ops->vm_event_control(d, mode, op);
 }
 
-#ifdef CONFIG_HAS_MEM_ACCESS
+#ifdef CONFIG_MEM_ACCESS
 static inline int xsm_mem_access (xsm_default_t def, struct domain *d)
 {
     return xsm_ops->mem_access(d);
index 6e751199eeb7e2078f5ad5a2782d79f1d0571ad9..3290d045270ad2160a26ce24564e6e229fd119b3 100644 (file)
@@ -127,7 +127,7 @@ void __init xsm_fixup_ops (struct xsm_operations *ops)
 
     set_to_dummy_if_null(ops, vm_event_control);
 
-#ifdef CONFIG_HAS_MEM_ACCESS
+#ifdef CONFIG_MEM_ACCESS
     set_to_dummy_if_null(ops, mem_access);
 #endif
 
index 78bc32602e4c41a087ea504c864ab916072da305..7a3ccfad026167301ac32918744d1e8ee9d4e930 100644 (file)
@@ -1256,7 +1256,7 @@ static int flask_vm_event_control(struct domain *d, int mode, int op)
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__VM_EVENT);
 }
 
-#ifdef CONFIG_HAS_MEM_ACCESS
+#ifdef CONFIG_MEM_ACCESS
 static int flask_mem_access(struct domain *d)
 {
     return current_has_perm(d, SECCLASS_DOMAIN2, DOMAIN2__MEM_ACCESS);
@@ -1803,7 +1803,7 @@ static struct xsm_operations flask_ops = {
 
     .vm_event_control = flask_vm_event_control,
 
-#ifdef CONFIG_HAS_MEM_ACCESS
+#ifdef CONFIG_MEM_ACCESS
     .mem_access = flask_mem_access,
 #endif