Skip to contentSkip to conversation

hw/arm/smmuv3: Check 31st bit to see if CD is valid

PATCH Applied Joe Komlodi 2 participants 3 messages Jul 19, 2021 – Jul 22, 2021

lore
Share & tools
lore
#0 lore raw

cover hw/arm/smmuv3: Check 31st bit to see if CD is valid

Hi all,

This fixes an off-by-1 error when checking to see if a context descriptor is valid in SMMUv3.

I think it hasn't caused problems yet because Linux will also set the 30th bit, which is the bit CD_VALID currently checks.

Thanks!
Joe

Joe Komlodi (1):
hw/arm/smmuv3: Check 31st bit to see if CD is valid

 hw/arm/smmuv3-internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 hw/arm/smmuv3: Check 31st bit to see if CD is valid

The bit to see if a CD is valid is the last bit of the first word of the CD.

---
 hw/arm/smmuv3-internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/smmuv3-internal.h +1 -1
index 3dac576..d1885ae 100644
@@ -570,7 +570,7 @@ static inline int pa_range(STE *ste)
 
 /* CD fields */
 
-#define CD_VALID(x)   extract32((x)->word[0], 30, 1)
+#define CD_VALID(x)   extract32((x)->word[0], 31, 1)
 #define CD_ASID(x)    extract32((x)->word[1], 16, 16)
 #define CD_TTB(x, sel)                                      \
     ({                                                      \
Signature · 1 line
2.7.4
#2 lore raw
Quoted 13 lines · Joe Komlodi

The bit to see if a CD is valid is the last bit of the first word of the CD.

---
 hw/arm/smmuv3-internal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/arm/smmuv3-internal.h +0 -0
index 3dac576..d1885ae 100644

hw/arm/smmuv3-internal.h static inline int pa_range(STE *ste) · line 576

Quoted 8 lines
hw/arm/smmuv3-internal.h +1 -1
@@ -570,7 +570,7 @@ static inline int pa_range(STE *ste)
 
 /* CD fields */
 
-#define CD_VALID(x)   extract32((x)->word[0], 30, 1)
+#define CD_VALID(x)   extract32((x)->word[0], 31, 1)
 #define CD_ASID(x)    extract32((x)->word[1], 16, 16)
 #define CD_TTB(x, sel)                                      \
     ({                                                      \

Applied to target-arm.next (should get into rc1), thanks.

-- PMM