From nobody Tue Apr 23 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570039334; cv=none; d=zoho.com; s=zohoarc; b=J2hqc1vnHiCwHS3FoTJ32zUOiCcTTsNll9YwpcWDX7mKOjAd3tzBhBGwp81YdmfNcaMJop7Dr0SICPoEJ8I5wgycZsmtCzIRuhx4L7RKJuwnPTQUY8HI5dGZQt8SVxSAQ2OB5YWkIIY0MlxB/1uaFUr88d0/LQ/OGm154gkpbms= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570039334; 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:ARC-Authentication-Results; bh=3DzOC9+Y4cV5J5ZTqqQrFTJC9TxNukXxeXrjad+cvfI=; b=O0e99Cb64VlkUj2v5IWPrM+CFq8SXngsDGYdTCLdWfzYAf8Rc8y4LFhGF6Gh/Kz1q8QZ7OdSPyABu+npVzhJDwMgTjFRRj1LE5UO4v33ZmePHejz65sUe2SG+KpvmdsdRS69PQZ+uMkVq3yFLtOUIv53lkre9gkJaK32DkrqO0w= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570039334675288.93051704575635; Wed, 2 Oct 2019 11:02:14 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFivn-0005HJ-B6; Wed, 02 Oct 2019 18:00:55 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFivm-0005H8-7h for xen-devel@lists.xenproject.org; Wed, 02 Oct 2019 18:00:54 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by localhost (Halon) with ESMTP id 934094e2-e53e-11e9-b588-bc764e2007e4; Wed, 02 Oct 2019 18:00:53 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2BFC41597; Wed, 2 Oct 2019 11:00:53 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 41EEF3F706; Wed, 2 Oct 2019 11:00:52 -0700 (PDT) X-Inumbo-ID: 934094e2-e53e-11e9-b588-bc764e2007e4 From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 2 Oct 2019 19:00:42 +0100 Message-Id: <20191002180047.17144-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191002180047.17144-1-julien.grall@arm.com> References: <20191002180047.17144-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 1/6] xen/arm: fix get_cpu_info() when built with clang X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Artem_Mygaiev@epam.com, Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang understands the GCCism in use here, but still complains that sp is unitialised. In such cases, resort to the older versions of this code, which directly read sp into the temporary variable. Note that GCCism is still kept in default because other compilers (e.g. clang) may also define __GNUC__, so AFAIK there are no proper way to detect properly GCC. This means that in the event Xen is ported to a new compiler, the code will need to be updated. But that likely not going to be the only place where Xen will need to be adapted... This is based on the x86 counterpart. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v2: - Update the commit message to explain the ordering in the code. - Add Stefano's acked-by --- xen/include/asm-arm/current.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xen/include/asm-arm/current.h b/xen/include/asm-arm/current.h index 1653e89d30..80503578cf 100644 --- a/xen/include/asm-arm/current.h +++ b/xen/include/asm-arm/current.h @@ -28,8 +28,16 @@ struct cpu_info { =20 static inline struct cpu_info *get_cpu_info(void) { +#ifdef __clang__ + unsigned long sp; + + asm ("mov %0, sp" : "=3Dr" (sp)); +#else register unsigned long sp asm ("sp"); - return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - siz= eof(struct cpu_info)); +#endif + + return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + + STACK_SIZE - sizeof(struct cpu_info)); } =20 #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs) --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 23 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570039333; cv=none; d=zoho.com; s=zohoarc; b=G+gHUovtW7xDFLzPld7lHwOqZo1/TOn6unXa7WrVQxLMpG+Rg2bkkWrc5XHeIHsJ4ef3FyInZvhdgkDopFYx2PNX41+/RjUmGgN0Ae0AqRs9VGdIlY1XHP0w4EnXBYCIqaIXbYhKRUfPO8m/FkykEFBAAmTU2KutlfGevy/L2P4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570039333; 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:ARC-Authentication-Results; bh=fFHxtSuGEGla73Zv6Fpr7HNcglkwuyZhu9lWsJNi2w0=; b=fRiGjmAM1hrvmiuyp0KSlRsw8jgm/Rl8q59QFAs5XkGLAZKHXq0Gw8s1K+JXFMLQOcDw9o2KMOMJnXbGYF1OEIB6qxkubsgf6Gzoy90AHkDIIFdO91W6OL1ozZsEn8I2dOfkyWCpNWugTI3Q5GFB0fL4j6Z0bGZKPBLXsmNpdx0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570039333625804.1326964262283; Wed, 2 Oct 2019 11:02:13 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFivr-0005Hc-L0; Wed, 02 Oct 2019 18:00:59 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFivq-0005HQ-4x for xen-devel@lists.xenproject.org; Wed, 02 Oct 2019 18:00:58 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by localhost (Halon) with ESMTP id 93b0929d-e53e-11e9-971c-12813bfff9fa; Wed, 02 Oct 2019 18:00:54 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4A25F15A1; Wed, 2 Oct 2019 11:00:54 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 613563F706; Wed, 2 Oct 2019 11:00:53 -0700 (PDT) X-Inumbo-ID: 93b0929d-e53e-11e9-971c-12813bfff9fa From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 2 Oct 2019 19:00:43 +0100 Message-Id: <20191002180047.17144-3-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191002180047.17144-1-julien.grall@arm.com> References: <20191002180047.17144-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 2/6] xen/arm64: bitops: Match the register size with the value size in flsl X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Artem_Mygaiev@epam.com, Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang is pickier than GCC for the register size in asm statement. It expects the register size to match the value size. The instruction clz is expecting the two operands to be the same size (i.e 32-bit or 64-bit). As the flsl function is dealing with 64-bit value, we need to make the destination variable 64-bit as well. While at it, add a newline before the return statement. Note that the return type of flsl is not updated because the result will always be smaller than 64 and therefore fit in 32-bit. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v2: - Update the commit message to explain why the return type is not modified --- xen/include/asm-arm/arm64/bitops.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/include/asm-arm/arm64/bitops.h b/xen/include/asm-arm/arm64= /bitops.h index 6cc224ad13..d85a49bca4 100644 --- a/xen/include/asm-arm/arm64/bitops.h +++ b/xen/include/asm-arm/arm64/bitops.h @@ -24,12 +24,13 @@ static /*__*/always_inline unsigned long __ffs(unsigned= long word) =20 static inline int flsl(unsigned long x) { - int ret; + uint64_t ret; =20 if (__builtin_constant_p(x)) return generic_flsl(x); =20 asm("clz\t%0, %1" : "=3Dr" (ret) : "r" (x)); + return BITS_PER_LONG - ret; } =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 23 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570039342; cv=none; d=zoho.com; s=zohoarc; b=nTzJyHveXU00X6eaA7oDpC4TYBkJDDLevtsOTIW/FKUujrWBDLhnNu77L1GrqatK57Sv4MTmJa9yE72//dL+eAOqR5pzYnzc3qx8SMQal5hmXnthPYZG60i1T+HNNhstSfn+Zk9ZudBQwo/dqprCbVuy5gzBV4L3GjNYE4DJfps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570039342; 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:ARC-Authentication-Results; bh=KVZmn7SDfQQdhwQQQ2O/cqdFiWbqxjIISULSRoRRFt8=; b=W9J7jt/oU5wt/83b+SM22I1zHbjnwY/Qr7ejf9DNdJXJmg78d+WxcGIBZCqIqeRpjxwzESML6BxWnGyjTUVWJ0RcWZj/StPQAaH7VnwfWPTan5U8zcEvkQqcaZSTsO70zz2ZqGLYusc5GjR8c6yp13qDoC7pSim8+xlHC/qvy8s= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570039342396792.6556976166415; Wed, 2 Oct 2019 11:02:22 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFivw-0005JZ-D5; Wed, 02 Oct 2019 18:01:04 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFivv-0005JI-4i for xen-devel@lists.xenproject.org; Wed, 02 Oct 2019 18:01:03 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by localhost (Halon) with ESMTP id 949eefe6-e53e-11e9-971c-12813bfff9fa; Wed, 02 Oct 2019 18:00:55 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 68F3E15A2; Wed, 2 Oct 2019 11:00:55 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7F5693F706; Wed, 2 Oct 2019 11:00:54 -0700 (PDT) X-Inumbo-ID: 949eefe6-e53e-11e9-971c-12813bfff9fa From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 2 Oct 2019 19:00:44 +0100 Message-Id: <20191002180047.17144-4-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191002180047.17144-1-julien.grall@arm.com> References: <20191002180047.17144-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 3/6] xen/arm: cpuerrata: Match register size with value size in check_workaround_* X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Artem_Mygaiev@epam.com, Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang is pickier than GCC for the register size in asm statement. It expects the register size to match the value size. The asm statement expects a 32-bit (resp. 64-bit) value on Arm32 (resp. Arm64) whereas the value is a boolean (Clang consider to be 32-bit). It would be possible to impose 32-bit register for both architecture but this require the code to use __OP32. However, it does not really improve the assembly generated. Instead, replace switch the variable to use register_t. Signed-off-by: Julien Grall --- Changes in v2: - Use !! per Stefano's request --- xen/include/asm-arm/cpuerrata.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-arm/cpuerrata.h b/xen/include/asm-arm/cpuerrat= a.h index 55ddfda272..0896fe6e25 100644 --- a/xen/include/asm-arm/cpuerrata.h +++ b/xen/include/asm-arm/cpuerrata.h @@ -14,14 +14,14 @@ static inline bool check_workaround_##erratum(void) = \ return false; \ else \ { \ - bool ret; \ + register_t ret; \ \ asm volatile (ALTERNATIVE("mov %0, #0", \ "mov %0, #1", \ feature) \ : "=3Dr" (ret)); \ \ - return unlikely(ret); \ + return unlikely(!!ret); \ } \ } =20 --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 23 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570039344; cv=none; d=zoho.com; s=zohoarc; b=YbZ89hs3VxRemuqt7MPX/xEAVLk4Rma0O4S9Yfsjj9oegWeTMXtw+v6MjhmKwVzJs6dCDYoJR4yPdJ4v0JdbfXbl8w4PrueWZt7giuyUg3EpbiJ7le+O7PkjNmMVuot6GtLXw03XYfErH+i6ILo1OMMV8SPKm/sVRY07ApgQwsY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570039344; 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:ARC-Authentication-Results; bh=xiAzKMNfdd5rd7jS3z+X2UH+tnJMVLTQo8pR+iql6mA=; b=BiMKDfpYtPviV6Qe9WIOYsPZ82n75SkGSglbUcSNhK1xduEQBOEkm9xhSZKGgVKF6FWpEKSTFyKuKY/Qppn0rpJjLyz4jXCDCOAMkcjYECtL3dRPCfIHo3OAJpqTk7XEoFXfW8jd9NO/+xi+7Y8HAqCOpbOba8V9kyOZmejczm4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570039344223495.35509498538374; Wed, 2 Oct 2019 11:02:24 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFiw1-0005Ld-NL; Wed, 02 Oct 2019 18:01:09 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFiw0-0005LE-52 for xen-devel@lists.xenproject.org; Wed, 02 Oct 2019 18:01:08 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by localhost (Halon) with ESMTP id 955a0812-e53e-11e9-971c-12813bfff9fa; Wed, 02 Oct 2019 18:00:56 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8A23E1000; Wed, 2 Oct 2019 11:00:56 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9E2403F706; Wed, 2 Oct 2019 11:00:55 -0700 (PDT) X-Inumbo-ID: 955a0812-e53e-11e9-971c-12813bfff9fa From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 2 Oct 2019 19:00:45 +0100 Message-Id: <20191002180047.17144-5-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191002180047.17144-1-julien.grall@arm.com> References: <20191002180047.17144-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 4/6] xen/arm: cpufeature: Match register size with value size in cpus_have_const_cap X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Artem_Mygaiev@epam.com, Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang is pickier than GCC for the register size in asm statement. It expects the register size to match the value size. The asm statement expects a 32-bit (resp. 64-bit) value on Arm32 (resp. Arm64) whereas the value is a boolean (Clang consider to be 32-bit). It would be possible to impose 32-bit register for both architecture but this require the code to use __OP32. However, it does no really improve the assembly generated. Instead, replace switch the variable to use register_t. Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v2: - Use !! per Stefano's request --- xen/include/asm-arm/cpufeature.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeat= ure.h index c2c8f3417c..4c5ff6e8ac 100644 --- a/xen/include/asm-arm/cpufeature.h +++ b/xen/include/asm-arm/cpufeature.h @@ -67,14 +67,14 @@ static inline bool cpus_have_cap(unsigned int num) =20 /* System capability check for constant cap */ #define cpus_have_const_cap(num) ({ \ - bool __ret; \ + register_t __ret; \ \ asm volatile (ALTERNATIVE("mov %0, #0", \ "mov %0, #1", \ num) \ : "=3Dr" (__ret)); \ \ - unlikely(__ret); \ + unlikely(!!__ret); \ }) =20 static inline void cpus_set_cap(unsigned int num) --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 23 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570039333; cv=none; d=zoho.com; s=zohoarc; b=N6PWOLKuCDZAiQFJtGuLgLqBEYCBIAFU1cJeCdRWj+gMDO7ed5hBLK9WkqgvqJMm2CNTBbkDe/wPcCxl0WhaKVsj5agEt2RotRjqg30SfWVFfj7jAXJG5BynzkIyedKYjgLnD+4PtH+gS43I6w1vPdF/2RmqbjuZuE8rpgHzjF8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570039333; 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:ARC-Authentication-Results; bh=a2ZdfQl7BwEiRFL1bJLLHwbGr+BBy4yngMFYM2wukfs=; b=P72EgAntSFlNpLrbRHVLQPGAA6c4otx2HJHHEisFSQXQHeEeQ54GSaF+VXMPImGPFGwibTkMz0iS6p5pjGDbGsL/oXflkTazrnkNJRy+gZZ1ktbv/NQ3dca4Mk7T6u/Dfaab3nYYmldrqqz9lB+3ecLHF6RheGUMJHSies5jbyU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1570039333713990.0904944133576; Wed, 2 Oct 2019 11:02:13 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFiw6-0005Od-1v; Wed, 02 Oct 2019 18:01:14 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFiw5-0005O6-2w for xen-devel@lists.xenproject.org; Wed, 02 Oct 2019 18:01:13 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by localhost (Halon) with ESMTP id 96037564-e53e-11e9-971c-12813bfff9fa; Wed, 02 Oct 2019 18:00:57 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id ABDA41597; Wed, 2 Oct 2019 11:00:57 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BF5153F706; Wed, 2 Oct 2019 11:00:56 -0700 (PDT) X-Inumbo-ID: 96037564-e53e-11e9-971c-12813bfff9fa From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 2 Oct 2019 19:00:46 +0100 Message-Id: <20191002180047.17144-6-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191002180047.17144-1-julien.grall@arm.com> References: <20191002180047.17144-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 5/6] xen/arm: mm: Mark check_memory_layout_alignment_constraints as unused X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Artem_Mygaiev@epam.com, Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang will throw an error if a function is unused unless you tell to ignore it. This can be done using __maybe_unused. While modifying the declaration, update it to match prototype of similar functions (see build_assertions). This helps to understand that the sole purpose of the function is to hold BUILD_BUG_ON(). Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v2: - Update the prototype to match style of other functions holding on build assertions. --- xen/arch/arm/mm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c index 9e0fdc39f9..be23acfe26 100644 --- a/xen/arch/arm/mm.c +++ b/xen/arch/arm/mm.c @@ -190,7 +190,8 @@ unsigned long total_pages; extern char __init_begin[], __init_end[]; =20 /* Checking VA memory layout alignment. */ -static inline void check_memory_layout_alignment_constraints(void) { +static void __init __maybe_unused build_assertions(void) +{ /* 2MB aligned regions */ BUILD_BUG_ON(XEN_VIRT_START & ~SECOND_MASK); BUILD_BUG_ON(FIXMAP_ADDR(0) & ~SECOND_MASK); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Tue Apr 23 20:57:49 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1570039344; cv=none; d=zoho.com; s=zohoarc; b=X5ix9KSupohg+Ako1pgjLbnGkv+y7fGWRpeyFVfXv3HxJ2p879kygS802nGSaKEmG/g4cWmsKCgy7tm+Vip/kWy9yVrXLrH4PhyG35sBbfDhQHhMMae9cDPtj5npR1EGRlLAGIcqcyTcqv0KHfJ9neqjJYOwtWef9fyirB5WayI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570039344; 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:ARC-Authentication-Results; bh=l9yKPfEyY8zwdhPc+BNaBgDpK0M85MdlJ6t+rMXZOO8=; b=SwsFkld/xjbpbivUv1F6EEahNmu7p+ozZtmHh/1mLVBkwMzXkb4NaUlH30PICSs7//Rxk0npAYUdzWGejAVdmjGrT6/DpyV6DLezT+JW5D/NWIzl+M7SBcjOpQGquCXMCU1QUUvV+nTacLDa1VpLGLunu1VcHNX59m0rXAeHQY8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 157003934460580.25634263871439; Wed, 2 Oct 2019 11:02:24 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFivt-0005I8-3W; Wed, 02 Oct 2019 18:01:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iFivr-0005Hb-LC for xen-devel@lists.xenproject.org; Wed, 02 Oct 2019 18:00:59 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by localhost (Halon) with ESMTP id 96a62a7a-e53e-11e9-8628-bc764e2007e4; Wed, 02 Oct 2019 18:00:59 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CF84815A1; Wed, 2 Oct 2019 11:00:58 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E25773F706; Wed, 2 Oct 2019 11:00:57 -0700 (PDT) X-Inumbo-ID: 96a62a7a-e53e-11e9-8628-bc764e2007e4 From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 2 Oct 2019 19:00:47 +0100 Message-Id: <20191002180047.17144-7-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191002180047.17144-1-julien.grall@arm.com> References: <20191002180047.17144-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH for-4.13 6/6] xen/arm: traps: Mark check_stack_alignment_constraints as unused X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Artem_Mygaiev@epam.com, Volodymyr Babchuk , Julien Grall , Stefano Stabellini , Julien Grall MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang will throw an error if a function is unused unless you tell to ignore it. This can be done using __maybe_unused. While modifying the declaration, update it to match prototype of similar functions (see build_assertions). This helps to understand that the sole purpose of the function is to hold BUILD_BUG_ON(). Signed-off-by: Julien Grall Acked-by: Stefano Stabellini --- Changes in v2: - Update the prototype to match style of other functions holding on build assertions. --- xen/arch/arm/traps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index a3b961bd06..a3deb59372 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -54,7 +54,8 @@ * that both the kernel half of struct cpu_user_regs (which is pushed in * entry.S) and struct cpu_info (which lives at the bottom of a Xen * stack) must be doubleword-aligned in size. */ -static inline void check_stack_alignment_constraints(void) { +static void __init __maybe_unused build_assertions(void) +{ #ifdef CONFIG_ARM_64 BUILD_BUG_ON((sizeof (struct cpu_user_regs)) & 0xf); BUILD_BUG_ON((offsetof(struct cpu_user_regs, spsr_el1)) & 0xf); --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel