On 27.11.2025 17:26, Oleksii Kurochko wrote: > From: Roger Pau Monne <[email protected]> > > Move x86's free_domain_struct() to common code since it is shared between > architectures. > > Move the x86 version of alloc_domain_struct() to common code as most of the > logic is architecture-independent. To handle the remaining architectural > differences, introduce arch_domain_struct_memflags() for x86-specific > allocation requirements. > > No functional change. > > Suggested-by: Jan Beulich <[email protected]> > [Introduce an arch-specific function instead of using a weak function] > Signed-off-by: Roger Pau Monné <[email protected]> > Signed-off-by: Oleksii Kurochko <[email protected]>
Reviewed-by: Jan Beulich <[email protected]> ideally with ... > --- a/xen/common/domain.c > +++ b/xen/common/domain.c > @@ -799,6 +799,28 @@ static int sanitise_domain_config(struct > xen_domctl_createdomain *config) > return arch_sanitise_domain_config(config); > } > > +struct domain *alloc_domain_struct(void) > +{ > +#ifndef arch_domain_struct_memflags > +# define arch_domain_struct_memflags() 0 > +#endif > + > + struct domain *d; > + > + BUILD_BUG_ON(sizeof(*d) > PAGE_SIZE); > + > + d = alloc_xenheap_pages(0, arch_domain_struct_memflags()); ... this now becoming the initializer of the variable. > + if ( d != NULL ) Personally I'd also prefer if the "!= NULL" was dropped at this occasion. Jan
