mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/dom0less: turn max_init_domid into a common variable
Until now every architecture carried its own notion of max_init_domid: Arm defined a real variable (declared in asm/setup.h, defined in setup.c), while ppc, riscv and x86 each provided a "#define max_init_domid (0)" stub in their asm/setup.h. This duplicated the same declaration across all arches and placed a purely dom0less concept in arch setup headers. Now that the dom0less build code lives in common (xen/common/ device-tree/dom0less-build.c sets max_init_domid, and the console serial-input switcher reads it), there is no reason for the symbol to be per-arch. Provide a single declaration in <xen/dom0less-build.h>, with the !CONFIG_DOM0LESS_BOOT stub kept there as well, so there is one source of truth and the arch headers no longer need to mention it. Update console.c to include <xen/dom0less-build.h> for the declaration instead of relying on asm/setup.h, and drop the now unneeded <asm/setup.h> include. Place the definition in xen/common/domid.c rather than in dom0less- build.c. The latter is built as dom0less-build.init.o, i.e. the whole object is relocated into the .init.* sections and freed after boot, whereas max_init_domid must outlive boot because it is read at runtime by the console serial-input switcher. domid.c is always linked (obj-y) and resides in regular (non-init) sections, so it is a correct home for the variable. It is marked __ro_after_init since it is only updated while creating boot-time domains and read-only afterwards, and guarded by CONFIG_DOM0LESS_BOOT as domid.c itself is unconditional. While at it, make <xen/dom0less-build.h> self-contained: it includes <public/xen.h>, which uses the fixed-width types provided by <xen/types.h>, so include the latter explicitly rather than relying on the includer having pulled it in first. This becomes necessary as soon as <xen/dom0less-build.h> comes first in an alphabetically sorted include list, as it now does in domid.c. Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> Reviewed-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
This commit is contained in:
1 parent
04d4312440
commit
2f73bc7c06
8 files changed
+14
-11
No files matched your search
@@ -25,8 +25,6 @@ struct map_range_data
|
||||
struct rangeset *irq_ranges;
|
||||
};
|
||||
|
||||
extern domid_t max_init_domid;
|
||||
|
||||
void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
|
||||
|
||||
size_t estimate_efi_size(unsigned int mem_nr_banks);
|
||||
|
||||
@@ -62,8 +62,6 @@ struct cpuinfo_arm __read_mostly system_cpuinfo;
|
||||
bool __read_mostly acpi_disabled;
|
||||
#endif
|
||||
|
||||
domid_t __read_mostly max_init_domid;
|
||||
|
||||
static __used void noreturn init_done(void)
|
||||
{
|
||||
/* Must be done past setting system_state. */
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#ifndef __ASM_PPC_SETUP_H__
|
||||
#define __ASM_PPC_SETUP_H__
|
||||
|
||||
#define max_init_domid (0)
|
||||
|
||||
#endif /* __ASM_PPC_SETUP_H__ */
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
#include <xen/types.h>
|
||||
|
||||
#define max_init_domid (0)
|
||||
|
||||
void setup_mm(void);
|
||||
|
||||
void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
|
||||
|
||||
@@ -68,6 +68,4 @@ extern bool opt_dom0_verbose;
|
||||
extern bool opt_dom0_cpuid_faulting;
|
||||
extern bool opt_dom0_msr_relaxed;
|
||||
|
||||
#define max_init_domid (0)
|
||||
|
||||
#endif
|
||||
@@ -8,8 +8,13 @@
|
||||
* Copyright 2025 Ford Motor Company
|
||||
*/
|
||||
|
||||
#include <xen/dom0less-build.h>
|
||||
#include <xen/domain.h>
|
||||
|
||||
#ifdef CONFIG_DOM0LESS_BOOT
|
||||
domid_t __ro_after_init max_init_domid;
|
||||
#endif
|
||||
|
||||
static DEFINE_SPINLOCK(domid_lock);
|
||||
static DECLARE_BITMAP(domid_bitmap, DOMID_FIRST_RESERVED);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <xen/early_printk.h>
|
||||
#include <xen/warning.h>
|
||||
#include <xen/pv_console.h>
|
||||
#include <asm/setup.h>
|
||||
#include <xen/dom0less-build.h>
|
||||
#include <xen/sections.h>
|
||||
#include <xen/consoled.h>
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#define XEN_DOM0LESS_BUILD_H
|
||||
|
||||
#include <xen/stdbool.h>
|
||||
#include <xen/types.h>
|
||||
|
||||
#include <public/xen.h>
|
||||
|
||||
struct domain;
|
||||
|
||||
@@ -13,6 +16,9 @@ struct boot_domain;
|
||||
struct dt_device_node;
|
||||
struct kernel_info;
|
||||
|
||||
/* Highest domain ID assigned to a boot-time (dom0less) domain. */
|
||||
extern domid_t max_init_domid;
|
||||
|
||||
/*
|
||||
* List of possible features for dom0less domUs
|
||||
*
|
||||
@@ -72,6 +78,8 @@ static inline bool is_dom0less_mode(void)
|
||||
}
|
||||
static inline void set_xs_domain(struct domain *d) {}
|
||||
|
||||
#define max_init_domid 0
|
||||
|
||||
#endif /* CONFIG_DOM0LESS_BOOT */
|
||||
|
||||
#endif /* __ASM_GENERIC_DOM0LESS_BUILD_H__ */
|
||||
|
||||