All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: xen-devel@lists.xenproject.org
Cc: Artem_Mygaiev@epam.com,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Julien Grall <julien@xen.org>
Subject: [Xen-devel] [PATCH for-4.13 4/6] xen/arm: cpufeature: Match register size with value size in cpus_have_const_cap
Date: Wed,  2 Oct 2019 19:00:45 +0100	[thread overview]
Message-ID: <20191002180047.17144-5-julien.grall@arm.com> (raw)
In-Reply-To: <20191002180047.17144-1-julien.grall@arm.com>

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 <julien.grall@arm.com>

---
    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)
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-10-02 18:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 18:00 [Xen-devel] [PATCH for-4.13 0/6] xen/arm: Add support to build with clang Julien Grall
2019-10-02 18:00 ` [Xen-devel] [PATCH for-4.13 1/6] xen/arm: fix get_cpu_info() when built " Julien Grall
2019-10-02 18:00 ` [Xen-devel] [PATCH for-4.13 2/6] xen/arm64: bitops: Match the register size with the value size in flsl Julien Grall
2019-10-02 22:26   ` Stefano Stabellini
2019-10-02 18:00 ` [Xen-devel] [PATCH for-4.13 3/6] xen/arm: cpuerrata: Match register size with value size in check_workaround_* Julien Grall
2019-10-02 18:42   ` Andrew Cooper
2019-10-02 19:17     ` Julien Grall
2019-10-02 22:27       ` Stefano Stabellini
2019-10-02 18:00 ` Julien Grall [this message]
2019-10-02 22:26   ` [Xen-devel] [PATCH for-4.13 4/6] xen/arm: cpufeature: Match register size with value size in cpus_have_const_cap Stefano Stabellini
2019-10-02 18:00 ` [Xen-devel] [PATCH for-4.13 5/6] xen/arm: mm: Mark check_memory_layout_alignment_constraints as unused Julien Grall
2019-10-02 22:26   ` Stefano Stabellini
2019-10-03 10:41     ` Julien Grall
2019-10-02 18:00 ` [Xen-devel] [PATCH for-4.13 6/6] xen/arm: traps: Mark check_stack_alignment_constraints " Julien Grall
2019-10-02 22:26   ` Stefano Stabellini
2019-10-03 10:44     ` Julien Grall
2019-10-03  7:37 ` [Xen-devel] [PATCH for-4.13 0/6] xen/arm: Add support to build with clang Jürgen Groß
2019-10-03  8:31 ` Artem Mygaiev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191002180047.17144-5-julien.grall@arm.com \
    --to=julien.grall@arm.com \
    --cc=Artem_Mygaiev@epam.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.