From patchwork Mon Aug 3 16:52:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 1340386 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=citrix.com header.i=@citrix.com header.a=rsa-sha256 header.s=securemail header.b=A+0ZU+43; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BL3qf2sFtz9sTY for ; Tue, 4 Aug 2020 02:53:32 +1000 (AEST) Received: from localhost ([::1]:44376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k2diM-0005A2-Fm for incoming@patchwork.ozlabs.org; Mon, 03 Aug 2020 12:53:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2di1-000591-Ol for qemu-devel@nongnu.org; Mon, 03 Aug 2020 12:53:09 -0400 Received: from esa5.hc3370-68.iphmx.com ([216.71.155.168]:24683) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k2dhz-0000HK-Sz for qemu-devel@nongnu.org; Mon, 03 Aug 2020 12:53:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1596473587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9FHDzk5jP15PoxSFIG/3+YaZpBrml62Q4eCYIN4d3r8=; b=A+0ZU+43gR8btCqOVRoS+sRtfoRtsYG/XD7kpaKyHcErj7e4IPoB2TBn UPUlyFgVbHA5Pvd9Ha6mcj2oXFJ/Ac4ztGYlNnWFqL3hGFS2Ao24nW2Pd 8X0P2DdKdbmnzUSnH7lxLLb5VkpHCk89fBG19vNEby++y2wTncOrDKuJY 4=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: oUizAzmZsbSPZfoucDhfLS3pp0o7C2fWvjF+HDf1ttDC08KVHWjcrG9PSqvQEBlqwv7JfCsNJg KCy83IsZWZRsis0vuW7kgTSt+MMgZXZ+KS0DXMtCnQpOnMZhrI1FX40OU3B/wgDdsEnUOyATwI YGlqEHb4rjBDjM8DRxExaVRzI5gZBGVI/J4h1Yz/Z3M8sxVwADYTCpUUhHCazqv8hug5gRb/Hu hBufHPAFCnV3pAUWFdL0u0BlUmLObj1z3j3Dd5PBli5UqhkzPWegs5b2fpiRvCJrtJwWcEzGnr Bec= X-SBRS: 3.7 X-MesageID: 23941194 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.75,430,1589256000"; d="scan'208";a="23941194" From: Anthony PERARD To: Subject: [PULL 1/1] accel/xen: Fix xen_enabled() behavior on target-agnostic objects Date: Mon, 3 Aug 2020 17:52:51 +0100 Message-ID: <20200803165251.907213-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200803165251.907213-1-anthony.perard@citrix.com> References: <20200803165251.907213-1-anthony.perard@citrix.com> MIME-Version: 1.0 Received-SPF: pass client-ip=216.71.155.168; envelope-from=anthony.perard@citrix.com; helo=esa5.hc3370-68.iphmx.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/03 12:53:05 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Peter Maydell , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , xen-devel@lists.xenproject.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé CONFIG_XEN is generated by configure and stored in "config-target.h", which is (obviously) only include for target-specific objects. This is a problem for target-agnostic objects as CONFIG_XEN is never defined and xen_enabled() is always inlined as 'false'. Fix by following the KVM schema, defining CONFIG_XEN_IS_POSSIBLE when we don't know to force the call of the non-inlined function, returning the xen_allowed boolean. Fixes: da278d58a092 ("accel: Move Xen accelerator code under accel/xen/") Reported-by: Paul Durrant Suggested-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Anthony PERARD Tested-by: Paul Durrant Message-Id: <20200728100925.10454-1-philmd@redhat.com> Signed-off-by: Anthony PERARD --- include/sysemu/xen.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h index 1ca292715e69..385a1fa2bff8 100644 --- a/include/sysemu/xen.h +++ b/include/sysemu/xen.h @@ -8,7 +8,15 @@ #ifndef SYSEMU_XEN_H #define SYSEMU_XEN_H -#ifdef CONFIG_XEN +#ifdef NEED_CPU_H +# ifdef CONFIG_XEN +# define CONFIG_XEN_IS_POSSIBLE +# endif +#else +# define CONFIG_XEN_IS_POSSIBLE +#endif + +#ifdef CONFIG_XEN_IS_POSSIBLE bool xen_enabled(void); @@ -18,7 +26,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, struct MemoryRegion *mr, Error **errp); #endif -#else /* !CONFIG_XEN */ +#else /* !CONFIG_XEN_IS_POSSIBLE */ #define xen_enabled() 0 #ifndef CONFIG_USER_ONLY @@ -33,6 +41,6 @@ static inline void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, } #endif -#endif /* CONFIG_XEN */ +#endif /* CONFIG_XEN_IS_POSSIBLE */ #endif