Hi,
On 23/09/2021 08:11, Penny Zheng wrote:
From: Stefano Stabellini <stefano.stabell...@xilinx.com>
This commit introduces a new ARM-specific flag to specify that the
domain should be 1:1 directly mapped (guest physical addresses ==
"1:1" and "directly" means the exactly the same. Please remove either.
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 <stefano.stabell...@xilinx.com>
Signed-off-by: Penny Zheng <penny.zh...@arm.com>
CC: andrew.coop...@citrix.com
CC: jbeul...@suse.com
CC: George Dunlap <george.dun...@eu.citrix.com>
CC: Ian Jackson <ian.jack...@eu.citrix.com>
CC: Wei Liu <w...@xen.org>
CC: "Roger Pau Monné" <roger....@citrix.com>
---
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.
+ */
I think this comment should be moved on top of dom0_cfg.flags. This will
prevent in stall comment if in the future we decide to remove the direct
map (I know that cache coloring will want to drop it).
+#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;
We already store the flag in d->options. So this is a bit redundant.
} __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)
Coding style: space before and after <<.
+
/*
* Arch-specifics.
*/
Cheers,
--
Julien Grall