From: Stefano Stabellini <[email protected]> This commit introduces a new ARM-specific flag to specify that the domain should be 1:1 directly mapped (guest physical addresses == physical addresses).
Also, add a direct_map flag under struct arch_domain and use it to implement is_domain_direct_mapped. Signed-off-by: Stefano Stabellini <[email protected]> Signed-off-by: Penny Zheng <[email protected]> CC: [email protected] CC: [email protected] CC: George Dunlap <[email protected]> CC: Ian Jackson <[email protected]> CC: Wei Liu <[email protected]> CC: "Roger Pau Monné" <[email protected]> --- xen/arch/arm/domain.c | 1 + xen/arch/arm/domain_build.c | 2 +- xen/include/asm-arm/domain.h | 9 +++++++-- xen/include/xen/domain.h | 4 ++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 7922249d26..0b3cff8a40 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -696,6 +696,7 @@ int arch_domain_create(struct domain *d, return 0; ASSERT(config != NULL); + d->arch.direct_map = config->flags & XEN_DOMCTL_INTERNAL_directmap; #ifdef CONFIG_IOREQ_SERVER ioreq_domain_init(d); diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 8cc4c800e9..21d8a559af 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2753,7 +2753,7 @@ void __init create_dom0(void) struct domain *dom0; struct xen_domctl_createdomain dom0_cfg = { .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap | - XEN_DOMCTL_INTERNAL_ispriv, + XEN_DOMCTL_INTERNAL_ispriv | XEN_DOMCTL_INTERNAL_directmap, .max_evtchn_port = -1, .max_grant_frames = gnttab_dom0_frames(), .max_maptrack_frames = -1, diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index c9277b5c6d..a74ee5720c 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -29,8 +29,11 @@ enum domain_type { #define is_64bit_domain(d) (0) #endif -/* The hardware domain has always its memory direct mapped. */ -#define is_domain_direct_mapped(d) is_hardware_domain(d) +/* + * The hardware domain has always its memory direct mapped. And DOM0 shall + * be always been set as 1:1 direct-map domain. + */ +#define is_domain_direct_mapped(d) (d)->arch.direct_map struct vtimer { struct vcpu *v; @@ -89,6 +92,8 @@ struct arch_domain #ifdef CONFIG_TEE void *tee; #endif + + bool direct_map; } __cacheline_aligned; struct arch_vcpu diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 7ed0b62b78..6c2b07eb42 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -32,6 +32,10 @@ void arch_get_domain_info(const struct domain *d, #define _XEN_DOMCTL_INTERNAL_ispriv 16 #define XEN_DOMCTL_INTERNAL_ispriv (1U<<_XEN_DOMCTL_INTERNAL_ispriv) +/* This flag is ARM specific */ +#define _XEN_DOMCTL_INTERNAL_directmap 17 +#define XEN_DOMCTL_INTERNAL_directmap (1U<<_XEN_DOMCTL_INTERNAL_directmap) + /* * Arch-specifics. */ -- 2.25.1
