From nobody Tue Feb 10 00:40:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of 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.zohomail.com with SMTPS id 1702555755114673.7177219332771; Thu, 14 Dec 2023 04:09:15 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.654520.1021487 (Exim 4.92) (envelope-from ) id 1rDkWH-0001Be-Ic; Thu, 14 Dec 2023 12:08:49 +0000 Received: by outflank-mailman (output) from mailman id 654520.1021487; Thu, 14 Dec 2023 12:08:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rDkWH-0001AS-Bl; Thu, 14 Dec 2023 12:08:49 +0000 Received: by outflank-mailman (input) for mailman id 654520; Thu, 14 Dec 2023 12:08:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rDkWF-0000tI-VF for xen-devel@lists.xenproject.org; Thu, 14 Dec 2023 12:08:47 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 87e99b2e-9a79-11ee-9b0f-b553b5be7939; Thu, 14 Dec 2023 13:08:45 +0100 (CET) Received: from beta.station (net-37-182-35-120.cust.vodafonedsl.it [37.182.35.120]) by support.bugseng.com (Postfix) with ESMTPSA id 39B574EE0744; Thu, 14 Dec 2023 13:08:45 +0100 (CET) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 87e99b2e-9a79-11ee-9b0f-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Maria Celeste Cesario , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Simone Ballarin Subject: [PATCH 1/9] xen/arm64: address violations of MISRA C:2012 Rule 11.8 Date: Thu, 14 Dec 2023 13:07:43 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1702555755461100002 Content-Type: text/plain; charset="utf-8" From: Maria Celeste Cesario The xen sources contain violations of MISRA C:2012 Rule 11.8 whose headline states: "A conversion shall not remove any const, volatile or _Atomic qualification from the type pointed to by a pointer". Add volatile qualifiers missing in casts. Arguments p and ptr are originally volatile-qualified. There's no reason to drop the qualifiers. No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- xen/arch/arm/arm64/lib/bitops.c | 6 ++++-- xen/arch/arm/include/asm/arm64/cmpxchg.h | 10 +++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/arm64/lib/bitops.c b/xen/arch/arm/arm64/lib/bitop= s.c index 20e3f3d6ce..275a780329 100644 --- a/xen/arch/arm/arm64/lib/bitops.c +++ b/xen/arch/arm/arm64/lib/bitops.c @@ -32,7 +32,8 @@ static always_inline bool int_##name(int nr, volatile void *p, bool timeou= t,\ unsigned int max_try) = \ { = \ - volatile uint32_t *ptr =3D (uint32_t *)p + BITOP_WORD((unsigned int)nr= ); \ + volatile uint32_t *ptr =3D (volatile uint32_t *)p + = \ + BITOP_WORD((unsigned int)nr); = \ const uint32_t mask =3D BITOP_MASK((unsigned int)nr); = \ unsigned long res, tmp; = \ = \ @@ -67,7 +68,8 @@ bool name##_timeout(int nr, volatile void *p, unsigned in= t max_try) \ static always_inline bool int_##name(int nr, volatile void *p, int *oldbit= , \ bool timeout, unsigned int max_try) = \ { = \ - volatile uint32_t *ptr =3D (uint32_t *)p + BITOP_WORD((unsigned int)nr= ); \ + volatile uint32_t *ptr =3D (volatile uint32_t *)p + = \ + BITOP_WORD((unsigned int)nr); = \ unsigned int bit =3D (unsigned int)nr % BITOP_BITS_PER_WORD; = \ const uint32_t mask =3D BITOP_MASK(bit); = \ unsigned long res, tmp; = \ diff --git a/xen/arch/arm/include/asm/arm64/cmpxchg.h b/xen/arch/arm/includ= e/asm/arm64/cmpxchg.h index dbfaf91567..031fa6d92a 100644 --- a/xen/arch/arm/include/asm/arm64/cmpxchg.h +++ b/xen/arch/arm/include/asm/arm64/cmpxchg.h @@ -13,7 +13,7 @@ static inline unsigned long __xchg(unsigned long x, volat= ile void *ptr, int size "1: ldxrb %w0, %2\n" " stlxrb %w1, %w3, %2\n" " cbnz %w1, 1b\n" - : "=3D&r" (ret), "=3D&r" (tmp), "+Q" (*(u8 *)ptr) + : "=3D&r" (ret), "=3D&r" (tmp), "+Q" (*(volatile u8 *)ptr) : "r" (x) : "memory"); break; @@ -22,7 +22,7 @@ static inline unsigned long __xchg(unsigned long x, volat= ile void *ptr, int size "1: ldxrh %w0, %2\n" " stlxrh %w1, %w3, %2\n" " cbnz %w1, 1b\n" - : "=3D&r" (ret), "=3D&r" (tmp), "+Q" (*(u16 *)ptr) + : "=3D&r" (ret), "=3D&r" (tmp), "+Q" (*(volatile u16 *)ptr) : "r" (x) : "memory"); break; @@ -31,7 +31,7 @@ static inline unsigned long __xchg(unsigned long x, volat= ile void *ptr, int size "1: ldxr %w0, %2\n" " stlxr %w1, %w3, %2\n" " cbnz %w1, 1b\n" - : "=3D&r" (ret), "=3D&r" (tmp), "+Q" (*(u32 *)ptr) + : "=3D&r" (ret), "=3D&r" (tmp), "+Q" (*(volatile u32 *)ptr) : "r" (x) : "memory"); break; @@ -40,7 +40,7 @@ static inline unsigned long __xchg(unsigned long x, volat= ile void *ptr, int size "1: ldxr %0, %2\n" " stlxr %w1, %3, %2\n" " cbnz %w1, 1b\n" - : "=3D&r" (ret), "=3D&r" (tmp), "+Q" (*(u64 *)ptr) + : "=3D&r" (ret), "=3D&r" (tmp), "+Q" (*(volatile u64 *)ptr) : "r" (x) : "memory"); break; @@ -82,7 +82,7 @@ static inline bool __cmpxchg_case_##name(volatile void *p= tr, \ " stxr" #sz " %w0, %" #w "4, %2\n" \ "1:\n" \ : "=3D&r" (res), "=3D&r" (oldval), \ - "+Q" (*(unsigned long *)ptr) \ + "+Q" (*(volatile unsigned long *)ptr) \ : "Ir" (*old), "r" (new) \ : "cc"); \ \ --=20 2.40.0