mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
arm/dom0less: put dom0less feature code in a separate module
Currently the dom0less feature code is mostly inside domain_build.c and setup.c, it is a feature that may not be useful to everyone so put the code in a different compilation module in order to make it easier to disable the feature in the future. Move gic_interrupt_t in domain_build.h to use it with the function declaration, move its comment above the declaration. The following functions are now visible externally from domain_build because they are used also from the dom0less-build module: - get_allocation_size - set_interrupt - domain_fdt_begin_node - make_memory_node - make_resv_memory_node - make_hypervisor_node - make_psci_node - make_cpus_node - make_timer_node - handle_device_interrupts - construct_domain - process_shm - allocate_bank_memory The functions allocate_static_memory and assign_static_memory_11 are now externally visible, so put their declarations into domain_build.h and move the #else and stub definition in the header as well. Move is_dom0less_mode from setup.c to dom0less-build.c and make it externally visible. The function allocate_bank_memory is used only by dom0less code at the moment, but it's been decided to leave it in domain_build.c in case that in the future the dom0 code can use it. Where spotted, fix code style issues. No functional change is intended. Signed-off-by: Luca Fancellu <luca.fancellu@arm.com> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
dcb92d4ef1
commit
8d2c3ab18c
7 files changed
+1130
-1048
No files matched your search
@@ -16,6 +16,7 @@ obj-y += cpufeature.o
|
||||
obj-y += decode.o
|
||||
obj-y += device.o
|
||||
obj-$(CONFIG_IOREQ_SERVER) += dm.o
|
||||
obj-y += dom0less-build.init.o
|
||||
obj-y += domain.o
|
||||
obj-y += domain_build.init.o
|
||||
obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
+30
-1015
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,20 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#ifndef __ASM_DOM0LESS_BUILD_H_
|
||||
#define __ASM_DOM0LESS_BUILD_H_
|
||||
|
||||
#include <xen/stdbool.h>
|
||||
|
||||
void create_domUs(void);
|
||||
bool is_dom0less_mode(void);
|
||||
|
||||
#endif /* __ASM_DOM0LESS_BUILD_H_ */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
* c-file-style: "BSD"
|
||||
* c-basic-offset: 4
|
||||
* indent-tabs-mode: nil
|
||||
* End:
|
||||
*/
|
||||
@@ -4,9 +4,47 @@
|
||||
#include <xen/sched.h>
|
||||
#include <asm/kernel.h>
|
||||
|
||||
typedef __be32 gic_interrupt_t[3];
|
||||
|
||||
bool allocate_bank_memory(struct domain *d, struct kernel_info *kinfo,
|
||||
gfn_t sgfn, paddr_t tot_size);
|
||||
int construct_domain(struct domain *d, struct kernel_info *kinfo);
|
||||
int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit);
|
||||
int make_resv_memory_node(const struct domain *d, void *fdt, int addrcells,
|
||||
int sizecells, const struct meminfo *mem);
|
||||
int make_chosen_node(const struct kernel_info *kinfo);
|
||||
int make_cpus_node(const struct domain *d, void *fdt);
|
||||
int make_hypervisor_node(struct domain *d, const struct kernel_info *kinfo,
|
||||
int addrcells, int sizecells);
|
||||
int make_memory_node(const struct domain *d, void *fdt, int addrcells,
|
||||
int sizecells, struct meminfo *mem);
|
||||
int make_psci_node(void *fdt);
|
||||
int make_timer_node(const struct kernel_info *kinfo);
|
||||
void evtchn_allocate(struct domain *d);
|
||||
|
||||
unsigned int get_allocation_size(paddr_t size);
|
||||
|
||||
/*
|
||||
* handle_device_interrupts retrieves the interrupts configuration from
|
||||
* a device tree node and maps those interrupts to the target domain.
|
||||
*
|
||||
* Returns:
|
||||
* < 0 error
|
||||
* 0 success
|
||||
*/
|
||||
int handle_device_interrupts(struct domain *d, struct dt_device_node *dev,
|
||||
bool need_mapping);
|
||||
|
||||
/*
|
||||
* Helper to write an interrupts with the GIC format
|
||||
* This code is assuming the irq is an PPI.
|
||||
*/
|
||||
void set_interrupt(gic_interrupt_t interrupt, unsigned int irq,
|
||||
unsigned int cpumask, unsigned int level);
|
||||
|
||||
int process_shm(struct domain *d, struct kernel_info *kinfo,
|
||||
const struct dt_device_node *node);
|
||||
|
||||
#ifndef CONFIG_ACPI
|
||||
static inline int prepare_acpi(struct domain *d, struct kernel_info *kinfo)
|
||||
{
|
||||
@@ -17,6 +55,28 @@ static inline int prepare_acpi(struct domain *d, struct kernel_info *kinfo)
|
||||
#else
|
||||
int prepare_acpi(struct domain *d, struct kernel_info *kinfo);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_STATIC_MEMORY
|
||||
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,
|
||||
const struct dt_device_node *node);
|
||||
#else
|
||||
static inline void allocate_static_memory(struct domain *d,
|
||||
struct kernel_info *kinfo,
|
||||
const struct dt_device_node *node)
|
||||
{
|
||||
ASSERT_UNREACHABLE();
|
||||
}
|
||||
|
||||
static inline void assign_static_memory_11(struct domain *d,
|
||||
struct kernel_info *kinfo,
|
||||
const struct dt_device_node *node)
|
||||
{
|
||||
ASSERT_UNREACHABLE();
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -135,7 +135,6 @@ void acpi_create_efi_mmap_table(struct domain *d,
|
||||
|
||||
int acpi_make_efi_nodes(void *fdt, struct membank tbl_add[]);
|
||||
|
||||
void create_domUs(void);
|
||||
void create_dom0(void);
|
||||
void alloc_static_evtchn(void);
|
||||
|
||||
|
||||
+1
-32
@@ -34,6 +34,7 @@
|
||||
#include <xen/warning.h>
|
||||
#include <xen/hypercall.h>
|
||||
#include <asm/alternative.h>
|
||||
#include <asm/dom0less-build.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/current.h>
|
||||
#include <asm/setup.h>
|
||||
@@ -724,38 +725,6 @@ void __init populate_boot_allocator(void)
|
||||
}
|
||||
}
|
||||
|
||||
static bool __init is_dom0less_mode(void)
|
||||
{
|
||||
struct bootmodules *mods = &bootinfo.modules;
|
||||
struct bootmodule *mod;
|
||||
unsigned int i;
|
||||
bool dom0found = false;
|
||||
bool domUfound = false;
|
||||
|
||||
/* Look into the bootmodules */
|
||||
for ( i = 0 ; i < mods->nr_mods ; i++ )
|
||||
{
|
||||
mod = &mods->module[i];
|
||||
/* Find if dom0 and domU kernels are present */
|
||||
if ( mod->kind == BOOTMOD_KERNEL )
|
||||
{
|
||||
if ( mod->domU == false )
|
||||
{
|
||||
dom0found = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
domUfound = true;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is no dom0 kernel but at least one domU, then we are in
|
||||
* dom0less mode
|
||||
*/
|
||||
return ( !dom0found && domUfound );
|
||||
}
|
||||
|
||||
size_t __read_mostly dcache_line_bytes;
|
||||
|
||||
/* C entry point for boot CPU */
|
||||
|
||||