From nobody Fri May 17 01:43:38 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 1712308508270485.8598195137764; Fri, 5 Apr 2024 02:15:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701160.1095347 (Exim 4.92) (envelope-from ) id 1rsfep-0007Z2-S5; Fri, 05 Apr 2024 09:14:47 +0000 Received: by outflank-mailman (output) from mailman id 701160.1095347; Fri, 05 Apr 2024 09:14:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfep-0007YW-Me; Fri, 05 Apr 2024 09:14:47 +0000 Received: by outflank-mailman (input) for mailman id 701160; Fri, 05 Apr 2024 09:14:46 +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 1rsfeo-0007WZ-Dr for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:46 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f0eb9a0d-f32c-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 11:14:44 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id CCE414EE0742; Fri, 5 Apr 2024 11:14:42 +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: f0eb9a0d-f32c-11ee-a1ef-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, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [XEN PATCH v2 1/9] x86/vlapic: tidy switch statement and address MISRA violation Date: Fri, 5 Apr 2024 11:14:29 +0200 Message-Id: <81ecc35d04456771b1e48cb25155b0151e2225b8.1712305581.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: 1712308509433100002 Content-Type: text/plain; charset="utf-8" Remove unneded blank lines between switch clauses. Refactor the last clauses so that a violation of MISRA C Rule 16.2 is resolved (A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement). The switch clause ending with the pseudo keyword "fallthrough" is an allowed exception to Rule 16.3. No functional change. Suggested-by: Jan Beulich Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- xen/arch/x86/hvm/vlapic.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index dcbcf4a1feb5..81efe5472518 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -976,7 +976,6 @@ int guest_wrmsr_x2apic(struct vcpu *v, uint32_t msr, ui= nt64_t val) if ( val & ~APIC_TPRI_MASK ) return X86EMUL_EXCEPTION; break; - case APIC_SPIV: if ( val & ~(APIC_VECTOR_MASK | APIC_SPIV_APIC_ENABLED | APIC_SPIV_FOCUS_DISABLED | @@ -984,38 +983,31 @@ int guest_wrmsr_x2apic(struct vcpu *v, uint32_t msr, = uint64_t val) ? APIC_SPIV_DIRECTED_EOI : 0)) ) return X86EMUL_EXCEPTION; break; - case APIC_LVTT: if ( val & ~(LVT_MASK | APIC_TIMER_MODE_MASK) ) return X86EMUL_EXCEPTION; break; - case APIC_LVTTHMR: case APIC_LVTPC: case APIC_CMCI: if ( val & ~(LVT_MASK | APIC_DM_MASK) ) return X86EMUL_EXCEPTION; break; - case APIC_LVT0: case APIC_LVT1: if ( val & ~LINT_MASK ) return X86EMUL_EXCEPTION; break; - case APIC_LVTERR: if ( val & ~LVT_MASK ) return X86EMUL_EXCEPTION; break; - case APIC_TMICT: break; - case APIC_TDCR: if ( val & ~APIC_TDR_DIV_MASK ) return X86EMUL_EXCEPTION; break; - case APIC_ICR: if ( (uint32_t)val & ~(APIC_VECTOR_MASK | APIC_DM_MASK | APIC_DEST_MASK | APIC_INT_ASSERT | @@ -1023,21 +1015,19 @@ int guest_wrmsr_x2apic(struct vcpu *v, uint32_t msr= , uint64_t val) return X86EMUL_EXCEPTION; vlapic_set_reg(vlapic, APIC_ICR2, val >> 32); break; - case APIC_SELF_IPI: if ( val & ~APIC_VECTOR_MASK ) return X86EMUL_EXCEPTION; offset =3D APIC_ICR; val =3D APIC_DEST_SELF | (val & APIC_VECTOR_MASK); break; - case APIC_EOI: case APIC_ESR: - if ( val ) - { + if ( !val ) + break; + fallthrough; default: return X86EMUL_EXCEPTION; - } } =20 vlapic_reg_write(v, array_index_nospec(offset, PAGE_SIZE), val); --=20 2.34.1 From nobody Fri May 17 01:43:38 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 1712308510620121.8794753259441; Fri, 5 Apr 2024 02:15:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701161.1095348 (Exim 4.92) (envelope-from ) id 1rsfeq-0007eO-03; Fri, 05 Apr 2024 09:14:48 +0000 Received: by outflank-mailman (output) from mailman id 701161.1095348; Fri, 05 Apr 2024 09:14:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfep-0007cS-TN; Fri, 05 Apr 2024 09:14:47 +0000 Received: by outflank-mailman (input) for mailman id 701161; Fri, 05 Apr 2024 09:14:46 +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 1rsfeo-0007WZ-Ti for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:46 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f17dc861-f32c-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 11:14:45 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 331774EE0743; Fri, 5 Apr 2024 11:14:44 +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: f17dc861-f32c-11ee-a1ef-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, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [XEN PATCH v2 2/9] x86/cpuid: address violation of MISRA C Rule 16.2 Date: Fri, 5 Apr 2024 11:14:30 +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: 1712308511373100010 Content-Type: text/plain; charset="utf-8" Refactor the switch so that a violation of MISRA C Rule 16.2 is resolved (A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement). Note that the switch clause ending with the pseudo keyword "fallthrough" is an allowed exception to Rule 16.3. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/arch/x86/cpuid.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c index 7290a979c667..0a7c55199f94 100644 --- a/xen/arch/x86/cpuid.c +++ b/xen/arch/x86/cpuid.c @@ -331,23 +331,22 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf, switch ( subleaf ) { case 1: - if ( p->xstate.xsavec || p->xstate.xsaves ) - { - /* - * TODO: Figure out what to do for XSS state. VT-x manages - * host vs guest MSR_XSS automatically, so as soon as we s= tart - * supporting any XSS states, the wrong XSS will be in - * context. - */ - BUILD_BUG_ON(XSTATE_XSAVES_ONLY !=3D 0); - - /* - * Read CPUID[0xD,0/1].EBX from hardware. They vary with - * enabled XSTATE, and appropraite XCR0|XSS are in context. - */ + if ( !(p->xstate.xsavec || p->xstate.xsaves) ) + break; + /* + * TODO: Figure out what to do for XSS state. VT-x manages + * host vs guest MSR_XSS automatically, so as soon as we start + * supporting any XSS states, the wrong XSS will be in + * context. + */ + BUILD_BUG_ON(XSTATE_XSAVES_ONLY !=3D 0); + fallthrough; case 0: - res->b =3D cpuid_count_ebx(leaf, subleaf); - } + /* + * Read CPUID[0xD,0/1].EBX from hardware. They vary with + * enabled XSTATE, and appropriate XCR0|XSS are in context. + */ + res->b =3D cpuid_count_ebx(leaf, subleaf); break; } break; --=20 2.34.1 From nobody Fri May 17 01:43:38 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 1712308507890613.9171434701649; Fri, 5 Apr 2024 02:15:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701162.1095371 (Exim 4.92) (envelope-from ) id 1rsfer-0008Ed-FR; Fri, 05 Apr 2024 09:14:49 +0000 Received: by outflank-mailman (output) from mailman id 701162.1095371; Fri, 05 Apr 2024 09:14:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfer-0008EM-BT; Fri, 05 Apr 2024 09:14:49 +0000 Received: by outflank-mailman (input) for mailman id 701162; Fri, 05 Apr 2024 09:14:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfep-0007WZ-U1 for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:47 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f2303e5d-f32c-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 11:14:46 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 2F3344EE0744; Fri, 5 Apr 2024 11:14:45 +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: f2303e5d-f32c-11ee-a1ef-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, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [XEN PATCH v2 3/9] x86/irq: tidy switch statement and address MISRA violation Date: Fri, 5 Apr 2024 11:14:31 +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: 1712308509495100005 Content-Type: text/plain; charset="utf-8" Remove unneded blank lines between switch clauses. Refactor the clauses so that a MISRA C Rule 16.2 violation is resolved (A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement). Note that the switch clause ending with the pseudo keyword "fallthrough" is an allowed exception to Rule 16.3. No functional change. Signed-off-by: Nicola Vetrini --- The initialization of irq is due to gcc thinking that irq may be used uninitizalied in the test after MAP_PIRQ_TYPE_MULTI_MSI --- xen/arch/x86/irq.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 0487f734a5d2..16c023f077da 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -2882,7 +2882,7 @@ int allocate_and_map_gsi_pirq(struct domain *d, int i= ndex, int *pirq_p) int allocate_and_map_msi_pirq(struct domain *d, int index, int *pirq_p, int type, struct msi_info *msi) { - int irq, pirq, ret; + int irq =3D -1, pirq, ret; =20 ASSERT_PDEV_LIST_IS_READ_LOCKED(d); =20 @@ -2892,12 +2892,10 @@ int allocate_and_map_msi_pirq(struct domain *d, int= index, int *pirq_p, if ( !msi->table_base ) msi->entry_nr =3D 1; irq =3D index; - if ( irq =3D=3D -1 ) - { + fallthrough; case MAP_PIRQ_TYPE_MULTI_MSI: + if( type =3D=3D MAP_PIRQ_TYPE_MULTI_MSI || irq =3D=3D -1 ) irq =3D create_irq(NUMA_NO_NODE, true); - } - if ( irq < nr_irqs_gsi || irq >=3D nr_irqs ) { dprintk(XENLOG_G_ERR, "dom%d: can't create irq for msi!\n", @@ -2905,7 +2903,6 @@ int allocate_and_map_msi_pirq(struct domain *d, int i= ndex, int *pirq_p, return -EINVAL; } break; - default: dprintk(XENLOG_G_ERR, "dom%d: wrong pirq type %x\n", d->domain_id, type); --=20 2.34.1 From nobody Fri May 17 01:43:38 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 1712308509532537.8421682536385; Fri, 5 Apr 2024 02:15:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701163.1095376 (Exim 4.92) (envelope-from ) id 1rsfer-0008HE-Pj; Fri, 05 Apr 2024 09:14:49 +0000 Received: by outflank-mailman (output) from mailman id 701163.1095376; Fri, 05 Apr 2024 09:14:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfer-0008GZ-K3; Fri, 05 Apr 2024 09:14:49 +0000 Received: by outflank-mailman (input) for mailman id 701163; Fri, 05 Apr 2024 09:14:49 +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 1rsfer-0007cm-0k for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f283f1f3-f32c-11ee-afe6-a90da7624cb6; Fri, 05 Apr 2024 11:14:47 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 3A76E4EE0745; Fri, 5 Apr 2024 11:14:46 +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: f283f1f3-f32c-11ee-afe6-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, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [XEN PATCH v2 4/9] x86/efi: tidy switch statement and address MISRA violation Date: Fri, 5 Apr 2024 11:14:32 +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: 1712308511369100009 Content-Type: text/plain; charset="utf-8" Refactor the first clauses so that a violation of MISRA C Rule 16.2 is resolved (a switch label, "default" in this case, should be immediately enclosed in the compound statement of the switch). Note that the switch clause ending with the pseudo keyword "fallthrough" is an allowed exception to Rule 16.3. Convert fallthrough comments in other clauses to the pseudo-keyword while at it. No functional change. Signed-off-by: Nicola Vetrini --- There is some degree of duplication here between the default clause and the others, but I don't think there is a way to avoid it. --- xen/arch/x86/efi/efi-boot.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 8ea64e31cdc2..c4d452c482be 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -169,20 +169,22 @@ static void __init efi_arch_process_memory_map(EFI_SY= STEM_TABLE *SystemTable, =20 switch ( desc->Type ) { + default: + type =3D E820_RESERVED; + break; case EfiBootServicesCode: case EfiBootServicesData: if ( map_bs ) { - default: type =3D E820_RESERVED; break; } - /* fall through */ + fallthrough; case EfiConventionalMemory: if ( !trampoline_phys && desc->PhysicalStart + len <=3D 0x1000= 00 && len >=3D cfg.size && desc->PhysicalStart + len > cfg.addr= ) cfg.addr =3D (desc->PhysicalStart + len - cfg.size) & PAGE= _MASK; - /* fall through */ + fallthrough; case EfiLoaderCode: case EfiLoaderData: if ( desc->Attribute & EFI_MEMORY_RUNTIME ) --=20 2.34.1 From nobody Fri May 17 01:43:38 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 1712308507929645.4130857723479; Fri, 5 Apr 2024 02:15:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701164.1095382 (Exim 4.92) (envelope-from ) id 1rsfes-0008Ox-6Q; Fri, 05 Apr 2024 09:14:50 +0000 Received: by outflank-mailman (output) from mailman id 701164.1095382; Fri, 05 Apr 2024 09:14:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfer-0008Na-Us; Fri, 05 Apr 2024 09:14:49 +0000 Received: by outflank-mailman (input) for mailman id 701164; Fri, 05 Apr 2024 09:14:49 +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 1rsfer-0007cm-7p for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f2db2379-f32c-11ee-afe6-a90da7624cb6; Fri, 05 Apr 2024 11:14:47 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id B86004EE073F; Fri, 5 Apr 2024 11:14:46 +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: f2db2379-f32c-11ee-afe6-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, Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall Subject: [XEN PATCH v2 5/9] xen/domctl: address violations of MISRA C Rule 16.2 Date: Fri, 5 Apr 2024 11:14:33 +0200 Message-Id: <5ba6dafed08ca148f7ea92e4c8f7fc947f825cd0.1712305581.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: 1712308509425100001 Content-Type: text/plain; charset="utf-8" Refactor the first clauses so that a violation of MISRA C Rule 16.2 is resolved (a switch label should be immediately enclosed in the compound statement of the switch). Note that the switch clause ending with the pseudo keyword "fallthrough" is an allowed exception to Rule 16.3. Convert fallthrough comments in other clauses to the pseudo-keyword while at it. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/common/domctl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/common/domctl.c b/xen/common/domctl.c index f2e0e36a17c3..cad0ff9d2ec0 100644 --- a/xen/common/domctl.c +++ b/xen/common/domctl.c @@ -293,6 +293,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_d= omctl) =20 switch ( op->cmd ) { + case XEN_DOMCTL_createdomain: + d =3D NULL; + break; case XEN_DOMCTL_assign_device: case XEN_DOMCTL_deassign_device: if ( op->domain =3D=3D DOMID_IO ) @@ -302,16 +305,15 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u= _domctl) } else if ( op->domain =3D=3D DOMID_INVALID ) return -ESRCH; - /* fall through */ + fallthrough; case XEN_DOMCTL_test_assign_device: case XEN_DOMCTL_vm_event_op: if ( op->domain =3D=3D DOMID_INVALID ) { - case XEN_DOMCTL_createdomain: d =3D NULL; break; } - /* fall through */ + fallthrough; default: d =3D rcu_lock_domain_by_id(op->domain); if ( !d ) --=20 2.34.1 From nobody Fri May 17 01:43:38 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 1712308514019105.33462147365265; Fri, 5 Apr 2024 02:15:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701165.1095398 (Exim 4.92) (envelope-from ) id 1rsfet-0000Qk-D0; Fri, 05 Apr 2024 09:14:51 +0000 Received: by outflank-mailman (output) from mailman id 701165.1095398; Fri, 05 Apr 2024 09:14:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfet-0000P6-6p; Fri, 05 Apr 2024 09:14:51 +0000 Received: by outflank-mailman (input) for mailman id 701165; Fri, 05 Apr 2024 09:14:49 +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 1rsfer-0007WZ-En for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f32b95bd-f32c-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 11:14:48 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 5167C4EE0747; Fri, 5 Apr 2024 11:14:47 +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: f32b95bd-f32c-11ee-a1ef-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, Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [XEN PATCH v2 6/9] x86/hvm: address violations of MISRA C Rule 16.2 Date: Fri, 5 Apr 2024 11:14:34 +0200 Message-Id: <165d61fab77c0b6613b78e0091195753fe9cd2cc.1712305581.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: 1712308515347100001 Content-Type: text/plain; charset="utf-8" Refactor the switch so that a violation of MISRA C Rule 16.2 is resolved (a switch label should be immediately enclosed in the compound statement of the switch). The switch clause ending with the pseudo keyword "fallthrough" is an allowed exception to Rule 16.3. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- xen/arch/x86/hvm/hypercall.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c index eeb73e1aa5d0..2801d75d89f1 100644 --- a/xen/arch/x86/hvm/hypercall.c +++ b/xen/arch/x86/hvm/hypercall.c @@ -119,12 +119,12 @@ int hvm_hypercall(struct cpu_user_regs *regs) (mode =3D=3D 8 ? regs->rdi : regs->ebx) =3D=3D HVMOP_guest_req= uest_vm_event ) break; =20 - if ( unlikely(hvm_get_cpl(curr)) ) - { + if ( !unlikely(hvm_get_cpl(curr)) ) + break; + fallthrough; default: - regs->rax =3D -EPERM; - return HVM_HCALL_completed; - } + regs->rax =3D -EPERM; + return HVM_HCALL_completed; case 0: break; } --=20 2.34.1 From nobody Fri May 17 01:43:38 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 1712308510746340.5334950077413; Fri, 5 Apr 2024 02:15:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701167.1095410 (Exim 4.92) (envelope-from ) id 1rsfeu-0000g9-DW; Fri, 05 Apr 2024 09:14:52 +0000 Received: by outflank-mailman (output) from mailman id 701167.1095410; Fri, 05 Apr 2024 09:14:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfet-0000cy-Vx; Fri, 05 Apr 2024 09:14:51 +0000 Received: by outflank-mailman (input) for mailman id 701167; Fri, 05 Apr 2024 09:14:50 +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 1rsfer-0007WZ-Vk for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f375b6da-f32c-11ee-a1ef-f123f15fe8a2; Fri, 05 Apr 2024 11:14:48 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id DBAA64EE0749; Fri, 5 Apr 2024 11:14:47 +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: f375b6da-f32c-11ee-a1ef-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, "Daniel P. Smith" Subject: [XEN PATCH v2 7/9] xen/xsm: address violation of MISRA C Rule 16.2 Date: Fri, 5 Apr 2024 11:14:35 +0200 Message-Id: <7fbb80bf62fc2e5f91a89375134622366c0b3891.1712305581.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: 1712308511368100008 Content-Type: text/plain; charset="utf-8" Refactor the switch so that a violation of MISRA C Rule 16.2 is resolved (A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement). Note that the switch clause ending with the pseudo keyword "fallthrough" is an allowed exception to Rule 16.3. Signed-off-by: Nicola Vetrini Acked-by: Daniel P. Smith Reviewed-by: Stefano Stabellini --- The second switch is not the best in terms of readability, so it may be best to deviate this particular instance. --- xen/include/xsm/dummy.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 88039fdd227c..84d3a8ed1c94 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -83,17 +83,17 @@ static always_inline int xsm_default_action( return 0; case XSM_TARGET: if ( evaluate_nospec(src =3D=3D target) ) - { return 0; + fallthrough; case XSM_XS_PRIV: - if ( evaluate_nospec(is_xenstore_domain(src)) ) - return 0; - } - /* fall through */ + if ( (action =3D=3D XSM_XS_PRIV) && + evaluate_nospec(is_xenstore_domain(src)) ) + return 0; + fallthrough; case XSM_DM_PRIV: if ( target && evaluate_nospec(src->target =3D=3D target) ) return 0; - /* fall through */ + fallthrough; case XSM_PRIV: if ( is_control_domain(src) ) return 0; --=20 2.34.1 From nobody Fri May 17 01:43:38 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 1712308510066235.8787464880811; Fri, 5 Apr 2024 02:15:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701166.1095406 (Exim 4.92) (envelope-from ) id 1rsfet-0000V4-TP; Fri, 05 Apr 2024 09:14:51 +0000 Received: by outflank-mailman (output) from mailman id 701166.1095406; Fri, 05 Apr 2024 09:14:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfet-0000SK-Gg; Fri, 05 Apr 2024 09:14:51 +0000 Received: by outflank-mailman (input) for mailman id 701166; Fri, 05 Apr 2024 09:14:50 +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 1rsfer-0007cm-T5 for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f3dbb950-f32c-11ee-afe6-a90da7624cb6; Fri, 05 Apr 2024 11:14:49 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 5D1974EE074B; Fri, 5 Apr 2024 11:14:48 +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: f3dbb950-f32c-11ee-afe6-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, Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall Subject: [XEN PATCH v2 8/9] xen/domain: deviate MISRA C Rule 16.2 violation Date: Fri, 5 Apr 2024 11:14:36 +0200 Message-Id: <2328b1a43f8bc4c9a9303c46f8eba2847c67a713.1712305581.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: 1712308511368100007 Content-Type: text/plain; charset="utf-8" MISRA C Rule 16.2 states: "A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement". The PROGRESS_VCPU local helper specifies a case that is directly inside the compound statement of a for loop, hence violating the rule. To avoid this, the construct is deviated with a text-based deviation. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Jan Beulich --- I chose a text-based deviation, rather than exempting PROGRESS_VCPU, because it's more refined and it's unlikely that more violations are introduced, since the rule has only very few violations left on both ARM and x86. --- docs/misra/safe.json | 8 ++++++++ xen/common/domain.c | 1 + 2 files changed, 9 insertions(+) diff --git a/docs/misra/safe.json b/docs/misra/safe.json index d361d0e65ceb..64178ba2ef7d 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -36,6 +36,14 @@ }, { "id": "SAF-4-safe", + "analyser": { + "eclair": "MC3R1.R16.2" + }, + "name": "MC3R1.R16.2: using a case label when the most closely= -enclosing compound statement is not a switch statement", + "text": "A switch label enclosed by some compound statement th= at is not the body of a switch is permitted within local helper macros that= are unlikely to be misused or misunderstood." + }, + { + "id": "SAF-5-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/common/domain.c b/xen/common/domain.c index ceb44c826685..1388b9e7cefa 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -457,6 +457,7 @@ static int domain_teardown(struct domain *d) =20 for_each_vcpu ( d, v ) { + /* SAF-4-safe MISRA C Rule 16.2: switch label enclosed by for = loop*/ PROGRESS_VCPU(teardown); =20 rc =3D vcpu_teardown(v); --=20 2.34.1 From nobody Fri May 17 01:43:38 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 1712308511053146.84181402536012; Fri, 5 Apr 2024 02:15:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.701168.1095421 (Exim 4.92) (envelope-from ) id 1rsfev-0000vP-9G; Fri, 05 Apr 2024 09:14:53 +0000 Received: by outflank-mailman (output) from mailman id 701168.1095421; Fri, 05 Apr 2024 09:14:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rsfeu-0000sL-So; Fri, 05 Apr 2024 09:14:52 +0000 Received: by outflank-mailman (input) for mailman id 701168; Fri, 05 Apr 2024 09:14:51 +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 1rsfes-0007cm-TQ for xen-devel@lists.xenproject.org; Fri, 05 Apr 2024 09:14:50 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f441b1f7-f32c-11ee-afe6-a90da7624cb6; Fri, 05 Apr 2024 11:14:49 +0200 (CEST) Received: from nico.bugseng.com (unknown [46.228.253.194]) by support.bugseng.com (Postfix) with ESMTPSA id 0464D4EE0748; Fri, 5 Apr 2024 11:14:48 +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: f441b1f7-f32c-11ee-afe6-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, Simone Ballarin , Doug Goldstein , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall Subject: [XEN PATCH v2 9/9] eclair_analysis: deviate x86 emulator for Rule 16.2 Date: Fri, 5 Apr 2024 11:14:37 +0200 Message-Id: <31647df45bf37e56ab81e1c8830211e60765d5c9.1712305581.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: 1712308511379100011 Content-Type: text/plain; charset="utf-8" MISRA C Rule 16.2 states: "A switch label shall only be used when the most closely-enclosing compound statement is the body of a switch statement". Since complying with this rule of the x86 emulator would lead to a lot of code duplication, it is deemed better to exempt those files for this guideline. No functional change. Signed-off-by: Nicola Vetrini Acked-by: Stefano Stabellini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 7 +++++++ docs/misra/deviations.rst | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index de9ba723fbc7..c714b7da03dc 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -358,6 +358,13 @@ therefore have the same behavior of a boolean" # Series 16. # =20 +-doc_begin=3D"Complying with the Rule would entail a lot of code duplicati= on in the implementation of the x86 emulator, +therefore it is deemed better to leave such files as is." +-file_tag+=3D{x86_emulate,"^xen/arch/x86/x86_emulate/.*$"} +-file_tag+=3D{x86_svm_emulate,"^xen/arch/x86/hvm/svm/emulate\\.c$"} +-config=3DMC3R1.R16.2,reports+=3D{deliberate, "any_area(any_loc(file(x86_e= mulate||x86_svm_emulate)))"} +-doc_end + -doc_begin=3D"Switch clauses ending with continue, goto, return statements= are safe." -config=3DMC3R1.R16.3,terminals+=3D{safe, "node(continue_stmt||goto_stmt||= return_stmt)"} diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index eb5ef2bd9dd6..28685ce7ab95 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -296,6 +296,12 @@ Deviations related to MISRA C:2012 Rules: therefore have the same behavior of a boolean. - Project-wide deviation; tagged as `deliberate` for ECLAIR. =20 + * - R16.2 + - Complying with the Rule would entail a lot of code duplication in t= he + implementation of the x86 emulator, therefore it is deemed better to + leave such files as is. + - Tagged as `deliberate` for ECLAIR. + * - R16.3 - Switch clauses ending with continue, goto, return statements are sa= fe. - Tagged as `safe` for ECLAIR. --=20 2.34.1