]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commit
xen/arm: Introduce a generic way to access memory bank structures
authorLuca Fancellu <luca.fancellu@arm.com>
Thu, 18 Apr 2024 07:36:44 +0000 (08:36 +0100)
committerJulien Grall <jgrall@amazon.com>
Wed, 24 Apr 2024 18:13:35 +0000 (19:13 +0100)
commit2209c1e35b479dff8ed3d3161001ffdefa0a704e
tree719899592603705e2159dcbaa9613549e62c4f3f
parent8d5ff144773dd326ce526173655a919d471a8cfc
xen/arm: Introduce a generic way to access memory bank structures

Currently the 'struct meminfo' is defining a static defined array of
'struct membank' of NR_MEM_BANKS elements, some features like
shared memory don't require such amount of memory allocation but
might want to reuse existing code to manipulate this kind of
structure that is just as 'struct meminfo' but less bulky.

For this reason introduce a generic way to access this kind of
structure using a new structure 'struct membanks', which implements
all the fields needed by a structure related to memory banks
without the need to specify at build time the size of the
'struct membank' array, using a flexible array member.

Modify 'struct meminfo' to implement the field related to the new
introduced structure, given the change all usage of this structure
are updated in this way:
 - code accessing bootinfo.{mem,reserved_mem,acpi} field now uses
   3 new introduced static inline helpers to access the new field
   of 'struct meminfo' named 'common'.
 - code accessing 'struct kernel_info *' member 'mem' now use the
   new introduced macro 'kernel_info_get_mem(...)' to access the
   new field of 'struct meminfo' named 'common'.
 - introduced KERNEL_INFO_INIT and BOOTINFO_INIT that from now on
   will be used to initialize 'struct kernel_info' and 'struct bootinfo'
   respectively, in order to initialize their 'struct meminfo'
   .common.max_banks members.

Constify pointers where needed.

Suggested-by: Julien Grall <julien@xen.org>
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
15 files changed:
xen/arch/arm/acpi/domain_build.c
xen/arch/arm/arm32/mmu/mm.c
xen/arch/arm/arm64/mmu/mm.c
xen/arch/arm/bootfdt.c
xen/arch/arm/dom0less-build.c
xen/arch/arm/domain_build.c
xen/arch/arm/efi/efi-boot.h
xen/arch/arm/efi/efi-dom0.c
xen/arch/arm/include/asm/domain_build.h
xen/arch/arm/include/asm/kernel.h
xen/arch/arm/include/asm/setup.h
xen/arch/arm/kernel.c
xen/arch/arm/setup.c
xen/arch/arm/static-memory.c
xen/arch/arm/static-shmem.c