From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiA15-00033z-5V for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UiA0z-0001ad-Au for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:11 -0400 Received: from mail-ea0-x22f.google.com ([2a00:1450:4013:c01::22f]:43764) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UiA0z-0001aE-4c for qemu-devel@nongnu.org; Thu, 30 May 2013 17:04:05 -0400 Received: by mail-ea0-f175.google.com with SMTP id h14so838653eaj.20 for ; Thu, 30 May 2013 14:04:04 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id y2sm62707218eeu.2.2013.05.30.14.04.02 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 30 May 2013 14:04:03 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 30 May 2013 23:03:35 +0200 Message-Id: <1369947836-2638-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1369947836-2638-1-git-send-email-pbonzini@redhat.com> References: <1369947836-2638-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 01/22] exec: eliminate io_mem_ram List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org It is never used, the IOTLB always goes through io_mem_notdirty. In fact in softmmu_template.h, if it were, QEMU would crash just below the tests, as soon as io_mem_read/write dispatches to error_mem_read/write. Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- exec.c | 18 ++---------------- include/exec/cpu-common.h | 1 - include/exec/softmmu_template.h | 4 ++-- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/exec.c b/exec.c index 3a9ddcb..b720be5 100644 --- a/exec.c +++ b/exec.c @@ -66,7 +66,7 @@ AddressSpace address_space_io; AddressSpace address_space_memory; DMAContext dma_context_memory; -MemoryRegion io_mem_ram, io_mem_rom, io_mem_unassigned, io_mem_notdirty; +MemoryRegion io_mem_rom, io_mem_unassigned, io_mem_notdirty; static MemoryRegion io_mem_subpage_ram; #endif @@ -200,8 +200,7 @@ MemoryRegionSection *phys_page_find(AddressSpaceDispatch *d, hwaddr index) bool memory_region_is_unassigned(MemoryRegion *mr) { - return mr != &io_mem_ram && mr != &io_mem_rom - && mr != &io_mem_notdirty && !mr->rom_device + return mr != &io_mem_rom && mr != &io_mem_notdirty && !mr->rom_device && mr != &io_mem_watch; } #endif @@ -1419,18 +1418,6 @@ static uint64_t error_mem_read(void *opaque, hwaddr addr, abort(); } -static void error_mem_write(void *opaque, hwaddr addr, - uint64_t value, unsigned size) -{ - abort(); -} - -static const MemoryRegionOps error_mem_ops = { - .read = error_mem_read, - .write = error_mem_write, - .endianness = DEVICE_NATIVE_ENDIAN, -}; - static const MemoryRegionOps rom_mem_ops = { .read = error_mem_read, .write = unassigned_mem_write, @@ -1691,7 +1678,6 @@ MemoryRegion *iotlb_to_region(hwaddr index) static void io_mem_init(void) { - memory_region_init_io(&io_mem_ram, &error_mem_ops, NULL, "ram", UINT64_MAX); memory_region_init_io(&io_mem_rom, &rom_mem_ops, NULL, "rom", UINT64_MAX); memory_region_init_io(&io_mem_unassigned, &unassigned_mem_ops, NULL, "unassigned", UINT64_MAX); diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index af5258d..1686b8f 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -110,7 +110,6 @@ void stq_phys(hwaddr addr, uint64_t val); void cpu_physical_memory_write_rom(hwaddr addr, const uint8_t *buf, int len); -extern struct MemoryRegion io_mem_ram; extern struct MemoryRegion io_mem_rom; extern struct MemoryRegion io_mem_unassigned; extern struct MemoryRegion io_mem_notdirty; diff --git a/include/exec/softmmu_template.h b/include/exec/softmmu_template.h index b219191..4501dac 100644 --- a/include/exec/softmmu_template.h +++ b/include/exec/softmmu_template.h @@ -68,7 +68,7 @@ static inline DATA_TYPE glue(io_read, SUFFIX)(CPUArchState *env, physaddr = (physaddr & TARGET_PAGE_MASK) + addr; env->mem_io_pc = retaddr; - if (mr != &io_mem_ram && mr != &io_mem_rom + if (mr != &io_mem_rom && mr != &io_mem_unassigned && mr != &io_mem_notdirty && !can_do_io(env)) { @@ -218,7 +218,7 @@ static inline void glue(io_write, SUFFIX)(CPUArchState *env, MemoryRegion *mr = iotlb_to_region(physaddr); physaddr = (physaddr & TARGET_PAGE_MASK) + addr; - if (mr != &io_mem_ram && mr != &io_mem_rom + if (mr != &io_mem_rom && mr != &io_mem_unassigned && mr != &io_mem_notdirty && !can_do_io(env)) { -- 1.7.4.1