Skip to contentSkip to conversation

gt64xxx: fix decoding of ISD register

PATCH Applied Paolo Bonzini 2 participants 2 messages Nov 6, 2015 – Nov 29, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gt64xxx: fix decoding of ISD register

The GT64xxx's internal registers can be placed above the first 4 GiB in the address space, but not above the first 64 GiB. Correctly cast the register to a 64-bit integer, and mask away bits above bit 35.

Datasheet at http://pdf.datasheetarchive.com/datasheetsmain/Datasheets-33/DSA-655889.pdf
(bug reported by Coverity).

---
 hw/mips/gt64xxx_pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/mips/gt64xxx_pci.c +2 -1
index 10fcca3..f76a9fd 100644
@@ -275,7 +275,8 @@ static void check_reserved_space (hwaddr *start,
 
 static void gt64120_isd_mapping(GT64120State *s)
 {
-    hwaddr start = s->regs[GT_ISD] << 21;
+    /* Bits 14:0 of ISD map to bits 35:21 of the start address.  */
+    hwaddr start = ((hwaddr)s->regs[GT_ISD] << 21) & 0xFFFE00000ull;
     hwaddr length = 0x1000;
 
     if (s->ISD_length) {
Signature · 1 line
2.5.0
#1 lore raw
Quoted 3 lines · Paolo Bonzini

The GT64xxx's internal registers can be placed above the first 4 GiB in the address space, but not above the first 64 GiB. Correctly cast the register to a 64-bit integer, and mask away bits above bit 35.

Applied to -trivial, thank you!

/mjt