From f5079a9a2a31607a2343e544e9182ce35b030578 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Fri, 19 Mar 2021 13:01:40 -0700 Subject: xen/arm: introduce XENFEAT_direct_mapped and XENFEAT_not_direct_mapped Newer Xen versions expose two Xen feature flags to tell us if the domain is directly mapped or not. Only when a domain is directly mapped it makes sense to enable swiotlb-xen on ARM. Introduce a function on ARM to check the new Xen feature flags and also to deal with the legacy case. Call the function xen_swiotlb_detect. Signed-off-by: Stefano Stabellini Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/r/20210319200140.12512-1-sstabellini@kernel.org Signed-off-by: Juergen Gross --- include/xen/interface/features.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/xen/interface') diff --git a/include/xen/interface/features.h b/include/xen/interface/features.h index 6d1384abfbdf..5a7bdefa06a8 100644 --- a/include/xen/interface/features.h +++ b/include/xen/interface/features.h @@ -83,6 +83,20 @@ */ #define XENFEAT_linux_rsdp_unrestricted 15 +/* + * A direct-mapped (or 1:1 mapped) domain is a domain for which its + * local pages have gfn == mfn. If a domain is direct-mapped, + * XENFEAT_direct_mapped is set; otherwise XENFEAT_not_direct_mapped + * is set. + * + * If neither flag is set (e.g. older Xen releases) the assumptions are: + * - not auto_translated domains (x86 only) are always direct-mapped + * - on x86, auto_translated domains are not direct-mapped + * - on ARM, Dom0 is direct-mapped, DomUs are not + */ +#define XENFEAT_not_direct_mapped 16 +#define XENFEAT_direct_mapped 17 + #define XENFEAT_NR_SUBMAPS 1 #endif /* __XEN_PUBLIC_FEATURES_H__ */ -- cgit v1.2.3-59-g8ed1b