On 17/12/2025 10:53 am, Oleksii Kurochko wrote:
> alloc_vcpu_struct() and free_vcpu_struct() contain little
> architecture-specific logic and are suitable for sharing across
> architectures. Move both helpers to common code.
>
> To support the remaining architectural differences, introduce
> arch_vcpu_struct_memflags(), allowing architectures to override the
> memory flags passed to alloc_xenheap_pages(). This is currently needed
> by x86, which may require MEMF_bits(32) for HVM guests using shadow
> paging.

You lost the comment explaining the restriction.  This needs adding back.

> Move the definition of MAX_PAGES_PER_VCPU to xen/domain.h and default
> it to 1. Retain the ARM64 exception (with CONFIG_NEW_VGIC) where two
> pages are required due to larger per-IRQ structures.

CONFIG_NEW_VGIC is still off by default, unsupported, and has had no
work on it since it's introduction in 2018.

There are a lot of good reasons to enforce struct vcpu being a single
page allocation, not least because an allocation can fail due to
fragmentation despite there being enough free RAM.

I would far rather that common code enforced it being page size, and
NEW_VGIC gets deleted or adjusted to cope, than to make it this easy for
architectures to shoot themselves in the foot.

>
> The ARM implementation of alloc/free_vcpu_struct() is removed and
> replaced by the common version. Stub implementations are also dropped
> from PPC and RISC-V.
>
> Finally, make alloc_vcpu_struct() and free_vcpu_struct() static to
> common/domain.c, as they are no longer used outside common code.
>
> No functional changes.
>
> Signed-off-by: Oleksii Kurochko <[email protected]>
> ---
> CI tests: 
> https://gitlab.com/xen-project/people/olkur/xen/-/pipelines/2219693055
>
> Shouldn't we make alloc_domain_struct() and free_domain_struct() static and
> drop their declarations from xen/domain.h, since these functions are only
> used in common/domain.c?

Yes - they should become static.

~Andrew

Reply via email to