From: Stefano Stabellini <sstabellini@kernel.org>
To: julien.grall@arm.com
Cc: artem_mygaiev@epam.com, lars.kurth@citrix.com,
sstabellini@kernel.org, andrii_anisov@epam.com,
George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, dfaggioli@suse.com, tim@xen.org,
jbeulich@suse.com, wei.liu2@citrix.com, xen-devel@lists.xen.org
Subject: [PATCH v3 04/10] Make MEM_ACCESS configurable
Date: Tue, 22 May 2018 17:25:02 -0700 [thread overview]
Message-ID: <1527035108-15051-4-git-send-email-sstabellini@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1805221719560.24793@sstabellini-ThinkPad-X260>
Have arm and x86 select HAS_MEM_ACCESS to mark that they can do
MEM_ACCESS.
Select an additional MEM_ACCESS_ALWAYS_ON on x86 to mark that MEM_ACCESS
is not configurable on x86.
Rename HAS_MEM_ACCESS to MEM_ACCESS everywhere else. 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 (enabled by default).
Suggested-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
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 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 | 2 +-
xen/arch/arm/Kconfig | 3 +++
xen/arch/x86/Kconfig | 7 +++++++
xen/common/Kconfig | 9 ++++++++-
xen/common/Makefile | 2 +-
xen/common/domctl.c | 2 +-
xen/include/xen/mem_access.h | 4 ++--
xen/include/xsm/dummy.h | 2 +-
xen/include/xsm/xsm.h | 4 ++--
xen/xsm/dummy.c | 2 +-
xen/xsm/flask/hooks.c | 4 ++--
11 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/tools/firmware/xen-dir/shim.config b/tools/firmware/xen-dir/shim.config
index 4d5630f..21d7075 100644
--- a/tools/firmware/xen-dir/shim.config
+++ b/tools/firmware/xen-dir/shim.config
@@ -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
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index 66adce4..164cdc3 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -26,6 +26,9 @@ config ARCH_DEFCONFIG
default "arch/arm/configs/arm32_defconfig" if ARM_32
default "arch/arm/configs/arm64_defconfig" if ARM_64
+config HAS_MEM_ACCESS
+ def_bool y
+
menu "Architecture Features"
source "arch/Kconfig"
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index f64fc56..0c49d71 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -16,6 +16,7 @@ config X86
select HAS_IOPORTS
select HAS_KEXEC
select HAS_MEM_ACCESS
+ select HAS_MEM_ACCESS_ALWAYS_ON
select HAS_MEM_PAGING
select HAS_MEM_SHARING
select HAS_NS16550
@@ -30,6 +31,12 @@ config ARCH_DEFCONFIG
string
default "arch/x86/configs/x86_64_defconfig"
+config HAS_MEM_ACCESS
+ def_bool y
+
+config MEM_ACCESS_ALWAYS_ON
+ def_bool y
+
menu "Architecture Features"
source "arch/Kconfig"
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 9043dce..e675972 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -20,8 +20,15 @@ config HAS_DEVICE_TREE
config HAS_EX_TABLE
bool
-config HAS_MEM_ACCESS
+config MEM_ACCESS
bool
+ prompt "Memory Access and VM events" if !MEM_ACCESS_ALWAYS_ON
+ default y
+ depends on HAS_MEM_ACCESS
+ ---help---
+
+ Framework to configure memory access types for guests and receive
+ related events in userspace.
config HAS_MEM_PAGING
bool
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 24d4752..6f2b3fc 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -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
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 9b7bc08..891ad58 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -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;
diff --git a/xen/include/xen/mem_access.h b/xen/include/xen/mem_access.h
index 5ab34c1..7e95eab 100644
--- a/xen/include/xen/mem_access.h
+++ b/xen/include/xen/mem_access.h
@@ -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 */
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index ff6b2db..b0ac1f6 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -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);
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index f0c6fc7..7636bcb 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -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);
diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c
index 6e75119..3290d04 100644
--- a/xen/xsm/dummy.c
+++ b/xen/xsm/dummy.c
@@ -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
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 78bc326..7a3ccfa 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -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
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-05-23 0:25 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 0:24 [PATCH v3 0/10] arm: more kconfig configurability and small default configs Stefano Stabellini
2018-05-23 0:24 ` [PATCH v3 01/10] arm: remove the ARM HDLCD driver Stefano Stabellini
2018-05-29 13:37 ` Julien Grall
2018-05-23 0:25 ` [PATCH v3 02/10] arm: make it possible to disable HAS_GICV3 Stefano Stabellini
2018-05-29 13:38 ` Julien Grall
2018-05-23 0:25 ` [PATCH v3 03/10] arm: rename HAS_GICV3 to GICV3 Stefano Stabellini
2018-05-29 13:39 ` Julien Grall
2018-05-23 0:25 ` Stefano Stabellini [this message]
2018-05-29 11:50 ` [PATCH v3 04/10] Make MEM_ACCESS configurable Jan Beulich
2018-05-30 20:24 ` Stefano Stabellini
2018-05-30 22:19 ` Tamas K Lengyel
2018-06-01 7:30 ` Jan Beulich
2018-05-23 0:25 ` [PATCH v3 05/10] make it possible to enable/disable UART drivers Stefano Stabellini
2018-05-29 12:02 ` Jan Beulich
2018-05-23 0:25 ` [PATCH v3 06/10] xen: remove HAS_ prefix from UART Kconfig options Stefano Stabellini
2018-05-29 12:06 ` Jan Beulich
2018-05-30 20:33 ` Stefano Stabellini
2018-05-23 0:25 ` [PATCH v3 07/10] arm: make it possible to disable the SMMU driver Stefano Stabellini
2018-05-23 17:54 ` Andrii Anisov
2018-05-23 19:16 ` Stefano Stabellini
2018-05-24 8:01 ` Andrii Anisov
2018-05-29 12:07 ` Jan Beulich
2018-05-29 13:40 ` Julien Grall
2018-05-23 0:25 ` [PATCH v3 08/10] arm: add a tiny kconfig configuration Stefano Stabellini
2018-05-23 0:25 ` [PATCH v3 09/10] arm: add QEMU, Rcar3 and MPSoC configs Stefano Stabellini
2018-05-29 14:07 ` Julien Grall
2018-05-30 21:39 ` Stefano Stabellini
2018-05-30 22:38 ` Julien Grall
2018-05-31 21:38 ` Stefano Stabellini
2018-06-04 15:58 ` Julien Grall
2018-05-23 0:25 ` [PATCH v3 10/10] xen: add cloc target Stefano Stabellini
2018-05-29 12:15 ` Jan Beulich
2018-05-30 0:50 ` Stefano Stabellini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1527035108-15051-4-git-send-email-sstabellini@kernel.org \
--to=sstabellini@kernel.org \
--cc=George.Dunlap@eu.citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=andrii_anisov@epam.com \
--cc=artem_mygaiev@epam.com \
--cc=dfaggioli@suse.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=lars.kurth@citrix.com \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).