From patchwork Tue Jun 21 20:59:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 101369 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0B545B6F8A for ; Wed, 22 Jun 2011 07:03:04 +1000 (EST) Received: from localhost ([::1]:45649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ867-0000cj-3P for incoming@patchwork.ozlabs.org; Tue, 21 Jun 2011 17:02:59 -0400 Received: from eggs.gnu.org ([140.186.70.92]:37681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ82i-0000bb-5U for qemu-devel@nongnu.org; Tue, 21 Jun 2011 16:59:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QZ82f-0008KK-RE for qemu-devel@nongnu.org; Tue, 21 Jun 2011 16:59:27 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:48599) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QZ82f-0008K3-AD for qemu-devel@nongnu.org; Tue, 21 Jun 2011 16:59:25 -0400 Received: from smtp06.web.de ( [172.20.5.172]) by fmmailgate02.web.de (Postfix) with ESMTP id 6AC701A3752A7; Tue, 21 Jun 2011 22:59:24 +0200 (CEST) Received: from [88.65.252.133] (helo=localhost.localdomain) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #2) id 1QZ82e-0005to-00; Tue, 21 Jun 2011 22:59:24 +0200 From: Jan Kiszka To: qemu-devel@nongnu.org, Alexander Graf Date: Tue, 21 Jun 2011 22:59:09 +0200 Message-Id: <65530aa88ea9017ad7b01ac61f828334b8fe47ee.1308689947.git.jan.kiszka@web.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX19QKcklZh3JNDspCiIiIWunBKtRi5SWN2CZNZuR mBu2rIQO/pxXPZBNU+StLtTxfq2qRO5wy7LdPathI9i40XtCLt LeKXHstGw= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 217.72.192.227 Cc: Anthony PERARD , xen-devel , Stefano Stabellini Subject: [Qemu-devel] [PATCH v2 3/3] xen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XEN X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Jan Kiszka Xen won't be enabled if there is no backend support available for the host. And that also means the map cache will work. So drop the separate config switch and move the required stubs over to xen-stub.c. Signed-off-by: Jan Kiszka --- Makefile.target | 5 +---- configure | 3 --- exec.c | 16 ++++++++-------- hw/xen.h | 9 --------- xen-mapcache-stub.c | 37 ------------------------------------- xen-stub.c | 16 ++++++++++++++++ 6 files changed, 25 insertions(+), 61 deletions(-) delete mode 100644 xen-mapcache-stub.c diff --git a/Makefile.target b/Makefile.target index d30e0fe..e86d3f6 100644 --- a/Makefile.target +++ b/Makefile.target @@ -4,7 +4,6 @@ GENERATED_HEADERS = config-target.h CONFIG_NO_PCI = $(if $(subst n,,$(CONFIG_PCI)),n,y) CONFIG_NO_KVM = $(if $(subst n,,$(CONFIG_KVM)),n,y) CONFIG_NO_XEN = $(if $(subst n,,$(CONFIG_XEN)),n,y) -CONFIG_NO_XEN_MAPCACHE = $(if $(subst n,,$(CONFIG_XEN_MAPCACHE)),n,y) include ../config-host.mak include config-devices.mak @@ -206,10 +205,8 @@ QEMU_CFLAGS += $(VNC_JPEG_CFLAGS) QEMU_CFLAGS += $(VNC_PNG_CFLAGS) # xen support -obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o +obj-$(CONFIG_XEN) += xen-all.o xen_machine_pv.o xen_domainbuild.o xen-mapcache.o obj-$(CONFIG_NO_XEN) += xen-stub.o -obj-i386-$(CONFIG_XEN_MAPCACHE) += xen-mapcache.o -obj-$(CONFIG_NO_XEN_MAPCACHE) += xen-mapcache-stub.o obj-i386-$(CONFIG_XEN) += xen_platform.o diff --git a/configure b/configure index 3e9a5e3..f4e8edc 100755 --- a/configure +++ b/configure @@ -3356,9 +3356,6 @@ case "$target_arch2" in if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then target_phys_bits=64 echo "CONFIG_XEN=y" >> $config_target_mak - if test "$cpu" = "i386" -o "$cpu" = "x86_64"; then - echo "CONFIG_XEN_MAPCACHE=y" >> $config_target_mak - fi fi esac case "$target_arch2" in diff --git a/exec.c b/exec.c index a61f84c..22e3e8d 100644 --- a/exec.c +++ b/exec.c @@ -2923,7 +2923,7 @@ ram_addr_t qemu_ram_alloc_from_ptr(DeviceState *dev, const char *name, abort(); } #else - if (xen_mapcache_enabled()) { + if (xen_enabled()) { xen_ram_alloc(new_block->offset, size); } else { new_block->host = qemu_vmalloc(size); @@ -2989,7 +2989,7 @@ void qemu_ram_free(ram_addr_t addr) #if defined(TARGET_S390X) && defined(CONFIG_KVM) munmap(block->host, block->length); #else - if (xen_mapcache_enabled()) { + if (xen_enabled()) { xen_invalidate_map_cache_entry(block->host); } else { qemu_vfree(block->host); @@ -3082,7 +3082,7 @@ void *qemu_get_ram_ptr(ram_addr_t addr) QLIST_REMOVE(block, next); QLIST_INSERT_HEAD(&ram_list.blocks, block, next); } - if (xen_mapcache_enabled()) { + if (xen_enabled()) { /* We need to check if the requested address is in the RAM * because we don't want to map the entire memory in QEMU. * In that case just map until the end of the page. @@ -3113,7 +3113,7 @@ void *qemu_safe_ram_ptr(ram_addr_t addr) QLIST_FOREACH(block, &ram_list.blocks, next) { if (addr - block->offset < block->length) { - if (xen_mapcache_enabled()) { + if (xen_enabled()) { /* We need to check if the requested address is in the RAM * because we don't want to map the entire memory in QEMU. * In that case just map until the end of the page. @@ -3139,9 +3139,9 @@ void *qemu_safe_ram_ptr(ram_addr_t addr) * but takes a size argument */ void *qemu_ram_ptr_length(target_phys_addr_t addr, target_phys_addr_t *size) { - if (xen_mapcache_enabled()) + if (xen_enabled()) { return xen_map_cache(addr, *size, 1); - else { + } else { RAMBlock *block; QLIST_FOREACH(block, &ram_list.blocks, next) { @@ -3170,7 +3170,7 @@ int qemu_ram_addr_from_host(void *ptr, ram_addr_t *ram_addr) RAMBlock *block; uint8_t *host = ptr; - if (xen_mapcache_enabled()) { + if (xen_enabled()) { *ram_addr = xen_ram_addr_from_mapcache(ptr); return 0; } @@ -4085,7 +4085,7 @@ void cpu_physical_memory_unmap(void *buffer, target_phys_addr_t len, access_len -= l; } } - if (xen_mapcache_enabled()) { + if (xen_enabled()) { xen_invalidate_map_cache_entry(buffer); } return; diff --git a/hw/xen.h b/hw/xen.h index d435ca0..95029bb 100644 --- a/hw/xen.h +++ b/hw/xen.h @@ -31,15 +31,6 @@ static inline int xen_enabled(void) #endif } -static inline int xen_mapcache_enabled(void) -{ -#ifdef CONFIG_XEN_MAPCACHE - return xen_enabled(); -#else - return 0; -#endif -} - int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num); void xen_piix3_set_irq(void *opaque, int irq_num, int level); void xen_piix_pci_write_config_client(uint32_t address, uint32_t val, int len); diff --git a/xen-mapcache-stub.c b/xen-mapcache-stub.c deleted file mode 100644 index 2d63fb6..0000000 --- a/xen-mapcache-stub.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2011 Citrix Ltd. - * - * This work is licensed under the terms of the GNU GPL, version 2. See - * the COPYING file in the top-level directory. - * - */ - -#include "config.h" - -#include "exec-all.h" -#include "qemu-common.h" -#include "cpu-common.h" -#include "xen-mapcache.h" - -void xen_map_cache_init(void) -{ -} - -uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size, - uint8_t lock) -{ - return qemu_get_ram_ptr(phys_addr); -} - -ram_addr_t xen_ram_addr_from_mapcache(void *ptr) -{ - return -1; -} - -void xen_invalidate_map_cache(void) -{ -} - -void xen_invalidate_map_cache_entry(uint8_t *buffer) -{ -} diff --git a/xen-stub.c b/xen-stub.c index a4f35a1..b8e0f9e 100644 --- a/xen-stub.c +++ b/xen-stub.c @@ -8,6 +8,7 @@ #include "qemu-common.h" #include "hw/xen.h" +#include "xen-mapcache.h" int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num) { @@ -39,3 +40,18 @@ int xen_init(void) { return -ENOSYS; } + +uint8_t *xen_map_cache(target_phys_addr_t phys_addr, target_phys_addr_t size, + uint8_t lock) +{ + return NULL; +} + +ram_addr_t xen_ram_addr_from_mapcache(void *ptr) +{ + return -1; +} + +void xen_invalidate_map_cache_entry(uint8_t *buffer) +{ +}