From patchwork Wed Dec 20 11:03:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Federico Serafini X-Patchwork-Id: 13499978 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52028C4706F for ; Wed, 20 Dec 2023 11:03:34 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.657633.1026628 (Exim 4.92) (envelope-from ) id 1rFuME-0005CK-2j; Wed, 20 Dec 2023 11:03:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 657633.1026628; Wed, 20 Dec 2023 11:03:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFuMD-0005Ba-T5; Wed, 20 Dec 2023 11:03:21 +0000 Received: by outflank-mailman (input) for mailman id 657633; Wed, 20 Dec 2023 11:03:20 +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 1rFuMC-00054g-JY for xen-devel@lists.xenproject.org; Wed, 20 Dec 2023 11:03:20 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 61969488-9f27-11ee-9b0f-b553b5be7939; Wed, 20 Dec 2023 12:03:18 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.161.218.228]) by support.bugseng.com (Postfix) with ESMTPSA id 6169E4EE0C99; Wed, 20 Dec 2023 12:03:17 +0100 (CET) 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: 61969488-9f27-11ee-9b0f-b553b5be7939 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH 1/7] xen/arm: gic-v3: address violations of MISRA C:2012 Rule 16.3 Date: Wed, 20 Dec 2023 12:03:01 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add the pseudo-keyword fallthrough to meet the requirements to deviate Rule 16.3 ("An unconditional `break' statement shall terminate every switch-clause"). No functional change. Signed-off-by: Federico Serafini Acked-by: Julien Grall --- xen/arch/arm/gic-v3.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index 18289cd645..bf0e5c1b75 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -65,34 +65,49 @@ static inline void gicv3_save_lrs(struct vcpu *v) { case 16: v->arch.gic.v3.lr[15] = READ_SYSREG_LR(15); + fallthrough; case 15: v->arch.gic.v3.lr[14] = READ_SYSREG_LR(14); + fallthrough; case 14: v->arch.gic.v3.lr[13] = READ_SYSREG_LR(13); + fallthrough; case 13: v->arch.gic.v3.lr[12] = READ_SYSREG_LR(12); + fallthrough; case 12: v->arch.gic.v3.lr[11] = READ_SYSREG_LR(11); + fallthrough; case 11: v->arch.gic.v3.lr[10] = READ_SYSREG_LR(10); + fallthrough; case 10: v->arch.gic.v3.lr[9] = READ_SYSREG_LR(9); + fallthrough; case 9: v->arch.gic.v3.lr[8] = READ_SYSREG_LR(8); + fallthrough; case 8: v->arch.gic.v3.lr[7] = READ_SYSREG_LR(7); + fallthrough; case 7: v->arch.gic.v3.lr[6] = READ_SYSREG_LR(6); + fallthrough; case 6: v->arch.gic.v3.lr[5] = READ_SYSREG_LR(5); + fallthrough; case 5: v->arch.gic.v3.lr[4] = READ_SYSREG_LR(4); + fallthrough; case 4: v->arch.gic.v3.lr[3] = READ_SYSREG_LR(3); + fallthrough; case 3: v->arch.gic.v3.lr[2] = READ_SYSREG_LR(2); + fallthrough; case 2: v->arch.gic.v3.lr[1] = READ_SYSREG_LR(1); + fallthrough; case 1: v->arch.gic.v3.lr[0] = READ_SYSREG_LR(0); break; @@ -112,34 +127,49 @@ static inline void gicv3_restore_lrs(const struct vcpu *v) { case 16: WRITE_SYSREG_LR(v->arch.gic.v3.lr[15], 15); + fallthrough; case 15: WRITE_SYSREG_LR(v->arch.gic.v3.lr[14], 14); + fallthrough; case 14: WRITE_SYSREG_LR(v->arch.gic.v3.lr[13], 13); + fallthrough; case 13: WRITE_SYSREG_LR(v->arch.gic.v3.lr[12], 12); + fallthrough; case 12: WRITE_SYSREG_LR(v->arch.gic.v3.lr[11], 11); + fallthrough; case 11: WRITE_SYSREG_LR(v->arch.gic.v3.lr[10], 10); + fallthrough; case 10: WRITE_SYSREG_LR(v->arch.gic.v3.lr[9], 9); + fallthrough; case 9: WRITE_SYSREG_LR(v->arch.gic.v3.lr[8], 8); + fallthrough; case 8: WRITE_SYSREG_LR(v->arch.gic.v3.lr[7], 7); + fallthrough; case 7: WRITE_SYSREG_LR(v->arch.gic.v3.lr[6], 6); + fallthrough; case 6: WRITE_SYSREG_LR(v->arch.gic.v3.lr[5], 5); + fallthrough; case 5: WRITE_SYSREG_LR(v->arch.gic.v3.lr[4], 4); + fallthrough; case 4: WRITE_SYSREG_LR(v->arch.gic.v3.lr[3], 3); + fallthrough; case 3: WRITE_SYSREG_LR(v->arch.gic.v3.lr[2], 2); + fallthrough; case 2: WRITE_SYSREG_LR(v->arch.gic.v3.lr[1], 1); + fallthrough; case 1: WRITE_SYSREG_LR(v->arch.gic.v3.lr[0], 0); break; From patchwork Wed Dec 20 11:03:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Federico Serafini X-Patchwork-Id: 13499973 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B50ADC46CD3 for ; Wed, 20 Dec 2023 11:03:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.657632.1026621 (Exim 4.92) (envelope-from ) id 1rFuMD-00058e-MF; Wed, 20 Dec 2023 11:03:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 657632.1026621; Wed, 20 Dec 2023 11:03:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFuMD-00057L-J2; Wed, 20 Dec 2023 11:03:21 +0000 Received: by outflank-mailman (input) for mailman id 657632; Wed, 20 Dec 2023 11:03:20 +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 1rFuMC-0004rG-59 for xen-devel@lists.xenproject.org; Wed, 20 Dec 2023 11:03:20 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6227cee9-9f27-11ee-98eb-6d05b1d4d9a1; Wed, 20 Dec 2023 12:03:19 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.161.218.228]) by support.bugseng.com (Postfix) with ESMTPSA id 8BE794EE0C9A; Wed, 20 Dec 2023 12:03:18 +0100 (CET) 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: 6227cee9-9f27-11ee-98eb-6d05b1d4d9a1 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH 2/7] xen/arm: traps: address violations of MISRA C:2012 Rule 16.3 Date: Wed, 20 Dec 2023 12:03:02 +0100 Message-Id: <90c6cdb780ff7b75aada2a8a8a2df5d9e8b94b78.1703066935.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 MISRA C:2012 Rule 16.3 states: "An unconditional `break' statement shall terminate every switch-clause". Add missing break statements to address violations of Rule 16.3. Add pseudo-keyword "fallthrough" to make explicit the intended behavior and satisfy the requirements to deviate Rule 16.3. No functional change. Signed-off-by: Federico Serafini Acked-by: Julien Grall --- xen/arch/arm/traps.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 77220ba092..9c10e8f78c 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1414,10 +1414,18 @@ static void do_trap_hypercall(struct cpu_user_regs *regs, register_t *nr, { /* Deliberately corrupt parameter regs used by this hypercall. */ switch ( hypercall_args[*nr] ) { - case 5: HYPERCALL_ARG5(regs) = 0xDEADBEEFU; - case 4: HYPERCALL_ARG4(regs) = 0xDEADBEEFU; - case 3: HYPERCALL_ARG3(regs) = 0xDEADBEEFU; - case 2: HYPERCALL_ARG2(regs) = 0xDEADBEEFU; + case 5: + HYPERCALL_ARG5(regs) = 0xDEADBEEFU; + fallthrough; + case 4: + HYPERCALL_ARG4(regs) = 0xDEADBEEFU; + fallthrough; + case 3: + HYPERCALL_ARG3(regs) = 0xDEADBEEFU; + fallthrough; + case 2: + HYPERCALL_ARG2(regs) = 0xDEADBEEFU; + fallthrough; case 1: /* Don't clobber x0/r0 -- it's the return value */ case 0: /* -ENOSYS case */ break; @@ -1929,6 +1937,7 @@ static void do_trap_stage2_abort_guest(struct cpu_user_regs *regs, gprintk(XENLOG_WARNING, "Unsupported FSC: HSR=%#"PRIregister" DFSC=%#x\n", hsr.bits, xabt.fsc); + break; } inject_abt: @@ -2136,6 +2145,7 @@ void asmlinkage do_trap_guest_sync(struct cpu_user_regs *regs) "Unknown Guest Trap. HSR=%#"PRIregister" EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n", hsr.bits, hsr.ec, hsr.len, hsr.iss); inject_undef_exception(regs, hsr); + break; } } From patchwork Wed Dec 20 11:03:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Federico Serafini X-Patchwork-Id: 13499974 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5AB06C46CD8 for ; Wed, 20 Dec 2023 11:03:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.657634.1026636 (Exim 4.92) (envelope-from ) id 1rFuME-0005OV-Ii; Wed, 20 Dec 2023 11:03:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 657634.1026636; Wed, 20 Dec 2023 11:03:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFuME-0005M8-DR; Wed, 20 Dec 2023 11:03:22 +0000 Received: by outflank-mailman (input) for mailman id 657634; Wed, 20 Dec 2023 11:03:21 +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 1rFuMD-0004rG-Au for xen-devel@lists.xenproject.org; Wed, 20 Dec 2023 11:03:21 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 62dd09f4-9f27-11ee-98eb-6d05b1d4d9a1; Wed, 20 Dec 2023 12:03:20 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.161.218.228]) by support.bugseng.com (Postfix) with ESMTPSA id 7FE1C4EE0C9B; Wed, 20 Dec 2023 12:03:19 +0100 (CET) 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: 62dd09f4-9f27-11ee-98eb-6d05b1d4d9a1 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH 3/7] xen/arm: guest_walk: address violations of MISRA C:2012 Rule 16.3 Date: Wed, 20 Dec 2023 12:03:03 +0100 Message-Id: <98175f394c2c8078a864071aacef04b8d9e1cb6a.1703066935.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add missing break statements to address violations of Rule 16.3 ("An unconditional `break' statement shall terminate every switch-clause"). No functional change. Signed-off-by: Federico Serafini Acked-by: Julien Grall --- xen/arch/arm/guest_walk.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c index d99b411f3b..2f7d3a0da7 100644 --- a/xen/arch/arm/guest_walk.c +++ b/xen/arch/arm/guest_walk.c @@ -165,6 +165,8 @@ static bool guest_walk_sd(const struct vcpu *v, *perms |= GV2M_WRITE; if ( !pte.sec.xn ) *perms |= GV2M_EXEC; + + break; } return true; @@ -260,6 +262,7 @@ static bool get_ttbr_and_gran_64bit(uint64_t *ttbr, unsigned int *gran, * fall back to 4K by default. */ *gran = GRANULE_SIZE_INDEX_4K; + break; } /* Use TTBR0 for GVA to IPA translation. */ @@ -291,6 +294,7 @@ static bool get_ttbr_and_gran_64bit(uint64_t *ttbr, unsigned int *gran, * fall back to 4K by default. */ *gran = GRANULE_SIZE_INDEX_4K; + break; } /* Use TTBR1 for GVA to IPA translation. */ From patchwork Wed Dec 20 11:03:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Federico Serafini X-Patchwork-Id: 13499976 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 38C8EC46CD4 for ; Wed, 20 Dec 2023 11:03:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.657635.1026652 (Exim 4.92) (envelope-from ) id 1rFuMG-0005ux-Qb; Wed, 20 Dec 2023 11:03:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 657635.1026652; Wed, 20 Dec 2023 11:03:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFuMG-0005uq-N0; Wed, 20 Dec 2023 11:03:24 +0000 Received: by outflank-mailman (input) for mailman id 657635; Wed, 20 Dec 2023 11:03:23 +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 1rFuMF-0004rG-1F for xen-devel@lists.xenproject.org; Wed, 20 Dec 2023 11:03:23 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 63ddd643-9f27-11ee-98eb-6d05b1d4d9a1; Wed, 20 Dec 2023 12:03:22 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.161.218.228]) by support.bugseng.com (Postfix) with ESMTPSA id DD4674EE0C9C; Wed, 20 Dec 2023 12:03:20 +0100 (CET) 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: 63ddd643-9f27-11ee-98eb-6d05b1d4d9a1 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH 4/7] xen/arm: mem_access: address violations of MISRA C:2012 Rule 16.3 Date: Wed, 20 Dec 2023 12:03:04 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Refactor of the code to have a break statement at the end of the switch-clause. This addresses violations of Rule 16.3 ("An unconditional `break' statement shall terminate every switch-clause"). No functional change. Signed-off-by: Federico Serafini --- xen/arch/arm/mem_access.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c index 31db846354..fbcb5471f7 100644 --- a/xen/arch/arm/mem_access.c +++ b/xen/arch/arm/mem_access.c @@ -168,10 +168,10 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag, * If this was a read then it was because of mem_access, but if it was * a write then the original get_page_from_gva fault was correct. */ - if ( flag == GV2M_READ ) - break; - else + if ( flag != GV2M_READ ) goto err; + + break; case XENMEM_access_rx2rw: case XENMEM_access_rx: case XENMEM_access_r: @@ -179,10 +179,10 @@ p2m_mem_access_check_and_get_page(vaddr_t gva, unsigned long flag, * If this was a write then it was because of mem_access, but if it was * a read then the original get_page_from_gva fault was correct. */ - if ( flag == GV2M_WRITE ) - break; - else + if ( flag != GV2M_WRITE ) goto err; + + break; } /* From patchwork Wed Dec 20 11:03:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Federico Serafini X-Patchwork-Id: 13499980 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5ABA7C3DA6E for ; Wed, 20 Dec 2023 11:03:37 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.657636.1026662 (Exim 4.92) (envelope-from ) id 1rFuMI-0006DE-63; Wed, 20 Dec 2023 11:03:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 657636.1026662; Wed, 20 Dec 2023 11:03:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFuMI-0006D3-1a; Wed, 20 Dec 2023 11:03:26 +0000 Received: by outflank-mailman (input) for mailman id 657636; Wed, 20 Dec 2023 11:03:24 +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 1rFuMG-0004rG-2S for xen-devel@lists.xenproject.org; Wed, 20 Dec 2023 11:03:24 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 647b579b-9f27-11ee-98eb-6d05b1d4d9a1; Wed, 20 Dec 2023 12:03:23 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.161.218.228]) by support.bugseng.com (Postfix) with ESMTPSA id 75AB84EE0C92; Wed, 20 Dec 2023 12:03:22 +0100 (CET) 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: 647b579b-9f27-11ee-98eb-6d05b1d4d9a1 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH 5/7] xen/arm: v{cp,sys}reg: address violations of MISRA C:2012 Rule 16.3 Date: Wed, 20 Dec 2023 12:03:05 +0100 Message-Id: <541bc4fd47d26b12ea131590bf0c49f7c92d9368.1703066935.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Refactor of the switch-clauses to have a return statement at the end. This satisfies the requirements to deviate Rule 16.3 ("An unconditional `break' statement shall terminate every switch-clause). No functional change. Signed-off-by: Federico Serafini Acked-by: Julien Grall --- xen/arch/arm/arm64/vsysreg.c | 4 ++-- xen/arch/arm/vcpreg.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/arm/arm64/vsysreg.c b/xen/arch/arm/arm64/vsysreg.c index b5d54c569b..247f08ad8d 100644 --- a/xen/arch/arm/arm64/vsysreg.c +++ b/xen/arch/arm/arm64/vsysreg.c @@ -210,8 +210,8 @@ void do_sysreg(struct cpu_user_regs *regs, /* RO at EL0. RAZ/WI at EL1 */ if ( regs_mode_is_user(regs) ) return handle_ro_raz(regs, regidx, hsr.sysreg.read, hsr, 0); - else - return handle_raz_wi(regs, regidx, hsr.sysreg.read, hsr, 1); + + return handle_raz_wi(regs, regidx, hsr.sysreg.read, hsr, 1); case HSR_SYSREG_PMCR_EL0: case HSR_SYSREG_PMCNTENSET_EL0: case HSR_SYSREG_PMCNTENCLR_EL0: diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c index a2d0500704..685609f825 100644 --- a/xen/arch/arm/vcpreg.c +++ b/xen/arch/arm/vcpreg.c @@ -289,8 +289,8 @@ void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr) /* RO at EL0. RAZ/WI at EL1 */ if ( regs_mode_is_user(regs) ) return handle_ro_raz(regs, regidx, cp32.read, hsr, 0); - else - return handle_raz_wi(regs, regidx, cp32.read, hsr, 1); + + return handle_raz_wi(regs, regidx, cp32.read, hsr, 1); case HSR_CPREG32(PMINTENSET): case HSR_CPREG32(PMINTENCLR): /* EL1 only, however MDCR_EL2.TPM==1 means EL0 may trap here also. */ From patchwork Wed Dec 20 11:03:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Federico Serafini X-Patchwork-Id: 13499975 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA8DFC4706C for ; Wed, 20 Dec 2023 11:03:33 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.657637.1026667 (Exim 4.92) (envelope-from ) id 1rFuMI-0006Gb-Ky; Wed, 20 Dec 2023 11:03:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 657637.1026667; Wed, 20 Dec 2023 11:03:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFuMI-0006Fe-C5; Wed, 20 Dec 2023 11:03:26 +0000 Received: by outflank-mailman (input) for mailman id 657637; Wed, 20 Dec 2023 11:03:25 +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 1rFuMH-0004rG-42 for xen-devel@lists.xenproject.org; Wed, 20 Dec 2023 11:03:25 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 651db1ee-9f27-11ee-98eb-6d05b1d4d9a1; Wed, 20 Dec 2023 12:03:24 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.161.218.228]) by support.bugseng.com (Postfix) with ESMTPSA id 6ED4C4EE0C99; Wed, 20 Dec 2023 12:03:23 +0100 (CET) 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: 651db1ee-9f27-11ee-98eb-6d05b1d4d9a1 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH 6/7] xen/arm: mmu: address a violations of MISRA C:2012 Rule 16.3 Date: Wed, 20 Dec 2023 12:03:06 +0100 Message-Id: <92740a979c4d3a19d7c76ff69b90ab211049448e.1703066935.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add missing break at the end of the switch-clause to address a violation of MISRA C:2012 Rule 16.3 ("An unconditional `break' statement shall terminate every switch-clause"). No functional change. Signed-off-by: Federico Serafini Acked-by: Julien Grall --- xen/arch/arm/mmu/p2m.c | 1 + 1 file changed, 1 insertion(+) diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c index 6a5a080307..41fcca011c 100644 --- a/xen/arch/arm/mmu/p2m.c +++ b/xen/arch/arm/mmu/p2m.c @@ -657,6 +657,7 @@ static lpae_t mfn_to_p2m_entry(mfn_t mfn, p2m_type_t t, p2m_access_t a) default: e.p2m.mattr = MATTR_MEM; e.p2m.sh = LPAE_SH_INNER; + break; } p2m_set_permission(&e, t, a); From patchwork Wed Dec 20 11:03:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Federico Serafini X-Patchwork-Id: 13499979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71FB2C46CD4 for ; Wed, 20 Dec 2023 11:03:37 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.657638.1026680 (Exim 4.92) (envelope-from ) id 1rFuMJ-0006hE-TA; Wed, 20 Dec 2023 11:03:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 657638.1026680; Wed, 20 Dec 2023 11:03:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFuMJ-0006gg-P2; Wed, 20 Dec 2023 11:03:27 +0000 Received: by outflank-mailman (input) for mailman id 657638; Wed, 20 Dec 2023 11:03:26 +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 1rFuMI-0004rG-92 for xen-devel@lists.xenproject.org; Wed, 20 Dec 2023 11:03:26 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 65d1acf7-9f27-11ee-98eb-6d05b1d4d9a1; Wed, 20 Dec 2023 12:03:25 +0100 (CET) Received: from Dell.bugseng.com (unknown [37.161.218.228]) by support.bugseng.com (Postfix) with ESMTPSA id 9D39F4EE0C9A; Wed, 20 Dec 2023 12:03:24 +0100 (CET) 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: 65d1acf7-9f27-11ee-98eb-6d05b1d4d9a1 From: Federico Serafini To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Federico Serafini , Bertrand Marquis , Rahul Singh , Stefano Stabellini , Julien Grall , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH 7/7] xen/arm: smmu-v3: address violations of MISRA C:2012 Rule 16.3 Date: Wed, 20 Dec 2023 12:03:07 +0100 Message-Id: <93d32bf20bb85b93618be5140edb1be527606b77.1703066935.git.federico.serafini@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add a break statement at the end of the switch-clauses to address violations of MISRA C:2012 Rule 16.3 ("An unconditional `break' statement shall terminate every switch-clause"). No funtional change. Signed-off-by: Federico Serafini Acked-by: Julien Grall Reviewed-by: Bertrand Marquis features |= ARM_SMMU_FEAT_STALLS; + break; } if (reg & IDR0_S2P) @@ -2301,6 +2302,7 @@ static int arm_smmu_device_hw_probe(struct arm_smmu_device *smmu) fallthrough; case IDR5_OAS_48_BIT: smmu->oas = 48; + break; } smmu->oas = min_t(unsigned long, PADDR_BITS, smmu->oas);