[PATCH v3 13/14] xen/dt: Allow CONFIG_DOM0LESS_BOOT to include device-tree/

Alejandro Vallejo posted 15 patches 4 months, 2 weeks ago
Only 14 patches received!
There is a newer version of this series
[PATCH v3 13/14] xen/dt: Allow CONFIG_DOM0LESS_BOOT to include device-tree/
Posted by Alejandro Vallejo 4 months, 2 weeks ago
... without CONFIG_HAS_DEVICE_TREE

Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
---
 xen/common/Kconfig              | 1 +
 xen/common/Makefile             | 2 +-
 xen/common/device-tree/Makefile | 8 ++++----
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 867710134a..2baa4221fd 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -14,6 +14,7 @@ config CORE_PARKING
 
 config DOM0LESS_BOOT
 	bool "Dom0less boot support" if EXPERT
+	select LIBFDT
 	depends on HAS_DOM0LESS && HAS_DEVICE_TREE && DOMAIN_BUILD_HELPERS
 	default y
 	help
diff --git a/xen/common/Makefile b/xen/common/Makefile
index 98f0873056..2717c81f9c 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -8,7 +8,7 @@ obj-y += cpu.o
 obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
 obj-$(CONFIG_HAS_DEVICE_TREE) += device.o
 obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
-obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
+obj-$(firstword $(CONFIG_HAS_DEVICE_TREE) $(CONFIG_DOM0LESS_BOOT)) += device-tree/
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
 obj-y += event_2l.o
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
index 8abc069c4b..cc56f42df9 100644
--- a/xen/common/device-tree/Makefile
+++ b/xen/common/device-tree/Makefile
@@ -1,11 +1,11 @@
 obj-y += bootfdt.init.o
-obj-y += bootinfo-fdt.init.o
-obj-y += bootinfo.init.o
-obj-y += device-tree.o
+obj-$(CONFIG_HAS_DEVICE_TREE) += bootinfo-fdt.init.o
+obj-$(CONFIG_HAS_DEVICE_TREE) += bootinfo.init.o
+obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree.o
 obj-$(CONFIG_DOMAIN_BUILD_HELPERS) += domain-build.init.o
 obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o
 obj-$(CONFIG_OVERLAY_DTB) += dt-overlay.o
-obj-y += intc.o
+obj-$(CONFIG_HAS_DEVICE_TREE) += intc.o
 obj-$(CONFIG_DOMAIN_BUILD_HELPERS) += kernel.o
 obj-$(CONFIG_STATIC_EVTCHN) += static-evtchn.init.o
 obj-$(CONFIG_STATIC_MEMORY) += static-memory.init.o
-- 
2.43.0
Re: [PATCH v3 13/14] xen/dt: Allow CONFIG_DOM0LESS_BOOT to include device-tree/
Posted by Jan Beulich 4 months, 2 weeks ago
On 13.06.2025 17:13, Alejandro Vallejo wrote:
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -14,6 +14,7 @@ config CORE_PARKING
>  
>  config DOM0LESS_BOOT
>  	bool "Dom0less boot support" if EXPERT
> +	select LIBFDT
>  	depends on HAS_DOM0LESS && HAS_DEVICE_TREE && DOMAIN_BUILD_HELPERS
>  	default y
>  	help

Nit: Imo it is good practice to have the select-s after the "depends on",
and perhaps also after any default(s).

> --- a/xen/common/Makefile
> +++ b/xen/common/Makefile
> @@ -8,7 +8,7 @@ obj-y += cpu.o
>  obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
>  obj-$(CONFIG_HAS_DEVICE_TREE) += device.o
>  obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
> -obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
> +obj-$(firstword $(CONFIG_HAS_DEVICE_TREE) $(CONFIG_DOM0LESS_BOOT)) += device-tree/

Why not

obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
obj-$(CONFIG_DOM0LESS_BOOT) += device-tree/

as we have it in a few similar situations?

And why would the duplication be needed in the first place? Shouldn't
DOM0LESS_BOOT imply HAS_DEVICE_TREE? Sadly the description once again
only says what is intended, but not why. And the dependency is actually
visible in patch context above, in the hunk altering xen/common/Kconfig.

Jan
Re: [PATCH v3 13/14] xen/dt: Allow CONFIG_DOM0LESS_BOOT to include device-tree/
Posted by Alejandro Vallejo 4 months, 2 weeks ago
On Mon Jun 16, 2025 at 8:55 AM CEST, Jan Beulich wrote:
> On 13.06.2025 17:13, Alejandro Vallejo wrote:
>> --- a/xen/common/Kconfig
>> +++ b/xen/common/Kconfig
>> @@ -14,6 +14,7 @@ config CORE_PARKING
>>  
>>  config DOM0LESS_BOOT
>>  	bool "Dom0less boot support" if EXPERT
>> +	select LIBFDT
>>  	depends on HAS_DOM0LESS && HAS_DEVICE_TREE && DOMAIN_BUILD_HELPERS
>>  	default y
>>  	help
>
> Nit: Imo it is good practice to have the select-s after the "depends on",
> and perhaps also after any default(s).
>
>> --- a/xen/common/Makefile
>> +++ b/xen/common/Makefile
>> @@ -8,7 +8,7 @@ obj-y += cpu.o
>>  obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
>>  obj-$(CONFIG_HAS_DEVICE_TREE) += device.o
>>  obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
>> -obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
>> +obj-$(firstword $(CONFIG_HAS_DEVICE_TREE) $(CONFIG_DOM0LESS_BOOT)) += device-tree/
>
> Why not
>
> obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
> obj-$(CONFIG_DOM0LESS_BOOT) += device-tree/
>
> as we have it in a few similar situations?

Because I wasn't sure the build system would swallow it. If you claim it does, sure.
I think the "firstword" version is clearer, but I don't mind.

>
> And why would the duplication be needed in the first place? Shouldn't
> DOM0LESS_BOOT imply HAS_DEVICE_TREE? Sadly the description once again
> only says what is intended, but not why. And the dependency is actually
> visible in patch context above, in the hunk altering xen/common/Kconfig.
>
> Jan

After this series the idea is that CONFIG_HAS_DEVICE_TREE means a platform
in which platform resources (memory, devices, etc) are described on DTs.

While x86 ends up understanding DTs to the extent that it's able to parse
and extract "xen,domain" nodes, it's not capable of much more than that. The
distinction is important because making x86 understand general DT (devices, IRQs
and memory) would be far too invasive and not very helpful.

I can rename it to CONFIG_HAS_PLATFORM_DT or CONFIG_HAS_DT_DEVICES, or anything
else if you (or anyone else) have any ideas.

TL;DR: It's to still be able to compile-out the bits x86 cannot use in the DT
machinery.

Cheers,
Alejandro
Re: [PATCH v3 13/14] xen/dt: Allow CONFIG_DOM0LESS_BOOT to include device-tree/
Posted by Stefano Stabellini 4 months, 2 weeks ago
On Mon, 16 Jun 2025, Alejandro Vallejo wrote:
> On Mon Jun 16, 2025 at 8:55 AM CEST, Jan Beulich wrote:
> > On 13.06.2025 17:13, Alejandro Vallejo wrote:
> >> --- a/xen/common/Kconfig
> >> +++ b/xen/common/Kconfig
> >> @@ -14,6 +14,7 @@ config CORE_PARKING
> >>  
> >>  config DOM0LESS_BOOT
> >>  	bool "Dom0less boot support" if EXPERT
> >> +	select LIBFDT
> >>  	depends on HAS_DOM0LESS && HAS_DEVICE_TREE && DOMAIN_BUILD_HELPERS
> >>  	default y
> >>  	help
> >
> > Nit: Imo it is good practice to have the select-s after the "depends on",
> > and perhaps also after any default(s).
> >
> >> --- a/xen/common/Makefile
> >> +++ b/xen/common/Makefile
> >> @@ -8,7 +8,7 @@ obj-y += cpu.o
> >>  obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
> >>  obj-$(CONFIG_HAS_DEVICE_TREE) += device.o
> >>  obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
> >> -obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
> >> +obj-$(firstword $(CONFIG_HAS_DEVICE_TREE) $(CONFIG_DOM0LESS_BOOT)) += device-tree/
> >
> > Why not
> >
> > obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
> > obj-$(CONFIG_DOM0LESS_BOOT) += device-tree/
> >
> > as we have it in a few similar situations?
> 
> Because I wasn't sure the build system would swallow it. If you claim it does, sure.
> I think the "firstword" version is clearer, but I don't mind.
> 
> >
> > And why would the duplication be needed in the first place? Shouldn't
> > DOM0LESS_BOOT imply HAS_DEVICE_TREE? Sadly the description once again
> > only says what is intended, but not why. And the dependency is actually
> > visible in patch context above, in the hunk altering xen/common/Kconfig.
> >
> > Jan
> 
> After this series the idea is that CONFIG_HAS_DEVICE_TREE means a platform
> in which platform resources (memory, devices, etc) are described on DTs.
> 
> While x86 ends up understanding DTs to the extent that it's able to parse
> and extract "xen,domain" nodes, it's not capable of much more than that. The
> distinction is important because making x86 understand general DT (devices, IRQs
> and memory) would be far too invasive and not very helpful.
> 
> I can rename it to CONFIG_HAS_PLATFORM_DT or CONFIG_HAS_DT_DEVICES, or anything
> else if you (or anyone else) have any ideas.
> 
> TL;DR: It's to still be able to compile-out the bits x86 cannot use in the DT
> machinery.

Yeah, as it looks like not introducing HAS_DEVICE_TREE on x86 is causing
confusion, maybe it is better to add HAS_DEVICE_TREE to all arches and
use a different kconfig to say "this architecture supports device
discovery via DT", such as CONFIG_HAS_DT_DEVICES or
CONFIG_DT_DEVICE_DISCOVERY.
Re: [PATCH v3 13/14] xen/dt: Allow CONFIG_DOM0LESS_BOOT to include device-tree/
Posted by Stefano Stabellini 4 months, 2 weeks ago
On Fri, 13 Jun 2025, Alejandro Vallejo wrote:
> ... without CONFIG_HAS_DEVICE_TREE
> 
> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/common/Kconfig              | 1 +
>  xen/common/Makefile             | 2 +-
>  xen/common/device-tree/Makefile | 8 ++++----
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/xen/common/Kconfig b/xen/common/Kconfig
> index 867710134a..2baa4221fd 100644
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -14,6 +14,7 @@ config CORE_PARKING
>  
>  config DOM0LESS_BOOT
>  	bool "Dom0less boot support" if EXPERT
> +	select LIBFDT
>  	depends on HAS_DOM0LESS && HAS_DEVICE_TREE && DOMAIN_BUILD_HELPERS
>  	default y
>  	help
> diff --git a/xen/common/Makefile b/xen/common/Makefile
> index 98f0873056..2717c81f9c 100644
> --- a/xen/common/Makefile
> +++ b/xen/common/Makefile
> @@ -8,7 +8,7 @@ obj-y += cpu.o
>  obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
>  obj-$(CONFIG_HAS_DEVICE_TREE) += device.o
>  obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
> -obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
> +obj-$(firstword $(CONFIG_HAS_DEVICE_TREE) $(CONFIG_DOM0LESS_BOOT)) += device-tree/
>  obj-$(CONFIG_IOREQ_SERVER) += dm.o
>  obj-y += domain.o
>  obj-y += event_2l.o
> diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
> index 8abc069c4b..cc56f42df9 100644
> --- a/xen/common/device-tree/Makefile
> +++ b/xen/common/device-tree/Makefile
> @@ -1,11 +1,11 @@
>  obj-y += bootfdt.init.o
> -obj-y += bootinfo-fdt.init.o
> -obj-y += bootinfo.init.o
> -obj-y += device-tree.o
> +obj-$(CONFIG_HAS_DEVICE_TREE) += bootinfo-fdt.init.o
> +obj-$(CONFIG_HAS_DEVICE_TREE) += bootinfo.init.o
> +obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree.o
>  obj-$(CONFIG_DOMAIN_BUILD_HELPERS) += domain-build.init.o
>  obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o
>  obj-$(CONFIG_OVERLAY_DTB) += dt-overlay.o
> -obj-y += intc.o
> +obj-$(CONFIG_HAS_DEVICE_TREE) += intc.o
>  obj-$(CONFIG_DOMAIN_BUILD_HELPERS) += kernel.o
>  obj-$(CONFIG_STATIC_EVTCHN) += static-evtchn.init.o
>  obj-$(CONFIG_STATIC_MEMORY) += static-memory.init.o
> -- 
> 2.43.0
>