From patchwork Wed Oct 2 18:00:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 175035 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1091161ill; Wed, 2 Oct 2019 11:02:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfklbiAgmtwMDRD4D9r0fcliEYaSJGYJvy7BKoCkz7i3wJVVVmf2mWuZFKQswd15lYDhgF X-Received: by 2002:a5e:de01:: with SMTP id e1mr4321400iok.195.1570039360441; Wed, 02 Oct 2019 11:02:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570039360; cv=none; d=google.com; s=arc-20160816; b=dmsIlC6aqu54X7bJGKOno1bWCiKTkRTzNT8PUYLEdC9hHs0GetLNlPjiOzIa4TYH7u qWV2XulJQ82dA0tJBQoGKABNeuY/LIhgvR4fT1aZMWtbnAtpMPJpOs5vKUAUrNUnYYRp xtFWvmnMd7sLgkVGgJxCw3cwadpWPKgoZ9JPDXDvA8ksElxFJThGyTQ8BuAI8BRbANTE ryTBgSGTsZlrouwpJzGYBzMBKAgH3uqWWXKOtkJRvjRTIXcu3J3ItwDwWHOb6QkFfjrL lBpG6Cdjy4t7cm8bQ8cyeHFMT85UtruRqLOTRkfQnf9foWJQg5hp83CTJ+kHUsOFHoz5 NccQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=3DzOC9+Y4cV5J5ZTqqQrFTJC9TxNukXxeXrjad+cvfI=; b=DJDCxiPb8Oa90cFW1nCib8qgBHaW8U/K+svYPXbWHAPCh92VQTwUOMyc7o2Wwz/FfD bK/nF7C+WnMvjNL5R+Xnx9f37JVOnjQ3tcIGxRXswV924Nw9i60DwahvlGt13UVQk0zi fyMHtkhizAN/I3xq7OpVw3AcIrAoY9lMcMMNGe18RABYIuUU6q/ixi+Zr9U4HUJypGdk 2bAlrsxbOTuwsjsxN4bTpuh4+zSSdI3yS5nUFzh8whK46qyIITho+VA+O8yjx5s2LcsD J345/PMdtMQK1M0ZqnKZqP1Y2TXH0+QwrOhgzAGrhXeVvoTy7NguB6r9KGvG7AU49dVU GBTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id t5si20398244ilg.68.2019.10.02.11.02.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Oct 2019 11:02:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) 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.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 X-Inumbo-ID: 934094e2-e53e-11e9-b588-bc764e2007e4 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) 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 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 { static inline struct cpu_info *get_cpu_info(void) { +#ifdef __clang__ + unsigned long sp; + + asm ("mov %0, sp" : "=r" (sp)); +#else register unsigned long sp asm ("sp"); - return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + STACK_SIZE - sizeof(struct cpu_info)); +#endif + + return (struct cpu_info *)((sp & ~(STACK_SIZE - 1)) + + STACK_SIZE - sizeof(struct cpu_info)); } #define guest_cpu_user_regs() (&get_cpu_info()->guest_cpu_user_regs) From patchwork Wed Oct 2 18:00:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 175034 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1091134ill; Wed, 2 Oct 2019 11:02:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqySr1GatWbxPc9kuW/UZhH/X/K4FKuoqAGpRBYN6/BS1nt/Ib7HaASBKQy9+Eo8s/D52p8U X-Received: by 2002:a6b:720a:: with SMTP id n10mr4359897ioc.64.1570039359475; Wed, 02 Oct 2019 11:02:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570039359; cv=none; d=google.com; s=arc-20160816; b=VQGelE1qX7bKXWIRxGUXfiX6+Op9CZLdrlsWu0ipvnbE0FFStMZhWB0b2gYkwJB2jg 8Tb9J+GjTCUHALWzhhsGxtcJuQJUBAVeTgVXK+q54VqkeSyRbTjnIru6RpQaCHKUDS5j YEOKsRz3p4BL92B5D+Efa8QI9XG5fLZCkX4NSK07jnzbBzd0nTBO0YVtpI38gBFYSKJg St38rZUAYUq1snsKBmchiWQY6f3rYWFJIV+QddospxuoSYfbTFYzISCv7uXCgfhYmIYo F1QO4DSM6XWtIZUyaXerbKdYU4RSgq63LNH8Uqe24pPabegxyaSXdRyHjhpu6iin3Jzu J+bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=fFHxtSuGEGla73Zv6Fpr7HNcglkwuyZhu9lWsJNi2w0=; b=008fXbXDrCEIAFlcfPTMVwhUMEcOjhCbnovCiIHNuo7BctwzjmEiGqutaieTlK2tYp 4VCl4ESb45kz+2C42EYwxzKnGmtiNHhXH0k2hmDqXZXbToD50SqsUeUR/Ho8eczD9lp7 uS0ES3PeWQ5bnmBxbO+bpNngcW7RicRotSRgcuyCQOyAC4LISCf5QnNVfHnBR4hDv6pg yeo5ERs6gjH2M25A3/qjMHtqULDACDGzXCp5zQnNSy55J0ayITtyadz17phaYh6QZSS2 /+BHvh1iabVCdYsQZQCgr7HzMYWJlaiaWvwnBcjk5o9kE+69oU94pX1baEw8XopJZgTn RfAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id e26si12515999iol.53.2019.10.02.11.02.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Oct 2019 11:02:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) 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.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 X-Inumbo-ID: 93b0929d-e53e-11e9-971c-12813bfff9fa 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) 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 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) static inline int flsl(unsigned long x) { - int ret; + uint64_t ret; if (__builtin_constant_p(x)) return generic_flsl(x); asm("clz\t%0, %1" : "=r" (ret) : "r" (x)); + return BITS_PER_LONG - ret; } From patchwork Wed Oct 2 18:00:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 175030 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1091059ill; Wed, 2 Oct 2019 11:02:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyankkvrvIxk1CTauR20vL2cOIq43hEJ+LinJbcijO7vdCmTbH66sj0M4JGvqCrgBrqh2N/ X-Received: by 2002:a05:6602:2241:: with SMTP id o1mr4200665ioo.129.1570039356653; Wed, 02 Oct 2019 11:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570039356; cv=none; d=google.com; s=arc-20160816; b=pkAnb9ONYvpeeqadpG0bnb09czfnfD173VadR+EO7tenYgictebrViUAX2Vjp0iqu7 qwXKeq0fXqLoXhtwu78Xx3b9PZyogZ1tMgwLhZxPhHBiKpdBwPboPfL/l8pWoHcwXaKm Bu9Uk38oNIKuWNgvOhjlcb4aOTKtk+AssE1fCETqQ5oB2iDt2LZZT1/VMi0bdOhihQcA jYZVYUdbXN/frTBdvq8TwdDwOxpe+72vs52w1i6abnBPChfkdz2y8RW/rFfiMFgkijxc 05cMblDjqYajBzqf++HkvbH8Qxqc96nadD3BwuhalEycg5f6oNLZkXbACb48ziDT0WDY HwXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=KVZmn7SDfQQdhwQQQ2O/cqdFiWbqxjIISULSRoRRFt8=; b=eW1redgjVDQXuylvP4E/Lc38FcYSdo2aCWddoCNfypkKR3MtDa7zoPrTzt3Mcnb8vV 22mF36oFK/oZLEjs2lALCXBguYk5coSkOwAteH+nbmhxa4eXpu9SELwEN5fPqgYM562F 0Es63u/NAhWJkgEnKQmvrhPeO6F0wnkN7r9QFsMlQAEpd0ceMTsrzr+9nOTizhxsb42u Q0le3v+3uRpK5B9EZlhgrq9GCWjv1XC8PS8QiwoeDxQVI4KtNGUXUeElQ5paQFDOXcNP jGgLWW4Sk/UJmRe6FLLSn/yeGR6OR/rCmloXl0jsuBJFOMIBQK2ovqSaF0ClPBuoSXd/ AY2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id k16si15590942ior.3.2019.10.02.11.02.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Oct 2019 11:02:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) 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.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 X-Inumbo-ID: 949eefe6-e53e-11e9-971c-12813bfff9fa 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) 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 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/cpuerrata.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) \ : "=r" (ret)); \ \ - return unlikely(ret); \ + return unlikely(!!ret); \ } \ } From patchwork Wed Oct 2 18:00:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 175029 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1091056ill; Wed, 2 Oct 2019 11:02:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfJrBB1p0ng/V2MibDpPREp8tgc09Z2Swvb9RvgN84g+iDHitUaouvPMF68lx+OcVleIws X-Received: by 2002:a92:b09:: with SMTP id b9mr1829586ilf.26.1570039356544; Wed, 02 Oct 2019 11:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570039356; cv=none; d=google.com; s=arc-20160816; b=Rrf0nN+y1sbz1Z4kOaU91VfGauW0n8RsajeZe5fFEPx4RXUIJQ4wm26aJ35qbDpTaX e7nNAl3K5gpVCYBH5JP8eQZpmNXCrp1+oSDE2EofLDFR054aoChEHraD2q2+jHumJJUd aTzvbNyIbE65Ta0itp3jK9dfbJndGU2lZh6ZaP805zcBy5WppTTMrQDdW5STCBZKvFVb MhydeQNjf0gOUMrberSJgQ/Z8L/mg5eq7YNUKrW1bxOo/fuKI9OvSi72F3uSdCbSGNwX NVKtpcMUTvQrvCW7PxhMxkanWncLN2tnda2dZaX7KPTSIRZyue1O0rsJNbMZ1LfXoHhn yo7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=xiAzKMNfdd5rd7jS3z+X2UH+tnJMVLTQo8pR+iql6mA=; b=xGBNrPJZeOGxKd3OthZ9Zn2yl0Slxnpgd9aB941uTCs39uwrHTmrJaasmcnSq8oGiN TgZZ4vBPPyfH/VsHAykVn0TMFb8mcBdHTZLZRI9jEP2VzmMjMS4VSJuWoXQeTzDw3MjS NH/TAJE70Lt0IuncrWMoMmvvHNB49j98e2UV6HokiC9f4F3+elL/QoaZKD/x2VMwRzm8 GAqaE8/vK664/jZ3oIK5QxYOcMtSywE1+jKk5ZBuf4RrkBv/mv6ENa6ETsSjggSp71Gw zwwOgR8QPTNu9MirKv/+QeDADytMUWAnjRLik1jUEx3I/T5ApnulGfc3KW0uS17RWU/4 sooQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id f21si27923455jac.3.2019.10.02.11.02.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Oct 2019 11:02:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) 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.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 X-Inumbo-ID: 955a0812-e53e-11e9-971c-12813bfff9fa 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) 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 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/cpufeature.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) /* 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) \ : "=r" (__ret)); \ \ - unlikely(__ret); \ + unlikely(!!__ret); \ }) static inline void cpus_set_cap(unsigned int num) From patchwork Wed Oct 2 18:00:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 175033 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1091124ill; Wed, 2 Oct 2019 11:02:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmBIq54emGSkNGgpaH/dcKvuTJgeQalNzJWfbWXl3NkGlrQpZ3TmARCAViSkX0XcDXVpkI X-Received: by 2002:a92:d84d:: with SMTP id h13mr5319164ilq.205.1570039358980; Wed, 02 Oct 2019 11:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570039358; cv=none; d=google.com; s=arc-20160816; b=ZSBSKBXNcK0sHHKepgl2+uc/2ZFxQZyO/CvK9w6IybHdbcvl12RoXRLhVI6Zjy2XUD 4Lkiy9b75Ak+nQTn2W/fRACEaYS+qfTkQAHOdajnWknJ6KznHb6hkmh0v9D6o9E80Qnu ZmQhGjQs/ZIvRSQC/lVcJxvFg2M3iNoi8bSTwbiC6m+9YoshD7kRNmz28+nyph1fw3FE Uwr34AbnVxCXCLEIALh/bphhlR+Xf7KQ2HssQN2cvt0f7NYOL9XMz7Rpm2LH+gRVuqJd GDSFOChn00PKxTUSIBVijTine0tO7xSLHIhxBp8N2mXoiZa+ChCE7KrhVy3jcZXLJ/hu 84hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=a2ZdfQl7BwEiRFL1bJLLHwbGr+BBy4yngMFYM2wukfs=; b=nN42z+HfF8B35IDJ1ifOXOSID886jAKkaZuFjX8viH23bv8vGDE9i4UuvR3cF6UsKr 4N704IUr4gkqahohg8EcLQLVHbZblg3I66+5DvQdsMbEWN/bc5bzSdw2frtDYT4Kk8om Dpep3N0Nop0UKtML124i06fc+8Yqi1POozII6HxwbLteL3rDqz+ydQuRlXweYs1nFrDf 9FsgUqYLl9cmdnL77QJD4Iy04t3tPbrg44iQKh7cTfG7y6Up1WotLk+sCSgnWRHh88N5 VYx/BqJzXEI1upA6dNa7GW5HSDJNK1Uv80bxsm7+x6Ro218H8XdHPu8xdmdf+AiVtFWe KW9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id n6si20266088ile.150.2019.10.02.11.02.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Oct 2019 11:02:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) 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.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 X-Inumbo-ID: 96037564-e53e-11e9-971c-12813bfff9fa 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) 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 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[]; /* 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); From patchwork Wed Oct 2 18:00:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 175031 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp1091066ill; Wed, 2 Oct 2019 11:02:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJ02DP1gKsd9TDQTqu1BHVl4MYnx949QCZKZ9H+b6Ngs96sAwrNeS7oC0tAUXuijr5COXY X-Received: by 2002:a92:83c8:: with SMTP id p69mr5712014ilk.45.1570039356961; Wed, 02 Oct 2019 11:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570039356; cv=none; d=google.com; s=arc-20160816; b=Ec2PQn3fNDoNOHY8Ob7+7g6CfwqM0jsH23gfZHzbjrnrfGoBDImdkJGpgS3pO7wQ+o VDaVPTnNh48+po3MUyEtz5f+ACX4IDaubJXwQsH7H4qVIcH4KHfuv0WkhjINs4OegvCQ C2CjtlwO5ZIBkHyPOlhxEEfSzxJUcDMJmPEU8dHXYTgm0zbGZ2CLwfrd8BB4w1dhQlin oifItwwc9aKqaGpuIublKZNlPadlpa8u3olah6O7LHfWqALXOmEArhdpO56C5+SghQtC 9etAeuoitKZ5o1k67CVEGwScslEnVLzMH0ZGuVpRBwTJA3rFTQhPg7wq4+hXAfnRagVY d1Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=l9yKPfEyY8zwdhPc+BNaBgDpK0M85MdlJ6t+rMXZOO8=; b=WkShoMpSKotgvUvuMrcP1++jccsRCMLJ0e0s/dyOg4dyafvBVZVRRftTrK4T4rSdkr TAVfel1Z9/I51kw9JtP7RY0JwEEgBDzX07tPPGfboLPDZQB4JoMxjQqse8UJb7/87h1l Uc6bZSlVodkoOoO6aByrzNd20IfayWoOdNdTrRonK/RvuQUCrQYRSmgvP/SO4/T90tv5 xfNi78f5ndrdS412X9Gu2/8FE+f9NFyBVEMgAsMIIJhcC0tgobUkwy0phCulpyI9RCVW B5Rrxt910ybRz50GtcNnCmQFbNK0hMc7U4DZUSrJr5NsXxExM6RPOok0Z485WBlvEitO aMwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id u127si27592373ioe.152.2019.10.02.11.02.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 02 Oct 2019 11:02:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) 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.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 X-Inumbo-ID: 96a62a7a-e53e-11e9-8628-bc764e2007e4 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) 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 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);