Message ID | 20220427092743.925563-5-Penny.Zheng@arm.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | populate/unpopulate memory when domain on static | expand |
Hi Penny, On 27/04/2022 10:27, Penny Zheng wrote: > 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. > > Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> The reviewed-by tags should be after signed-off-by tags. Cheers, > Signed-off-by: Penny Zheng <penny.zheng@arm.com> > --- > 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/arch/arm/include/asm/domain.h | 2 ++ > xen/include/xen/domain.h | 2 ++ > 3 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c > index 1472ca4972..6830a282a0 100644 > --- a/xen/arch/arm/domain_build.c > +++ b/xen/arch/arm/domain_build.c > @@ -3190,9 +3190,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 ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !(flags & CDF_staticmem) ) > panic("direct-map is not valid for domain %s without static allocation.\n", > dt_node_name(node)); > > diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h > index fe7a029ebf..110c672589 100644 > --- a/xen/arch/arm/include/asm/domain.h > +++ b/xen/arch/arm/include/asm/domain.h > @@ -31,6 +31,8 @@ enum domain_type { > > #define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap) > > +#define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) > + > /* > * Is the domain using the host memory layout? > * > diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h > index 1c3c88a14d..35dc7143a4 100644 > --- a/xen/include/xen/domain.h > +++ b/xen/include/xen/domain.h > @@ -34,6 +34,8 @@ void arch_get_domain_info(const struct domain *d, > #ifdef CONFIG_ARM > /* Should domain memory be directly mapped? */ > #define CDF_directmap (1U << 1) > +/* Is domain memory on static allocation? */ > +#define CDF_staticmem (1U << 2) > #endif > > /*
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 1472ca4972..6830a282a0 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -3190,9 +3190,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 ( !IS_ENABLED(CONFIG_STATIC_MEMORY) || !(flags & CDF_staticmem) ) panic("direct-map is not valid for domain %s without static allocation.\n", dt_node_name(node)); diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h index fe7a029ebf..110c672589 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -31,6 +31,8 @@ enum domain_type { #define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap) +#define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) + /* * Is the domain using the host memory layout? * diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 1c3c88a14d..35dc7143a4 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -34,6 +34,8 @@ void arch_get_domain_info(const struct domain *d, #ifdef CONFIG_ARM /* Should domain memory be directly mapped? */ #define CDF_directmap (1U << 1) +/* Is domain memory on static allocation? */ +#define CDF_staticmem (1U << 2) #endif /*