xen/arm: Introduce helper for static memory pages

Introduce a new helper function in the static-memory module
that can be called to manage static memory banks, this is
done to reuse the code when other modules would like to
manage static memory banks that are not part of the
reserved_mem structure, this is done because the static
shared memory banks will be removed from reserved_mem.

Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
Luca Fancellu authored and Julien Grall committed 2024-04-24 19:13:35 +01:00
1 parent 9f657d8832
commit e5816ad4e8
2 files changed
+14 -11

No files matched your search

+13
View File
@@ -3,10 +3,23 @@
#ifndef __ASM_STATIC_MEMORY_H_
#define __ASM_STATIC_MEMORY_H_
#include <xen/pfn.h>
#include <asm/kernel.h>
#ifdef CONFIG_STATIC_MEMORY
static inline void init_staticmem_bank(const struct membank *bank)
{
mfn_t bank_start = _mfn(PFN_UP(bank->start));
unsigned long bank_pages = PFN_DOWN(bank->size);
mfn_t bank_end = mfn_add(bank_start, bank_pages);
if ( mfn_x(bank_end) <= mfn_x(bank_start) )
return;
unprepare_staticmem_pages(mfn_to_page(bank_start), bank_pages, false);
}
void allocate_static_memory(struct domain *d, struct kernel_info *kinfo,
const struct dt_device_node *node);
void assign_static_memory_11(struct domain *d, struct kernel_info *kinfo,
+1 -11
View File
@@ -265,17 +265,7 @@ void __init init_staticmem_pages(void)
for ( bank = 0 ; bank < reserved_mem->nr_banks; bank++ )
{
if ( reserved_mem->bank[bank].type == MEMBANK_STATIC_DOMAIN )
{
mfn_t bank_start = _mfn(PFN_UP(reserved_mem->bank[bank].start));
unsigned long bank_pages = PFN_DOWN(reserved_mem->bank[bank].size);
mfn_t bank_end = mfn_add(bank_start, bank_pages);
if ( mfn_x(bank_end) <= mfn_x(bank_start) )
return;
unprepare_staticmem_pages(mfn_to_page(bank_start),
bank_pages, false);
}
init_staticmem_bank(&reserved_mem->bank[bank]);
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.