Skip to contentSkip to conversation

arm64: ITS: fix cacheability adjustment

PATCH In review Andre Przywara 2 participants 3 messages Nov 16, 2017 – Nov 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: ITS: fix cacheability adjustment

If the host GICv3 redistributor reports that the pending table cannot use shareable memory, we try to drop the cacheability attributes as well. However we fail horribly in doing computer science 101 bit masking, effectively clearing the whole register instead of just a few bits.
Fix this by removing the one redundant masking operation and adding the magic negation for the actually needed other operation.

---
Julien,

can we have this still for 4.10, please? Seems like an obvious bug to me.

Cheers,
Andre

 xen/arch/arm/gic-v3-lpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/arm/gic-v3-lpi.c +1 -2
index c3474f5434..84582157b8 100644
@@ -359,8 +359,7 @@ int gicv3_lpi_init_rdist(void __iomem * rdist_base)
     /* If the hardware reports non-shareable, drop cacheability as well. */
     if ( !(table_reg & GICR_PENDBASER_SHAREABILITY_MASK) )
     {
-        table_reg &= GICR_PENDBASER_SHAREABILITY_MASK;
-        table_reg &= GICR_PENDBASER_INNER_CACHEABILITY_MASK;
+        table_reg &= ~GICR_PENDBASER_INNER_CACHEABILITY_MASK;
         table_reg |= GIC_BASER_CACHE_nC << GICR_PENDBASER_INNER_CACHEABILITY_SHIFT;
 
         writeq_relaxed(table_reg, rdist_base + GICR_PENDBASER);
Signature · 7 lines
2.14.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

Hi,

Quoted 9 lines · Andre Przywara

If the host GICv3 redistributor reports that the pending table cannot use shareable memory, we try to drop the cacheability attributes as well. However we fail horribly in doing computer science 101 bit masking, effectively clearing the whole register instead of just a few bits.
Fix this by removing the one redundant masking operation and adding the magic negation for the actually needed other operation.

Manish, can you please test this patch and confirm that it works? Also how does the bug manifest for you?

Julien, Stefano: Are there any objections against taking this patch for 4.10? This was introduced with the ITS emulation.

Cheers,
Andre.

Quoted 18 lines

---
Julien,

can we have this still for 4.10, please? Seems like an obvious bug to me.

Cheers,
Andre

 xen/arch/arm/gic-v3-lpi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
xen/arch/arm/gic-v3-lpi.c +0 -0
index c3474f5434..84582157b8 100644

xen/arch/arm/gic-v3-lpi.c int gicv3_lpi_init_rdist(void __iomem * rdist_base) · line 365

Quoted 9 lines
xen/arch/arm/gic-v3-lpi.c +1 -2
@@ -359,8 +359,7 @@ int gicv3_lpi_init_rdist(void __iomem * rdist_base)
     /* If the hardware reports non-shareable, drop cacheability as well. */
     if ( !(table_reg & GICR_PENDBASER_SHAREABILITY_MASK) )
     {
-        table_reg &= GICR_PENDBASER_SHAREABILITY_MASK;
-        table_reg &= GICR_PENDBASER_INNER_CACHEABILITY_MASK;
+        table_reg &= ~GICR_PENDBASER_INNER_CACHEABILITY_MASK;
         table_reg |= GIC_BASER_CACHE_nC << GICR_PENDBASER_INNER_CACHEABILITY_SHIFT;
 
         writeq_relaxed(table_reg, rdist_base + GICR_PENDBASER);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reviewed-by
#2 lore raw
Quoted 1 line · Andre Przywara

Hi,

Hi Andre,

Sorry someone I skipped that patch :/.

Quoted 9 lines · Andre Przywara
Quoted 8 lines

If the host GICv3 redistributor reports that the pending table cannot use shareable memory, we try to drop the cacheability attributes as well. However we fail horribly in doing computer science 101 bit masking, effectively clearing the whole register instead of just a few bits.
Fix this by removing the one redundant masking operation and adding the magic negation for the actually needed other operation.

Quoted 6 lines
Quoted 1 line

Manish, can you please test this patch and confirm that it works? Also how does the bug manifest for you?

Julien, Stefano: Are there any objections against taking this patch for > 4.10? This was introduced with the ITS emulation.

This is new code and in technical preview. So I think it is fine to get them in Xen 4.10.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel