Skip to contentSkip to conversation

Coalesced MMIO flushing cleanups

PATCH New Paolo Bonzini 1 participant 4 messages Oct 3, 2013

lore
Share & tools
lore
#1 lore raw

PATCH 1/3 portio: Allow to mark portio lists as coalesced MMIO flushing

In reply to Paolo Bonzini

From: Jan Kiszka <[email protected]>

This will enable us to remove all remaining explicit calls of qemu_flush_coalesced_mmio_buffer in IO handlers.

---
 include/exec/ioport.h | 2 ++
 ioport.c              | 9 +++++++++
 2 files changed, 11 insertions(+)
include/exec/ioport.h +2 -0
index b3848be..3bd6722 100644
@@ -64,11 +64,13 @@ typedef struct PortioList {
     struct MemoryRegion **regions;
     void *opaque;
     const char *name;
+    bool flush_coalesced_mmio;
 } PortioList;
 
 void portio_list_init(PortioList *piolist, Object *owner,
                       const struct MemoryRegionPortio *callbacks,
                       void *opaque, const char *name);
+void portio_list_set_flush_coalesced(PortioList *piolist);
 void portio_list_destroy(PortioList *piolist);
 void portio_list_add(PortioList *piolist,
                      struct MemoryRegion *address_space,
ioport.c +9 -0
index 707cce8..3d91e79 100644
@@ -139,6 +139,12 @@ void portio_list_init(PortioList *piolist,
     piolist->opaque = opaque;
     piolist->owner = owner;
     piolist->name = name;
+    piolist->flush_coalesced_mmio = false;
+}
+
+void portio_list_set_flush_coalesced(PortioList *piolist)
+{
+    piolist->flush_coalesced_mmio = true;
 }
 
 void portio_list_destroy(PortioList *piolist)
@@ -231,6 +237,9 @@ static void portio_list_add_1(PortioList *piolist,
      */
     memory_region_init_io(&mrpio->mr, piolist->owner, &portio_ops, mrpio,
                           piolist->name, off_high - off_low);
+    if (piolist->flush_coalesced_mmio) {
+        memory_region_set_flush_coalesced(&mrpio->mr);
+    }
     memory_region_add_subregion(piolist->address_space,
                                 start + off_low, &mrpio->mr);
     piolist->regions[piolist->nr] = &mrpio->mr;
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/3 cirrus: Mark vga io region as coalesced MMIO flushing

In reply to Paolo Bonzini

From: Jan Kiszka <[email protected]>

This allows to remove the explicit qemu_flush_coalesced_mmio_buffer calls - the memory core will invoke them now.

---
 hw/display/cirrus_vga.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
hw/display/cirrus_vga.c +1 -2
index dbd1f4a..e4c345f 100644
@@ -2447,7 +2447,6 @@ static uint64_t cirrus_vga_ioport_read(void *opaque, hwaddr addr,
     VGACommonState *s = &c->vga;
     int val, index;
 
-    qemu_flush_coalesced_mmio_buffer();
     addr += 0x3b0;
 
     if (vga_ioport_invalid(s, addr)) {
@@ -2544,7 +2543,6 @@ static void cirrus_vga_ioport_write(void *opaque, hwaddr addr, uint64_t val,
     VGACommonState *s = &c->vga;
     int index;
 
-    qemu_flush_coalesced_mmio_buffer();
     addr += 0x3b0;
 
     /* check port range access depending on color/monochrome mode */
@@ -2843,6 +2841,7 @@ static void cirrus_init_common(CirrusVGAState *s, Object *owner,
     /* Register ioport 0x3b0 - 0x3df */
     memory_region_init_io(&s->cirrus_vga_io, owner, &cirrus_vga_io_ops, s,
                           "cirrus-io", 0x30);
+    memory_region_set_flush_coalesced(&s->cirrus_vga_io);
     memory_region_add_subregion(system_io, 0x3b0, &s->cirrus_vga_io);
 
     memory_region_init(&s->low_mem_container, owner,
Signature · 1 line
1.8.3.1
#0 lore raw

cover Coalesced MMIO flushing cleanups

Three patches from Jan. They've never been posted publicly, so I'm doing that to get them review and exposure. I'll send a pull request sometime next week.

Paolo

Jan Kiszka (3):
portio: Allow to mark portio lists as coalesced MMIO flushing
cirrus: Mark vga io region as coalesced MMIO flushing
vga: Mark relevant portio lists regions as coalesced MMIO flushing

 hw/display/cirrus_vga.c | 3 +--
 hw/display/qxl.c        | 1 +
 hw/display/vga.c        | 5 +----
 include/exec/ioport.h   | 2 ++
 ioport.c                | 9 +++++++++
 5 files changed, 14 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.3.1
#3 lore raw

PATCH 3/3 vga: Mark relevant portio lists regions as coalesced MMIO flushing

From: Jan Kiszka <[email protected]>

This allows to remove the explicit qemu_flush_coalesced_mmio_buffer calls.

---
 hw/display/qxl.c | 1 +
 hw/display/vga.c | 5 +----
 2 files changed, 2 insertions(+), 4 deletions(-)
hw/display/qxl.c +1 -0
index ee2db0d..3051006 100644
@@ -2074,6 +2074,7 @@ static int qxl_init_primary(PCIDevice *dev)
              pci_address_space(dev), pci_address_space_io(dev), false);
     portio_list_init(qxl_vga_port_list, OBJECT(dev), qxl_vga_portio_list,
                      vga, "vga");
+    portio_list_set_flush_coalesced(qxl_vga_port_list);
     portio_list_add(qxl_vga_port_list, pci_address_space_io(dev), 0x3b0);
 
     vga->con = graphic_console_init(DEVICE(dev), &qxl_ops, qxl);
hw/display/vga.c +1 -4
index 7b91d9c..b5e2284 100644
@@ -359,8 +359,6 @@ uint32_t vga_ioport_read(void *opaque, uint32_t addr)
     VGACommonState *s = opaque;
     int val, index;
 
-    qemu_flush_coalesced_mmio_buffer();
-
     if (vga_ioport_invalid(s, addr)) {
         val = 0xff;
     } else {
@@ -453,8 +451,6 @@ void vga_ioport_write(void *opaque, uint32_t addr, uint32_t val)
     VGACommonState *s = opaque;
     int index;
 
-    qemu_flush_coalesced_mmio_buffer();
-
     /* check port range access depending on color/monochrome mode */
     if (vga_ioport_invalid(s, addr)) {
         return;
@@ -2373,6 +2369,7 @@ void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
     memory_region_set_coalescing(vga_io_memory);
     if (init_vga_ports) {
         portio_list_init(vga_port_list, obj, vga_ports, s, "vga");
+        portio_list_set_flush_coalesced(vga_port_list);
         portio_list_add(vga_port_list, address_space_io, 0x3b0);
     }
     if (vbe_ports) {
Signature · 1 line
1.8.3.1