Message ID | 20220620024408.203797-7-Penny.Zheng@arm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | populate/unpopulate memory when domain on static allocation | expand |
On 20.06.2022 04:44, Penny Zheng wrote: > --- a/xen/include/xen/domain.h > +++ b/xen/include/xen/domain.h > @@ -35,6 +35,18 @@ void arch_get_domain_info(const struct domain *d, > /* Should domain memory be directly mapped? */ > #define CDF_directmap (1U << 1) > #endif > +/* Is domain memory on static allocation? */ > +#ifdef CONFIG_STATIC_MEMORY > +#define CDF_staticmem (1U << 2) > +#else > +#define CDF_staticmem 0 > +#endif With this do you really need ... > +#ifdef CONFIG_STATIC_MEMORY > +#define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) > +#else > +#define is_domain_using_staticmem(d) ((void)(d), false) > +#endif ... the #ifdef-ary here anymore? Jan
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 7ddd16c26d..17cd886be8 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3287,9 +3287,12 @@ void __init create_domUs(void) if ( !dt_device_is_compatible(node, "xen,domain") ) continue; + if ( dt_find_property(node, "xen,static-mem", NULL) ) + flags |= CDF_staticmem; + if ( dt_property_read_bool(node, "direct-map") ) { - if ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !dt_find_property(node, "xen,static-mem", NULL) ) + if ( !(flags & CDF_staticmem) ) panic("direct-map is not valid for domain %s without static allocation.\n", dt_node_name(node)); diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 1c3c88a14d..cf34eddf6d 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -35,6 +35,18 @@ void arch_get_domain_info(const struct domain *d, /* Should domain memory be directly mapped? */ #define CDF_directmap (1U << 1) #endif +/* Is domain memory on static allocation? */ +#ifdef CONFIG_STATIC_MEMORY +#define CDF_staticmem (1U << 2) +#else +#define CDF_staticmem 0 +#endif + +#ifdef CONFIG_STATIC_MEMORY +#define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) +#else +#define is_domain_using_staticmem(d) ((void)(d), false) +#endif /* * Arch-specifics.
In order to have an easy and quick way to find out whether this domain memory is statically configured, this commit introduces a new flag CDF_staticmem and a new helper is_domain_using_staticmem() to tell. Signed-off-by: Penny Zheng <penny.zheng@arm.com> --- v7 changes: - IS_ENABLED(CONFIG_STATIC_MEMORY) would not be needed anymore --- v6 changes: - move non-zero is_domain_using_staticmem() from ARM header to common header --- v5 changes: - guard "is_domain_using_staticmem" under CONFIG_STATIC_MEMORY - #define is_domain_using_staticmem zero if undefined --- v4 changes: - no changes --- v3 changes: - change name from "is_domain_static()" to "is_domain_using_staticmem" --- v2 changes: - change name from "is_domain_on_static_allocation" to "is_domain_static()" --- xen/arch/arm/domain_build.c | 5 ++++- xen/include/xen/domain.h | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)