Skip to contentSkip to conversation

hw/omap_gpio: Fix infinite recursion when doing 8/16 bit reads

PATCH Applied Peter Maydell 3 participants 4 messages Nov 7, 2011 – Nov 15, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/omap_gpio: Fix infinite recursion when doing 8/16 bit reads

Fix a long-standing bug which meant that any attempt to do an 8 or 16 bit read from the OMAP GPIO module would cause qemu to crash due to an infinite recursion.

---
This has actually been in the code since the original OMAP2 support was added in 2008; we've never noticed before because the kernel happened to always do 32 bit accesses...
Long term we should fix this by conversion to MemoryRegion; this is the minimally invasive fix for 1.0.

 hw/omap_gpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/omap_gpio.c +1 -1
index d775df6..d630748 100644
@@ -510,7 +510,7 @@ static void omap2_gpio_module_write(void *opaque, target_phys_addr_t addr,
 
 static uint32_t omap2_gpio_module_readp(void *opaque, target_phys_addr_t addr)
 {
-    return omap2_gpio_module_readp(opaque, addr) >> ((addr & 3) << 3);
+    return omap2_gpio_module_read(opaque, addr & ~3) >> ((addr & 3) << 3);
 }
 
 static void omap2_gpio_module_writep(void *opaque, target_phys_addr_t addr,
Signature · 1 line
1.7.4.1
#1 lore raw

Anthony -- you've committed a bunch of later patches but not this one:
did you miss it?

thanks
-- PMM

Quoted 30 lines · Peter Maydell

Fix a long-standing bug which meant that any attempt to do an 8 or 16 bit read from the OMAP GPIO module would cause qemu to crash due to an infinite recursion.

---
This has actually been in the code since the original OMAP2 support was added in 2008; we've never noticed before because the kernel happened to always do 32 bit accesses...
Long term we should fix this by conversion to MemoryRegion; this is the minimally invasive fix for 1.0.

 hw/omap_gpio.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
hw/omap_gpio.c +1 -2
index d775df6..d630748 100644
@@ -510,7 +510,7 @@ static void omap2_gpio_module_write(void *opaque, target_phys_addr_t addr,
 
  static uint32_t omap2_gpio_module_readp(void *opaque, target_phys_addr_t addr)
  {
-    return omap2_gpio_module_readp(opaque, addr) >> ((addr & 3) << 3);
+    return omap2_gpio_module_read(opaque, addr & ~3) >> ((addr & 3) << 3);
  }
 
  static void omap2_gpio_module_writep(void *opaque, target_phys_addr_t addr,
--

1.7.4.1

#2 lore raw
Quoted 2 lines · Peter Maydell

Anthony -- you've committed a bunch of later patches but not this one:
did you miss it?

Most likely an over zealous delete on my part. I'll requeue.

Regards,

Anthony Liguori

Quoted 37 lines

thanks
-- PMM

Quoted 30 lines · Peter Maydell

Fix a long-standing bug which meant that any attempt to do an 8 or 16 bit read from the OMAP GPIO module would cause qemu to crash due to an infinite recursion.

---
This has actually been in the code since the original OMAP2 support was added in 2008; we've never noticed before because the kernel happened to always do 32 bit accesses...
Long term we should fix this by conversion to MemoryRegion; this is the minimally invasive fix for 1.0.

  hw/omap_gpio.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
hw/omap_gpio.c +1 -2
index d775df6..d630748 100644
@@ -510,7 +510,7 @@ static void omap2_gpio_module_write(void *opaque, target_phys_addr_t addr,
 
  static uint32_t omap2_gpio_module_readp(void *opaque, target_phys_addr_t addr)
  {
-    return omap2_gpio_module_readp(opaque, addr)>>  ((addr&  3)<<  3);
+    return omap2_gpio_module_read(opaque, addr&  ~3)>>  ((addr&  3)<<  3);
  }
 
  static void omap2_gpio_module_writep(void *opaque, target_phys_addr_t addr,
--

1.7.4.1

#3 lore raw
In reply to Peter Maydell
Quoted 5 lines · Peter Maydell

Fix a long-standing bug which meant that any attempt to do an 8 or 16 bit read from the OMAP GPIO module would cause qemu to crash due to an infinite recursion.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 23 lines

---
This has actually been in the code since the original OMAP2 support was added in 2008; we've never noticed before because the kernel happened to always do 32 bit accesses...
Long term we should fix this by conversion to MemoryRegion; this is the minimally invasive fix for 1.0.

  hw/omap_gpio.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
hw/omap_gpio.c +1 -1
index d775df6..d630748 100644
@@ -510,7 +510,7 @@ static void omap2_gpio_module_write(void *opaque, target_phys_addr_t addr,
 
  static uint32_t omap2_gpio_module_readp(void *opaque, target_phys_addr_t addr)
  {
-    return omap2_gpio_module_readp(opaque, addr)>>  ((addr&  3)<<  3);
+    return omap2_gpio_module_read(opaque, addr&  ~3)>>  ((addr&  3)<<  3);
  }
 
  static void omap2_gpio_module_writep(void *opaque, target_phys_addr_t addr,