All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] gt64xxx: fix decoding of ISD register
@ 2015-11-06 15:34 Paolo Bonzini
  2015-11-29 10:46 ` Michael Tokarev
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2015-11-06 15:34 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

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).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/mips/gt64xxx_pci.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/mips/gt64xxx_pci.c b/hw/mips/gt64xxx_pci.c
index 10fcca3..f76a9fd 100644
--- a/hw/mips/gt64xxx_pci.c
+++ b/hw/mips/gt64xxx_pci.c
@@ -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) {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] gt64xxx: fix decoding of ISD register
  2015-11-06 15:34 [Qemu-devel] [PATCH] gt64xxx: fix decoding of ISD register Paolo Bonzini
@ 2015-11-29 10:46 ` Michael Tokarev
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tokarev @ 2015-11-29 10:46 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: qemu-trivial

06.11.2015 18:34, Paolo Bonzini wrote:
> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-29 10:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-06 15:34 [Qemu-devel] [PATCH] gt64xxx: fix decoding of ISD register Paolo Bonzini
2015-11-29 10:46 ` Michael Tokarev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.