From nobody Tue May 21 14:45:54 2024 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 170922052049069.73943398074789; Thu, 29 Feb 2024 07:28:40 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687191.1070226 (Exim 4.92) (envelope-from ) id 1rfiKS-0008MB-5V; Thu, 29 Feb 2024 15:28:12 +0000 Received: by outflank-mailman (output) from mailman id 687191.1070226; Thu, 29 Feb 2024 15:28:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKS-0008M4-2J; Thu, 29 Feb 2024 15:28:12 +0000 Received: by outflank-mailman (input) for mailman id 687191; Thu, 29 Feb 2024 15:28:10 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKQ-00087e-9P for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:10 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 24a431a6-d717-11ee-afd8-a90da7624cb6; Thu, 29 Feb 2024 16:28:09 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id ABBBC4EE074A; Thu, 29 Feb 2024 16:28:07 +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: 24a431a6-d717-11ee-afd8-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap , Wei Liu Subject: [XEN PATCH 01/10] xen/include: address violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:27:53 +0100 Message-Id: <15d6e4fb5c873e7ea42cfcee2faa0bf33c10d101.1709219010.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709220521525100017 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- xen/include/xen/bug.h | 2 +- xen/include/xen/init.h | 4 +-- xen/include/xen/kconfig.h | 2 +- xen/include/xen/list.h | 59 +++++++++++++++++++------------------- xen/include/xen/param.h | 22 +++++++------- xen/include/xen/spinlock.h | 2 +- 6 files changed, 45 insertions(+), 46 deletions(-) diff --git a/xen/include/xen/bug.h b/xen/include/xen/bug.h index 2c45c462fc63..77fe1e1ba840 100644 --- a/xen/include/xen/bug.h +++ b/xen/include/xen/bug.h @@ -80,7 +80,7 @@ struct bug_frame { [bf_type] "i" (type), = \ [bf_ptr] "i" (ptr), = \ [bf_msg] "i" (msg), = \ - [bf_line_lo] "i" ((line & ((1 << BUG_LINE_LO_WIDTH) - 1)) = \ + [bf_line_lo] "i" (((line) & ((1 << BUG_LINE_LO_WIDTH) - 1)) = \ << BUG_DISP_WIDTH), = \ [bf_line_hi] "i" (((line) >> BUG_LINE_LO_WIDTH) << BUG_DISP_WIDTH) =20 diff --git a/xen/include/xen/init.h b/xen/include/xen/init.h index 1d7c0216bc80..0a4223833755 100644 --- a/xen/include/xen/init.h +++ b/xen/include/xen/init.h @@ -63,9 +63,9 @@ typedef int (*initcall_t)(void); typedef void (*exitcall_t)(void); =20 #define presmp_initcall(fn) \ - const static initcall_t __initcall_##fn __init_call("presmp") =3D fn + const static initcall_t __initcall_##fn __init_call("presmp") =3D (fn) #define __initcall(fn) \ - const static initcall_t __initcall_##fn __init_call("1") =3D fn + const static initcall_t __initcall_##fn __init_call("1") =3D (fn) #define __exitcall(fn) \ static exitcall_t __exitcall_##fn __exit_call =3D fn =20 diff --git a/xen/include/xen/kconfig.h b/xen/include/xen/kconfig.h index c25dc0f6c2a9..b7e70289737b 100644 --- a/xen/include/xen/kconfig.h +++ b/xen/include/xen/kconfig.h @@ -25,7 +25,7 @@ #define __ARG_PLACEHOLDER_1 0, #define config_enabled(cfg) _config_enabled(cfg) #define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value) -#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0) +#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk (1),= (0)) #define ___config_enabled(__ignored, val, ...) val =20 /* diff --git a/xen/include/xen/list.h b/xen/include/xen/list.h index b5eab3a1eb6c..d803e7848cad 100644 --- a/xen/include/xen/list.h +++ b/xen/include/xen/list.h @@ -490,9 +490,9 @@ static inline void list_splice_init(struct list_head *l= ist, * @member: the name of the list_struct within the struct. */ #define list_for_each_entry(pos, head, member) \ - for (pos =3D list_entry((head)->next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D list_entry(pos->member.next, typeof(*pos), member)) + for (pos =3D list_entry((head)->next, typeof(*(pos)), member); = \ + &(pos)->member !=3D (head); \ + pos =3D list_entry((pos)->member.next, typeof(*(pos)), member)) =20 /** * list_for_each_entry_reverse - iterate backwards over list of given type. @@ -501,9 +501,9 @@ static inline void list_splice_init(struct list_head *l= ist, * @member: the name of the list_struct within the struct. */ #define list_for_each_entry_reverse(pos, head, member) \ - for (pos =3D list_entry((head)->prev, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D list_entry(pos->member.prev, typeof(*pos), member)) + for (pos =3D list_entry((head)->prev, typeof(*(pos)), member); = \ + &(pos)->member !=3D (head); \ + pos =3D list_entry((pos)->member.prev, typeof(*(pos)), member)) =20 /** * list_prepare_entry - prepare a pos entry for use in @@ -516,7 +516,7 @@ static inline void list_splice_init(struct list_head *l= ist, * list_for_each_entry_continue. */ #define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) + ((pos) ? : list_entry(head, typeof(*(pos)), member)) =20 /** * list_for_each_entry_continue - continue iteration over list of given ty= pe @@ -528,9 +528,9 @@ static inline void list_splice_init(struct list_head *l= ist, * the current position. */ #define list_for_each_entry_continue(pos, head, member) \ - for (pos =3D list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D list_entry(pos->member.next, typeof(*pos), member)) + for (pos =3D list_entry((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member !=3D (head); \ + pos =3D list_entry((pos)->member.next, typeof(*(pos)), member)) =20 /** * list_for_each_entry_from - iterate over list of given type from the @@ -542,8 +542,8 @@ static inline void list_splice_init(struct list_head *l= ist, * Iterate over list of given type, continuing from current position. */ #define list_for_each_entry_from(pos, head, member) \ - for (; &pos->member !=3D (head); \ - pos =3D list_entry(pos->member.next, typeof(*pos), member)) + for (; &(pos)->member !=3D (head); \ + pos =3D list_entry((pos)->member.next, typeof(*(pos)), member)) =20 /** * list_for_each_entry_safe - iterate over list of given type safe @@ -554,10 +554,10 @@ static inline void list_splice_init(struct list_head = *list, * @member: the name of the list_struct within the struct. */ #define list_for_each_entry_safe(pos, n, head, member) \ - for (pos =3D list_entry((head)->next, typeof(*pos), member), \ - n =3D list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D n, n =3D list_entry(n->member.next, typeof(*n), member)) + for (pos =3D list_entry((head)->next, typeof(*(pos)), member), \ + n =3D list_entry((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member !=3D (head); \ + pos =3D (n), n =3D list_entry((n)->member.next, typeof(*(n)), mem= ber)) =20 /** * list_for_each_entry_safe_continue @@ -570,10 +570,10 @@ static inline void list_splice_init(struct list_head = *list, * safe against removal of list entry. */ #define list_for_each_entry_safe_continue(pos, n, head, member) \ - for (pos =3D list_entry(pos->member.next, typeof(*pos), member), \ - n =3D list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D n, n =3D list_entry(n->member.next, typeof(*n), member)) + for (pos =3D list_entry((pos)->member.next, typeof(*(pos)), member), \ + n =3D list_entry((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member !=3D (head); \ + pos =3D (n), n =3D list_entry((n)->member.next, typeof(*(n)), mem= ber)) =20 /** * list_for_each_entry_safe_from @@ -586,9 +586,9 @@ static inline void list_splice_init(struct list_head *l= ist, * removal of list entry. */ #define list_for_each_entry_safe_from(pos, n, head, member) \ - for (n =3D list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D n, n =3D list_entry(n->member.next, typeof(*n), member)) + for (n =3D list_entry((pos)->member.next, typeof(*(pos)), member); \ + &(pos)->member !=3D (head); \ + pos =3D (n), n =3D list_entry((n)->member.next, typeof(*(n)), mem= ber)) =20 /** * list_for_each_entry_safe_reverse @@ -601,10 +601,10 @@ static inline void list_splice_init(struct list_head = *list, * of list entry. */ #define list_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos =3D list_entry((head)->prev, typeof(*pos), member), \ - n =3D list_entry(pos->member.prev, typeof(*pos), member); \ - &pos->member !=3D (head); \ - pos =3D n, n =3D list_entry(n->member.prev, typeof(*n), member)) + for (pos =3D list_entry((head)->prev, typeof(*(pos)), member), \ + n =3D list_entry((pos)->member.prev, typeof(*(pos)), member); \ + &(pos)->member !=3D (head); \ + pos =3D (n), n =3D list_entry((n)->member.prev, typeof(*(n)), mem= ber)) =20 /** * list_for_each_rcu - iterate over an rcu-protected list @@ -653,9 +653,9 @@ static inline void list_splice_init(struct list_head *l= ist, * as long as the traversal is guarded by rcu_read_lock(). */ #define list_for_each_entry_rcu(pos, head, member) \ - for (pos =3D list_entry((head)->next, typeof(*pos), member); \ + for (pos =3D list_entry((head)->next, typeof(*(pos)), member); \ &rcu_dereference(pos)->member !=3D (head); \ - pos =3D list_entry(pos->member.next, typeof(*pos), member)) + pos =3D list_entry((pos)->member.next, typeof(*(pos)), member)) =20 /** * list_for_each_continue_rcu @@ -977,4 +977,3 @@ static inline void hlist_add_after_rcu(struct hlist_nod= e *prev, pos =3D pos->next) =20 #endif /* __XEN_LIST_H__ */ - diff --git a/xen/include/xen/param.h b/xen/include/xen/param.h index 13607e0e50e0..1bdbab34ab1f 100644 --- a/xen/include/xen/param.h +++ b/xen/include/xen/param.h @@ -45,42 +45,42 @@ extern const struct kernel_param __setup_start[], __set= up_end[]; #define TEMP_NAME(base) _TEMP_NAME(base, __LINE__) =20 #define custom_param(_name, _var) \ - __setup_str __setup_str_##_var[] =3D _name; \ + __setup_str __setup_str_##_var[] =3D (_name); \ __kparam __setup_##_var =3D \ { .name =3D __setup_str_##_var, \ .type =3D OPT_CUSTOM, \ - .par.func =3D _var } + .par.func =3D (_var) } #define boolean_param(_name, _var) \ - __setup_str __setup_str_##_var[] =3D _name; \ + __setup_str __setup_str_##_var[] =3D (_name); \ __kparam __setup_##_var =3D \ { .name =3D __setup_str_##_var, \ .type =3D OPT_BOOL, \ .len =3D sizeof(_var) + \ BUILD_BUG_ON_ZERO(sizeof(_var) !=3D sizeof(bool)), \ - .par.var =3D &_var } + .par.var =3D &(_var) } #define integer_param(_name, _var) \ - __setup_str __setup_str_##_var[] =3D _name; \ + __setup_str __setup_str_##_var[] =3D (_name); \ __kparam __setup_##_var =3D \ { .name =3D __setup_str_##_var, \ .type =3D OPT_UINT, \ .len =3D sizeof(_var), \ - .par.var =3D &_var } + .par.var =3D &(_var) } #define size_param(_name, _var) \ - __setup_str __setup_str_##_var[] =3D _name; \ + __setup_str __setup_str_##_var[] =3D (_name); \ __kparam __setup_##_var =3D \ { .name =3D __setup_str_##_var, \ .type =3D OPT_SIZE, \ .len =3D sizeof(_var), \ - .par.var =3D &_var } + .par.var =3D &(_var) } #define string_param(_name, _var) \ - __setup_str __setup_str_##_var[] =3D _name; \ + __setup_str __setup_str_##_var[] =3D (_name); \ __kparam __setup_##_var =3D \ { .name =3D __setup_str_##_var, \ .type =3D OPT_STR, \ .len =3D sizeof(_var), \ - .par.var =3D &_var } + .par.var =3D &(_var) } #define ignore_param(_name) \ - __setup_str TEMP_NAME(__setup_str_ign)[] =3D _name; \ + __setup_str TEMP_NAME(__setup_str_ign)[] =3D (_name); \ __kparam TEMP_NAME(__setup_ign) =3D \ { .name =3D TEMP_NAME(__setup_str_ign), \ .type =3D OPT_IGNORE } diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h index 1cd9120eac7a..0e6a083dfb9e 100644 --- a/xen/include/xen/spinlock.h +++ b/xen/include/xen/spinlock.h @@ -94,7 +94,7 @@ struct lock_profile_qhead { int32_t idx; /* index for printout */ }; =20 -#define _LOCK_PROFILE(lockname) { .name =3D #lockname, .lock =3D &lockname= , } +#define _LOCK_PROFILE(lockname) { .name =3D #lockname, .lock =3D &(locknam= e), } #define _LOCK_PROFILE_PTR(name) = \ static struct lock_profile * const __lock_profile_##name = \ __used_section(".lockprofile.data") =3D = \ --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220516573339.48696756319316; Thu, 29 Feb 2024 07:28:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687192.1070230 (Exim 4.92) (envelope-from ) id 1rfiKS-0008Or-DT; Thu, 29 Feb 2024 15:28:12 +0000 Received: by outflank-mailman (output) from mailman id 687192.1070230; Thu, 29 Feb 2024 15:28:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKS-0008Nf-9I; Thu, 29 Feb 2024 15:28:12 +0000 Received: by outflank-mailman (input) for mailman id 687192; Thu, 29 Feb 2024 15:28:11 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKR-00087e-0N for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:11 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 25227046-d717-11ee-afd8-a90da7624cb6; Thu, 29 Feb 2024 16:28:10 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id 852CA4EE074B; Thu, 29 Feb 2024 16:28:09 +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: 25227046-d717-11ee-afd8-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, Volodymyr Babchuk Subject: [XEN PATCH 02/10] xen/arm: address some violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:27:54 +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: 1709220517678100005 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- Style in arm64/cpufeature.c has not been amended, because this file seems to be kept in sync with its Linux counterpart. --- xen/arch/arm/arm64/cpufeature.c | 14 +++++++------- xen/arch/arm/cpuerrata.c | 4 ++-- xen/arch/arm/include/asm/arm64/sysregs.h | 2 +- xen/arch/arm/include/asm/guest_atomics.h | 4 ++-- xen/arch/arm/include/asm/mm.h | 2 +- xen/arch/arm/include/asm/smccc.h | 8 ++++---- xen/arch/arm/include/asm/vgic-emul.h | 8 ++++---- xen/arch/arm/vcpreg.c | 5 +++-- 8 files changed, 24 insertions(+), 23 deletions(-) diff --git a/xen/arch/arm/arm64/cpufeature.c b/xen/arch/arm/arm64/cpufeatur= e.c index 864413d9cc03..6fb8974ade7f 100644 --- a/xen/arch/arm/arm64/cpufeature.c +++ b/xen/arch/arm/arm64/cpufeature.c @@ -78,13 +78,13 @@ =20 #define __ARM64_FTR_BITS(SIGNED, VISIBLE, STRICT, TYPE, SHIFT, WIDTH, SAFE= _VAL) \ { \ - .sign =3D SIGNED, \ - .visible =3D VISIBLE, \ - .strict =3D STRICT, \ - .type =3D TYPE, \ - .shift =3D SHIFT, \ - .width =3D WIDTH, \ - .safe_val =3D SAFE_VAL, \ + .sign =3D (SIGNED), \ + .visible =3D (VISIBLE), \ + .strict =3D (STRICT), \ + .type =3D (TYPE), \ + .shift =3D (SHIFT), \ + .width =3D (WIDTH), \ + .safe_val =3D (SAFE_VAL), \ } =20 /* Define a feature with unsigned values */ diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c index a28fa6ac78cc..c678a555910f 100644 --- a/xen/arch/arm/cpuerrata.c +++ b/xen/arch/arm/cpuerrata.c @@ -462,8 +462,8 @@ static bool has_ssbd_mitigation(const struct arm_cpu_ca= pabilities *entry) #define MIDR_RANGE(model, min, max) \ .matches =3D is_affected_midr_range, \ .midr_model =3D model, \ - .midr_range_min =3D min, \ - .midr_range_max =3D max + .midr_range_min =3D (min), \ + .midr_range_max =3D (max) =20 #define MIDR_ALL_VERSIONS(model) \ .matches =3D is_affected_midr_range, \ diff --git a/xen/arch/arm/include/asm/arm64/sysregs.h b/xen/arch/arm/includ= e/asm/arm64/sysregs.h index 3fdeb9d8cdef..b593e4028b53 100644 --- a/xen/arch/arm/include/asm/arm64/sysregs.h +++ b/xen/arch/arm/include/asm/arm64/sysregs.h @@ -465,7 +465,7 @@ /* Access to system registers */ =20 #define WRITE_SYSREG64(v, name) do { \ - uint64_t _r =3D v; \ + uint64_t _r =3D (v); \ asm volatile("msr "__stringify(name)", %0" : : "r" (_r)); \ } while (0) #define READ_SYSREG64(name) ({ \ diff --git a/xen/arch/arm/include/asm/guest_atomics.h b/xen/arch/arm/includ= e/asm/guest_atomics.h index a1745f8613f6..8893eb9a55d7 100644 --- a/xen/arch/arm/include/asm/guest_atomics.h +++ b/xen/arch/arm/include/asm/guest_atomics.h @@ -32,7 +32,7 @@ static inline void guest_##name(struct domain *d, int nr,= volatile void *p) \ perfc_incr(atomics_guest_paused); = \ = \ domain_pause_nosync(d); = \ - name(nr, p); = \ + (name)(nr, p); = \ domain_unpause(d); = \ } =20 @@ -52,7 +52,7 @@ static inline int guest_##name(struct domain *d, int nr, = volatile void *p) \ perfc_incr(atomics_guest_paused); = \ = \ domain_pause_nosync(d); = \ - oldbit =3D name(nr, p); = \ + oldbit =3D (name)(nr, p); = \ domain_unpause(d); = \ = \ return oldbit; = \ diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h index cbcf3bf14767..48538b5337aa 100644 --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -250,7 +250,7 @@ static inline void __iomem *ioremap_wc(paddr_t start, s= ize_t len) #define gaddr_to_gfn(ga) _gfn(paddr_to_pfn(ga)) #define mfn_to_maddr(mfn) pfn_to_paddr(mfn_x(mfn)) #define maddr_to_mfn(ma) _mfn(paddr_to_pfn(ma)) -#define vmap_to_mfn(va) maddr_to_mfn(virt_to_maddr((vaddr_t)va)) +#define vmap_to_mfn(va) maddr_to_mfn(virt_to_maddr((vaddr_t)(va))) #define vmap_to_page(va) mfn_to_page(vmap_to_mfn(va)) =20 /* Page-align address and convert to frame number format */ diff --git a/xen/arch/arm/include/asm/smccc.h b/xen/arch/arm/include/asm/sm= ccc.h index 1adcd37443c7..a1f309eea45a 100644 --- a/xen/arch/arm/include/asm/smccc.h +++ b/xen/arch/arm/include/asm/smccc.h @@ -122,7 +122,7 @@ struct arm_smccc_res { #define __constraint_read_7 __constraint_read_6, "r" (r7) =20 #define __declare_arg_0(a0, res) \ - struct arm_smccc_res *___res =3D res; \ + struct arm_smccc_res *___res =3D (res); \ register unsigned long r0 ASM_REG(0) =3D (uint32_t)a0; \ register unsigned long r1 ASM_REG(1); \ register unsigned long r2 ASM_REG(2); \ @@ -130,7 +130,7 @@ struct arm_smccc_res { =20 #define __declare_arg_1(a0, a1, res) \ typeof(a1) __a1 =3D a1; \ - struct arm_smccc_res *___res =3D res; \ + struct arm_smccc_res *___res =3D (res); \ register unsigned long r0 ASM_REG(0) =3D (uint32_t)a0; \ register unsigned long r1 ASM_REG(1) =3D __a1; \ register unsigned long r2 ASM_REG(2); \ @@ -139,7 +139,7 @@ struct arm_smccc_res { #define __declare_arg_2(a0, a1, a2, res) \ typeof(a1) __a1 =3D a1; \ typeof(a2) __a2 =3D a2; \ - struct arm_smccc_res *___res =3D res; \ + struct arm_smccc_res *___res =3D (res); \ register unsigned long r0 ASM_REG(0) =3D (uint32_t)a0; \ register unsigned long r1 ASM_REG(1) =3D __a1; \ register unsigned long r2 ASM_REG(2) =3D __a2; \ @@ -149,7 +149,7 @@ struct arm_smccc_res { typeof(a1) __a1 =3D a1; \ typeof(a2) __a2 =3D a2; \ typeof(a3) __a3 =3D a3; \ - struct arm_smccc_res *___res =3D res; \ + struct arm_smccc_res *___res =3D (res); \ register unsigned long r0 ASM_REG(0) =3D (uint32_t)a0; \ register unsigned long r1 ASM_REG(1) =3D __a1; \ register unsigned long r2 ASM_REG(2) =3D __a2; \ diff --git a/xen/arch/arm/include/asm/vgic-emul.h b/xen/arch/arm/include/as= m/vgic-emul.h index e52fbaa3ec04..e2afb52498a8 100644 --- a/xen/arch/arm/include/asm/vgic-emul.h +++ b/xen/arch/arm/include/asm/vgic-emul.h @@ -6,11 +6,11 @@ * a range of registers */ =20 -#define VREG32(reg) reg ... reg + 3 -#define VREG64(reg) reg ... reg + 7 +#define VREG32(reg) (reg) ... (reg) + 3 +#define VREG64(reg) (reg) ... (reg) + 7 =20 -#define VRANGE32(start, end) start ... end + 3 -#define VRANGE64(start, end) start ... end + 7 +#define VRANGE32(start, end) (start) ... (end) + 3 +#define VRANGE64(start, end) (start) ... (end) + 7 =20 /* * 64 bits registers can be accessible using 32-bit and 64-bit unless diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c index a2d050070473..019cf34f003a 100644 --- a/xen/arch/arm/vcpreg.c +++ b/xen/arch/arm/vcpreg.c @@ -39,7 +39,8 @@ */ =20 #ifdef CONFIG_ARM_64 -#define WRITE_SYSREG_SZ(sz, val, sysreg) WRITE_SYSREG((uint##sz##_t)val, s= ysreg) +#define WRITE_SYSREG_SZ(sz, val, sysreg) \ + WRITE_SYSREG((uint##sz##_t)(val), sysreg) #else /* * WRITE_SYSREG{32/64} on arm32 is defined as variadic macro which imposes @@ -64,7 +65,7 @@ static bool func(struct cpu_user_regs *regs, type##sz##_t= *r, bool read) \ bool cache_enabled =3D vcpu_has_cache_enabled(v); = \ = \ GUEST_BUG_ON(read); = \ - WRITE_SYSREG_SZ(sz, *r, reg); = \ + WRITE_SYSREG_SZ(sz, *(r), reg); = \ = \ p2m_toggle_cache(v, cache_enabled); = \ = \ --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220519884366.59751666549596; Thu, 29 Feb 2024 07:28:39 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687194.1070251 (Exim 4.92) (envelope-from ) id 1rfiKT-0000QV-Vx; Thu, 29 Feb 2024 15:28:13 +0000 Received: by outflank-mailman (output) from mailman id 687194.1070251; Thu, 29 Feb 2024 15:28:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKT-0000QD-Ry; Thu, 29 Feb 2024 15:28:13 +0000 Received: by outflank-mailman (input) for mailman id 687194; Thu, 29 Feb 2024 15:28:12 +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 1rfiKS-0008Ql-PM for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:12 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2576eed4-d717-11ee-a1ee-f123f15fe8a2; Thu, 29 Feb 2024 16:28:10 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id 3B1364EE074C; Thu, 29 Feb 2024 16:28:10 +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: 2576eed4-d717-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, Wei Liu Subject: [XEN PATCH 03/10] x86: address some violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:27:55 +0100 Message-Id: <3c9e90aaf5dde769b689468fc818e4ae61fa11f3.1709219010.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709220521471100010 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. GUARD(1) is also amended to avoid modifying UA_KEEP or its definition. No functional change. Signed-off-by: Nicola Vetrini --- I wasn't very sure whether touching the definition of UA_KEEP would be a go= od idea, so I added parentheses in the only user I've seen so far that causes a violation. --- xen/arch/x86/include/asm/irq.h | 6 +++--- xen/arch/x86/usercopy.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h index 082a3d6bbc6a..5c722848e8ce 100644 --- a/xen/arch/x86/include/asm/irq.h +++ b/xen/arch/x86/include/asm/irq.h @@ -179,9 +179,9 @@ void cleanup_domain_irq_mapping(struct domain *d); void *__ret =3D radix_tree_lookup(&(d)->arch.hvm.emuirq_pirq, emuirq);\ __ret ? radix_tree_ptr_to_int(__ret) : IRQ_UNBOUND; \ }) -#define IRQ_UNBOUND -1 -#define IRQ_PT -2 -#define IRQ_MSI_EMU -3 +#define IRQ_UNBOUND (-1) +#define IRQ_PT (-2) +#define IRQ_MSI_EMU (-3) =20 bool cpu_has_pending_apic_eoi(void); =20 diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c index b8c2d1cc0bed..b0b55398e968 100644 --- a/xen/arch/x86/usercopy.c +++ b/xen/arch/x86/usercopy.c @@ -106,7 +106,7 @@ unsigned int copy_from_guest_ll(void *to, const void __= user *from, unsigned int return n; } =20 -#if GUARD(1) + 0 +#if GUARD((1)) + 0 =20 /** * copy_to_guest_pv: - Copy a block of data into PV guest space. --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220519638760.424187805347; Thu, 29 Feb 2024 07:28:39 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687195.1070266 (Exim 4.92) (envelope-from ) id 1rfiKV-0000rj-Bx; Thu, 29 Feb 2024 15:28:15 +0000 Received: by outflank-mailman (output) from mailman id 687195.1070266; Thu, 29 Feb 2024 15:28:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKV-0000rA-6I; Thu, 29 Feb 2024 15:28:15 +0000 Received: by outflank-mailman (input) for mailman id 687195; Thu, 29 Feb 2024 15:28:13 +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 1rfiKT-0008Ql-F2 for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:13 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 25de8189-d717-11ee-a1ee-f123f15fe8a2; Thu, 29 Feb 2024 16:28:11 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id C5A944EE074D; Thu, 29 Feb 2024 16:28:10 +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: 25de8189-d717-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap , Wei Liu Subject: [XEN PATCH 04/10] xen/public: address violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:27:56 +0100 Message-Id: <0cdc4dc2fcad699a2274277b32de3ee0207d5a2d.1709219010.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709220521479100012 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore the macro XEN_DEFINE_UUID_ should wrap its parameters in parentheses. No functional change. Signed-off-by: Nicola Vetrini --- xen/include/public/xen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index b47d48d0e2d6..fa23080bd7af 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -988,7 +988,7 @@ typedef struct { ((b) >> 8) & 0xFF, ((b) >> 0) & 0xFF, \ ((c) >> 8) & 0xFF, ((c) >> 0) & 0xFF, \ ((d) >> 8) & 0xFF, ((d) >> 0) & 0xFF, \ - e1, e2, e3, e4, e5, e6}} + (e1), (e2), (e3), (e4), (e5), (e6)}} =20 #if defined(__STDC_VERSION__) ? __STDC_VERSION__ >=3D 199901L : defined(__= GNUC__) #define XEN_DEFINE_UUID(a, b, c, d, e1, e2, e3, e4, e5, e6) \ --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220520268813.4589261837178; Thu, 29 Feb 2024 07:28:40 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687193.1070246 (Exim 4.92) (envelope-from ) id 1rfiKT-0000Ob-NY; Thu, 29 Feb 2024 15:28:13 +0000 Received: by outflank-mailman (output) from mailman id 687193.1070246; Thu, 29 Feb 2024 15:28:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKT-0000OP-KM; Thu, 29 Feb 2024 15:28:13 +0000 Received: by outflank-mailman (input) for mailman id 687193; Thu, 29 Feb 2024 15:28:12 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKS-00087e-Nk for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:12 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 26432195-d717-11ee-afd8-a90da7624cb6; Thu, 29 Feb 2024 16:28:12 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id 7886A4EE074E; Thu, 29 Feb 2024 16:28:11 +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: 26432195-d717-11ee-afd8-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap , Wei Liu Subject: [XEN PATCH 05/10] xen/perfc: address violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:27:57 +0100 Message-Id: <3418c09bb8c4ceeceb66334191adfad190954f56.1709219010.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709220521463100009 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini --- xen/common/perfc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/common/perfc.c b/xen/common/perfc.c index 7400667bf0c4..02f4fc8fe032 100644 --- a/xen/common/perfc.c +++ b/xen/common/perfc.c @@ -10,10 +10,10 @@ #include #include =20 -#define PERFCOUNTER( var, name ) { name, TYPE_SINGLE, 0 }, -#define PERFCOUNTER_ARRAY( var, name, size ) { name, TYPE_ARRAY, size }, -#define PERFSTATUS( var, name ) { name, TYPE_S_SINGLE, 0 }, -#define PERFSTATUS_ARRAY( var, name, size ) { name, TYPE_S_ARRAY, size = }, +#define PERFCOUNTER( var, name ) { (name), TYPE_SINGLE, 0 }, +#define PERFCOUNTER_ARRAY( var, name, size ) { (name), TYPE_ARRAY, (size= ) }, +#define PERFSTATUS( var, name ) { (name), TYPE_S_SINGLE, 0 }, +#define PERFSTATUS_ARRAY( var, name, size ) { (name), TYPE_S_ARRAY, (si= ze) }, static const struct { const char *name; enum { TYPE_SINGLE, TYPE_ARRAY, --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220515973976.2779074583402; Thu, 29 Feb 2024 07:28:35 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687196.1070271 (Exim 4.92) (envelope-from ) id 1rfiKV-0000wt-O0; Thu, 29 Feb 2024 15:28:15 +0000 Received: by outflank-mailman (output) from mailman id 687196.1070271; Thu, 29 Feb 2024 15:28:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKV-0000vn-Gq; Thu, 29 Feb 2024 15:28:15 +0000 Received: by outflank-mailman (input) for mailman id 687196; Thu, 29 Feb 2024 15:28:13 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKT-00087e-KT for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:13 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 26a97bd9-d717-11ee-afd8-a90da7624cb6; Thu, 29 Feb 2024 16:28:13 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id 2112C4EE074F; Thu, 29 Feb 2024 16:28:12 +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: 26a97bd9-d717-11ee-afd8-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, Rahul Singh , Volodymyr Babchuk Subject: [XEN PATCH 06/10] arm/smmu: address some violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:27:58 +0100 Message-Id: <8bbf294d832b973648e84e5d837b1878a84f7645.1709219010.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709220517526100002 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- xen/drivers/passthrough/arm/smmu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu.c b/xen/drivers/passthrough/a= rm/smmu.c index 625ed0e41961..83196057a937 100644 --- a/xen/drivers/passthrough/arm/smmu.c +++ b/xen/drivers/passthrough/arm/smmu.c @@ -242,7 +242,7 @@ struct arm_smmu_xen_device { struct iommu_group *group; }; =20 -#define dev_archdata(dev) ((struct arm_smmu_xen_device *)dev->iommu) +#define dev_archdata(dev) ((struct arm_smmu_xen_device *)(dev)->iommu) #define dev_iommu_domain(dev) (dev_archdata(dev)->domain) #define dev_iommu_group(dev) (dev_archdata(dev)->group) =20 @@ -627,7 +627,7 @@ struct arm_smmu_master_cfg { }; #define INVALID_SMENDX -1 #define for_each_cfg_sme(cfg, i, idx, num) \ - for (i =3D 0; idx =3D cfg->smendx[i], i < num; ++i) + for (i =3D 0; idx =3D (cfg)->smendx[i], (i) < (num); ++(i)) =20 struct arm_smmu_master { struct device_node *of_node; --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220520831716.4376487071905; Thu, 29 Feb 2024 07:28:40 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687197.1070277 (Exim 4.92) (envelope-from ) id 1rfiKW-00012z-74; Thu, 29 Feb 2024 15:28:16 +0000 Received: by outflank-mailman (output) from mailman id 687197.1070277; Thu, 29 Feb 2024 15:28:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKV-00010D-Tv; Thu, 29 Feb 2024 15:28:15 +0000 Received: by outflank-mailman (input) for mailman id 687197; Thu, 29 Feb 2024 15:28:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKU-00087e-2r for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:14 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 2711c01f-d717-11ee-afd8-a90da7624cb6; Thu, 29 Feb 2024 16:28:13 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id C4A8C4EE0737; Thu, 29 Feb 2024 16:28:12 +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: 2711c01f-d717-11ee-afd8-a90da7624cb6 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, Rahul Singh , Volodymyr Babchuk Subject: [XEN PATCH 07/10] xen/arm: smmuv3: address violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:27:59 +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: 1709220521472100011 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- xen/drivers/passthrough/arm/smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthroug= h/arm/smmu-v3.c index c3ac6d17d1c8..b1c40c2c0ae7 100644 --- a/xen/drivers/passthrough/arm/smmu-v3.c +++ b/xen/drivers/passthrough/arm/smmu-v3.c @@ -111,7 +111,7 @@ #define GFP_KERNEL 0 =20 /* Device logger functions */ -#define dev_name(dev) dt_node_full_name(dev->of_node) +#define dev_name(dev) dt_node_full_name((dev)->of_node) #define dev_dbg(dev, fmt, ...) \ printk(XENLOG_DEBUG "SMMUv3: %s: " fmt, dev_name(dev), ## __VA_ARGS__) #define dev_notice(dev, fmt, ...) \ --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220515972866.7729130852018; Thu, 29 Feb 2024 07:28:35 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687198.1070291 (Exim 4.92) (envelope-from ) id 1rfiKX-0001Rx-IP; Thu, 29 Feb 2024 15:28:17 +0000 Received: by outflank-mailman (output) from mailman id 687198.1070291; Thu, 29 Feb 2024 15:28:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKX-0001RX-BU; Thu, 29 Feb 2024 15:28:17 +0000 Received: by outflank-mailman (input) for mailman id 687198; Thu, 29 Feb 2024 15:28:15 +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 1rfiKV-0008Ql-QY for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:15 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 277a35f8-d717-11ee-a1ee-f123f15fe8a2; Thu, 29 Feb 2024 16:28:14 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id 7B5DA4EE0751; Thu, 29 Feb 2024 16:28:13 +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: 277a35f8-d717-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap , Wei Liu Subject: [XEN PATCH 08/10] xen/errno: address violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:28:00 +0100 Message-Id: <92dbcd9e5aa2ab45c50f3f567ddece59108568ad.1709219010.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709220517509100001 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/include/xen/errno.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/xen/errno.h b/xen/include/xen/errno.h index 69b28dd3c6c5..506674701fae 100644 --- a/xen/include/xen/errno.h +++ b/xen/include/xen/errno.h @@ -3,7 +3,7 @@ =20 #ifndef __ASSEMBLY__ =20 -#define XEN_ERRNO(name, value) name =3D value, +#define XEN_ERRNO(name, value) name =3D (value), enum { #include }; --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220518891272.16846594468757; Thu, 29 Feb 2024 07:28:38 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687199.1070296 (Exim 4.92) (envelope-from ) id 1rfiKY-0001Xr-5R; Thu, 29 Feb 2024 15:28:18 +0000 Received: by outflank-mailman (output) from mailman id 687199.1070296; Thu, 29 Feb 2024 15:28:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKX-0001Vj-Qj; Thu, 29 Feb 2024 15:28:17 +0000 Received: by outflank-mailman (input) for mailman id 687199; Thu, 29 Feb 2024 15:28:16 +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 1rfiKW-0008Ql-Nu for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:16 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 27e30321-d717-11ee-a1ee-f123f15fe8a2; Thu, 29 Feb 2024 16:28:15 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id 2F2B24EE0750; Thu, 29 Feb 2024 16:28:14 +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: 27e30321-d717-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap , Wei Liu Subject: [XEN PATCH 09/10] xen/include: tasklet: address violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:28:01 +0100 Message-Id: <952d13bdb830cb1d8d3282e49333323bc8755cd5.1709219010.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709220519469100007 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- xen/include/xen/tasklet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/xen/tasklet.h b/xen/include/xen/tasklet.h index 593d6a2400fb..78760b694a39 100644 --- a/xen/include/xen/tasklet.h +++ b/xen/include/xen/tasklet.h @@ -27,7 +27,7 @@ struct tasklet =20 #define _DECLARE_TASKLET(name, func, data, softirq) \ struct tasklet name =3D { \ - LIST_HEAD_INIT(name.list), -1, softirq, 0, 0, func, data } + LIST_HEAD_INIT((name).list), -1, softirq, 0, 0, func, data } #define DECLARE_TASKLET(name, func, data) \ _DECLARE_TASKLET(name, func, data, 0) #define DECLARE_SOFTIRQ_TASKLET(name, func, data) \ --=20 2.34.1 From nobody Tue May 21 14:45:54 2024 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 1709220521503884.6778064771571; Thu, 29 Feb 2024 07:28:41 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.687200.1070302 (Exim 4.92) (envelope-from ) id 1rfiKY-0001fA-In; Thu, 29 Feb 2024 15:28:18 +0000 Received: by outflank-mailman (output) from mailman id 687200.1070302; Thu, 29 Feb 2024 15:28:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfiKY-0001cQ-6M; Thu, 29 Feb 2024 15:28:18 +0000 Received: by outflank-mailman (input) for mailman id 687200; Thu, 29 Feb 2024 15:28:17 +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 1rfiKX-0008Ql-4w for xen-devel@lists.xenproject.org; Thu, 29 Feb 2024 15:28:17 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 28499bfa-d717-11ee-a1ee-f123f15fe8a2; Thu, 29 Feb 2024 16:28:15 +0100 (CET) Received: from nico.bugseng.com (unknown [46.228.253.196]) by support.bugseng.com (Postfix) with ESMTPSA id D53774EE0752; Thu, 29 Feb 2024 16:28:14 +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: 28499bfa-d717-11ee-a1ee-f123f15fe8a2 From: Nicola Vetrini To: nicola.vetrini@bugseng.com, xen-devel@lists.xenproject.org Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, jbeulich@suse.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, George Dunlap , Wei Liu Subject: [XEN PATCH 10/10] xen/keyhandler: address violations of MISRA C Rule 20.7 Date: Thu, 29 Feb 2024 16:28:02 +0100 Message-Id: <2bc4a964f0f2f47488e72237678e944dbdbd7bb7.1709219010.git.nicola.vetrini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1709220523491100020 Content-Type: text/plain; charset="utf-8" MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, some macro definitions should gain additional parentheses to ensure that all current and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- xen/common/keyhandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 127ca506965c..4c1ce007870f 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -42,10 +42,10 @@ static struct keyhandler { } key_table[128] __read_mostly =3D { #define KEYHANDLER(k, f, desc, diag) \ - [k] =3D { { .fn =3D (f) }, desc, 0, diag } + [k] =3D { { .fn =3D (f) }, (desc), 0, (diag) } =20 #define IRQ_KEYHANDLER(k, f, desc, diag) \ - [k] =3D { { .irq_fn =3D (f) }, desc, 1, diag } + [k] =3D { { .irq_fn =3D (f) }, (desc), 1, (diag) } =20 IRQ_KEYHANDLER('A', do_toggle_alt_key, "toggle alternative key handlin= g", 0), IRQ_KEYHANDLER('d', dump_registers, "dump registers", 1), --=20 2.34.1