From: Andrew Cooper <andrew.cooper3@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: "Jan Beulich" <jbeulich@suse.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Teddy Astie" <teddy.astie@vates.tech>,
"Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>
Subject: [PATCH 4/4] x86/bitops: don't cast away volatile-ness
Date: Wed, 2 Sep 2026 12:43:39 +0100 [thread overview]
Message-ID: <20260902114339.62043-5-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20260902114339.62043-1-andrew.cooper3@citrix.com>
From: Jan Beulich <jbeulich@suse.com>
Doing so, besides being a bad idea in general, violates Misra rule 11.8.
Use the helper macro we have available anyway.
No functional change intended.
Fixes: f1879b2c2584 ("xen: introduce generic non-atomic test_*bit()")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <jbeulich@suse.com>
CC: Roger Pau Monné <roger@xenproject.org>
CC: Teddy Astie <teddy.astie@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien@xen.org>
CC: Bertrand Marquis <bertrand.marquis@arm.com>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Rebase over removal of ADDR.
---
xen/arch/x86/include/asm/bitops.h | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index 45fc64474344..8f6bea388035 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -185,7 +185,9 @@ static inline int arch__test_and_set_bit(int nr, volatile void *addr)
asm volatile ( "btsl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (*(int *)addr) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
@@ -233,7 +235,9 @@ static inline int arch__test_and_clear_bit(int nr, volatile void *addr)
asm volatile ( "btrl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (*(int *)addr) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
@@ -247,7 +251,9 @@ static inline int arch__test_and_change_bit(int nr, volatile void *addr)
asm volatile ( "btcl %[nr], %[addr]\n\t"
ASM_FLAG_OUT(, "sbbl %[old], %[old]\n\t")
: [old] ASM_FLAG_OUT("=@ccc", "=r") (oldbit),
- [addr] "+m" (*(int *)addr) : [nr] "Ir" (nr) : "memory" );
+ [addr] "+m" (*(volatile int *)addr)
+ : [nr] "Ir" (nr)
+ : "memory" );
return oldbit;
}
--
2.34.1
next prev parent reply other threads:[~2026-09-02 11:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 11:43 [PATCH 0/4] xen/bitops: ADDR removal Andrew Cooper
2026-09-02 11:43 ` [PATCH 1/4] arm/bitops: Drop unused ADDR macros Andrew Cooper
2026-09-02 11:51 ` Orzel, Michal
2026-09-02 12:09 ` Teddy Astie
2026-09-02 11:43 ` [PATCH 2/4] x86/bitops: Remove CONST_ADDR Andrew Cooper
2026-09-02 12:10 ` Teddy Astie
2026-09-02 12:43 ` Jan Beulich
2026-09-02 12:55 ` Andrew Cooper
2026-09-02 11:43 ` [PATCH 3/4] x86/bitops: Remove ADDR Andrew Cooper
2026-09-02 12:12 ` Teddy Astie
2026-09-02 12:50 ` Jan Beulich
2026-09-02 20:40 ` Andrew Cooper
2026-09-02 11:43 ` Andrew Cooper [this message]
2026-09-02 12:13 ` [PATCH 4/4] x86/bitops: don't cast away volatile-ness Teddy Astie
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=20260902114339.62043-5-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=bertrand.marquis@arm.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--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.