From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: "Orzel, Michal" <michal.orzel@amd.com>, xen-devel@lists.xenproject.org
Cc: "Romain Caritey" <Romain.Caritey@microchip.com>,
"Baptiste Le Duc" <baptiste.le-duc@vates.tech>,
"Zheng Zhang" <zhangzheng@iscas.ac.cn>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Timothy Pearson" <tpearson@raptorengineering.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Connor Davis" <connojdavis@gmail.com>,
"Teddy Astie" <teddy.astie@vates.tech>
Subject: Re: [PATCH v8 02/20] xen/dom0less: turn max_init_domid into a common variable
Date: Wed, 2 Sep 2026 11:59:16 +0200 [thread overview]
Message-ID: <69c29c07-c63f-433a-a7ad-85fa981c89b4@gmail.com> (raw)
In-Reply-To: <b65fcc50-b249-4505-a212-b2f60c55f86d@amd.com>
On 8/31/26 5:48 PM, Orzel, Michal wrote:
>
>
> On 27-Aug-26 17:18, Oleksii Kurochko wrote:
>> 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.
>>
>> 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.
>>
>> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> Changes in v6-8:
>> - Nothing changed. Only rebase.
>> ---
>> Changes in v5:
>> - Add Reviewed-by: Jan Beulich <jbeulich@suse.com>
>> ---
>> Changes in v4:
>> - New patch.
>> ---
>> ---
>> xen/arch/arm/include/asm/setup.h | 2 --
>> xen/arch/arm/setup.c | 2 --
>> xen/arch/ppc/include/asm/setup.h | 2 --
>> xen/arch/riscv/include/asm/setup.h | 2 --
>> xen/arch/x86/include/asm/setup.h | 2 --
>> xen/common/domid.c | 5 +++++
>> xen/drivers/char/console.c | 1 +
>> xen/include/xen/dom0less-build.h | 7 +++++++
>> 8 files changed, 13 insertions(+), 10 deletions(-)
>>
>> diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
>> index 0adfa4993a8f..2af780512540 100644
>> --- a/xen/arch/arm/include/asm/setup.h
>> +++ b/xen/arch/arm/include/asm/setup.h
>> @@ -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);
>> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>> index 6310a47d68b6..86532d0a35b6 100644
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -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. */
>> diff --git a/xen/arch/ppc/include/asm/setup.h b/xen/arch/ppc/include/asm/setup.h
>> index e4f64879b68c..956fa6985adb 100644
>> --- a/xen/arch/ppc/include/asm/setup.h
>> +++ b/xen/arch/ppc/include/asm/setup.h
>> @@ -1,6 +1,4 @@
>> #ifndef __ASM_PPC_SETUP_H__
>> #define __ASM_PPC_SETUP_H__
>>
>> -#define max_init_domid (0)
>> -
>> #endif /* __ASM_PPC_SETUP_H__ */
>> diff --git a/xen/arch/riscv/include/asm/setup.h b/xen/arch/riscv/include/asm/setup.h
>> index 2215894cfbb1..73ce2f293348 100644
>> --- a/xen/arch/riscv/include/asm/setup.h
>> +++ b/xen/arch/riscv/include/asm/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);
>> diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
>> index b01e83a8ed9f..5925c5f39cff 100644
>> --- a/xen/arch/x86/include/asm/setup.h
>> +++ b/xen/arch/x86/include/asm/setup.h
>> @@ -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
>> diff --git a/xen/common/domid.c b/xen/common/domid.c
>> index b0258e477c1a..cd46cf952be6 100644
>> --- a/xen/common/domid.c
>> +++ b/xen/common/domid.c
>> @@ -9,6 +9,11 @@
>> */
>>
>> #include <xen/domain.h>
>> +#include <xen/dom0less-build.h>
> NIT: "dom0less" comes before "domain" when it comes to alphabetical order I think.
Agreed. With that re-ordering, <xen/types.h> also has to be added to
<xen/dom0less-build.h>, as the latter includes <public/xen.h>, which
uses the fixed-width types defined in <xen/types.h>. Without it, the
build fails with "unknown type name 'uint64_t'".
I will re-order the includes and add <xen/types.h> to dom0less-build.h.
I will also added the following to commit message:
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.
>
>> +
>> +#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);
>> diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
>> index fcacf37c52f0..61e92491e40a 100644
>> --- a/xen/drivers/char/console.c
>> +++ b/xen/drivers/char/console.c
>> @@ -31,6 +31,7 @@
>> #include <xen/warning.h>
>> #include <xen/pv_console.h>
>> #include <asm/setup.h>
> NIT: This can be dropped - I don't see anything relying on it in this file.
Checked that: nothing really depends on it + CI tests are passed.
I will also then add the following to commit message:
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.
>
> Other than that:
> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
Thanks.
~ Oleksii
next prev parent reply other threads:[~2026-09-02 9:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 15:18 [PATCH v8 00/20] Introduce enablemenant of dom0less Oleksii Kurochko
2026-08-27 15:18 ` [PATCH v8 01/20] xen: introduce CONFIG_HAS_SHARED_INFO for archs without a shared page Oleksii Kurochko
2026-08-27 15:18 ` [PATCH v8 02/20] xen/dom0less: turn max_init_domid into a common variable Oleksii Kurochko
2026-08-31 15:48 ` Orzel, Michal
2026-09-01 6:54 ` Jan Beulich
2026-09-01 7:14 ` Orzel, Michal
2026-09-01 7:26 ` Jan Beulich
2026-09-02 9:59 ` Oleksii Kurochko [this message]
2026-08-27 15:18 ` [PATCH v8 03/20] xen/riscv: Implement construct_domain() Oleksii Kurochko
2026-08-27 15:18 ` [PATCH v8 04/20] xen/riscv: introduce guest riscv,isa string Oleksii Kurochko
2026-09-02 14:58 ` Jan Beulich
2026-09-03 7:27 ` Oleksii Kurochko
2026-09-03 7:33 ` Jan Beulich
2026-08-27 15:18 ` [PATCH v8 05/20] xen/riscv: implement make_cpus_node() Oleksii Kurochko
2026-08-27 15:18 ` [PATCH v8 06/20] xen/riscv: implement make_timer_node() Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 07/20] xen/riscv: implement make_arch_nodes() Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 08/20] xen/riscv: introduce init interrupt controller operations Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 09/20] xen/riscv: implement make_intc_domU_node() Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 10/20] xen/riscv: introduce aia_init() and aia_usable() Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 11/20] xen/riscv: introduce per-vCPU IMSIC state Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 12/20] xen/riscv: introduce minimal virtual APLIC (vAPLIC) infrastructure Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 13/20] xen/riscv: introduce (de)initialization helpers for vINTC Oleksii Kurochko
2026-09-03 9:20 ` Jan Beulich
2026-09-03 10:49 ` Oleksii Kurochko
2026-09-03 11:16 ` Jan Beulich
2026-08-27 15:19 ` [PATCH v8 14/20] xen/riscv: generate IMSIC DT node for guest domains Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 15/20] xen/riscv: create APLIC " Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 16/20] xen/riscv: implement IRQ routing for device passthrough Oleksii Kurochko
2026-09-03 10:00 ` Jan Beulich
2026-09-03 14:39 ` Oleksii Kurochko
2026-09-04 10:58 ` Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 17/20] xen/riscv: implement init_intc_phandle() Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 18/20] xen/riscv: initialize RCU, scheduler, and system domains in start_xen() Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 19/20] xen/riscv: provide init_vuart() Oleksii Kurochko
2026-08-27 15:19 ` [PATCH v8 20/20] xen/riscv: add initial dom0less infrastructure support Oleksii Kurochko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69c29c07-c63f-433a-a7ad-85fa981c89b4@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=Romain.Caritey@microchip.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=baptiste.le-duc@vates.tech \
--cc=bertrand.marquis@arm.com \
--cc=connojdavis@gmail.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--cc=tpearson@raptorengineering.com \
--cc=xen-devel@lists.xenproject.org \
--cc=zhangzheng@iscas.ac.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.