From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnUgF-0005ns-Iy for qemu-devel@nongnu.org; Mon, 02 Dec 2013 09:41:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnUg6-0005r2-Kz for qemu-devel@nongnu.org; Mon, 02 Dec 2013 09:40:59 -0500 Received: from mail-qa0-x22a.google.com ([2607:f8b0:400d:c00::22a]:40454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnUg6-0005qy-HA for qemu-devel@nongnu.org; Mon, 02 Dec 2013 09:40:50 -0500 Received: by mail-qa0-f42.google.com with SMTP id k4so4385641qaq.8 for ; Mon, 02 Dec 2013 06:40:50 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 2 Dec 2013 15:40:27 +0100 Message-Id: <1385995228-19585-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1385994239-19016-1-git-send-email-pbonzini@redhat.com> References: <1385994239-19016-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 3/4] memory: hoist coalesced MMIO flush List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com, marcel.a@redhat.com No need to flush the coalesced MMIO buffer multiple times when combining multiple accesses into one. Signed-off-by: Paolo Bonzini --- memory.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/memory.c b/memory.c index 1ade19c..495e693 100644 --- a/memory.c +++ b/memory.c @@ -401,9 +401,6 @@ static void memory_region_read_accessor(MemoryRegion *mr, { uint64_t tmp; - if (mr->flush_coalesced_mmio) { - qemu_flush_coalesced_mmio_buffer(); - } tmp = mr->ops->read(mr->opaque, addr, size); trace_memory_region_ops_read(mr, addr, tmp, size); *value |= (tmp & mask) << shift; @@ -432,9 +429,6 @@ static void memory_region_write_accessor(MemoryRegion *mr, { uint64_t tmp; - if (mr->flush_coalesced_mmio) { - qemu_flush_coalesced_mmio_buffer(); - } tmp = (*value >> shift) & mask; trace_memory_region_ops_write(mr, addr, tmp, size); mr->ops->write(mr->opaque, addr, tmp, size); @@ -965,6 +959,10 @@ static bool memory_region_dispatch_read(MemoryRegion *mr, uint64_t *pval, unsigned size) { + if (mr->flush_coalesced_mmio) { + qemu_flush_coalesced_mmio_buffer(); + } + if (!memory_region_access_valid(mr, addr, size, false)) { *pval = unassigned_mem_read(mr, addr, size); return true; @@ -1013,6 +1011,10 @@ static bool memory_region_dispatch_write(MemoryRegion *mr, uint64_t data, unsigned size) { + if (mr->flush_coalesced_mmio) { + qemu_flush_coalesced_mmio_buffer(); + } + if (!memory_region_access_valid(mr, addr, size, true)) { unassigned_mem_write(mr, addr, data, size); return true; -- 1.8.4.2