From nobody Sun May 5 06:39:41 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1596533217; cv=none; d=zohomail.com; s=zohoarc; b=ZnrLfMNnpCpfY7qbLQ6wLrcjHDdwOW/jl2uIAbEqCWTu4wFe947nggTRC+bKdrlFheeiAQp9uWIYl3nPfJkX9zXGp6u9+7gYkvdGJDA37kXE6BY401WV2mTtODmO6DcIB5adqmGLlIT1Ee/LUYeGZG/ODwDQDaP3XJwsaOcirhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1596533217; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WY0tYIkS7EoUQ216jfzT5JtYB6t9F0XCXHDiuetDssk=; b=nbDP4MHLg8dv00xkWVu5Zz1pineWbiCCy87xuQaHc3zN4LciplqQwnOei7t6K0cfhtVjcfGN4lxv63hw8WsOHdSRUDx4E7tTF2xbUPRO8MxzgaoQjl0ZV/vOfBQDHySLsUOV0VMe9g8FtXnOjr4ptXvCA5Efx6tKdlIa1EUGD/0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1596533217106701.3076834464973; Tue, 4 Aug 2020 02:26:57 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2tDP-0001sz-9l; Tue, 04 Aug 2020 09:26:35 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2tDO-0001sq-72 for xen-devel@lists.xenproject.org; Tue, 04 Aug 2020 09:26:34 +0000 Received: from esa6.hc3370-68.iphmx.com (unknown [216.71.155.175]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 95bd8dc8-d634-11ea-913d-bc764e2007e4; Tue, 04 Aug 2020 09:26:33 +0000 (UTC) X-Inumbo-ID: 95bd8dc8-d634-11ea-913d-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1596533193; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q3ReqT69K9XKGGN+e8ZybiqO+/keDcz0thRqBcGSR3M=; b=SPB5k+Bhaw6JKzIojmQekE7L76rVDNoAbAPHQ61jksNJlb3zAkfbEBtP WGtemK6cDprR+IK5/vZqYwGURx59fFougDPKqHewAGZY8a8W80GQTEUFC FgyJ7HFDiJxwH4xhlaQK7u+KT6U3GpUZXvnTHrsSh50LJ4DW83ZYru2iT I=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: Eq+gN6YFmS3ohlQqKPhOe2NcoL+vSDTiKtV8jXYqR+o7M3gFioVAeSG2I1hriVOiye0+/6X/8h OqfLandO1LO14rrROu8L9enqiFcL2gLkDkVY+0SVwQ6ouPLhjJ41HSoB/Qi0BogF5/OcytdetB mIxVAeP0V93Qzse3rdr+TlFOhU7KTCfEYYrsOz+4vM5iLXQmyRRmWkuGRVB86HgBJEBdrB0JOH +TH3asiD+AJ9QUYIWOd4nz/Tv3VItzy03bKZLluN7MhPuT0A74mPOv+nNCXvrOKAsNJs2wTgDE 6C4= X-SBRS: 3.7 X-MesageID: 24124488 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.75,433,1589256000"; d="scan'208";a="24124488" From: Anthony PERARD To: Subject: [PULL 1/1] accel/xen: Fix xen_enabled() behavior on target-agnostic objects Date: Tue, 4 Aug 2020 10:26:24 +0100 Message-ID: <20200804092624.1126013-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200804092624.1126013-1-anthony.perard@citrix.com> References: <20200804092624.1126013-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=20Mathieu-Daud=C3=A9?= , xen-devel@lists.xenproject.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Philippe Mathieu-Daud=C3=A9 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=C3=A9 Reviewed-by: Paul Durrant Reviewed-by: Anthony PERARD Message-Id: <20200804074930.13104-2-philmd@redhat.com> Signed-off-by: Anthony PERARD --- accel/stubs/xen-stub.c | 2 ++ accel/xen/xen-all.c | 7 +------ include/sysemu/xen.h | 18 ++++++++++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/accel/stubs/xen-stub.c b/accel/stubs/xen-stub.c index dcca4e678a13..8ae658acff5f 100644 --- a/accel/stubs/xen-stub.c +++ b/accel/stubs/xen-stub.c @@ -9,6 +9,8 @@ #include "hw/xen/xen.h" #include "qapi/qapi-commands-misc.h" =20 +bool xen_allowed; + void xenstore_store_pv_console_info(int i, Chardev *chr) { } diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index 0c24d4b191a4..60b971d0a82f 100644 --- a/accel/xen/xen-all.c +++ b/accel/xen/xen-all.c @@ -32,12 +32,7 @@ do { } while (0) #endif =20 -static bool xen_allowed; - -bool xen_enabled(void) -{ - return xen_allowed; -} +bool xen_allowed; =20 xc_interface *xen_xc; xenforeignmemory_handle *xen_fmem; diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h index 1ca292715e69..2c2c429ea8bf 100644 --- a/include/sysemu/xen.h +++ b/include/sysemu/xen.h @@ -8,9 +8,19 @@ #ifndef SYSEMU_XEN_H #define SYSEMU_XEN_H =20 -#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 + +extern bool xen_allowed; =20 -bool xen_enabled(void); +#define xen_enabled() (xen_allowed) =20 #ifndef CONFIG_USER_ONLY void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length); @@ -18,7 +28,7 @@ void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size, struct MemoryRegion *mr, Error **errp); #endif =20 -#else /* !CONFIG_XEN */ +#else /* !CONFIG_XEN_IS_POSSIBLE */ =20 #define xen_enabled() 0 #ifndef CONFIG_USER_ONLY @@ -33,6 +43,6 @@ static inline void xen_ram_alloc(ram_addr_t ram_addr, ram= _addr_t size, } #endif =20 -#endif /* CONFIG_XEN */ +#endif /* CONFIG_XEN_IS_POSSIBLE */ =20 #endif --=20 Anthony PERARD