[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] arm/gicv3: Decode cacheability fields before comparing



commit 49e0ce5b3499dfa2b1c5b87d90b7f35fd5207c2b
Author:     Mykola Kvach <mykola_kvach@xxxxxxxx>
AuthorDate: Mon Apr 27 10:37:31 2026 +0200
Commit:     Michal Orzel <michal.orzel@xxxxxxx>
CommitDate: Mon Apr 27 12:04:01 2026 +0200

    arm/gicv3: Decode cacheability fields before comparing
    
    GITS_BASER_INNER_CACHEABILITY_MASK and
    GICR_PROPBASER_INNER_CACHEABILITY_MASK are shifted masks. Comparing the
    masked but unshifted values against GIC_BASER_CACHE_nC, which is an
    unshifted enum value, leads to incorrect detection of non-cacheable
    GITS_BASER tables and GICR_PROPBASER mappings.
    
    Use MASK_EXTR() to decode these cacheability fields before comparing
    against GIC_BASER_CACHE_nC, so the backing memory is flushed when
    required.
    
    Fixes: 05238012b86d ("ARM: GICv3 ITS: allocate device and collection table")
    Fixes: c9b939863c89 ("ARM: GICv3: allocate LPI pending and property table")
    Signed-off-by: Mykyta Poturai <mykyta_poturai@xxxxxxxx>
    Signed-off-by: Mykola Kvach <mykola_kvach@xxxxxxxx>
    Reviewed-by: Michal Orzel <michal.orzel@xxxxxxx>
---
 xen/arch/arm/gic-v3-its.c | 3 ++-
 xen/arch/arm/gic-v3-lpi.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index e38aa87117..9005ce8ce5 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -496,7 +496,8 @@ retry:
         }
         attr = regc & BASER_ATTR_MASK;
     }
-    if ( (regc & GITS_BASER_INNER_CACHEABILITY_MASK) <= GIC_BASER_CACHE_nC )
+    if ( MASK_EXTR(regc, GITS_BASER_INNER_CACHEABILITY_MASK) <=
+         GIC_BASER_CACHE_nC )
         clean_and_invalidate_dcache_va_range(buffer, table_size);
 
     /* If the host accepted our page size, we are done. */
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index de5052e5cf..9ee338edc2 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -351,7 +351,8 @@ static int gicv3_lpi_set_proptable(void __iomem * 
rdist_base)
     }
 
     /* Remember that we have to flush the property table if non-cacheable. */
-    if ( (reg & GICR_PROPBASER_INNER_CACHEABILITY_MASK) <= GIC_BASER_CACHE_nC )
+    if ( MASK_EXTR(reg, GICR_PROPBASER_INNER_CACHEABILITY_MASK) <=
+         GIC_BASER_CACHE_nC )
     {
         lpi_data.flags |= LPI_PROPTABLE_NEEDS_FLUSHING;
         /* Update the redistributors knowledge about the attributes. */
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.