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: 11698427 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6E81214DD for ; Mon, 3 Aug 2020 16:54:33 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4B1C7207DF for ; Mon, 3 Aug 2020 16:54:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="Ky7VFNfU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4B1C7207DF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2di4-0000O9-Vn; Mon, 03 Aug 2020 16:53:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2di3-0000Lq-4j for xen-devel@lists.xenproject.org; Mon, 03 Aug 2020 16:53:11 +0000 X-Inumbo-ID: cc940269-d5a9-11ea-90ad-bc764e2007e4 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id cc940269-d5a9-11ea-90ad-bc764e2007e4; Mon, 03 Aug 2020 16:53:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1596473586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9FHDzk5jP15PoxSFIG/3+YaZpBrml62Q4eCYIN4d3r8=; b=Ky7VFNfUWN3Ydkd6hSyzTAp5UOfdE1XawX/uIot6MKPXY2BB9PLX7Hre WkhDiSoOG7ZIn2GATbMd5IMG+f8vugk3FbFa1zxseqdToYJPOsykbq6my flTnNQBVJmu88005+FYJWZR626PI2R190ocbGg664gQKMiYeOGEkFtCYx Y=; 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 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , 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: xen-devel-bounces@lists.xenproject.org Sender: "Xen-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