From patchwork Fri Jul 22 12:43:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 106487 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 06D33B6F71 for ; Sun, 24 Jul 2011 06:28:36 +1000 (EST) Received: from localhost ([::1]:37150 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkioK-0000Dh-Ef for incoming@patchwork.ozlabs.org; Sat, 23 Jul 2011 16:28:32 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkinG-00055Q-1S for qemu-devel@nongnu.org; Sat, 23 Jul 2011 16:27:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QkinD-0000AR-7n for qemu-devel@nongnu.org; Sat, 23 Jul 2011 16:27:26 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46751 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkinD-0000AK-0t for qemu-devel@nongnu.org; Sat, 23 Jul 2011 16:27:23 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 8B8988B013; Sat, 23 Jul 2011 22:27:21 +0200 (CEST) From: Alexander Graf To: QEMU-devel Developers Date: Fri, 22 Jul 2011 14:43:40 +0200 Message-Id: <1311338620-26932-6-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1311338620-26932-1-git-send-email-agraf@suse.de> References: <1311338620-26932-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Anthony Liguori Subject: [Qemu-devel] [PATCH 5/5] xen: make xen_enabled even more clever 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 When using xen_enabled() we're currently only checking if xen is enabled at all during the build. But what if you want to build multiple targets out of which only one can potentially run xen code? That means that for generic code we'll still have to fall back to the variable and potentially slow the code down, but it's not as important as that is mostly xen device emulation which is not touched for non-xen targets. The target specific code however can with this patch see that it's unable to ever execute xen code. We can thus always return 0 on xen_enabled(), giving gcc enough hints to evict the mapcache code from the target memory management code. Signed-off-by: Alexander Graf Acked-by: Anthony PERARD --- configure | 5 +++++ hw/xen.h | 2 +- 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/configure b/configure index 90fe09f..e5ecec9 100755 --- a/configure +++ b/configure @@ -3277,7 +3277,12 @@ case "$target_arch2" in if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then target_phys_bits=64 echo "CONFIG_XEN=y" >> $config_target_mak + else + echo "CONFIG_NO_XEN=y" >> $config_target_mak fi + ;; + *) + echo "CONFIG_NO_XEN=y" >> $config_target_mak esac case "$target_arch2" in i386|x86_64|ppcemb|ppc|ppc64|s390x) diff --git a/hw/xen.h b/hw/xen.h index 43b95d6..2162111 100644 --- a/hw/xen.h +++ b/hw/xen.h @@ -24,7 +24,7 @@ extern int xen_allowed; static inline int xen_enabled(void) { -#ifdef CONFIG_XEN_BACKEND +#if defined(CONFIG_XEN_BACKEND) && !defined(CONFIG_NO_XEN) return xen_allowed; #else return 0;