[PATCH for-4.20] xen/arm: dom0less: Add #redistributor-regions property to GICv3 node

Michal Orzel posted 1 patch 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20240704075419.34966-1-michal.orzel@amd.com
xen/arch/arm/dom0less-build.c | 5 +++++
1 file changed, 5 insertions(+)
[PATCH for-4.20] xen/arm: dom0less: Add #redistributor-regions property to GICv3 node
Posted by Michal Orzel 2 months ago
Dom0less domain using host memory layout may use more than one
re-distributor region (d->arch.vgic.nr_regions > 1). In that case Xen
will add them in a "reg" property of a GICv3 domU node. Guest needs to
know how many regions to search for, and therefore the GICv3 dt binding
[1] specifies that "#redistributor-regions" property is required if more
than one redistributor region is present. However, Xen does not add this
property which makes guest believe, there is just one such region. This
can lead to guest boot failure when doing GIC SMP initialization. Fix it
by adding this property, which matches what we do for hwdom.

[1] Linux: Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml

Fixes: 4809f9ec7d71 ("xen/arm: if direct-map domain use native addresses for GICv3")
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
Tested with Qemu 8.2, virt machine with nr cpus > 123 which requires to use a
second redistributor region.
---
 xen/arch/arm/dom0less-build.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index f919d3acf976..09b65e44aed3 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -176,6 +176,11 @@ static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
     if ( res )
         return res;
 
+    res = fdt_property_cell(fdt, "#redistributor-regions",
+                            d->arch.vgic.nr_regions);
+    if ( res )
+        return res;
+
     /* reg specifies all re-distributors and Distributor. */
     len = (GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) *
           (d->arch.vgic.nr_regions + 1) * sizeof(__be32);
-- 
2.25.1
Re: [PATCH for-4.20] xen/arm: dom0less: Add #redistributor-regions property to GICv3 node
Posted by Luca Fancellu 2 months ago

> On 4 Jul 2024, at 08:54, Michal Orzel <michal.orzel@amd.com> wrote:
> 
> Dom0less domain using host memory layout may use more than one
> re-distributor region (d->arch.vgic.nr_regions > 1). In that case Xen
> will add them in a "reg" property of a GICv3 domU node. Guest needs to
> know how many regions to search for, and therefore the GICv3 dt binding
> [1] specifies that "#redistributor-regions" property is required if more
> than one redistributor region is present. However, Xen does not add this
> property which makes guest believe, there is just one such region. This
> can lead to guest boot failure when doing GIC SMP initialization. Fix it
> by adding this property, which matches what we do for hwdom.
> 
> [1] Linux: Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
> 
> Fixes: 4809f9ec7d71 ("xen/arm: if direct-map domain use native addresses for GICv3")
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> ---

Looks good to me!

Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Re: [PATCH for-4.20] xen/arm: dom0less: Add #redistributor-regions property to GICv3 node
Posted by Julien Grall 2 months ago
Hi,

On 04/07/2024 11:39, Luca Fancellu wrote:
> 
> 
>> On 4 Jul 2024, at 08:54, Michal Orzel <michal.orzel@amd.com> wrote:
>>
>> Dom0less domain using host memory layout may use more than one
>> re-distributor region (d->arch.vgic.nr_regions > 1). In that case Xen
>> will add them in a "reg" property of a GICv3 domU node. Guest needs to
>> know how many regions to search for, and therefore the GICv3 dt binding
>> [1] specifies that "#redistributor-regions" property is required if more
>> than one redistributor region is present. However, Xen does not add this
>> property which makes guest believe, there is just one such region. This
>> can lead to guest boot failure when doing GIC SMP initialization. Fix it
>> by adding this property, which matches what we do for hwdom.
>>
>> [1] Linux: Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
>>
>> Fixes: 4809f9ec7d71 ("xen/arm: if direct-map domain use native addresses for GICv3")
>> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
>> ---
> 
> Looks good to me!
> 
> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>

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

Cheers,

-- 
Julien Grall
Re: [PATCH for-4.20] xen/arm: dom0less: Add #redistributor-regions property to GICv3 node
Posted by Julien Grall 1 month ago
Hi,

On 05/07/2024 14:03, Julien Grall wrote:
> Hi,
> 
> On 04/07/2024 11:39, Luca Fancellu wrote:
>>
>>
>>> On 4 Jul 2024, at 08:54, Michal Orzel <michal.orzel@amd.com> wrote:
>>>
>>> Dom0less domain using host memory layout may use more than one
>>> re-distributor region (d->arch.vgic.nr_regions > 1). In that case Xen
>>> will add them in a "reg" property of a GICv3 domU node. Guest needs to
>>> know how many regions to search for, and therefore the GICv3 dt binding
>>> [1] specifies that "#redistributor-regions" property is required if more
>>> than one redistributor region is present. However, Xen does not add this
>>> property which makes guest believe, there is just one such region. This
>>> can lead to guest boot failure when doing GIC SMP initialization. Fix it
>>> by adding this property, which matches what we do for hwdom.
>>>
>>> [1] Linux: Documentation/devicetree/bindings/interrupt-controller/ 
>>> arm,gic-v3.yaml
>>>
>>> Fixes: 4809f9ec7d71 ("xen/arm: if direct-map domain use native 
>>> addresses for GICv3")
>>> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
>>> ---
>>
>> Looks good to me!
>>
>> Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
> 
> Acked-by: Julien Grall <jgrall@amazon.com>

This is now committed.

Cheers,

-- 
Julien Grall