From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTxNi-0004Jo-9T for qemu-devel@nongnu.org; Fri, 06 Mar 2015 13:54:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YTxNb-0000FP-GL for qemu-devel@nongnu.org; Fri, 06 Mar 2015 13:53:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40641) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YTxNb-0000F3-8G for qemu-devel@nongnu.org; Fri, 06 Mar 2015 13:53:47 -0500 From: Andrew Jones Date: Fri, 6 Mar 2015 13:53:33 -0500 Message-Id: <1425668018-3649-2-git-send-email-drjones@redhat.com> In-Reply-To: <1425668018-3649-1-git-send-email-drjones@redhat.com> References: <1425667780-3449-1-git-send-email-drjones@redhat.com> <1425668018-3649-1-git-send-email-drjones@redhat.com> Subject: [Qemu-devel] [RFC PATCH 1/6] memory: add incoherent cache flag List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org, ard.biesheuvel@linaro.org, christoffer.dall@linaro.org, marc.zyngier@arm.com, peter.maydell@linaro.org Cc: pbonzini@redhat.com, lersek@redhat.com, agraf@suse.de, catalin.marinas@arm.com Add an incoherent cache flag, which indicates the region needs explicit cache maintenance. Signed-off-by: Andrew Jones --- include/exec/memory.h | 23 +++++++++++++++++++++++ memory.c | 15 +++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/exec/memory.h b/include/exec/memory.h index 06ffa1d185b93..c947b88b87241 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -158,6 +158,7 @@ struct MemoryRegion { bool rom_device; bool warning_printed; /* For reservations */ bool flush_coalesced_mmio; + bool incoherent_cache; MemoryRegion *alias; hwaddr alias_offset; int32_t priority; @@ -778,6 +779,28 @@ void memory_region_set_flush_coalesced(MemoryRegion *mr); void memory_region_clear_flush_coalesced(MemoryRegion *mr); /** + * memory_region_set_incoherent_cache: Flag this memory region as needing + * explicit cache maintenance. + * + * @mr: the memory region to be updated. + */ +void memory_region_set_incoherent_cache(MemoryRegion *mr); + +/** + * memory_region_clear_incoherent_cache: Remove the incoherent cache flag. + * + * @mr: the memory region to be updated. + */ +void memory_region_clear_incoherent_cache(MemoryRegion *mr); + +/** + * memory_region_has_incoherent_cache: Return the incoherent cache flag. + * + * @mr: the memory region to check. + */ +bool memory_region_has_incoherent_cache(MemoryRegion *mr); + +/** * memory_region_add_eventfd: Request an eventfd to be triggered when a word * is written to a location. * diff --git a/memory.c b/memory.c index 20f6d9eeac737..fa74bcb8c1e4c 100644 --- a/memory.c +++ b/memory.c @@ -1549,6 +1549,21 @@ void memory_region_clear_flush_coalesced(MemoryRegion *mr) } } +void memory_region_set_incoherent_cache(MemoryRegion *mr) +{ + mr->incoherent_cache = true; +} + +void memory_region_clear_incoherent_cache(MemoryRegion *mr) +{ + mr->incoherent_cache = false; +} + +bool memory_region_has_incoherent_cache(MemoryRegion *mr) +{ + return mr->incoherent_cache; +} + void memory_region_add_eventfd(MemoryRegion *mr, hwaddr addr, unsigned size, -- 1.8.3.1