From patchwork Tue Jul 28 10:09:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 11688845 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 D520314DD for ; Tue, 28 Jul 2020 10:11:13 +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 B14C320714 for ; Tue, 28 Jul 2020 10:11:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="NtZplSVJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B14C320714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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 1k0MY7-0006Uf-Rn; Tue, 28 Jul 2020 10:09:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k0MY6-0006Ua-Ui for xen-devel@lists.xenproject.org; Tue, 28 Jul 2020 10:09:30 +0000 X-Inumbo-ID: 6d1286f0-d0ba-11ea-8b26-bc764e2007e4 Received: from us-smtp-delivery-1.mimecast.com (unknown [207.211.31.81]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 6d1286f0-d0ba-11ea-8b26-bc764e2007e4; Tue, 28 Jul 2020 10:09:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595930969; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=BhUW9ESioUiSA1BxCHyRzLsoe5bVOy2Ifgl37qfIfW8=; b=NtZplSVJwZ7F5rq1xoMDzu8GtJNtYQ9kJJQ6xtpmGyQmEnFTt8LXSxRU+RyYLFxdPDHZy/ 7xULRLR9URQU+kbIuSaf0zbV8bn/W8WIgaNh7BZOliVdSHaLMODlR0H0lQguE3OObM2ebL MTiZKb9vrSkvtAvxJcq6jKRkzojzDjY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-EGscLMuqPqqiQS7NiaRsog-1; Tue, 28 Jul 2020 06:09:28 -0400 X-MC-Unique: EGscLMuqPqqiQS7NiaRsog-1 Received: by mail-wm1-f70.google.com with SMTP id l5so8686845wml.7 for ; Tue, 28 Jul 2020 03:09:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BhUW9ESioUiSA1BxCHyRzLsoe5bVOy2Ifgl37qfIfW8=; b=rScWMQTxXXShHykeXVJ2wm7lOCm9s+y1pPSGef4+d50WZFOg4WkGbtBFBPYH064s9l GXhkPrsQGUzNSJGTHDQIGMMW2fjaXhjkaQlZLpX+Sr+gYnJKx03hr4Iggg7aW4HhNqCy YaWLEzJc4TglL3z5Jr08mBN3RBh6tb+cN+9kQytK98H90VRCElrjiaUfUYIHhIspp3Tw 9jY2zkbQLcE5VKRCefD5lAek2dc2nipL3j/zfpBqpR5qIkU0+RwcdjjX+kYSEwEqj2WA csOaD3iMZcIWLFTl0oLtufTZE7PalfmLz8aJyw0BOAGYHrJ3Qej4RwfInjQ/SP7iJ6w2 2DLQ== X-Gm-Message-State: AOAM533KblaNqPu9Ydb39I+f6pBE1fDonaOqE3xhPgwRmtFV0X+Wehe5 AWgeW1KcHPCbYKnntkrsgIVMC7uxlQHQCrfNK/D0VZhazpU3wuyCTaFT2bNYSiPztkPQkDzKWRy B56RkYzGi5Cdb9u3iCnu6BuTEdZY= X-Received: by 2002:a7b:cc12:: with SMTP id f18mr3138781wmh.129.1595930967269; Tue, 28 Jul 2020 03:09:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyBky3N1fiOwAUAbRDwFfDOzU+3zWFKcPh/zvwPQji/U4MbFglqtL0NILX0yFEK52pUUrByrA== X-Received: by 2002:a7b:cc12:: with SMTP id f18mr3138766wmh.129.1595930967114; Tue, 28 Jul 2020 03:09:27 -0700 (PDT) Received: from localhost.localdomain (214.red-88-21-68.staticip.rima-tde.net. [88.21.68.214]) by smtp.gmail.com with ESMTPSA id t202sm3475876wmt.20.2020.07.28.03.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2020 03:09:26 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1] accel/xen: Fix xen_enabled() behavior on target-agnostic objects Date: Tue, 28 Jul 2020 12:09:25 +0200 Message-Id: <20200728100925.10454-1-philmd@redhat.com> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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: Peter Maydell , Stefano Stabellini , Paul Durrant , Paul Durrant , xen-devel@lists.xenproject.org, Anthony Perard , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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é Tested-by: Paul Durrant Reviewed-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 1ca292715e..385a1fa2bf 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