[PATCH v2] xen/arm: Skip Xen specific nodes/properties from hwdom /chosen node

Michal Orzel posted 1 patch 7 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230912105341.16687-1-michal.orzel@amd.com
xen/arch/arm/domain_build.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
[PATCH v2] xen/arm: Skip Xen specific nodes/properties from hwdom /chosen node
Posted by Michal Orzel 7 months, 2 weeks ago
Skip the following Xen specific host device tree nodes/properties
from being included into hardware domain /chosen node:
 - xen,static-heap: this property informs Xen about memory regions
   reserved exclusively as static heap,
 - xen,domain-shared-memory-v1: node with this compatible informs Xen
   about static shared memory region for a domain. Xen exposes a different
   node (under /reserved-memory with compatible "xen,shared-memory-v1") to
   let domain know about the shared region,
 - xen,evtchn-v1: node with this compatible informs Xen about static
   event channel configuration for a domain. Xen does not expose
   information about static event channels to domUs and dom0 case was
   overlooked (by default nodes from host dt are copied to dom0 fdt unless
   explicitly marked to be skipped), since the author's idea was not to
   expose it (refer docs/misc/arm/device-tree/booting.txt, "Static Event
   Channel"). Even if we wanted to expose the static event channel
   information, the current node is in the wrong format (i.e. contains
   phandle to domU node not visible by dom0). Lastly, this feature is
   marked as tech-preview and there is no Linux dt binding in place.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
Changes in v2:
 - update commit msg with better reasoning
---
 xen/arch/arm/domain_build.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 29dcbb8a2ee6..413568c0e2fd 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1149,7 +1149,7 @@ static int __init write_properties(struct domain *d, struct kernel_info *kinfo,
          * * remember xen,dom0-bootargs if we don't already have
          *   bootargs (from module #1, above).
          * * remove bootargs,  xen,dom0-bootargs, xen,xen-bootargs,
-         *   linux,initrd-start and linux,initrd-end.
+         *   xen,static-heap, linux,initrd-start and linux,initrd-end.
          * * remove stdout-path.
          * * remove bootargs, linux,uefi-system-table,
          *   linux,uefi-mmap-start, linux,uefi-mmap-size,
@@ -1158,7 +1158,8 @@ static int __init write_properties(struct domain *d, struct kernel_info *kinfo,
          */
         if ( dt_node_path_is_equal(node, "/chosen") )
         {
-            if ( dt_property_name_is_equal(prop, "xen,xen-bootargs") ||
+            if ( dt_property_name_is_equal(prop, "xen,static-heap") ||
+                 dt_property_name_is_equal(prop, "xen,xen-bootargs") ||
                  dt_property_name_is_equal(prop, "linux,initrd-start") ||
                  dt_property_name_is_equal(prop, "linux,initrd-end") ||
                  dt_property_name_is_equal(prop, "stdout-path") ||
@@ -2300,6 +2301,8 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
     static const struct dt_device_match skip_matches[] __initconst =
     {
         DT_MATCH_COMPATIBLE("xen,domain"),
+        DT_MATCH_COMPATIBLE("xen,domain-shared-memory-v1"),
+        DT_MATCH_COMPATIBLE("xen,evtchn-v1"),
         DT_MATCH_COMPATIBLE("xen,xen"),
         DT_MATCH_COMPATIBLE("xen,multiboot-module"),
         DT_MATCH_COMPATIBLE("multiboot,module"),
-- 
2.25.1
Re: [PATCH v2] xen/arm: Skip Xen specific nodes/properties from hwdom /chosen node
Posted by Julien Grall 7 months, 2 weeks ago
Hi Michal,

On 12/09/2023 11:53, Michal Orzel wrote:
> Skip the following Xen specific host device tree nodes/properties
> from being included into hardware domain /chosen node:
>   - xen,static-heap: this property informs Xen about memory regions
>     reserved exclusively as static heap,
>   - xen,domain-shared-memory-v1: node with this compatible informs Xen
>     about static shared memory region for a domain. Xen exposes a different
>     node (under /reserved-memory with compatible "xen,shared-memory-v1") to
>     let domain know about the shared region,
>   - xen,evtchn-v1: node with this compatible informs Xen about static
>     event channel configuration for a domain. Xen does not expose
>     information about static event channels to domUs and dom0 case was
>     overlooked (by default nodes from host dt are copied to dom0 fdt unless
>     explicitly marked to be skipped), since the author's idea was not to
>     expose it (refer docs/misc/arm/device-tree/booting.txt, "Static Event
>     Channel"). Even if we wanted to expose the static event channel
>     information, the current node is in the wrong format (i.e. contains
>     phandle to domU node not visible by dom0). Lastly, this feature is
>     marked as tech-preview and there is no Linux dt binding in place.
> 
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

-- 
Julien Grall
Re: [PATCH v2] xen/arm: Skip Xen specific nodes/properties from hwdom /chosen node
Posted by Stefano Stabellini 7 months, 2 weeks ago
On Tue, 12 Sep 2023, Michal Orzel wrote:
> Skip the following Xen specific host device tree nodes/properties
> from being included into hardware domain /chosen node:
>  - xen,static-heap: this property informs Xen about memory regions
>    reserved exclusively as static heap,
>  - xen,domain-shared-memory-v1: node with this compatible informs Xen
>    about static shared memory region for a domain. Xen exposes a different
>    node (under /reserved-memory with compatible "xen,shared-memory-v1") to
>    let domain know about the shared region,
>  - xen,evtchn-v1: node with this compatible informs Xen about static
>    event channel configuration for a domain. Xen does not expose
>    information about static event channels to domUs and dom0 case was
>    overlooked (by default nodes from host dt are copied to dom0 fdt unless
>    explicitly marked to be skipped), since the author's idea was not to
>    expose it (refer docs/misc/arm/device-tree/booting.txt, "Static Event
>    Channel"). Even if we wanted to expose the static event channel
>    information, the current node is in the wrong format (i.e. contains
>    phandle to domU node not visible by dom0). Lastly, this feature is
>    marked as tech-preview and there is no Linux dt binding in place.
> 
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>

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

Do we need Henry's explicit approval on bug fixes at this point?


> ---
> Changes in v2:
>  - update commit msg with better reasoning
> ---
>  xen/arch/arm/domain_build.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 29dcbb8a2ee6..413568c0e2fd 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -1149,7 +1149,7 @@ static int __init write_properties(struct domain *d, struct kernel_info *kinfo,
>           * * remember xen,dom0-bootargs if we don't already have
>           *   bootargs (from module #1, above).
>           * * remove bootargs,  xen,dom0-bootargs, xen,xen-bootargs,
> -         *   linux,initrd-start and linux,initrd-end.
> +         *   xen,static-heap, linux,initrd-start and linux,initrd-end.
>           * * remove stdout-path.
>           * * remove bootargs, linux,uefi-system-table,
>           *   linux,uefi-mmap-start, linux,uefi-mmap-size,
> @@ -1158,7 +1158,8 @@ static int __init write_properties(struct domain *d, struct kernel_info *kinfo,
>           */
>          if ( dt_node_path_is_equal(node, "/chosen") )
>          {
> -            if ( dt_property_name_is_equal(prop, "xen,xen-bootargs") ||
> +            if ( dt_property_name_is_equal(prop, "xen,static-heap") ||
> +                 dt_property_name_is_equal(prop, "xen,xen-bootargs") ||
>                   dt_property_name_is_equal(prop, "linux,initrd-start") ||
>                   dt_property_name_is_equal(prop, "linux,initrd-end") ||
>                   dt_property_name_is_equal(prop, "stdout-path") ||
> @@ -2300,6 +2301,8 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
>      static const struct dt_device_match skip_matches[] __initconst =
>      {
>          DT_MATCH_COMPATIBLE("xen,domain"),
> +        DT_MATCH_COMPATIBLE("xen,domain-shared-memory-v1"),
> +        DT_MATCH_COMPATIBLE("xen,evtchn-v1"),
>          DT_MATCH_COMPATIBLE("xen,xen"),
>          DT_MATCH_COMPATIBLE("xen,multiboot-module"),
>          DT_MATCH_COMPATIBLE("multiboot,module"),
> -- 
> 2.25.1
>
Re: [PATCH v2] xen/arm: Skip Xen specific nodes/properties from hwdom /chosen node
Posted by Henry Wang 7 months, 2 weeks ago
Hi Stefano,

> On Sep 13, 2023, at 01:46, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> On Tue, 12 Sep 2023, Michal Orzel wrote:
>> Skip the following Xen specific host device tree nodes/properties
>> from being included into hardware domain /chosen node:
>> - xen,static-heap: this property informs Xen about memory regions
>>   reserved exclusively as static heap,
>> - xen,domain-shared-memory-v1: node with this compatible informs Xen
>>   about static shared memory region for a domain. Xen exposes a different
>>   node (under /reserved-memory with compatible "xen,shared-memory-v1") to
>>   let domain know about the shared region,
>> - xen,evtchn-v1: node with this compatible informs Xen about static
>>   event channel configuration for a domain. Xen does not expose
>>   information about static event channels to domUs and dom0 case was
>>   overlooked (by default nodes from host dt are copied to dom0 fdt unless
>>   explicitly marked to be skipped), since the author's idea was not to
>>   expose it (refer docs/misc/arm/device-tree/booting.txt, "Static Event
>>   Channel"). Even if we wanted to expose the static event channel
>>   information, the current node is in the wrong format (i.e. contains
>>   phandle to domU node not visible by dom0). Lastly, this feature is
>>   marked as tech-preview and there is no Linux dt binding in place.
>> 
>> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> Do we need Henry's explicit approval on bug fixes at this point?

I think it is a bit too early, we can wait for the code freeze for the release-ack.
Before code freeze, maintainers/committers can push the patch as usual.

Anyway, I agree this patch is definitely qualified to be included in 4.18 so feel
free to add below tag if you want.

Release-acked-by: Henry Wang <Henry.Wang@arm.com>

Kind regards,
Henry
Re: [PATCH v2] xen/arm: Skip Xen specific nodes/properties from hwdom /chosen node
Posted by Julien Grall 7 months, 2 weeks ago
Hi Henry,

On 13/09/2023 01:49, Henry Wang wrote:
> Hi Stefano,
> 
>> On Sep 13, 2023, at 01:46, Stefano Stabellini <sstabellini@kernel.org> wrote:
>>
>> On Tue, 12 Sep 2023, Michal Orzel wrote:
>>> Skip the following Xen specific host device tree nodes/properties
>>> from being included into hardware domain /chosen node:
>>> - xen,static-heap: this property informs Xen about memory regions
>>>    reserved exclusively as static heap,
>>> - xen,domain-shared-memory-v1: node with this compatible informs Xen
>>>    about static shared memory region for a domain. Xen exposes a different
>>>    node (under /reserved-memory with compatible "xen,shared-memory-v1") to
>>>    let domain know about the shared region,
>>> - xen,evtchn-v1: node with this compatible informs Xen about static
>>>    event channel configuration for a domain. Xen does not expose
>>>    information about static event channels to domUs and dom0 case was
>>>    overlooked (by default nodes from host dt are copied to dom0 fdt unless
>>>    explicitly marked to be skipped), since the author's idea was not to
>>>    expose it (refer docs/misc/arm/device-tree/booting.txt, "Static Event
>>>    Channel"). Even if we wanted to expose the static event channel
>>>    information, the current node is in the wrong format (i.e. contains
>>>    phandle to domU node not visible by dom0). Lastly, this feature is
>>>    marked as tech-preview and there is no Linux dt binding in place.
>>>
>>> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
>>
>> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
>>
>> Do we need Henry's explicit approval on bug fixes at this point?
> 
> I think it is a bit too early, we can wait for the code freeze for the release-ack.
> Before code freeze, maintainers/committers can push the patch as usual.
> 
> Anyway, I agree this patch is definitely qualified to be included in 4.18 so feel
> free to add below tag if you want.
> 
> Release-acked-by: Henry Wang <Henry.Wang@arm.com>

Thanks. It is now committed.

Cheers,

-- 
Julien Grall