From patchwork Fri Jul 22 13:36:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 106492 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 49361B6F72 for ; Sun, 24 Jul 2011 07:20:39 +1000 (EST) Received: from localhost ([::1]:38052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qkjcc-0002uL-FD for incoming@patchwork.ozlabs.org; Sat, 23 Jul 2011 17:20:30 -0400 Received: from eggs.gnu.org ([140.186.70.92]:44801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkjcQ-0002n5-0m for qemu-devel@nongnu.org; Sat, 23 Jul 2011 17:20:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QkjcL-0000dH-K4 for qemu-devel@nongnu.org; Sat, 23 Jul 2011 17:20:17 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48408 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QkjcL-0000cs-Dd for qemu-devel@nongnu.org; Sat, 23 Jul 2011 17:20:13 -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 6E90989994; Sat, 23 Jul 2011 23:20:12 +0200 (CEST) From: Alexander Graf To: QEMU-devel Developers Date: Fri, 22 Jul 2011 15:36:24 +0200 Message-Id: <1311341784-29845-5-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1311341784-29845-1-git-send-email-agraf@suse.de> References: <1311341784-29845-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 4/4] 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;