* [Qemu-devel] [PATCH 0/3] omap l4 updates
@ 2011-11-24 15:56 Avi Kivity
2011-11-24 15:57 ` [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK Avi Kivity
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Avi Kivity @ 2011-11-24 15:56 UTC (permalink / raw)
To: qemu-devel
The following three patches are part of the memory API conversion queue;
while I don't think there's anything contentious in there, it's not the usual
convert-to-memory-API fare.
The patches remove a bunch of dead code that has not been in use for more
than three years, so they should be quite safe.
Avi Kivity (3):
omap: remove L4_MUX_HACK
omap: eliminate l4_register_io_memory
omap_l4: add memory API variant of omap_l4_attach()
hw/omap.h | 12 ++--
hw/omap2.c | 14 ++--
hw/omap_dss.c | 16 +++---
hw/omap_gptimer.c | 4 +-
hw/omap_i2c.c | 4 +-
hw/omap_l4.c | 159 ++++++++++-----------------------------------------
hw/omap_mmc.c | 4 +-
hw/omap_spi.c | 4 +-
hw/omap_synctimer.c | 5 +-
hw/omap_tap.c | 5 +-
10 files changed, 65 insertions(+), 162 deletions(-)
--
1.7.7.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK
2011-11-24 15:56 [Qemu-devel] [PATCH 0/3] omap l4 updates Avi Kivity
@ 2011-11-24 15:57 ` Avi Kivity
2011-11-27 3:52 ` andrzej zaborowski
2011-11-24 15:57 ` [Qemu-devel] [PATCH 2/3] omap: eliminate l4_register_io_memory Avi Kivity
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2011-11-24 15:57 UTC (permalink / raw)
To: qemu-devel
This was introduced apparently to overcome a limitation on the number of
cpu_register_io_memory() calls. 477b24ef91175 (July 2008) removed use
of the hack, but retained the code. This patch removes the code as well.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/omap.h | 3 -
hw/omap_l4.c | 118 ----------------------------------------------------------
2 files changed, 0 insertions(+), 121 deletions(-)
diff --git a/hw/omap.h b/hw/omap.h
index 924618e..8bd1810 100644
--- a/hw/omap.h
+++ b/hw/omap.h
@@ -1127,7 +1127,4 @@ inline static int debug_register_io_memory(CPUReadMemoryFunc * const *mem_read,
# define cpu_register_io_memory debug_register_io_memory
# endif
-/* Define when we want to reduce the number of IO regions registered. */
-/*# define L4_MUX_HACK*/
-
#endif /* hw_omap_h */
diff --git a/hw/omap_l4.c b/hw/omap_l4.c
index a4a8883..ebec874 100644
--- a/hw/omap_l4.c
+++ b/hw/omap_l4.c
@@ -20,89 +20,6 @@
#include "hw.h"
#include "omap.h"
-#ifdef L4_MUX_HACK
-static int omap_l4_io_entries;
-static int omap_cpu_io_entry;
-static struct omap_l4_entry {
- CPUReadMemoryFunc * const *mem_read;
- CPUWriteMemoryFunc * const *mem_write;
- void *opaque;
-} *omap_l4_io_entry;
-static CPUReadMemoryFunc * const *omap_l4_io_readb_fn;
-static CPUReadMemoryFunc * const *omap_l4_io_readh_fn;
-static CPUReadMemoryFunc * const *omap_l4_io_readw_fn;
-static CPUWriteMemoryFunc * const *omap_l4_io_writeb_fn;
-static CPUWriteMemoryFunc * const *omap_l4_io_writeh_fn;
-static CPUWriteMemoryFunc * const *omap_l4_io_writew_fn;
-static void **omap_l4_io_opaque;
-
-int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
- CPUWriteMemoryFunc * const *mem_write, void *opaque)
-{
- omap_l4_io_entry[omap_l4_io_entries].mem_read = mem_read;
- omap_l4_io_entry[omap_l4_io_entries].mem_write = mem_write;
- omap_l4_io_entry[omap_l4_io_entries].opaque = opaque;
-
- return omap_l4_io_entries ++;
-}
-
-static uint32_t omap_l4_io_readb(void *opaque, target_phys_addr_t addr)
-{
- unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
- return omap_l4_io_readb_fn[i](omap_l4_io_opaque[i], addr);
-}
-
-static uint32_t omap_l4_io_readh(void *opaque, target_phys_addr_t addr)
-{
- unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
- return omap_l4_io_readh_fn[i](omap_l4_io_opaque[i], addr);
-}
-
-static uint32_t omap_l4_io_readw(void *opaque, target_phys_addr_t addr)
-{
- unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
- return omap_l4_io_readw_fn[i](omap_l4_io_opaque[i], addr);
-}
-
-static void omap_l4_io_writeb(void *opaque, target_phys_addr_t addr,
- uint32_t value)
-{
- unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
- return omap_l4_io_writeb_fn[i](omap_l4_io_opaque[i], addr, value);
-}
-
-static void omap_l4_io_writeh(void *opaque, target_phys_addr_t addr,
- uint32_t value)
-{
- unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
- return omap_l4_io_writeh_fn[i](omap_l4_io_opaque[i], addr, value);
-}
-
-static void omap_l4_io_writew(void *opaque, target_phys_addr_t addr,
- uint32_t value)
-{
- unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
-
- return omap_l4_io_writew_fn[i](omap_l4_io_opaque[i], addr, value);
-}
-
-static CPUReadMemoryFunc * const omap_l4_io_readfn[] = {
- omap_l4_io_readb,
- omap_l4_io_readh,
- omap_l4_io_readw,
-};
-
-static CPUWriteMemoryFunc * const omap_l4_io_writefn[] = {
- omap_l4_io_writeb,
- omap_l4_io_writeh,
- omap_l4_io_writew,
-};
-#else
int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
CPUWriteMemoryFunc * const *mem_write,
void *opaque)
@@ -110,7 +27,6 @@ int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
return cpu_register_io_memory(mem_read, mem_write, opaque,
DEVICE_NATIVE_ENDIAN);
}
-#endif
struct omap_l4_s {
target_phys_addr_t base;
@@ -126,23 +42,6 @@ struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num)
bus->ta_num = ta_num;
bus->base = base;
-#ifdef L4_MUX_HACK
- omap_l4_io_entries = 1;
- omap_l4_io_entry = g_malloc0(125 * sizeof(*omap_l4_io_entry));
-
- omap_cpu_io_entry =
- cpu_register_io_memory(omap_l4_io_readfn,
- omap_l4_io_writefn, bus, DEVICE_NATIVE_ENDIAN);
-# define L4_PAGES (0xb4000 / TARGET_PAGE_SIZE)
- omap_l4_io_readb_fn = g_malloc0(sizeof(void *) * L4_PAGES);
- omap_l4_io_readh_fn = g_malloc0(sizeof(void *) * L4_PAGES);
- omap_l4_io_readw_fn = g_malloc0(sizeof(void *) * L4_PAGES);
- omap_l4_io_writeb_fn = g_malloc0(sizeof(void *) * L4_PAGES);
- omap_l4_io_writeh_fn = g_malloc0(sizeof(void *) * L4_PAGES);
- omap_l4_io_writew_fn = g_malloc0(sizeof(void *) * L4_PAGES);
- omap_l4_io_opaque = g_malloc0(sizeof(void *) * L4_PAGES);
-#endif
-
return bus;
}
@@ -245,9 +144,6 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
{
target_phys_addr_t base;
ssize_t size;
-#ifdef L4_MUX_HACK
- int i;
-#endif
if (region < 0 || region >= ta->regions) {
fprintf(stderr, "%s: bad io region (%i)\n", __FUNCTION__, region);
@@ -257,21 +153,7 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
base = ta->bus->base + ta->start[region].offset;
size = ta->start[region].size;
if (iotype) {
-#ifndef L4_MUX_HACK
cpu_register_physical_memory(base, size, iotype);
-#else
- cpu_register_physical_memory(base, size, omap_cpu_io_entry);
- i = (base - ta->bus->base) / TARGET_PAGE_SIZE;
- for (; size > 0; size -= TARGET_PAGE_SIZE, i ++) {
- omap_l4_io_readb_fn[i] = omap_l4_io_entry[iotype].mem_read[0];
- omap_l4_io_readh_fn[i] = omap_l4_io_entry[iotype].mem_read[1];
- omap_l4_io_readw_fn[i] = omap_l4_io_entry[iotype].mem_read[2];
- omap_l4_io_writeb_fn[i] = omap_l4_io_entry[iotype].mem_write[0];
- omap_l4_io_writeh_fn[i] = omap_l4_io_entry[iotype].mem_write[1];
- omap_l4_io_writew_fn[i] = omap_l4_io_entry[iotype].mem_write[2];
- omap_l4_io_opaque[i] = omap_l4_io_entry[iotype].opaque;
- }
-#endif
}
return base;
--
1.7.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 2/3] omap: eliminate l4_register_io_memory
2011-11-24 15:56 [Qemu-devel] [PATCH 0/3] omap l4 updates Avi Kivity
2011-11-24 15:57 ` [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK Avi Kivity
@ 2011-11-24 15:57 ` Avi Kivity
2011-11-24 15:57 ` [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach() Avi Kivity
2011-11-24 16:22 ` [Qemu-devel] [PATCH 0/3] omap l4 updates Peter Maydell
3 siblings, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2011-11-24 15:57 UTC (permalink / raw)
To: qemu-devel
This is a trivial wrapper around cpu_register_io_memory(), adding
no value. Inline it into all callers.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/omap.h | 2 --
hw/omap2.c | 12 ++++++------
hw/omap_dss.c | 16 ++++++++--------
hw/omap_gptimer.c | 4 ++--
hw/omap_i2c.c | 4 ++--
hw/omap_l4.c | 12 ++----------
hw/omap_mmc.c | 4 ++--
hw/omap_spi.c | 4 ++--
hw/omap_synctimer.c | 5 +++--
hw/omap_tap.c | 5 +++--
10 files changed, 30 insertions(+), 38 deletions(-)
diff --git a/hw/omap.h b/hw/omap.h
index 8bd1810..d12f402 100644
--- a/hw/omap.h
+++ b/hw/omap.h
@@ -96,8 +96,6 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
int iotype);
target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
int region);
-int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
- CPUWriteMemoryFunc * const *mem_write, void *opaque);
/* OMAP2 SDRAM controller */
struct omap_sdrc_s;
diff --git a/hw/omap2.c b/hw/omap2.c
index e299884..8a0fa73 100644
--- a/hw/omap2.c
+++ b/hw/omap2.c
@@ -784,8 +784,8 @@ static void omap_sti_fifo_write(void *opaque, target_phys_addr_t addr,
s->chr = chr ?: qemu_chr_new("null", "null", NULL);
- iomemtype = l4_register_io_memory(omap_sti_readfn,
- omap_sti_writefn, s);
+ iomemtype = cpu_register_io_memory(omap_sti_readfn,
+ omap_sti_writefn, s, DEVICE_NATIVE_ENDIAN);
omap_l4_attach(ta, 0, iomemtype);
iomemtype = cpu_register_io_memory(omap_sti_fifo_readfn,
@@ -1798,8 +1798,8 @@ static void omap_prcm_coldreset(struct omap_prcm_s *s)
s->mpu = mpu;
omap_prcm_coldreset(s);
- iomemtype = l4_register_io_memory(omap_prcm_readfn,
- omap_prcm_writefn, s);
+ iomemtype = cpu_register_io_memory(omap_prcm_readfn,
+ omap_prcm_writefn, s, DEVICE_NATIVE_ENDIAN);
omap_l4_attach(ta, 0, iomemtype);
omap_l4_attach(ta, 1, iomemtype);
@@ -2168,8 +2168,8 @@ static void omap_sysctl_reset(struct omap_sysctl_s *s)
s->mpu = mpu;
omap_sysctl_reset(s);
- iomemtype = l4_register_io_memory(omap_sysctl_readfn,
- omap_sysctl_writefn, s);
+ iomemtype = cpu_register_io_memory(omap_sysctl_readfn,
+ omap_sysctl_writefn, s, DEVICE_NATIVE_ENDIAN);
omap_l4_attach(ta, 0, iomemtype);
return s;
diff --git a/hw/omap_dss.c b/hw/omap_dss.c
index b4a8b4c..b138c23 100644
--- a/hw/omap_dss.c
+++ b/hw/omap_dss.c
@@ -1037,14 +1037,14 @@ struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta,
s->drq = drq;
omap_dss_reset(s);
- iomemtype[0] = l4_register_io_memory(omap_diss1_readfn,
- omap_diss1_writefn, s);
- iomemtype[1] = l4_register_io_memory(omap_disc1_readfn,
- omap_disc1_writefn, s);
- iomemtype[2] = l4_register_io_memory(omap_rfbi1_readfn,
- omap_rfbi1_writefn, s);
- iomemtype[3] = l4_register_io_memory(omap_venc1_readfn,
- omap_venc1_writefn, s);
+ iomemtype[0] = cpu_register_io_memory(omap_diss1_readfn,
+ omap_diss1_writefn, s, DEVICE_NATIVE_ENDIAN);
+ iomemtype[1] = cpu_register_io_memory(omap_disc1_readfn,
+ omap_disc1_writefn, s, DEVICE_NATIVE_ENDIAN);
+ iomemtype[2] = cpu_register_io_memory(omap_rfbi1_readfn,
+ omap_rfbi1_writefn, s, DEVICE_NATIVE_ENDIAN);
+ iomemtype[3] = cpu_register_io_memory(omap_venc1_readfn,
+ omap_venc1_writefn, s, DEVICE_NATIVE_ENDIAN);
iomemtype[4] = cpu_register_io_memory(omap_im3_readfn,
omap_im3_writefn, s, DEVICE_NATIVE_ENDIAN);
omap_l4_attach(ta, 0, iomemtype[0]);
diff --git a/hw/omap_gptimer.c b/hw/omap_gptimer.c
index 704b000..c1cbdf8 100644
--- a/hw/omap_gptimer.c
+++ b/hw/omap_gptimer.c
@@ -476,8 +476,8 @@ struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
omap_gp_timer_reset(s);
omap_gp_timer_clk_setup(s);
- iomemtype = l4_register_io_memory(omap_gp_timer_readfn,
- omap_gp_timer_writefn, s);
+ iomemtype = cpu_register_io_memory(omap_gp_timer_readfn,
+ omap_gp_timer_writefn, s, DEVICE_NATIVE_ENDIAN);
omap_l4_attach(ta, 0, iomemtype);
return s;
diff --git a/hw/omap_i2c.c b/hw/omap_i2c.c
index 11577b1..52c38ba 100644
--- a/hw/omap_i2c.c
+++ b/hw/omap_i2c.c
@@ -457,8 +457,8 @@ struct omap_i2c_s *omap2_i2c_init(struct omap_target_agent_s *ta,
s->bus = i2c_init_bus(NULL, "i2c");
omap_i2c_reset(s);
- iomemtype = l4_register_io_memory(omap_i2c_readfn,
- omap_i2c_writefn, s);
+ iomemtype = cpu_register_io_memory(omap_i2c_readfn,
+ omap_i2c_writefn, s, DEVICE_NATIVE_ENDIAN);
omap_l4_attach(ta, 0, iomemtype);
return s;
diff --git a/hw/omap_l4.c b/hw/omap_l4.c
index ebec874..a19ea70 100644
--- a/hw/omap_l4.c
+++ b/hw/omap_l4.c
@@ -20,14 +20,6 @@
#include "hw.h"
#include "omap.h"
-int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
- CPUWriteMemoryFunc * const *mem_write,
- void *opaque)
-{
- return cpu_register_io_memory(mem_read, mem_write, opaque,
- DEVICE_NATIVE_ENDIAN);
-}
-
struct omap_l4_s {
target_phys_addr_t base;
int ta_num;
@@ -132,8 +124,8 @@ struct omap_target_agent_s *omap_l4ta_get(struct omap_l4_s *bus,
ta->status = 0x00000000;
ta->control = 0x00000200; /* XXX 01000200 for L4TAO */
- iomemtype = l4_register_io_memory(omap_l4ta_readfn,
- omap_l4ta_writefn, ta);
+ iomemtype = cpu_register_io_memory(omap_l4ta_readfn,
+ omap_l4ta_writefn, ta, DEVICE_NATIVE_ENDIAN);
ta->base = omap_l4_attach(ta, info->ta_region, iomemtype);
return ta;
diff --git a/hw/omap_mmc.c b/hw/omap_mmc.c
index a1afeb5..b42cf90 100644
--- a/hw/omap_mmc.c
+++ b/hw/omap_mmc.c
@@ -612,8 +612,8 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
omap_mmc_reset(s);
- iomemtype = l4_register_io_memory(omap_mmc_readfn,
- omap_mmc_writefn, s);
+ iomemtype = cpu_register_io_memory(omap_mmc_readfn,
+ omap_mmc_writefn, s, DEVICE_NATIVE_ENDIAN);
omap_l4_attach(ta, 0, iomemtype);
/* Instantiate the storage */
diff --git a/hw/omap_spi.c b/hw/omap_spi.c
index 6030ad9..c20f425 100644
--- a/hw/omap_spi.c
+++ b/hw/omap_spi.c
@@ -327,8 +327,8 @@ struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum,
}
omap_mcspi_reset(s);
- iomemtype = l4_register_io_memory(omap_mcspi_readfn,
- omap_mcspi_writefn, s);
+ iomemtype = cpu_register_io_memory(omap_mcspi_readfn,
+ omap_mcspi_writefn, s, DEVICE_NATIVE_ENDIAN);
omap_l4_attach(ta, 0, iomemtype);
return s;
diff --git a/hw/omap_synctimer.c b/hw/omap_synctimer.c
index b47ca88..ece5388 100644
--- a/hw/omap_synctimer.c
+++ b/hw/omap_synctimer.c
@@ -89,8 +89,9 @@ struct omap_synctimer_s *omap_synctimer_init(struct omap_target_agent_s *ta,
struct omap_synctimer_s *s = g_malloc0(sizeof(*s));
omap_synctimer_reset(s);
- omap_l4_attach(ta, 0, l4_register_io_memory(
- omap_synctimer_readfn, omap_synctimer_writefn, s));
+ omap_l4_attach(ta, 0, cpu_register_io_memory(
+ omap_synctimer_readfn, omap_synctimer_writefn, s,
+ DEVICE_NATIVE_ENDIAN));
return s;
}
diff --git a/hw/omap_tap.c b/hw/omap_tap.c
index 1f18ddd..e685288 100644
--- a/hw/omap_tap.c
+++ b/hw/omap_tap.c
@@ -107,6 +107,7 @@ static void omap_tap_write(void *opaque, target_phys_addr_t addr,
void omap_tap_init(struct omap_target_agent_s *ta,
struct omap_mpu_state_s *mpu)
{
- omap_l4_attach(ta, 0, l4_register_io_memory(
- omap_tap_readfn, omap_tap_writefn, mpu));
+ omap_l4_attach(ta, 0, cpu_register_io_memory(
+ omap_tap_readfn, omap_tap_writefn, mpu,
+ DEVICE_NATIVE_ENDIAN));
}
--
1.7.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach()
2011-11-24 15:56 [Qemu-devel] [PATCH 0/3] omap l4 updates Avi Kivity
2011-11-24 15:57 ` [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK Avi Kivity
2011-11-24 15:57 ` [Qemu-devel] [PATCH 2/3] omap: eliminate l4_register_io_memory Avi Kivity
@ 2011-11-24 15:57 ` Avi Kivity
2011-11-27 4:19 ` andrzej zaborowski
2011-11-24 16:22 ` [Qemu-devel] [PATCH 0/3] omap l4 updates Peter Maydell
3 siblings, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2011-11-24 15:57 UTC (permalink / raw)
To: qemu-devel
Also add omap_l4_region_size(), since memory API functions need
the size during initialization.
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/omap.h | 7 ++++++-
hw/omap2.c | 2 +-
hw/omap_l4.c | 29 ++++++++++++++++++++++++++++-
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/hw/omap.h b/hw/omap.h
index d12f402..367ba11 100644
--- a/hw/omap.h
+++ b/hw/omap.h
@@ -84,7 +84,8 @@ struct omap_target_agent_s {
uint32_t control;
uint32_t status;
};
-struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num);
+struct omap_l4_s *omap_l4_init(MemoryRegion *address_space,
+ target_phys_addr_t base, int ta_num);
struct omap_target_agent_s;
struct omap_target_agent_s *omap_l4ta_get(
@@ -94,8 +95,12 @@ struct omap_target_agent_s *omap_l4ta_get(
int cs);
target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
int iotype);
+target_phys_addr_t omap_l4_attach_region(struct omap_target_agent_s *ta,
+ int region, MemoryRegion *mr);
target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
int region);
+target_phys_addr_t omap_l4_region_size(struct omap_target_agent_s *ta,
+ int region);
/* OMAP2 SDRAM controller */
struct omap_sdrc_s;
diff --git a/hw/omap2.c b/hw/omap2.c
index 8a0fa73..5fc3fcf 100644
--- a/hw/omap2.c
+++ b/hw/omap2.c
@@ -2260,7 +2260,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
(sram_base = qemu_ram_alloc(NULL, "omap2.sram",
s->sram_size)) | IO_MEM_RAM);
- s->l4 = omap_l4_init(OMAP2_L4_BASE, 54);
+ s->l4 = omap_l4_init(sysmem, OMAP2_L4_BASE, 54);
/* Actually mapped at any 2K boundary in the ARM11 private-peripheral if */
cpu_irq = arm_pic_init_cpu(s->env);
diff --git a/hw/omap_l4.c b/hw/omap_l4.c
index a19ea70..a0bed5c 100644
--- a/hw/omap_l4.c
+++ b/hw/omap_l4.c
@@ -21,16 +21,19 @@
#include "omap.h"
struct omap_l4_s {
+ MemoryRegion *address_space;
target_phys_addr_t base;
int ta_num;
struct omap_target_agent_s ta[0];
};
-struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num)
+struct omap_l4_s *omap_l4_init(MemoryRegion *address_space,
+ target_phys_addr_t base, int ta_num)
{
struct omap_l4_s *bus = g_malloc0(
sizeof(*bus) + ta_num * sizeof(*bus->ta));
+ bus->address_space = address_space;
bus->ta_num = ta_num;
bus->base = base;
@@ -43,6 +46,12 @@ target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
return ta->bus->base + ta->start[region].offset;
}
+target_phys_addr_t omap_l4_region_size(struct omap_target_agent_s *ta,
+ int region)
+{
+ return ta->start[region].size;
+}
+
static uint32_t omap_l4ta_read(void *opaque, target_phys_addr_t addr)
{
struct omap_target_agent_s *s = (struct omap_target_agent_s *) opaque;
@@ -150,3 +159,21 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
return base;
}
+
+target_phys_addr_t omap_l4_attach_region(struct omap_target_agent_s *ta,
+ int region, MemoryRegion *mr)
+{
+ target_phys_addr_t base;
+
+ if (region < 0 || region >= ta->regions) {
+ fprintf(stderr, "%s: bad io region (%i)\n", __FUNCTION__, region);
+ exit(-1);
+ }
+
+ base = ta->bus->base + ta->start[region].offset;
+ if (mr) {
+ memory_region_add_subregion(ta->bus->address_space, base, mr);
+ }
+
+ return base;
+}
--
1.7.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 0/3] omap l4 updates
2011-11-24 15:56 [Qemu-devel] [PATCH 0/3] omap l4 updates Avi Kivity
` (2 preceding siblings ...)
2011-11-24 15:57 ` [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach() Avi Kivity
@ 2011-11-24 16:22 ` Peter Maydell
3 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2011-11-24 16:22 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel
On 24 November 2011 15:56, Avi Kivity <avi@redhat.com> wrote:
> The following three patches are part of the memory API conversion queue;
> while I don't think there's anything contentious in there, it's not the usual
> convert-to-memory-API fare.
>
> The patches remove a bunch of dead code that has not been in use for more
> than three years, so they should be quite safe.
>
> Avi Kivity (3):
> omap: remove L4_MUX_HACK
> omap: eliminate l4_register_io_memory
> omap_l4: add memory API variant of omap_l4_attach()
These look OK to me; an ack from Andrzej would be good too.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
(checkpatch will whine about your use of __FUNCTION__ which might
be nice to fix if you have to do a v2 for some other reason.)
-- PMM
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK
2011-11-24 15:57 ` [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK Avi Kivity
@ 2011-11-27 3:52 ` andrzej zaborowski
0 siblings, 0 replies; 7+ messages in thread
From: andrzej zaborowski @ 2011-11-27 3:52 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel
On 24 November 2011 16:57, Avi Kivity <avi@redhat.com> wrote:
> This was introduced apparently to overcome a limitation on the number of
> cpu_register_io_memory() calls. 477b24ef91175 (July 2008) removed use
> of the hack, but retained the code. This patch removes the code as well.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
Reviewed-by: Andrzej Zaborowski <balrogg@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach()
2011-11-24 15:57 ` [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach() Avi Kivity
@ 2011-11-27 4:19 ` andrzej zaborowski
0 siblings, 0 replies; 7+ messages in thread
From: andrzej zaborowski @ 2011-11-27 4:19 UTC (permalink / raw)
To: Avi Kivity; +Cc: qemu-devel
On 24 November 2011 16:57, Avi Kivity <avi@redhat.com> wrote:
> Also add omap_l4_region_size(), since memory API functions need
> the size during initialization.
Logically it should be one of the omap_l4_* functions that set the
size for the region instead of the target agents because this is where
all the memory map is hardcoded. However with the current memory api
I see that it's more straight forward to go this way.
Cheers
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
> hw/omap.h | 7 ++++++-
> hw/omap2.c | 2 +-
> hw/omap_l4.c | 29 ++++++++++++++++++++++++++++-
> 3 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/hw/omap.h b/hw/omap.h
> index d12f402..367ba11 100644
> --- a/hw/omap.h
> +++ b/hw/omap.h
> @@ -84,7 +84,8 @@ struct omap_target_agent_s {
> uint32_t control;
> uint32_t status;
> };
> -struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num);
> +struct omap_l4_s *omap_l4_init(MemoryRegion *address_space,
> + target_phys_addr_t base, int ta_num);
>
> struct omap_target_agent_s;
> struct omap_target_agent_s *omap_l4ta_get(
> @@ -94,8 +95,12 @@ struct omap_target_agent_s *omap_l4ta_get(
> int cs);
> target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
> int iotype);
> +target_phys_addr_t omap_l4_attach_region(struct omap_target_agent_s *ta,
> + int region, MemoryRegion *mr);
> target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
> int region);
> +target_phys_addr_t omap_l4_region_size(struct omap_target_agent_s *ta,
> + int region);
>
> /* OMAP2 SDRAM controller */
> struct omap_sdrc_s;
> diff --git a/hw/omap2.c b/hw/omap2.c
> index 8a0fa73..5fc3fcf 100644
> --- a/hw/omap2.c
> +++ b/hw/omap2.c
> @@ -2260,7 +2260,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
> (sram_base = qemu_ram_alloc(NULL, "omap2.sram",
> s->sram_size)) | IO_MEM_RAM);
>
> - s->l4 = omap_l4_init(OMAP2_L4_BASE, 54);
> + s->l4 = omap_l4_init(sysmem, OMAP2_L4_BASE, 54);
>
> /* Actually mapped at any 2K boundary in the ARM11 private-peripheral if */
> cpu_irq = arm_pic_init_cpu(s->env);
> diff --git a/hw/omap_l4.c b/hw/omap_l4.c
> index a19ea70..a0bed5c 100644
> --- a/hw/omap_l4.c
> +++ b/hw/omap_l4.c
> @@ -21,16 +21,19 @@
> #include "omap.h"
>
> struct omap_l4_s {
> + MemoryRegion *address_space;
> target_phys_addr_t base;
> int ta_num;
> struct omap_target_agent_s ta[0];
> };
>
> -struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num)
> +struct omap_l4_s *omap_l4_init(MemoryRegion *address_space,
> + target_phys_addr_t base, int ta_num)
> {
> struct omap_l4_s *bus = g_malloc0(
> sizeof(*bus) + ta_num * sizeof(*bus->ta));
>
> + bus->address_space = address_space;
> bus->ta_num = ta_num;
> bus->base = base;
>
> @@ -43,6 +46,12 @@ target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
> return ta->bus->base + ta->start[region].offset;
> }
>
> +target_phys_addr_t omap_l4_region_size(struct omap_target_agent_s *ta,
> + int region)
> +{
> + return ta->start[region].size;
> +}
> +
> static uint32_t omap_l4ta_read(void *opaque, target_phys_addr_t addr)
> {
> struct omap_target_agent_s *s = (struct omap_target_agent_s *) opaque;
> @@ -150,3 +159,21 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
>
> return base;
> }
> +
> +target_phys_addr_t omap_l4_attach_region(struct omap_target_agent_s *ta,
> + int region, MemoryRegion *mr)
> +{
> + target_phys_addr_t base;
> +
> + if (region < 0 || region >= ta->regions) {
> + fprintf(stderr, "%s: bad io region (%i)\n", __FUNCTION__, region);
> + exit(-1);
> + }
> +
> + base = ta->bus->base + ta->start[region].offset;
> + if (mr) {
> + memory_region_add_subregion(ta->bus->address_space, base, mr);
> + }
> +
> + return base;
> +}
> --
> 1.7.7.1
>
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-11-27 4:19 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24 15:56 [Qemu-devel] [PATCH 0/3] omap l4 updates Avi Kivity
2011-11-24 15:57 ` [Qemu-devel] [PATCH 1/3] omap: remove L4_MUX_HACK Avi Kivity
2011-11-27 3:52 ` andrzej zaborowski
2011-11-24 15:57 ` [Qemu-devel] [PATCH 2/3] omap: eliminate l4_register_io_memory Avi Kivity
2011-11-24 15:57 ` [Qemu-devel] [PATCH 3/3] omap_l4: add memory API variant of omap_l4_attach() Avi Kivity
2011-11-27 4:19 ` andrzej zaborowski
2011-11-24 16:22 ` [Qemu-devel] [PATCH 0/3] omap l4 updates Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).