From patchwork Mon Aug 28 13:19:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368039 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 6D57CC83F12 for ; Mon, 28 Aug 2023 14:45:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591532.924030 (Exim 4.92) (envelope-from ) id 1qadUM-00011n-3u; Mon, 28 Aug 2023 14:45:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591532.924030; Mon, 28 Aug 2023 14:45: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 1qadUM-00011g-1O; Mon, 28 Aug 2023 14:45:10 +0000 Received: by outflank-mailman (input) for mailman id 591532; Mon, 28 Aug 2023 13:36:30 +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 1qacPu-0004gK-UA for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:36:30 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a7ca1d81-45a5-11ee-9b0c-b553b5be7939; Mon, 28 Aug 2023 15:20:28 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 943794EE073A; Mon, 28 Aug 2023 15:20:27 +0200 (CEST) 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: a7ca1d81-45a5-11ee-9b0c-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Doug Goldstein , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 01/13] misra: add deviation for headers that explicitly avoid guards Date: Mon, 28 Aug 2023 15:19:58 +0200 Message-Id: <9b8165105c28f8e684844f56814726498e34c46e.1693228255.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Some headers, under specific circumstances (documented in a comment at the beginning of the file), explicitly avoid inclusion guards: the caller is responsible for including them correctly. These files are not supposed to comply with Directive 4.10: "Precautions shall be taken in order to prevent the contents of a header file being included more than once" This patch adds a deviation for all headers that contain the following in a comment text: "In this case, no inclusion guards apply and the caller is responsible" Signed-off-by: Simone Ballarin Acked-by: Stefano Stabellini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++ docs/misra/rules.rst | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index d8170106b4..5f068377fa 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -91,6 +91,10 @@ conform to the directive." -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"} -doc_end +-doc_begin="Some headers, under specific circumstances, explicitly avoid inclusion guards." +-config=MC3R1.D4.10,reports+={safe, "first_area(text(^ \\* In this case, no inclusion guards apply and the caller is responsible.*\\*/$, begin-1))"} +-doc_end + # # Series 5. # diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index db30632b93..4b1a7b02b6 100644 --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -60,7 +60,8 @@ maintainers if you want to suggest a change. - Precautions shall be taken in order to prevent the contents of a header file being included more than once - Files that are intended to be included more than once do not need to - conform to the directive + conform to the directive. Files that explicitly avoid inclusion guards + under specific circumstances do not need to conform the directive. * - `Dir 4.11 `_ - Required From patchwork Mon Aug 28 13:19:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368041 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 D82F4C83F12 for ; Mon, 28 Aug 2023 14:45:39 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591533.924037 (Exim 4.92) (envelope-from ) id 1qadUM-00014J-Eg; Mon, 28 Aug 2023 14:45:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591533.924037; Mon, 28 Aug 2023 14:45: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 1qadUM-00013N-8I; Mon, 28 Aug 2023 14:45:10 +0000 Received: by outflank-mailman (input) for mailman id 591533; Mon, 28 Aug 2023 13:36:31 +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 1qacPv-0004gK-K3 for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:36:31 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a8090660-45a5-11ee-9b0c-b553b5be7939; Mon, 28 Aug 2023 15:20:28 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 3C6744EE073C; Mon, 28 Aug 2023 15:20:28 +0200 (CEST) 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: a8090660-45a5-11ee-9b0c-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Doug Goldstein Subject: [XEN PATCH 02/13] automation/eclair: add text-based deviation for empty headers Date: Mon, 28 Aug 2023 15:19:59 +0200 Message-Id: <96e9ca524ed8191bfd5ee1230e8d581c50e299f5.1693228255.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 This patch adds a text-based deviation for Directive 4.10: "Precautions shall be taken in order to prevent the contents of a header file being included more than once" Headers starting with the following comment are not supposed to comply with the directive: "/* empty */" These headers should be empty, therefore they pose no risk if included more than once. Signed-off-by: Simone Ballarin Acked-by: Stefano Stabellini --- automation/eclair_analysis/ECLAIR/deviations.ecl | 1 + 1 file changed, 1 insertion(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index 5f068377fa..2681a4cff5 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -80,6 +80,7 @@ inline functions." -doc_begin="This header file is autogenerated or empty, therefore it poses no risk if included more than once." +-config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* empty \\*/$, begin-1))"} -file_tag+={empty_header, "^xen/arch/arm/efi/runtime\\.h$"} -file_tag+={autogen_headers, "^xen/include/xen/compile\\.h$||^xen/include/generated/autoconf.h$||^xen/include/xen/hypercall-defs.h$"} -config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(file(empty_header||autogen_headers)))"} From patchwork Mon Aug 28 13:20:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368038 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 BA9BBC83F15 for ; Mon, 28 Aug 2023 14:45:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591534.924044 (Exim 4.92) (envelope-from ) id 1qadUM-0001AT-NZ; Mon, 28 Aug 2023 14:45:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591534.924044; Mon, 28 Aug 2023 14:45: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 1qadUM-00019E-GC; Mon, 28 Aug 2023 14:45:10 +0000 Received: by outflank-mailman (input) for mailman id 591534; Mon, 28 Aug 2023 13:36:32 +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 1qacPw-0004gK-KM for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:36:32 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a8528174-45a5-11ee-9b0c-b553b5be7939; Mon, 28 Aug 2023 15:20:29 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 9EA0C4EE073E; Mon, 28 Aug 2023 15:20:28 +0200 (CEST) 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: a8528174-45a5-11ee-9b0c-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [XEN PATCH 03/13] xen/arm: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:00 +0200 Message-Id: <2d37ca48cf6556ebfcb4b17cddd2446fa549f689.1693228255.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add or move inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). Inclusion guards must appear at the beginning of the headers (comments are permitted anywhere). Mechanical change. Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- xen/arch/arm/efi/efi-boot.h | 6 ++++++ xen/arch/arm/include/asm/hypercall.h | 6 +++--- xen/arch/arm/include/asm/iocap.h | 6 +++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 1c3640bb65..aba522ead5 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -3,6 +3,10 @@ * is intended to be included by common/efi/boot.c _only_, and * therefore can define arch specific global variables. */ + +#ifndef __ARM_EFI_EFI_BOOT_H__ +#define __ARM_EFI_EFI_BOOT_H__ + #include #include #include @@ -1003,6 +1007,8 @@ static void __init efi_arch_flush_dcache_area(const void *vaddr, UINTN size) __flush_dcache_area(vaddr, size); } +#endif /* __ARM_EFI_EFI_BOOT_H__*/ + /* * Local variables: * mode: C diff --git a/xen/arch/arm/include/asm/hypercall.h b/xen/arch/arm/include/asm/hypercall.h index ccd26c5184..4f4d96f1f2 100644 --- a/xen/arch/arm/include/asm/hypercall.h +++ b/xen/arch/arm/include/asm/hypercall.h @@ -1,10 +1,10 @@ +#ifndef __ASM_ARM_HYPERCALL_H__ +#define __ASM_ARM_HYPERCALL_H__ + #ifndef __XEN_HYPERCALL_H__ #error "asm/hypercall.h should not be included directly - include xen/hypercall.h instead" #endif -#ifndef __ASM_ARM_HYPERCALL_H__ -#define __ASM_ARM_HYPERCALL_H__ - #include /* for arch_do_domctl */ long subarch_do_domctl(struct xen_domctl *domctl, struct domain *d, diff --git a/xen/arch/arm/include/asm/iocap.h b/xen/arch/arm/include/asm/iocap.h index 276fefbc59..4db1b16839 100644 --- a/xen/arch/arm/include/asm/iocap.h +++ b/xen/arch/arm/include/asm/iocap.h @@ -1,10 +1,10 @@ -#ifndef __X86_IOCAP_H__ -#define __X86_IOCAP_H__ +#ifndef __ASM_ARM_IOCAP_H__ +#define __ASM_ARM_IOCAP_H__ #define cache_flush_permitted(d) \ (!rangeset_is_empty((d)->iomem_caps)) -#endif +#endif /* __ASM_ARM_IOCAP_H__ */ /* * Local variables: From patchwork Mon Aug 28 13:20:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368042 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 9CF4BC71153 for ; Mon, 28 Aug 2023 14:45:41 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591535.924052 (Exim 4.92) (envelope-from ) id 1qadUN-0001Oo-5T; Mon, 28 Aug 2023 14:45:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591535.924052; Mon, 28 Aug 2023 14:45:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qadUM-0001Nj-Vx; Mon, 28 Aug 2023 14:45:10 +0000 Received: by outflank-mailman (input) for mailman id 591535; Mon, 28 Aug 2023 13:36:33 +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 1qacPx-0004gK-KO for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:36:33 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a8a3e59e-45a5-11ee-9b0c-b553b5be7939; Mon, 28 Aug 2023 15:20:29 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 239EC4EE074E; Mon, 28 Aug 2023 15:20:29 +0200 (CEST) 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: a8a3e59e-45a5-11ee-9b0c-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH 04/13] xen/x86: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:01 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add or move inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). Inclusion guards must appear at the beginning of the headers (comments are permitted anywhere). Also C files, if included somewhere, need to comply with the guideline. Mechanical change. Signed-off-by: Simone Ballarin --- xen/arch/x86/Makefile | 8 ++++---- xen/arch/x86/cpu/cpu.h | 5 +++++ xen/arch/x86/physdev.c | 4 ++++ xen/arch/x86/platform_hypercall.c | 5 +++++ xen/arch/x86/x86_64/compat/mm.c | 5 +++++ xen/arch/x86/x86_64/mmconfig.h | 5 +++++ xen/arch/x86/x86_emulate/private.h | 5 +++++ xen/arch/x86/x86_emulate/x86_emulate.c | 5 +++++ 8 files changed, 38 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index e642ad6c55..f956b7f0cd 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -259,17 +259,17 @@ $(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefil $(call filechk,asm-macros.h) define filechk_asm-macros.h + echo '#ifndef __ASM_MACROS_H__'; \ + echo '#define __ASM_MACROS_H__'; \ echo '#if 0'; \ echo '.if 0'; \ echo '#endif'; \ - echo '#ifndef __ASM_MACROS_H__'; \ - echo '#define __ASM_MACROS_H__'; \ echo 'asm ( ".include \"$@\"" );'; \ - echo '#endif /* __ASM_MACROS_H__ */'; \ echo '#if 0'; \ echo '.endif'; \ cat $<; \ - echo '#endif' + echo '#endif'; \ + echo '#endif /* __ASM_MACROS_H__ */' endef $(obj)/efi.lds: AFLAGS-y += -DEFI diff --git a/xen/arch/x86/cpu/cpu.h b/xen/arch/x86/cpu/cpu.h index e3d06278b3..95939c7fb6 100644 --- a/xen/arch/x86/cpu/cpu.h +++ b/xen/arch/x86/cpu/cpu.h @@ -1,3 +1,6 @@ +#ifndef __X86_CPU_CPU_H__ +#define __X86_CPU_CPU_H__ + /* attempt to consolidate cpu attributes */ struct cpu_dev { void (*c_early_init)(struct cpuinfo_x86 *c); @@ -24,3 +27,5 @@ void amd_init_lfence(struct cpuinfo_x86 *c); void amd_init_ssbd(const struct cpuinfo_x86 *c); void amd_init_spectral_chicken(void); void detect_zen2_null_seg_behaviour(void); + +#endif /* __X86_CPU_CPU_H__ */ diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c index 2f1d955a96..08b391d8f3 100644 --- a/xen/arch/x86/physdev.c +++ b/xen/arch/x86/physdev.c @@ -1,3 +1,5 @@ +#ifndef __X86_PHYSDEV_C__ +#define __X86_PHYSDEV_C__ #include #include @@ -623,6 +625,8 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) return ret; } +#endif /* __X86_PHYSDEV_C__ */ + /* * Local variables: * mode: C diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c index 9ff2da8fc3..11aa084887 100644 --- a/xen/arch/x86/platform_hypercall.c +++ b/xen/arch/x86/platform_hypercall.c @@ -6,6 +6,9 @@ * Copyright (c) 2002-2006, K Fraser */ +#ifndef __X86_PLATFORM_HYPERCALL_C__ +#define __X86_PLATFORM_HYPERCALL_C__ + #include #include #include @@ -899,6 +902,8 @@ ret_t do_platform_op( return ret; } +#endif /* __X86_PLATFORM_HYPERCALL_C__ */ + /* * Local variables: * mode: C diff --git a/xen/arch/x86/x86_64/compat/mm.c b/xen/arch/x86/x86_64/compat/mm.c index d54efaad21..24f7eb8788 100644 --- a/xen/arch/x86/x86_64/compat/mm.c +++ b/xen/arch/x86/x86_64/compat/mm.c @@ -1,3 +1,6 @@ +#ifndef __X86_X86_64_COMPAT_MM_C__ +#define __X86_X86_64_COMPAT_MM_C__ + #include #include #include @@ -326,6 +329,8 @@ int compat_mmuext_op( } #endif /* CONFIG_PV */ +#endif /* __X86_X86_64_COMPAT_MM_C__ */ + /* * Local variables: * mode: C diff --git a/xen/arch/x86/x86_64/mmconfig.h b/xen/arch/x86/x86_64/mmconfig.h index 2d49fc79a0..c562879c76 100644 --- a/xen/arch/x86/x86_64/mmconfig.h +++ b/xen/arch/x86/x86_64/mmconfig.h @@ -5,6 +5,9 @@ * Author: Allen Kay - adapted from linux */ +#ifndef __X86_X86_64_MMCONFIG_H__ +#define __X86_X86_64_MMCONFIG_H__ + #define PCI_DEVICE_ID_INTEL_E7520_MCH 0x3590 #define PCI_DEVICE_ID_INTEL_82945G_HB 0x2770 @@ -72,3 +75,5 @@ int pci_mmcfg_reserved(uint64_t address, unsigned int segment, int pci_mmcfg_arch_init(void); int pci_mmcfg_arch_enable(unsigned int); void pci_mmcfg_arch_disable(unsigned int); + +#endif /* __X86_X86_64_MMCONFIG_H__ */ diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h index 719dad59cd..ffa134f297 100644 --- a/xen/arch/x86/x86_emulate/private.h +++ b/xen/arch/x86/x86_emulate/private.h @@ -6,6 +6,9 @@ * Copyright (c) 2005-2007 XenSource Inc. */ +#ifndef __X86_X86_EMULATE_PRIVATE_H__ +#define __X86_X86_EMULATE_PRIVATE_H__ + #ifdef __XEN__ # include @@ -831,3 +834,5 @@ static inline int read_ulong(enum x86_segment seg, *val = 0; return ops->read(seg, offset, val, bytes, ctxt); } + +#endif /* __X86_X86_EMULATE_PRIVATE_H__ */ diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c index e88245eae9..8977a1b82e 100644 --- a/xen/arch/x86/x86_emulate/x86_emulate.c +++ b/xen/arch/x86/x86_emulate/x86_emulate.c @@ -8,6 +8,9 @@ * Copyright (c) 2005-2007 XenSource Inc. */ +#ifndef __X86_X86_EMULATE_EMULATE_C__ +#define __X86_X86_EMULATE_EMULATE_C__ + #include "private.h" /* @@ -8678,3 +8681,5 @@ int x86_emulate_wrapper( return rc; } #endif + +#endif /* __X86_X86_EMULATE_EMULATE_C__ */ From patchwork Mon Aug 28 13:20:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368037 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 0555CC71153 for ; Mon, 28 Aug 2023 14:45:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591537.924061 (Exim 4.92) (envelope-from ) id 1qadUN-0001Xh-Im; Mon, 28 Aug 2023 14:45:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591537.924061; Mon, 28 Aug 2023 14:45:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qadUN-0001VO-8C; Mon, 28 Aug 2023 14:45:11 +0000 Received: by outflank-mailman (input) for mailman id 591537; Mon, 28 Aug 2023 13:36:34 +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 1qacPy-0004gK-Kc for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:36:34 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a904a21b-45a5-11ee-9b0c-b553b5be7939; Mon, 28 Aug 2023 15:20:30 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id A7A354EE073D; Mon, 28 Aug 2023 15:20:29 +0200 (CEST) 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: a904a21b-45a5-11ee-9b0c-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Doug Goldstein , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 05/13] automation/eclair: add deviation for usercopy.c Date: Mon, 28 Aug 2023 15:20:02 +0200 Message-Id: <4039623dc4341758f383ec49228c1e55e5862b0f.1693228255.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 xen/arch/x86/usercopy.c includes itself, so it is not supposed to comply with Directive 4.10: "Precautions shall be taken in order to prevent the contents of a header file being included more than once" This patch adds a deviation for the file. Signed-off-by: Simone Ballarin --- automation/eclair_analysis/ECLAIR/deviations.ecl | 4 ++++ docs/misra/rules.rst | 2 ++ 2 files changed, 6 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index 2681a4cff5..a7d4f29b43 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -96,6 +96,10 @@ conform to the directive." -config=MC3R1.D4.10,reports+={safe, "first_area(text(^ \\* In this case, no inclusion guards apply and the caller is responsible.*\\*/$, begin-1))"} -doc_end +-doc_begin="xen/arch/x86/usercopy.c includes itself: it is not supposed to comply with the directive" +-config=MC3R1.D4.10,reports+={deliberate, "all_area(all_loc(file("^xen/arch/x86/usercopy\\.c$")))"} +-doc_end + # # Series 5. # diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index 4b1a7b02b6..45e13d0302 100644 --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -62,6 +62,8 @@ maintainers if you want to suggest a change. - Files that are intended to be included more than once do not need to conform to the directive. Files that explicitly avoid inclusion guards under specific circumstances do not need to conform the directive. + xen/arch/x86/usercopy.c includes itself: it is not supposed to comply + with the directive. * - `Dir 4.11 `_ - Required From patchwork Mon Aug 28 13:20:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368034 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 0DCACC83F15 for ; Mon, 28 Aug 2023 14:30:40 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591519.923957 (Exim 4.92) (envelope-from ) id 1qadFp-0003jh-SM; Mon, 28 Aug 2023 14:30:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591519.923957; Mon, 28 Aug 2023 14:30:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qadFp-0003jW-Nh; Mon, 28 Aug 2023 14:30:09 +0000 Received: by outflank-mailman (input) for mailman id 591519; Mon, 28 Aug 2023 13:20:31 +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 1qacAR-00031h-EZ for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:20:31 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a95820c2-45a5-11ee-8783-cb3800f73035; Mon, 28 Aug 2023 15:20:31 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 4EA2E4EE0C81; Mon, 28 Aug 2023 15:20:30 +0200 (CEST) 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: a95820c2-45a5-11ee-8783-cb3800f73035 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH 06/13] x86/EFI: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:03 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). Mechanical change. Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- xen/arch/x86/efi/efi-boot.h | 6 ++++++ xen/arch/x86/efi/runtime.h | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 92f4cfe8bd..2c6be062cc 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -3,6 +3,10 @@ * is intended to be included by common/efi/boot.c _only_, and * therefore can define arch specific global variables. */ + +#ifndef __X86_EFI_EFI_BOOT_H__ +#define __X86_EFI_EFI_BOOT_H__ + #include #include #include @@ -913,6 +917,8 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable efi_exit_boot(ImageHandle, SystemTable); } +#endif /* __X86_EFI_EFI_BOOT_H__ */ + /* * Local variables: * mode: C diff --git a/xen/arch/x86/efi/runtime.h b/xen/arch/x86/efi/runtime.h index 77866c5f21..10b36bcb89 100644 --- a/xen/arch/x86/efi/runtime.h +++ b/xen/arch/x86/efi/runtime.h @@ -1,3 +1,6 @@ +#ifndef __X86_EFI_RUNTIME_H__ +#define __X86_EFI_RUNTIME_H__ + #include #include #include @@ -17,3 +20,5 @@ void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t l4e) } } #endif + +#endif /* __X86_EFI_RUNTIME_H__ */ From patchwork Mon Aug 28 13:20:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368028 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 56094C71153 for ; Mon, 28 Aug 2023 14:30:22 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591520.923963 (Exim 4.92) (envelope-from ) id 1qadFq-0003rF-6J; Mon, 28 Aug 2023 14:30:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591520.923963; Mon, 28 Aug 2023 14:30: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 1qadFq-0003qL-1E; Mon, 28 Aug 2023 14:30:10 +0000 Received: by outflank-mailman (input) for mailman id 591520; Mon, 28 Aug 2023 13:20:32 +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 1qacAS-00031h-1E for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:20:32 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a9ab7628-45a5-11ee-8783-cb3800f73035; Mon, 28 Aug 2023 15:20:31 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id D3C664EE0C87; Mon, 28 Aug 2023 15:20:30 +0200 (CEST) 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: a9ab7628-45a5-11ee-8783-cb3800f73035 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH 07/13] x86/asm: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:04 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add or move inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). Inclusion guards must appear at the beginning of the headers (comments are permitted anywhere). The text of the beggining comment of cpufeatures.h has been changed to match the deviation in automation/eclair_analysis/ECLAIR/deviations.ecl, moreover this new formulation is already used in other files. Mechanical change. Signed-off-by: Simone Ballarin --- xen/arch/x86/include/asm/compat.h | 5 +++++ xen/arch/x86/include/asm/cpufeatures.h | 4 +--- xen/arch/x86/include/asm/efibind.h | 5 +++++ xen/arch/x86/include/asm/hypercall.h | 6 +++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/include/asm/compat.h b/xen/arch/x86/include/asm/compat.h index 818cad87db..3d3891d061 100644 --- a/xen/arch/x86/include/asm/compat.h +++ b/xen/arch/x86/include/asm/compat.h @@ -2,6 +2,9 @@ * compat.h */ +#ifndef __ASM_X86_COMPAT_H__ +#define __ASM_X86_COMPAT_H__ + #ifdef CONFIG_COMPAT #define COMPAT_BITS_PER_LONG 32 @@ -18,3 +21,5 @@ int switch_compat(struct domain *); #include static inline int switch_compat(struct domain *d) { return -EOPNOTSUPP; } #endif + +#endif /* __ASM_X86_COMPAT_H__ */ diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/asm/cpufeatures.h index da0593de85..1dfdd478ab 100644 --- a/xen/arch/x86/include/asm/cpufeatures.h +++ b/xen/arch/x86/include/asm/cpufeatures.h @@ -1,6 +1,4 @@ -/* - * Explicitly intended for multiple inclusion. - */ +/* This file is legitimately included multiple times */ #include diff --git a/xen/arch/x86/include/asm/efibind.h b/xen/arch/x86/include/asm/efibind.h index bce02f3707..f2eb8b5496 100644 --- a/xen/arch/x86/include/asm/efibind.h +++ b/xen/arch/x86/include/asm/efibind.h @@ -1,2 +1,7 @@ +#ifndef __ASM_X86_EFIBIND_H__ +#define __ASM_X86_EFIBIND_H__ + #include #include + +#endif /* __ASM_X86_EFIBIND_H__ */ diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h index ec2edc771e..2ade5d71b8 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -2,13 +2,13 @@ * asm-x86/hypercall.h */ +#ifndef __ASM_X86_HYPERCALL_H__ +#define __ASM_X86_HYPERCALL_H__ + #ifndef __XEN_HYPERCALL_H__ #error "asm/hypercall.h should not be included directly - include xen/hypercall.h instead" #endif -#ifndef __ASM_X86_HYPERCALL_H__ -#define __ASM_X86_HYPERCALL_H__ - #include #include #include From patchwork Mon Aug 28 13:20:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368043 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 AD20AC83F15 for ; Mon, 28 Aug 2023 14:45:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591538.924063 (Exim 4.92) (envelope-from ) id 1qadUN-0001j1-RU; Mon, 28 Aug 2023 14:45:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591538.924063; Mon, 28 Aug 2023 14:45:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qadUN-0001f8-Lb; Mon, 28 Aug 2023 14:45:11 +0000 Received: by outflank-mailman (input) for mailman id 591538; Mon, 28 Aug 2023 13:36:35 +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 1qacPz-0004gK-Kw for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:36:35 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id aa04e8e8-45a5-11ee-9b0c-b553b5be7939; Mon, 28 Aug 2023 15:20:32 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 64F7E4EE0C88; Mon, 28 Aug 2023 15:20:31 +0200 (CEST) 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: aa04e8e8-45a5-11ee-9b0c-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Jan Beulich , Andrew Cooper , George Dunlap , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH 08/13] x86/mm: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:05 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). C files, if included somewhere, need to comply with the guideline. Mechanical change. Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- xen/arch/x86/mm/guest_walk.c | 5 +++++ xen/arch/x86/mm/hap/guest_walk.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/xen/arch/x86/mm/guest_walk.c b/xen/arch/x86/mm/guest_walk.c index fe7393334f..66c127156d 100644 --- a/xen/arch/x86/mm/guest_walk.c +++ b/xen/arch/x86/mm/guest_walk.c @@ -9,6 +9,9 @@ * Parts based on earlier work by Michael A Fetterman, Ian Pratt et al. */ +#ifndef __X86_MM_GUEST_WALK_C__ +#define __X86_MM_GUEST_WALK_C__ + #include #include #include @@ -576,6 +579,8 @@ void *map_domain_gfn(struct p2m_domain *p2m, gfn_t gfn, mfn_t *mfn, } #endif +#endif /* __X86_MM_GUEST_WALK_C__ */ + /* * Local variables: * mode: C diff --git a/xen/arch/x86/mm/hap/guest_walk.c b/xen/arch/x86/mm/hap/guest_walk.c index d1b7c5762c..d4ffa8141f 100644 --- a/xen/arch/x86/mm/hap/guest_walk.c +++ b/xen/arch/x86/mm/hap/guest_walk.c @@ -7,6 +7,9 @@ * Copyright (c) 2007, XenSource Inc. */ +#ifndef __X86_MM_HAP_GUEST_WALK_C__ +#define __X86_MM_HAP_GUEST_WALK_C__ + #include #include #include @@ -124,6 +127,7 @@ unsigned long cf_check hap_p2m_ga_to_gfn(GUEST_PAGING_LEVELS)( return gfn_x(INVALID_GFN); } +#endif /* __X86_MM_HAP_GUEST_WALK_C__ */ /* * Local variables: From patchwork Mon Aug 28 13:20:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368032 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 3E31DC83F12 for ; Mon, 28 Aug 2023 14:30:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591521.923971 (Exim 4.92) (envelope-from ) id 1qadFq-0003yF-Kh; Mon, 28 Aug 2023 14:30:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591521.923971; Mon, 28 Aug 2023 14:30: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 1qadFq-0003wn-9q; Mon, 28 Aug 2023 14:30:10 +0000 Received: by outflank-mailman (input) for mailman id 591521; Mon, 28 Aug 2023 13:20:33 +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 1qacAT-00031h-7K for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:20:33 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id aa5f419c-45a5-11ee-8783-cb3800f73035; Mon, 28 Aug 2023 15:20:32 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id F391E4EE0C89; Mon, 28 Aug 2023 15:20:31 +0200 (CEST) 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: aa5f419c-45a5-11ee-8783-cb3800f73035 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 09/13] xen/common: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:06 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). Also C files, if included somewhere, need to comply with the guideline. Mechanical change. Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- xen/common/compat/grant_table.c | 7 +++++++ xen/common/coverage/gcc_4_7.c | 5 +++++ xen/common/decompress.h | 5 +++++ xen/common/event_channel.h | 5 +++++ xen/common/multicall.c | 5 +++++ 5 files changed, 27 insertions(+) diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_table.c index f8177c84c0..614ad71a59 100644 --- a/xen/common/compat/grant_table.c +++ b/xen/common/compat/grant_table.c @@ -3,6 +3,10 @@ * */ + +#ifndef __COMMON_COMPAT_GRANT_TABLE_C__ +#define __COMMON_COMPAT_GRANT_TABLE_C__ + #include #include @@ -331,6 +335,9 @@ int compat_grant_table_op( return rc; } + +#endif /* __COMMON_COMPAT_GRANT_TABLE_C__ */ + /* * Local variables: * mode: C diff --git a/xen/common/coverage/gcc_4_7.c b/xen/common/coverage/gcc_4_7.c index 25b4a8bcdc..12e4ec8cbb 100644 --- a/xen/common/coverage/gcc_4_7.c +++ b/xen/common/coverage/gcc_4_7.c @@ -14,6 +14,9 @@ * Wei Liu */ +#ifndef __COMMON_COVERAGE_GCC_4_7_C__ +#define __COMMON_COVERAGE_GCC_4_7_C__ + #include #include "gcov.h" @@ -193,6 +196,8 @@ size_t gcov_info_to_gcda(char *buffer, const struct gcov_info *info) return pos; } +#endif /* __COMMON_COVERAGE_GCC_4_7_C__ */ + /* * Local variables: * mode: C diff --git a/xen/common/decompress.h b/xen/common/decompress.h index e8195b353a..da3c3abb6a 100644 --- a/xen/common/decompress.h +++ b/xen/common/decompress.h @@ -1,3 +1,6 @@ +#ifndef __COMMON_DECOMPRESS_H__ +#define __COMMON_DECOMPRESS_H__ + #ifdef __XEN__ #include @@ -23,3 +26,5 @@ #define large_free free #endif + +#endif /* __COMMON_DECOMPRESS_H__ */ diff --git a/xen/common/event_channel.h b/xen/common/event_channel.h index 45219ca67c..040bad77f9 100644 --- a/xen/common/event_channel.h +++ b/xen/common/event_channel.h @@ -1,5 +1,8 @@ /* Event channel handling private header. */ +#ifndef __COMMON_EVENT_CHANNEL_H__ +#define __COMMON_EVENT_CHANNEL_H__ + #include static inline unsigned int max_evtchns(const struct domain *d) @@ -52,6 +55,8 @@ int evtchn_fifo_init_control(struct evtchn_init_control *init_control); int evtchn_fifo_expand_array(const struct evtchn_expand_array *expand_array); void evtchn_fifo_destroy(struct domain *d); +#endif /* __COMMON_EVENT_CHANNEL_H__ */ + /* * Local variables: * mode: C diff --git a/xen/common/multicall.c b/xen/common/multicall.c index 1f0cc4cb26..421bb25b70 100644 --- a/xen/common/multicall.c +++ b/xen/common/multicall.c @@ -2,6 +2,9 @@ * multicall.c */ +#ifndef __COMMON_MULTICALL_C__ +#define __COMMON_MULTICALL_C__ + #include #include #include @@ -124,6 +127,8 @@ ret_t do_multicall( __HYPERVISOR_multicall, "hi", call_list, nr_calls-i); } +#endif /* __COMMON_MULTICALL_C__ */ + /* * Local variables: * mode: C From patchwork Mon Aug 28 13:20:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368029 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 D1EDBC83F12 for ; Mon, 28 Aug 2023 14:30:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591522.923975 (Exim 4.92) (envelope-from ) id 1qadFq-00047O-S7; Mon, 28 Aug 2023 14:30:10 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591522.923975; Mon, 28 Aug 2023 14:30: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 1qadFq-000439-LK; Mon, 28 Aug 2023 14:30:10 +0000 Received: by outflank-mailman (input) for mailman id 591522; Mon, 28 Aug 2023 13:20:33 +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 1qacAT-00031h-Il for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:20:33 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id aa9d47fc-45a5-11ee-8783-cb3800f73035; Mon, 28 Aug 2023 15:20:33 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 8F0C04EE0C8A; Mon, 28 Aug 2023 15:20:32 +0200 (CEST) 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: aa9d47fc-45a5-11ee-8783-cb3800f73035 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Jan Beulich Subject: [XEN PATCH 10/13] xen/efi: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:07 +0200 Message-Id: <7726a38c4bf15a94b9bbcbc465bd499f94067ddc.1693228255.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). Also C files, if included somewhere, need to comply with the guideline. Mechanical change. Signed-off-by: Simone Ballarin --- xen/common/efi/efi.h | 5 +++++ xen/common/efi/runtime.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/xen/common/efi/efi.h b/xen/common/efi/efi.h index c02fbb7b69..cef9381d30 100644 --- a/xen/common/efi/efi.h +++ b/xen/common/efi/efi.h @@ -1,3 +1,6 @@ +#ifndef __COMMON_EFI_EFI_H__ +#define __COMMON_EFI_EFI_H__ + #include #include #include @@ -51,3 +54,5 @@ void free_ebmalloc_unused_mem(void); const void *pe_find_section(const void *image, const UINTN image_size, const CHAR16 *section_name, UINTN *size_out); + +#endif /* __COMMON_EFI_EFI_H__ */ diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c index 5cb7504c96..fb6fd17ba3 100644 --- a/xen/common/efi/runtime.c +++ b/xen/common/efi/runtime.c @@ -6,6 +6,10 @@ #include #include +#ifndef __COMMON_EFI_RUNTIME_C__ +#define __COMMON_EFI_RUNTIME_C__ + + DEFINE_XEN_GUEST_HANDLE(CHAR16); struct efi_rs_state { @@ -704,3 +708,5 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op) return rc; } #endif + +#endif /* __COMMON_EFI_RUNTIME_C__ */ From patchwork Mon Aug 28 13:20:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368033 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 B53F8C71153 for ; Mon, 28 Aug 2023 14:30:38 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591523.923986 (Exim 4.92) (envelope-from ) id 1qadFr-0004Gm-Ff; Mon, 28 Aug 2023 14:30:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591523.923986; Mon, 28 Aug 2023 14:30:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qadFr-0004FA-2p; Mon, 28 Aug 2023 14:30:11 +0000 Received: by outflank-mailman (input) for mailman id 591523; Mon, 28 Aug 2023 13:20:34 +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 1qacAU-00031h-F8 for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:20:34 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id aae1a550-45a5-11ee-8783-cb3800f73035; Mon, 28 Aug 2023 15:20:33 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id F17CE4EE0C8D; Mon, 28 Aug 2023 15:20:32 +0200 (CEST) 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: aae1a550-45a5-11ee-8783-cb3800f73035 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , George Dunlap , Dario Faggioli Subject: [XEN PATCH 11/13] xen/sched: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:08 +0200 Message-Id: <8f2179f60335edcf97a04e1c35c7f4bb574c2145.1693228255.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). Mechanical change. Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini Reviewed-by: George Dunlap --- xen/common/sched/compat.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/common/sched/compat.c b/xen/common/sched/compat.c index a596e3a226..d718e450d4 100644 --- a/xen/common/sched/compat.c +++ b/xen/common/sched/compat.c @@ -3,6 +3,10 @@ * */ +#ifndef __COMMON_SCHED_COMPAT_C__ +#define __COMMON_SCHED_COMPAT_C__ + + #include #define COMPAT @@ -44,6 +48,8 @@ int compat_set_timer_op(uint32_t lo, int32_t hi) return do_set_timer_op(((s64)hi << 32) | lo); } +#endif /* __COMMON_SCHED_COMPAT_C__ */ + /* * Local variables: * mode: C From patchwork Mon Aug 28 13:20:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368040 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 60936C83F16 for ; Mon, 28 Aug 2023 14:45:28 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591539.924077 (Exim 4.92) (envelope-from ) id 1qadUO-0001tA-H5; Mon, 28 Aug 2023 14:45:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591539.924077; Mon, 28 Aug 2023 14:45: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 1qadUO-0001rC-43; Mon, 28 Aug 2023 14:45:12 +0000 Received: by outflank-mailman (input) for mailman id 591539; Mon, 28 Aug 2023 13:36:36 +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 1qacQ0-0004gK-LD for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:36:36 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ab3ade64-45a5-11ee-9b0c-b553b5be7939; Mon, 28 Aug 2023 15:20:34 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 6CD1D4EE0C8B; Mon, 28 Aug 2023 15:20:33 +0200 (CEST) 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: ab3ade64-45a5-11ee-9b0c-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 12/13] xen: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:09 +0200 Message-Id: <6ef4634e273a89582299061f1d14346572bf1d47.1693228255.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Move or amended inclusion guards to address violations of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). Inclusion guards must appear at the beginning of the headers (comments are permitted anywhere) and the #if directive cannot be used for other checks. Mechanical change. Signed-off-by: Simone Ballarin --- xen/include/xen/err.h | 4 +++- xen/include/xen/pci_ids.h | 5 +++++ xen/include/xen/softirq.h | 4 +++- xen/include/xen/unaligned.h | 7 ++++--- xen/include/xen/vmap.h | 4 +++- 5 files changed, 18 insertions(+), 6 deletions(-) diff --git a/xen/include/xen/err.h b/xen/include/xen/err.h index 2f29b57d28..a6323d82d7 100644 --- a/xen/include/xen/err.h +++ b/xen/include/xen/err.h @@ -1,5 +1,6 @@ -#if !defined(__XEN_ERR_H__) && !defined(__ASSEMBLY__) +#if !defined(__XEN_ERR_H__) #define __XEN_ERR_H__ +#if !defined(__ASSEMBLY__) #include #include @@ -54,4 +55,5 @@ static inline int __must_check PTR_RET(const void *ptr) return IS_ERR(ptr) ? PTR_ERR(ptr) : 0; } +#endif /* __ASSEMBLY__ */ #endif /* __XEN_ERR_H__ */ diff --git a/xen/include/xen/pci_ids.h b/xen/include/xen/pci_ids.h index e798477a7e..1a739d4c92 100644 --- a/xen/include/xen/pci_ids.h +++ b/xen/include/xen/pci_ids.h @@ -1,3 +1,6 @@ +#ifndef __XEN_PCI_IDS_H__ +#define __XEN_PCI_IDS_H__ + #define PCI_VENDOR_ID_AMD 0x1022 #define PCI_VENDOR_ID_NVIDIA 0x10de @@ -11,3 +14,5 @@ #define PCI_VENDOR_ID_BROADCOM 0x14e4 #define PCI_VENDOR_ID_INTEL 0x8086 + +#endif /* __XEN_PCI_IDS_H__ */ diff --git a/xen/include/xen/softirq.h b/xen/include/xen/softirq.h index 33d6f2ecd2..092ec733b7 100644 --- a/xen/include/xen/softirq.h +++ b/xen/include/xen/softirq.h @@ -1,5 +1,6 @@ -#if !defined(__XEN_SOFTIRQ_H__) && !defined(__ASSEMBLY__) +#if !defined(__XEN_SOFTIRQ_H__) #define __XEN_SOFTIRQ_H__ +#if !defined(__ASSEMBLY__) /* Low-latency softirqs come first in the following list. */ enum { @@ -40,4 +41,5 @@ void cpu_raise_softirq_batch_finish(void); */ void process_pending_softirqs(void); +#endif /* __ASSEMBLY__ */ #endif /* __XEN_SOFTIRQ_H__ */ diff --git a/xen/include/xen/unaligned.h b/xen/include/xen/unaligned.h index 0a2b16d05d..45f03b3f1b 100644 --- a/xen/include/xen/unaligned.h +++ b/xen/include/xen/unaligned.h @@ -3,13 +3,14 @@ * without faulting, and at least reasonably efficiently. Other architectures * will need to have a custom asm/unaligned.h. */ -#ifndef __ASM_UNALIGNED_H__ -#error "xen/unaligned.h should not be included directly - include asm/unaligned.h instead" -#endif #ifndef __XEN_UNALIGNED_H__ #define __XEN_UNALIGNED_H__ +#ifndef __ASM_UNALIGNED_H__ +#error "xen/unaligned.h should not be included directly - include asm/unaligned.h instead" +#endif + #ifdef __XEN__ #include #include diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h index b0f7632e89..7a61dea54a 100644 --- a/xen/include/xen/vmap.h +++ b/xen/include/xen/vmap.h @@ -1,5 +1,6 @@ -#if !defined(__XEN_VMAP_H__) && defined(VMAP_VIRT_START) +#if !defined(__XEN_VMAP_H__) #define __XEN_VMAP_H__ +#if defined(VMAP_VIRT_START) #include #include @@ -38,4 +39,5 @@ static inline void vm_init(void) vm_init_type(VMAP_DEFAULT, (void *)VMAP_VIRT_START, arch_vmap_virt_end()); } +#endif /* VMAP_VIRT_START */ #endif /* __XEN_VMAP_H__ */ From patchwork Mon Aug 28 13:20:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13368030 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 7A1B2C71153 for ; Mon, 28 Aug 2023 14:30:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.591524.923996 (Exim 4.92) (envelope-from ) id 1qadFs-0004b6-6a; Mon, 28 Aug 2023 14:30:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 591524.923996; Mon, 28 Aug 2023 14:30: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 1qadFr-0004XZ-Rq; Mon, 28 Aug 2023 14:30:11 +0000 Received: by outflank-mailman (input) for mailman id 591524; Mon, 28 Aug 2023 13:20:35 +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 1qacAV-00031h-FS for xen-devel@lists.xenproject.org; Mon, 28 Aug 2023 13:20:35 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ab949e26-45a5-11ee-8783-cb3800f73035; Mon, 28 Aug 2023 15:20:34 +0200 (CEST) Received: from beta.station (net-93-66-137-131.cust.vodafonedsl.it [93.66.137.131]) by support.bugseng.com (Postfix) with ESMTPSA id 073734EE0739; Mon, 28 Aug 2023 15:20:33 +0200 (CEST) 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: ab949e26-45a5-11ee-8783-cb3800f73035 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 13/13] x86/asm: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 28 Aug 2023 15:20:10 +0200 Message-Id: <7af1f690e486e2872a645463b4ec9d4b07a6c23a.1693228255.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Amend generation script to address a violation of MISRA C:2012 Directive 4.10 ("Precautions shall be taken in order to prevent the contents of a header file being included more than once"). This patch adds a special comment to the beginning of the header to make it explicit that the file is generated automatically. The comment is recognized by ECLAIR and will cause the deviation of the violation. Signed-off-by: Simone Ballarin --- xen/tools/compat-xlat-header.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/tools/compat-xlat-header.py b/xen/tools/compat-xlat-header.py index 2b805b23a8..9e336277ac 100644 --- a/xen/tools/compat-xlat-header.py +++ b/xen/tools/compat-xlat-header.py @@ -406,6 +406,8 @@ def main(): line = line.strip() header_tokens += re_tokenazier.split(line) + print("/* Generated file, do not edit! */") + with open(sys.argv[2]) as compat_list: for line in compat_list: words = re_tokenazier.split(line, maxsplit=1)