From a603002eea8213eec5211be5a85db8340aea06d0 Mon Sep 17 00:00:00 2001 From: Juergen Gross Date: Wed, 22 Jun 2022 08:38:36 +0200 Subject: virtio: replace restricted mem access flag with callback Instead of having a global flag to require restricted memory access for all virtio devices, introduce a callback which can select that requirement on a per-device basis. For convenience add a common function returning always true, which can be used for use cases like SEV. Per default use a callback always returning false. As the callback needs to be set in early init code already, add a virtio anchor which is builtin in case virtio is enabled. Signed-off-by: Juergen Gross Tested-by: Oleksandr Tyshchenko # Arm64 guest using Xen Reviewed-by: Stefano Stabellini Link: https://lore.kernel.org/r/20220622063838.8854-2-jgross@suse.com Signed-off-by: Juergen Gross --- include/xen/xen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/xen') diff --git a/include/xen/xen.h b/include/xen/xen.h index 0780a81e140d..ac5a144c6a65 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -52,12 +52,12 @@ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, extern u64 xen_saved_max_mem_size; #endif -#include +#include static inline void xen_set_restricted_virtio_memory_access(void) { if (IS_ENABLED(CONFIG_XEN_VIRTIO) && xen_domain()) - platform_set(PLATFORM_VIRTIO_RESTRICTED_MEM_ACCESS); + virtio_set_mem_acc_cb(virtio_require_restricted_mem_acc); } #ifdef CONFIG_XEN_UNPOPULATED_ALLOC -- cgit v1.2.3-58-ga151