Hi Penny,
On 30/03/2022 10:36, Penny Zheng wrote:
> With more and more CDF_xxx internal flags in and to save the space, this
> commit introduces a new field "flags" to store CDF_* internal flags
> directly.
>
> Another new CDF_xxx will be introduced in the next patch.
>
> Signed-off-by: Penny Zheng <penny.zheng@arm.com>
> ---
> xen/arch/arm/domain.c | 3 ++-
> xen/arch/arm/include/asm/domain.h | 5 +++--
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 8110c1df86..35c157d499 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -709,7 +709,8 @@ int arch_domain_create(struct domain *d,
> ioreq_domain_init(d);
> #endif
>
> - d->arch.directmap = flags & CDF_directmap;
> + /* Holding CDF_* internal flags. */
> + d->arch.flags = flags;
>
> /* p2m_init relies on some value initialized by the IOMMU subsystem */
> if ( (rc = iommu_domain_init(d, config->iommu_opts)) != 0 )
> diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h
> index ed63c2b6f9..95fef29111 100644
> --- a/xen/arch/arm/include/asm/domain.h
> +++ b/xen/arch/arm/include/asm/domain.h
> @@ -29,7 +29,7 @@ enum domain_type {
> #define is_64bit_domain(d) (0)
> #endif
>
> -#define is_domain_direct_mapped(d) (d)->arch.directmap
> +#define is_domain_direct_mapped(d) (((d)->arch.flags) & CDF_directmap)
The () around (d)->arch.flags are not necessary.
>
> /*
> * Is the domain using the host memory layout?
> @@ -103,7 +103,8 @@ struct arch_domain
> void *tee;
> #endif
>
> - bool directmap;
> + /* Holding CDF_* constant. Internal flags for domain creation. */
> + uint32_t flags;
I think this wants to live in the struct domain. So other arch can take
advantage of it in the future.
> } __cacheline_aligned;
>
> struct arch_vcpu
Cheers,
--
Julien Grall