device-tree.c stops requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY and may
function with DOM0LESS_BOOT.
Without this, there's a clash with x86's definition of device_t. Because
x86 doesn't discover devices in the DT it can simply skip the code
to do so during the unflattening phase.
Not a functional change on architectures that currently use these files,
as they already select CONFIG_HAS_DEVICE_TREE_DISCOVERY.
Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
---
xen/common/device-tree/device-tree.c | 2 ++
xen/include/xen/device_tree.h | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
index 725ff71646..741e2ce585 100644
--- a/xen/common/device-tree/device-tree.c
+++ b/xen/common/device-tree/device-tree.c
@@ -2029,9 +2029,11 @@ static unsigned long unflatten_dt_node(const void *fdt,
((char *)pp->value)[sz - 1] = 0;
dt_dprintk("fixed up name for %s -> %s\n", pathp,
(char *)pp->value);
+#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY
/* Generic device initialization */
np->dev.type = DEV_DT;
np->dev.of_node = np;
+#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
}
}
if ( allnextpp )
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index b6d16756fc..ace7fc3274 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -108,9 +108,12 @@ struct dt_device_node {
*/
struct list_head domain_list;
+#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY
struct device dev;
+#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
};
+#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY
#define dt_to_dev(dt_node) (&(dt_node)->dev)
static inline struct dt_device_node *dev_to_dt(struct device *dev)
@@ -119,6 +122,7 @@ static inline struct dt_device_node *dev_to_dt(struct device *dev)
return container_of(dev, struct dt_device_node, dev);
}
+#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
#define MAX_PHANDLE_ARGS 16
struct dt_phandle_args {
--
2.43.0
On 20.06.2025 20:28, Alejandro Vallejo wrote:
> device-tree.c stops requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY and may
> function with DOM0LESS_BOOT.
>
> Without this, there's a clash with x86's definition of device_t. Because
> x86 doesn't discover devices in the DT it can simply skip the code
> to do so during the unflattening phase.
>
> Not a functional change on architectures that currently use these files,
> as they already select CONFIG_HAS_DEVICE_TREE_DISCOVERY.
>
> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
> ---
> xen/common/device-tree/device-tree.c | 2 ++
> xen/include/xen/device_tree.h | 4 ++++
> 2 files changed, 6 insertions(+)
>
> diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
> index 725ff71646..741e2ce585 100644
> --- a/xen/common/device-tree/device-tree.c
> +++ b/xen/common/device-tree/device-tree.c
> @@ -2029,9 +2029,11 @@ static unsigned long unflatten_dt_node(const void *fdt,
> ((char *)pp->value)[sz - 1] = 0;
> dt_dprintk("fixed up name for %s -> %s\n", pathp,
> (char *)pp->value);
> +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY
> /* Generic device initialization */
> np->dev.type = DEV_DT;
> np->dev.of_node = np;
> +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
> }
> }
Without something said to that effect in the description, this contradicts
obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) += device-tree/
that the previous patch put in place, and that only the subsequent patch
will further change.
Jan
On Mon Jun 23, 2025 at 9:44 AM CEST, Jan Beulich wrote:
> On 20.06.2025 20:28, Alejandro Vallejo wrote:
>> device-tree.c stops requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY and may
>> function with DOM0LESS_BOOT.
>>
>> Without this, there's a clash with x86's definition of device_t. Because
>> x86 doesn't discover devices in the DT it can simply skip the code
>> to do so during the unflattening phase.
>>
>> Not a functional change on architectures that currently use these files,
>> as they already select CONFIG_HAS_DEVICE_TREE_DISCOVERY.
>>
>> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
>> ---
>> xen/common/device-tree/device-tree.c | 2 ++
>> xen/include/xen/device_tree.h | 4 ++++
>> 2 files changed, 6 insertions(+)
>>
>> diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
>> index 725ff71646..741e2ce585 100644
>> --- a/xen/common/device-tree/device-tree.c
>> +++ b/xen/common/device-tree/device-tree.c
>> @@ -2029,9 +2029,11 @@ static unsigned long unflatten_dt_node(const void *fdt,
>> ((char *)pp->value)[sz - 1] = 0;
>> dt_dprintk("fixed up name for %s -> %s\n", pathp,
>> (char *)pp->value);
>> +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY
>> /* Generic device initialization */
>> np->dev.type = DEV_DT;
>> np->dev.of_node = np;
>> +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
>> }
>> }
>
> Without something said to that effect in the description, this contradicts
>
> obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) += device-tree/
>
> that the previous patch put in place, and that only the subsequent patch
> will further change.
>
> Jan
Would replacing the last paragraph of the commit message with...
Not a functional change because the whole file is gated by
CONFIG_HAS_DEVICE_TREE_DISCOVERY already. A later patch allows the file to be
usable without it, for which this ifdefs are a prerequisite.
... help?
Cheers,
Alejandro
On 23.06.2025 15:18, Alejandro Vallejo wrote:
> On Mon Jun 23, 2025 at 9:44 AM CEST, Jan Beulich wrote:
>> On 20.06.2025 20:28, Alejandro Vallejo wrote:
>>> device-tree.c stops requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY and may
>>> function with DOM0LESS_BOOT.
>>>
>>> Without this, there's a clash with x86's definition of device_t. Because
>>> x86 doesn't discover devices in the DT it can simply skip the code
>>> to do so during the unflattening phase.
>>>
>>> Not a functional change on architectures that currently use these files,
>>> as they already select CONFIG_HAS_DEVICE_TREE_DISCOVERY.
>>>
>>> Signed-off-by: Alejandro Vallejo <agarciav@amd.com>
>>> ---
>>> xen/common/device-tree/device-tree.c | 2 ++
>>> xen/include/xen/device_tree.h | 4 ++++
>>> 2 files changed, 6 insertions(+)
>>>
>>> diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
>>> index 725ff71646..741e2ce585 100644
>>> --- a/xen/common/device-tree/device-tree.c
>>> +++ b/xen/common/device-tree/device-tree.c
>>> @@ -2029,9 +2029,11 @@ static unsigned long unflatten_dt_node(const void *fdt,
>>> ((char *)pp->value)[sz - 1] = 0;
>>> dt_dprintk("fixed up name for %s -> %s\n", pathp,
>>> (char *)pp->value);
>>> +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY
>>> /* Generic device initialization */
>>> np->dev.type = DEV_DT;
>>> np->dev.of_node = np;
>>> +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
>>> }
>>> }
>>
>> Without something said to that effect in the description, this contradicts
>>
>> obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) += device-tree/
>>
>> that the previous patch put in place, and that only the subsequent patch
>> will further change.
>>
>> Jan
>
> Would replacing the last paragraph of the commit message with...
>
> Not a functional change because the whole file is gated by
> CONFIG_HAS_DEVICE_TREE_DISCOVERY already. A later patch allows the file to be
> usable without it, for which this ifdefs are a prerequisite.
>
> ... help?
Yes, afaic.
Jan
On Fri, 20 Jun 2025, Alejandro Vallejo wrote: > device-tree.c stops requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY and may > function with DOM0LESS_BOOT. > > Without this, there's a clash with x86's definition of device_t. Because > x86 doesn't discover devices in the DT it can simply skip the code > to do so during the unflattening phase. > > Not a functional change on architectures that currently use these files, > as they already select CONFIG_HAS_DEVICE_TREE_DISCOVERY. > > Signed-off-by: Alejandro Vallejo <agarciav@amd.com> Same comment about renaming DOM0LESS_BOOT from this commit message if there is a decision to rename that option. Other than that: Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
© 2016 - 2026 Red Hat, Inc.