From nobody Mon May 13 06:21:34 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 1688033253002654.2891640586897; Thu, 29 Jun 2023 03:07:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.556720.869451 (Exim 4.92) (envelope-from ) id 1qEoYL-0000nW-DY; Thu, 29 Jun 2023 10:07:05 +0000 Received: by outflank-mailman (output) from mailman id 556720.869451; Thu, 29 Jun 2023 10:07:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qEoYL-0000nP-AL; Thu, 29 Jun 2023 10:07:05 +0000 Received: by outflank-mailman (input) for mailman id 556720; Thu, 29 Jun 2023 10:07:04 +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 1qEoYK-0000mz-CU for xen-devel@lists.xenproject.org; Thu, 29 Jun 2023 10:07:04 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b1690b83-1664-11ee-b237-6b7b168915f2; Thu, 29 Jun 2023 12:07:02 +0200 (CEST) Received: from nico.bugseng.com (unknown [151.43.188.44]) by support.bugseng.com (Postfix) with ESMTPSA id C30534EE0739; Thu, 29 Jun 2023 12:06:59 +0200 (CEST) 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: b1690b83-1664-11ee-b237-6b7b168915f2 From: Nicola Vetrini To: 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, Nicola Vetrini , Volodymyr Babchuk Subject: [XEN PATCH v3 1/3] xen/arch/arm: fix violations of MISRA C:2012 Rule 3.1 Date: Thu, 29 Jun 2023 12:06:15 +0200 Message-Id: <7996a8bb62e62076d48bdf289e37352bb5e43b52.1688032865.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: 1688033255249100003 Content-Type: text/plain; charset="utf-8" In the files `xen/arch/arm/include/asm/arm(32|64)/flushtlb.h' there are a few occurrences of nested '//' character sequences inside C-style comment blocks, which violate Rule 3.1. The patch aims to resolve those by changing the inner comments to arm asm comments, delimited by ';' instead. Signed-off-by: Nicola Vetrini Reviewed-by: Luca Fancellu Reviewed-by: Stefano Stabellini --- Changes: - Resending the patch with the right maintainers in CC. Changes in V2: - Split the patch into a series and reworked the fix. - Apply the fix to the arm32 `flushtlb.h' file, for consistency Changes in V3: - Switched to arm asm comment in `arm(32|64)/flushtlb.h' --- xen/arch/arm/include/asm/arm32/flushtlb.h | 8 ++++---- xen/arch/arm/include/asm/arm64/flushtlb.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/include/asm/arm32/flushtlb.h b/xen/arch/arm/inclu= de/asm/arm32/flushtlb.h index 22ee3b317b..61c25a3189 100644 --- a/xen/arch/arm/include/asm/arm32/flushtlb.h +++ b/xen/arch/arm/include/asm/arm32/flushtlb.h @@ -4,10 +4,10 @@ /* * Every invalidation operation use the following patterns: * - * DSB ISHST // Ensure prior page-tables updates have completed - * TLBI... // Invalidate the TLB - * DSB ISH // Ensure the TLB invalidation has completed - * ISB // See explanation below + * DSB ISHST ; Ensure prior page-tables updates have completed + * TLBI... ; Invalidate the TLB + * DSB ISH ; Ensure the TLB invalidation has completed + * ISB ; See explanation below * * For Xen page-tables the ISB will discard any instructions fetched * from the old mappings. diff --git a/xen/arch/arm/include/asm/arm64/flushtlb.h b/xen/arch/arm/inclu= de/asm/arm64/flushtlb.h index 56c6fc763b..45642201d1 100644 --- a/xen/arch/arm/include/asm/arm64/flushtlb.h +++ b/xen/arch/arm/include/asm/arm64/flushtlb.h @@ -4,10 +4,10 @@ /* * Every invalidation operation use the following patterns: * - * DSB ISHST // Ensure prior page-tables updates have completed - * TLBI... // Invalidate the TLB - * DSB ISH // Ensure the TLB invalidation has completed - * ISB // See explanation below + * DSB ISHST ; Ensure prior page-tables updates have completed + * TLBI... ; Invalidate the TLB + * DSB ISH ; Ensure the TLB invalidation has completed + * ISB ; See explanation below * * ARM64_WORKAROUND_REPEAT_TLBI: * Modification of the translation table for a virtual address might lead = to --=20 2.34.1 From nobody Mon May 13 06:21:34 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 168803325386729.262340414182745; Thu, 29 Jun 2023 03:07:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.556722.869461 (Exim 4.92) (envelope-from ) id 1qEoYQ-00014y-Lk; Thu, 29 Jun 2023 10:07:10 +0000 Received: by outflank-mailman (output) from mailman id 556722.869461; Thu, 29 Jun 2023 10:07:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qEoYQ-00014n-Ik; Thu, 29 Jun 2023 10:07:10 +0000 Received: by outflank-mailman (input) for mailman id 556722; Thu, 29 Jun 2023 10:07:09 +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 1qEoYP-0000mz-HI for xen-devel@lists.xenproject.org; Thu, 29 Jun 2023 10:07:09 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b501fc14-1664-11ee-b237-6b7b168915f2; Thu, 29 Jun 2023 12:07:08 +0200 (CEST) Received: from nico.bugseng.com (unknown [151.43.188.44]) by support.bugseng.com (Postfix) with ESMTPSA id 829344EE0738; Thu, 29 Jun 2023 12:07:05 +0200 (CEST) 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: b501fc14-1664-11ee-b237-6b7b168915f2 From: Nicola Vetrini To: 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, Nicola Vetrini , Rahul Singh , Volodymyr Babchuk Subject: [XEN PATCH v3 2/3] xen/drivers/passthrough/arm/smmu-v3.c: fix violations of MISRA C:2012 Rule 3.1 Date: Thu, 29 Jun 2023 12:06:16 +0200 Message-Id: <8a8d5ed47f24791d3927345fafed07023a8b0b76.1688032865.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: 1688033255057100001 Content-Type: text/plain; charset="utf-8" In the file `xen/drivers/passthrough/arm/smmu-v3.c' there are a few occurre= nces of nested '//' character sequences inside C-style comment blocks, which vio= late Rule 3.1. The patch aims to resolve those by replacing the nested comments with equivalent constructs that do not violate the rule. Signed-off-by: Nicola Vetrini Changes: - Resending the patch with the right maintainers in CC. Changes in V2: - Split the patch into a series and reworked the fix. - Apply the fix to the arm32 `flushtlb.h' file, for consistency Changes in V3: - Revised the comment to make it clear the function the parallel control flows in the comment belong to. Acked-by: Rahul Singh Reviewed-by: Luca Fancellu Reviewed-by: Stefano Stabellini --- xen/drivers/passthrough/arm/smmu-v3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthroug= h/arm/smmu-v3.c index 720aa69ff2..cdbb505134 100644 --- a/xen/drivers/passthrough/arm/smmu-v3.c +++ b/xen/drivers/passthrough/arm/smmu-v3.c @@ -1047,10 +1047,10 @@ static int arm_smmu_atc_inv_domain(struct arm_smmu_= domain *smmu_domain, * before we read 'nr_ats_masters' in case of a concurrent call to * arm_smmu_enable_ats(): * - * // unmap() // arm_smmu_enable_ats() - * TLBI+SYNC atomic_inc(&nr_ats_masters); - * smp_mb(); [...] - * atomic_read(&nr_ats_masters); pci_enable_ats() // writel() + * --- unmap() --- --- arm_smmu_enable_ats() --- + * TLBI+SYNC atomic_inc(&nr_ats_masters); + * smp_mb(); [...] + * atomic_read(&nr_ats_masters); pci_enable_ats() (see writel()) * * Ensures that we always see the incremented 'nr_ats_masters' count if * ATS was enabled at the PCI device before completion of the TLBI. --=20 2.34.1 From nobody Mon May 13 06:21:34 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 168803326163017.487754843680364; Thu, 29 Jun 2023 03:07:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.556724.869471 (Exim 4.92) (envelope-from ) id 1qEoYU-0001PT-TI; Thu, 29 Jun 2023 10:07:14 +0000 Received: by outflank-mailman (output) from mailman id 556724.869471; Thu, 29 Jun 2023 10:07:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qEoYU-0001PM-Pq; Thu, 29 Jun 2023 10:07:14 +0000 Received: by outflank-mailman (input) for mailman id 556724; Thu, 29 Jun 2023 10:07: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 1qEoYT-0000mz-TN for xen-devel@lists.xenproject.org; Thu, 29 Jun 2023 10:07:13 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b7dfd45c-1664-11ee-b237-6b7b168915f2; Thu, 29 Jun 2023 12:07:13 +0200 (CEST) Received: from nico.bugseng.com (unknown [151.43.188.44]) by support.bugseng.com (Postfix) with ESMTPSA id B76564EE0739; Thu, 29 Jun 2023 12:07:10 +0200 (CEST) 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: b7dfd45c-1664-11ee-b237-6b7b168915f2 From: Nicola Vetrini To: 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, Nicola Vetrini , George Dunlap , Wei Liu Subject: [XEN PATCH v3 3/3] xen: fix violations of MISRA C:2012 Rule 3.1 Date: Thu, 29 Jun 2023 12:06:17 +0200 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: 1688033262594100001 Content-Type: text/plain; charset="utf-8" In the files modified by this patch there are a few occurrences of nested '= //' character sequences inside C-style comment blocks, which violate Rule 3.1. The patch aims to resolve those by removing the nested comments. In the file 'xen/common/xmalloc_tlsf.c' the comment has been replaces by an ASSERT, to ensure that the invariant in the comment is enforced. In the file 'xen/include/xen/atomic.h' the nested comment has been removed, since the code sample is already explained by the preceding comment. Signed-off-by: Nicola Vetrini Changes: - Resending the patch with the right maintainers in CC. Changes in V2: - Split the patch into a series and reworked the fix; - Apply the fix to the arm32 `flushtlb.h' file, for consistency. Changes in V3: - Replaced commmented-out 'if' with an ASSERT( *fl >=3D 0 ). Reviewed-by: Luca Fancellu --- xen/common/xmalloc_tlsf.c | 4 +--- xen/include/xen/atomic.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/xen/common/xmalloc_tlsf.c b/xen/common/xmalloc_tlsf.c index 75bdf18c4e..95affcc571 100644 --- a/xen/common/xmalloc_tlsf.c +++ b/xen/common/xmalloc_tlsf.c @@ -140,9 +140,7 @@ static inline void MAPPING_SEARCH(unsigned long *r, int= *fl, int *sl) *fl =3D flsl(*r) - 1; *sl =3D (*r >> (*fl - MAX_LOG2_SLI)) - MAX_SLI; *fl -=3D FLI_OFFSET; - /*if ((*fl -=3D FLI_OFFSET) < 0) // FL will be always >0! - *fl =3D *sl =3D 0; - */ + ASSERT( *fl >=3D 0 ); *r &=3D ~t; } } diff --git a/xen/include/xen/atomic.h b/xen/include/xen/atomic.h index 529213ebbb..fa750a18ae 100644 --- a/xen/include/xen/atomic.h +++ b/xen/include/xen/atomic.h @@ -78,7 +78,7 @@ static inline void _atomic_set(atomic_t *v, int i); * int old =3D atomic_read(&v); * int new =3D old + 1; * if ( likely(old =3D=3D atomic_cmpxchg(&v, old, new)) ) - * break; // success! + * break; * } */ static inline int atomic_cmpxchg(atomic_t *v, int old, int new); --=20 2.34.1