From patchwork Mon Mar 11 08:59:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588371 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 BA33DC5475B for ; Mon, 11 Mar 2024 09:00:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691262.1077047 (Exim 4.92) (envelope-from ) id 1rjbW2-00070S-Iu; Mon, 11 Mar 2024 09:00:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691262.1077047; Mon, 11 Mar 2024 09:00:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW2-0006zX-Cl; Mon, 11 Mar 2024 09:00:14 +0000 Received: by outflank-mailman (input) for mailman id 691262; Mon, 11 Mar 2024 09:00:13 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW1-0006j9-AA for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:13 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c45e3e27-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:11 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id B8C4D4EE0C96; Mon, 11 Mar 2024 10:00:10 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c45e3e27-df85-11ee-a1ee-f123f15fe8a2 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 , =?utf-8?q?Roger_Pau_Mo?= =?utf-8?q?nn=C3=A9?= Subject: [XEN PATCH v3 01/16] misra: add deviation for headers that explicitly avoid guards Date: Mon, 11 Mar 2024 09:59:10 +0100 Message-Id: <310fe4a0ccd0ad45bcf1cd9811ac56c9a560dd0b.1710145041.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 deviation cooments for headers that avoid guards. Signed-off-by: Simone Ballarin --- Changes in v3: - fix inconsistent deviation ID - change comment-based deviation text Changes in v2: - use the format introduced with doc/misra/safe.json instead of a generic text-based deviation --- docs/misra/safe.json | 9 +++++++++ xen/include/public/arch-x86/cpufeatureset.h | 1 + xen/include/public/errno.h | 1 + 3 files changed, 11 insertions(+) diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 952324f85c..e98956d604 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -28,6 +28,15 @@ }, { "id": "SAF-3-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: headers that leave it up to the caller to include them correctly", + "text": "Headers that deliberatively avoid inclusion guards explicitly leaving responsibility to the caller are allowed." + + }, + { + "id": "SAF-4-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h index 0374cec3a2..f78a461d93 100644 --- a/xen/include/public/arch-x86/cpufeatureset.h +++ b/xen/include/public/arch-x86/cpufeatureset.h @@ -23,6 +23,7 @@ * their XEN_CPUFEATURE() being appropriate in the included context. */ +/* SAF-3-safe omitted inclusion guard */ #ifndef XEN_CPUFEATURE /* diff --git a/xen/include/public/errno.h b/xen/include/public/errno.h index 5a78a7607c..28e064b67f 100644 --- a/xen/include/public/errno.h +++ b/xen/include/public/errno.h @@ -17,6 +17,7 @@ * will unilaterally #undef XEN_ERRNO(). */ +/* SAF-3-safe omitted inclusion guard */ #ifndef XEN_ERRNO /* From patchwork Mon Mar 11 08:59:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588372 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 CDFEFC54E6A for ; Mon, 11 Mar 2024 09:00:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691263.1077062 (Exim 4.92) (envelope-from ) id 1rjbW3-0007QX-Pf; Mon, 11 Mar 2024 09:00:15 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691263.1077062; Mon, 11 Mar 2024 09:00:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW3-0007QK-Kv; Mon, 11 Mar 2024 09:00:15 +0000 Received: by outflank-mailman (input) for mailman id 691263; Mon, 11 Mar 2024 09:00:14 +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 1rjbW2-0006j9-0I for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:14 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c4c1e773-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:12 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 4BD344EE0C98; Mon, 11 Mar 2024 10:00:11 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c4c1e773-df85-11ee-a1ee-f123f15fe8a2 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 , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH v3 02/16] misra: modify deviations for empty and generated headers Date: Mon, 11 Mar 2024 09:59:11 +0100 Message-Id: <8a491f641a8931b6ccc91fca1da6cdfa090c5b36.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 This patch modifies deviations for Directive 4.10: "Precautions shall be taken in order to prevent the contents of a header file being included more than once" This patch avoids the file-based deviation for empty headers, and replaces it with a comment-based one using the format specified in docs/misra/safe.json. Generated headers are not generally safe against multi-inclusions, whether a header is safe depends on the nature of the generated code in the header. For that reason, this patch drops the deviation for generated headers. Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- Changes in v2: - use the format introduced with doc/misra/safe.json instead of a file-based deviation for empty headers - remove deviation for generated headers The reason of moving the comment-based deviation in "runtime.h" is that it should appear immediatly before the violation and, for files with no tokens, the location is the the last line of the file. --- automation/eclair_analysis/ECLAIR/deviations.ecl | 7 ------- docs/misra/safe.json | 13 ++++++++++--- xen/arch/arm/efi/runtime.h | 1 + xen/include/Makefile | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index 9ac3ee4dfd..039ffaf52a 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -63,13 +63,6 @@ they are not instances of commented-out code." -config=MC3R1.D4.3,reports+={disapplied,"!(any_area(any_loc(file(^xen/arch/arm/arm64/.*$))))"} -doc_end --doc_begin="This header file is autogenerated or empty, therefore it poses no -risk if included more than once." --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)))"} --doc_end - -doc_begin="Files that are intended to be included more than once do not need to conform to the directive." -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* This file is legitimately included multiple times\\. \\*/$, begin-4))"} diff --git a/docs/misra/safe.json b/docs/misra/safe.json index e98956d604..d2489379a7 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -33,10 +33,17 @@ }, "name": "Dir 4.10: headers that leave it up to the caller to include them correctly", "text": "Headers that deliberatively avoid inclusion guards explicitly leaving responsibility to the caller are allowed." - - }, - { + }, + { "id": "SAF-4-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: empty headers", + "text": "Empty headers pose no risk if included more than once." + }, + { + "id": "SAF-5-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/arch/arm/efi/runtime.h b/xen/arch/arm/efi/runtime.h index 25afcebed1..732bf4a18c 100644 --- a/xen/arch/arm/efi/runtime.h +++ b/xen/arch/arm/efi/runtime.h @@ -1 +1,2 @@ /* Placeholder for ARM-specific runtime include/declarations */ +/* SAF-4-safe empty header */ diff --git a/xen/include/Makefile b/xen/include/Makefile index 2e61b50139..a77c9ffb7e 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -53,7 +53,7 @@ cmd_compat_h = \ mv -f $@.new $@ quiet_cmd_stub_h = GEN $@ -cmd_stub_h = echo '/* empty */' >$@ +cmd_stub_h = echo '/* SAF-4-safe empty header */' >$@ quiet_cmd_compat_i = CPP $@ cmd_compat_i = $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/config.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $< From patchwork Mon Mar 11 08:59:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588368 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 21EADC54E58 for ; Mon, 11 Mar 2024 09:00:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691261.1077042 (Exim 4.92) (envelope-from ) id 1rjbW2-0006xV-9C; Mon, 11 Mar 2024 09:00:14 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691261.1077042; Mon, 11 Mar 2024 09:00:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW2-0006xO-5g; Mon, 11 Mar 2024 09:00:14 +0000 Received: by outflank-mailman (input) for mailman id 691261; Mon, 11 Mar 2024 09:00:13 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW1-0006iu-9W for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:13 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c5248ef2-df85-11ee-afdc-a90da7624cb6; Mon, 11 Mar 2024 10:00:12 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id F11A14EE0C97; Mon, 11 Mar 2024 10:00:11 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c5248ef2-df85-11ee-afdc-a90da7624cb6 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 , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= Subject: [XEN PATCH v3 03/16] misra: add deviations for direct inclusion guards Date: Mon, 11 Mar 2024 09:59:12 +0100 Message-Id: <1fdfec12fd2207c294f50d01d8ec32f890b915d7.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add deviation comments 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). This patch adds deviation comments using the format specified in docs/misra/safe.json for headers with just the direct inclusion guard before the inclusion guard since they are safe and not supposed to comply with the directive. Signed-off-by: Simone Ballarin --- Changes in v3: - fix inconsistent deviation ID The patch has been introduced in v2. --- docs/misra/safe.json | 8 ++++++++ xen/arch/arm/include/asm/hypercall.h | 1 + xen/arch/x86/include/asm/hypercall.h | 1 + 3 files changed, 10 insertions(+) diff --git a/docs/misra/safe.json b/docs/misra/safe.json index d2489379a7..363c9e21b0 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -44,6 +44,14 @@ }, { "id": "SAF-5-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: direct inclusion guard before", + "text": "Headers with just the direct inclusion guard before the inclusion guard are safe." + }, + { + "id": "SAF-6-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/arch/arm/include/asm/hypercall.h b/xen/arch/arm/include/asm/hypercall.h index ccd26c5184..b754475cd0 100644 --- a/xen/arch/arm/include/asm/hypercall.h +++ b/xen/arch/arm/include/asm/hypercall.h @@ -1,3 +1,4 @@ +/* SAF-5-safe direct inclusion guard before */ #ifndef __XEN_HYPERCALL_H__ #error "asm/hypercall.h should not be included directly - include xen/hypercall.h instead" #endif diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/asm/hypercall.h index ec2edc771e..1a51ae02bf 100644 --- a/xen/arch/x86/include/asm/hypercall.h +++ b/xen/arch/x86/include/asm/hypercall.h @@ -2,6 +2,7 @@ * asm-x86/hypercall.h */ +/* SAF-5-safe direct inclusion guard before */ #ifndef __XEN_HYPERCALL_H__ #error "asm/hypercall.h should not be included directly - include xen/hypercall.h instead" #endif From patchwork Mon Mar 11 08:59:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588369 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 D2680C54E6E for ; Mon, 11 Mar 2024 09:00:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691264.1077067 (Exim 4.92) (envelope-from ) id 1rjbW4-0007T9-2i; Mon, 11 Mar 2024 09:00:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691264.1077067; Mon, 11 Mar 2024 09:00:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW3-0007SC-T7; Mon, 11 Mar 2024 09:00:15 +0000 Received: by outflank-mailman (input) for mailman id 691264; Mon, 11 Mar 2024 09:00:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW2-0006iu-83 for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:14 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c5755589-df85-11ee-afdc-a90da7624cb6; Mon, 11 Mar 2024 10:00:13 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id A07264EE0C99; Mon, 11 Mar 2024 10:00:12 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c5755589-df85-11ee-afdc-a90da7624cb6 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Maria Celeste Cesario Subject: [XEN PATCH v3 04/16] xen/arm: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:13 +0100 Message-Id: <868ede5a23489e018e272188edfbee572d1ad393.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add inclusion guard 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 Signed-off-by: Maria Celeste Cesario --- Changes in v3: - remove trailing underscores - change inclusion guard name to adhere to the new standard Changes in v2: - drop changes in xen/arch/arm/include/asm/hypercall.h - drop changes in xen/arch/arm/include/asm/iocap.h since they are not related with the directive --- xen/arch/arm/efi/efi-boot.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index 0cb29f90a0..580859fecd 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 XEN_ARCH_ARM_EFI_EFI_BOOT_H +#define XEN_ARCH_ARM_EFI_EFI_BOOT_H + #include #include #include @@ -992,6 +996,8 @@ static void __init efi_arch_flush_dcache_area(const void *vaddr, UINTN size) __flush_dcache_area(vaddr, size); } +#endif /* XEN_ARCH_ARM_EFI_EFI_BOOT_H */ + /* * Local variables: * mode: C From patchwork Mon Mar 11 08:59:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588366 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 C51B4C54E67 for ; Mon, 11 Mar 2024 09:00:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691265.1077073 (Exim 4.92) (envelope-from ) id 1rjbW4-0007dE-Ji; Mon, 11 Mar 2024 09:00:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691265.1077073; Mon, 11 Mar 2024 09:00:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW4-0007aH-EZ; Mon, 11 Mar 2024 09:00:16 +0000 Received: by outflank-mailman (input) for mailman id 691265; Mon, 11 Mar 2024 09:00:15 +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 1rjbW3-0006iu-8G for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:15 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c5c13633-df85-11ee-afdc-a90da7624cb6; Mon, 11 Mar 2024 10:00:13 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 2A4544EE0C9C; Mon, 11 Mar 2024 10:00:13 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c5c13633-df85-11ee-afdc-a90da7624cb6 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 , Maria Celeste Cesario Subject: [XEN PATCH v3 05/16] xen/x86: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:14 +0100 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). Mechanical change. Signed-off-by: Simone Ballarin Signed-off-by: Maria Celeste Cesario --- Changes in v3: - remove trailing underscores - change inclusion guard name to adhere to the new standard Changes in v2: - remove extra blanks - drop changes in C files Note: Changes in Makefile were not strictly necessary in v1 and a maintainer asked to remove them since there was a deviation for generated headers. Starting from v2, they are required since the deviation has been removed by another patch of this series. --- xen/arch/x86/Makefile | 10 ++++++---- xen/arch/x86/cpu/cpu.h | 5 +++++ xen/arch/x86/x86_64/mmconfig.h | 5 +++++ xen/arch/x86/x86_emulate/private.h | 5 +++++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index 26d8740529..4548cdc53d 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -258,18 +258,20 @@ $(obj)/asm-macros.i: CFLAGS-y += -P $(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/asm-macros.i $(src)/Makefile $(call filechk,asm-macros.h) +ARCHDIR = $(shell echo $(SRCARCH) | tr a-z A-Z) + define filechk_asm-macros.h + echo '#ifndef ASM_$(ARCHDIR)_ASM_MACROS_H'; \ + echo '#define ASM_$(ARCHDIR)_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_$(ARCHDIR)_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..b763cdf3da 100644 --- a/xen/arch/x86/cpu/cpu.h +++ b/xen/arch/x86/cpu/cpu.h @@ -1,3 +1,6 @@ +#ifndef XEN_ARCH_X86_CPU_CPU_H +#define XEN_ARCH_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 /* XEN_ARCH_X86_CPU_CPU_H */ diff --git a/xen/arch/x86/x86_64/mmconfig.h b/xen/arch/x86/x86_64/mmconfig.h index 3da4b21e9b..c8e67a67db 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 XEN_ARCH_X86_X86_64_MMCONFIG_H +#define XEN_ARCH_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 idx); void pci_mmcfg_arch_disable(unsigned int idx); + +#endif /* XEN_ARCH_X86_X86_64_MMCONFIG_H */ diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h index 0fa26ba00a..835161cb53 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 XEN_ARCH_X86_X86_EMULATE_PRIVATE_H +#define XEN_ARCH_X86_X86_EMULATE_PRIVATE_H + #ifdef __XEN__ # include @@ -836,3 +839,5 @@ static inline int read_ulong(enum x86_segment seg, *val = 0; return ops->read(seg, offset, val, bytes, ctxt); } + +#endif /* XEN_ARCH_X86_X86_EMULATE_PRIVATE_H */ From patchwork Mon Mar 11 08:59:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588374 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 E3BB3C54E69 for ; Mon, 11 Mar 2024 09:00:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691266.1077082 (Exim 4.92) (envelope-from ) id 1rjbW5-0007j6-8j; Mon, 11 Mar 2024 09:00:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691266.1077082; Mon, 11 Mar 2024 09:00:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW4-0007hC-Pw; Mon, 11 Mar 2024 09:00:16 +0000 Received: by outflank-mailman (input) for mailman id 691266; Mon, 11 Mar 2024 09:00:15 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW3-0006j9-QO for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:15 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c616516b-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:14 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id AC1DE4EE0C9F; Mon, 11 Mar 2024 10:00:13 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c616516b-df85-11ee-a1ee-f123f15fe8a2 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 , Maria Celeste Cesario Subject: [XEN PATCH v3 06/16] x86/EFI: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:15 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Add inclusion guard 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 Signed-off-by: Maria Celeste Cesario Reviewed-by: Stefano Stabellini --- Changes in v3: - remove trailing underscores - change inclusion guard name to adhere to the new standard --- xen/arch/x86/efi/efi-boot.h | 7 +++++++ xen/arch/x86/efi/runtime.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 8ea64e31cd..df6eaa9e9e 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -3,6 +3,11 @@ * is intended to be included by common/efi/boot.c _only_, and * therefore can define arch specific global variables. */ + +#ifndef XEN_ARCH_X86_EFI_EFI_BOOT_H +#define XEN_ARCH_X86_EFI_EFI_BOOT_H + + #include #include #include @@ -905,6 +910,8 @@ void asmlinkage __init efi_multiboot2(EFI_HANDLE ImageHandle, efi_exit_boot(ImageHandle, SystemTable); } +#endif /* XEN_ARCH_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..13d4ba66b6 100644 --- a/xen/arch/x86/efi/runtime.h +++ b/xen/arch/x86/efi/runtime.h @@ -1,3 +1,6 @@ +#ifndef XEN_ARCH_X86_EFI_RUNTIME_H +#define XEN_ARCH_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 /* XEN_ARCH_X86_EFI_RUNTIME_H */ From patchwork Mon Mar 11 08:59:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588373 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 0F044C54E72 for ; Mon, 11 Mar 2024 09:00:28 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691267.1077092 (Exim 4.92) (envelope-from ) id 1rjbW6-00084Q-EW; Mon, 11 Mar 2024 09:00:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691267.1077092; Mon, 11 Mar 2024 09:00:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW6-00082p-4l; Mon, 11 Mar 2024 09:00:18 +0000 Received: by outflank-mailman (input) for mailman id 691267; Mon, 11 Mar 2024 09:00:16 +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 1rjbW4-0006iu-8Y for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:16 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c6687e97-df85-11ee-afdc-a90da7624cb6; Mon, 11 Mar 2024 10:00:14 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 37EFA4EE0C9B; Mon, 11 Mar 2024 10:00:14 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c6687e97-df85-11ee-afdc-a90da7624cb6 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 , Maria Celeste Cesario Subject: [XEN PATCH v3 07/16] xen/common: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:16 +0100 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 Signed-off-by: Maria Celeste Cesario Reviewed-by: Stefano Stabellini --- Changes in v3: - remove trailing underscores - change inclusion guard name to adhere to the new standard Changes in v2: - drop changes in C files --- xen/common/decompress.h | 5 +++++ xen/common/event_channel.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/xen/common/decompress.h b/xen/common/decompress.h index e8195b353a..41848274ab 100644 --- a/xen/common/decompress.h +++ b/xen/common/decompress.h @@ -1,3 +1,6 @@ +#ifndef XEN_COMMON_DECOMPRESS_H +#define XEN_COMMON_DECOMPRESS_H + #ifdef __XEN__ #include @@ -23,3 +26,5 @@ #define large_free free #endif + +#endif /* XEN_COMMON_DECOMPRESS_H */ diff --git a/xen/common/event_channel.h b/xen/common/event_channel.h index 45219ca67c..a23e39a713 100644 --- a/xen/common/event_channel.h +++ b/xen/common/event_channel.h @@ -1,5 +1,8 @@ /* Event channel handling private header. */ +#ifndef XEN_COMMON_EVENT_CHANNEL_H +#define XEN_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 /* XEN_COMMON_EVENT_CHANNEL_H */ + /* * Local variables: * mode: C From patchwork Mon Mar 11 08:59:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588370 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 C992BC54E68 for ; Mon, 11 Mar 2024 09:00:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691268.1077096 (Exim 4.92) (envelope-from ) id 1rjbW7-0008Db-1w; Mon, 11 Mar 2024 09:00:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691268.1077096; Mon, 11 Mar 2024 09:00:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW6-0008Ad-Po; Mon, 11 Mar 2024 09:00:18 +0000 Received: by outflank-mailman (input) for mailman id 691268; Mon, 11 Mar 2024 09:00:17 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW4-0006j9-Q4 for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:16 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c6a8ece6-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:15 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id BECF04EE0CA0; Mon, 11 Mar 2024 10:00:14 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c6a8ece6-df85-11ee-a1ee-f123f15fe8a2 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Jan Beulich , Maria Celeste Cesario Subject: [XEN PATCH v3 08/16] xen/efi: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:17 +0100 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 Signed-off-by: Maria Celeste Cesario Reviewed-by: Stefano Stabellini --- Changes in v3: - remove trailing underscores - change inclusion guard name to adhere to the new standard Changes in v2: - drop changes in C files --- xen/common/efi/efi.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/common/efi/efi.h b/xen/common/efi/efi.h index c02fbb7b69..ab604ebd59 100644 --- a/xen/common/efi/efi.h +++ b/xen/common/efi/efi.h @@ -1,3 +1,6 @@ +#ifndef XEN_COMMON_EFI_EFI_H +#define XEN_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 /* XEN_COMMON_EFI_EFI_H */ From patchwork Mon Mar 11 08:59:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588376 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 C17EAC5475B for ; Mon, 11 Mar 2024 09:00:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691269.1077106 (Exim 4.92) (envelope-from ) id 1rjbW7-0008LK-Sb; Mon, 11 Mar 2024 09:00:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691269.1077106; Mon, 11 Mar 2024 09:00:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW7-0008Ia-Gr; Mon, 11 Mar 2024 09:00:19 +0000 Received: by outflank-mailman (input) for mailman id 691269; Mon, 11 Mar 2024 09:00:17 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW5-0006j9-D7 for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:17 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c6fdbf60-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:15 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 2D0764EE0CA3; Mon, 11 Mar 2024 10:00:15 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c6fdbf60-df85-11ee-a1ee-f123f15fe8a2 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 , Maria Celeste Cesario Subject: [XEN PATCH v3 09/16] xen: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:18 +0100 Message-Id: <504cdd2a0f27d28e0a87492f75476b123b68bbc0.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Amend 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 Signed-off-by: Maria Celeste Cesario Acked-by: Julien Grall Reviewed-by: Stefano Stabellini --- Changes in v3: - remove trailing underscores - change inclusion guard name to adhere to the new standard Changes in v2: - drop changes in xen/include/xen/unaligned.h since this second series adds a comment-based deviation in a separate patch - use #ifndef instead of #if !defined() --- xen/include/xen/err.h | 8 +++++--- xen/include/xen/pci_ids.h | 5 +++++ xen/include/xen/softirq.h | 8 +++++--- xen/include/xen/vmap.h | 8 +++++--- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/xen/include/xen/err.h b/xen/include/xen/err.h index cbdd1bf7f8..360307c5da 100644 --- a/xen/include/xen/err.h +++ b/xen/include/xen/err.h @@ -1,5 +1,6 @@ -#if !defined(__XEN_ERR_H__) && !defined(__ASSEMBLY__) -#define __XEN_ERR_H__ +#ifndef XEN_INCLUDE_XEN_ERR_H +#define XEN_INCLUDE_XEN_ERR_H +#ifndef __ASSEMBLY__ #include #include @@ -41,4 +42,5 @@ static inline int __must_check PTR_RET(const void *ptr) return IS_ERR(ptr) ? PTR_ERR(ptr) : 0; } -#endif /* __XEN_ERR_H__ */ +#endif /* __ASSEMBLY__ */ +#endif /* XEN_INCLUDE_XEN_ERR_H */ diff --git a/xen/include/xen/pci_ids.h b/xen/include/xen/pci_ids.h index e798477a7e..8f2318bccd 100644 --- a/xen/include/xen/pci_ids.h +++ b/xen/include/xen/pci_ids.h @@ -1,3 +1,6 @@ +#ifndef XEN_INCLUDE_XEN_PCI_IDS_H +#define XEN_INCLUDE_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_INCLUDE_XEN_PCI_IDS_H */ diff --git a/xen/include/xen/softirq.h b/xen/include/xen/softirq.h index 33d6f2ecd2..d108cdd4bc 100644 --- a/xen/include/xen/softirq.h +++ b/xen/include/xen/softirq.h @@ -1,5 +1,6 @@ -#if !defined(__XEN_SOFTIRQ_H__) && !defined(__ASSEMBLY__) -#define __XEN_SOFTIRQ_H__ +#ifndef XEN_INCLUDE_XEN_SOFTIRQ_H +#define XEN_INCLUDE_XEN_SOFTIRQ_H +#ifndef __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 /* __XEN_SOFTIRQ_H__ */ +#endif /* __ASSEMBLY__ */ +#endif /* XEN_INCLUDE_XEN_SOFTIRQ_H */ diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h index 0c16baa85f..bb83f5f64a 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) -#define __XEN_VMAP_H__ +#ifndef XEN_INCLUDE_XEN_VMAP_H +#define XEN_INCLUDE_XEN_VMAP_H +#ifdef VMAP_VIRT_START #include #include @@ -42,4 +43,5 @@ static inline void vm_init(void) vm_init_type(VMAP_DEFAULT, (void *)VMAP_VIRT_START, arch_vmap_virt_end()); } -#endif /* __XEN_VMAP_H__ */ +#endif /* VMAP_VIRT_START */ +#endif /* XEN_INCLUDE_XEN_VMAP_H */ From patchwork Mon Mar 11 08:59:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588378 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 D52E8C54E68 for ; Mon, 11 Mar 2024 09:00:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691271.1077114 (Exim 4.92) (envelope-from ) id 1rjbW9-000081-0f; Mon, 11 Mar 2024 09:00:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691271.1077114; Mon, 11 Mar 2024 09:00:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW8-0008U8-Dc; Mon, 11 Mar 2024 09:00:20 +0000 Received: by outflank-mailman (input) for mailman id 691271; Mon, 11 Mar 2024 09:00:18 +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 1rjbW6-0006j9-0j for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:18 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c7593b5a-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:16 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id B42534EE0C90; Mon, 11 Mar 2024 10:00:15 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c7593b5a-df85-11ee-a1ee-f123f15fe8a2 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 , =?utf-8?q?Roger_Pau_Mo?= =?utf-8?q?nn=C3=A9?= , Maria Celeste Cesario Subject: [XEN PATCH v3 10/16] x86/asm: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:19 +0100 Message-Id: <1e44047e767431c32621ae44d3121bc2152b3cb5.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Amend generation script, 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"). This patch amends the Makefile adding the required inclusion guards for xlat.h. Add deviation comment for files intended for multiple inclusion. Signed-off-by: Simone Ballarin Signed-off-by: Maria Celeste Cesario --- Changes in v3: - fix inconsistent deviation ID - remove trailing underscores Changes in v2: - merge patches 7/13 and 13/13 of v1 as they had the same commit message - amend the Makefile to produce the required inclusion guard - use the format introduced with doc/misra/safe.json instead of a generic text-based deviation --- docs/misra/safe.json | 8 ++++++++ xen/arch/x86/include/asm/compat.h | 5 +++++ xen/arch/x86/include/asm/cpufeatures.h | 5 +---- xen/arch/x86/include/asm/efibind.h | 5 +++++ xen/include/Makefile | 10 ++++++++-- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 363c9e21b0..13208d18ec 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -52,6 +52,14 @@ }, { "id": "SAF-6-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: file intended for multiple inclusion", + "text": "Files intended for multiple inclusion are not supposed to comply with D4.10." + }, + { + "id": "SAF-7-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/arch/x86/include/asm/compat.h b/xen/arch/x86/include/asm/compat.h index 818cad87db..36e7750843 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 c3aad21c3b..a65754d553 100644 --- a/xen/arch/x86/include/asm/cpufeatures.h +++ b/xen/arch/x86/include/asm/cpufeatures.h @@ -1,7 +1,4 @@ -/* - * Explicitly intended for multiple inclusion. - */ - +/* SAF-6-safe file intended for multiple inclusion */ #include /* Number of capability words covered by the featureset words. */ diff --git a/xen/arch/x86/include/asm/efibind.h b/xen/arch/x86/include/asm/efibind.h index bce02f3707..75684742be 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/include/Makefile b/xen/include/Makefile index a77c9ffb7e..e777921eb1 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -104,10 +104,16 @@ $(obj)/compat/.xlat/%.lst: $(srcdir)/xlat.lst FORCE xlat-y := $(shell sed -ne 's,@arch@,$(compat-arch-y),g' -re 's,^[?!][[:blank:]]+[^[:blank:]]+[[:blank:]]+,,p' $(srcdir)/xlat.lst | uniq) xlat-y := $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y)) +ARCHDIR = $(shell echo $(SRCARCH) | tr a-z A-Z) + quiet_cmd_xlat_h = GEN $@ -cmd_xlat_h = \ - cat $(filter %.h,$^) >$@.new; \ +define cmd_xlat_h + echo "#ifndef ASM_$(ARCHDIR)_COMPAT_XLAT_H" > $@.new; \ + echo "#define ASM_$(ARCHDIR)_COMPAT_XLAT_H" >> $@.new; \ + cat $(filter %.h,$^) >> $@.new; \ + echo "#endif /* ASM_$(ARCHDIR)_COMPAT_XLAT_H */" >> $@.new; \ mv -f $@.new $@ +endef $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) FORCE $(call if_changed,xlat_h) From patchwork Mon Mar 11 08:59:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588379 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 C12FBC5475B for ; Mon, 11 Mar 2024 09:00:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691273.1077141 (Exim 4.92) (envelope-from ) id 1rjbWB-0000q2-V2; Mon, 11 Mar 2024 09:00:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691273.1077141; Mon, 11 Mar 2024 09:00:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbWB-0000nU-Dx; Mon, 11 Mar 2024 09:00:23 +0000 Received: by outflank-mailman (input) for mailman id 691273; Mon, 11 Mar 2024 09:00:19 +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 1rjbW7-0006j9-0o for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:19 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c7a8977b-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:17 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 53C8B4EE0C9A; Mon, 11 Mar 2024 10:00:16 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c7a8977b-df85-11ee-a1ee-f123f15fe8a2 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Maria Celeste Cesario , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Simone Ballarin Subject: [XEN PATCH v3 11/16] xen/arm: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:20 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add or modify 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. --- Commit introduced in v3 Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/arch/arm/include/asm/domain.h | 6 +++--- xen/arch/arm/include/asm/efibind.h | 5 +++++ xen/arch/arm/include/asm/event.h | 6 +++--- xen/arch/arm/include/asm/grant_table.h | 6 +++--- xen/arch/arm/include/asm/io.h | 6 +++--- xen/arch/arm/include/asm/irq.h | 6 +++--- xen/arch/arm/include/asm/smp.h | 6 +++--- xen/arch/arm/include/asm/spinlock.h | 6 +++--- xen/arch/arm/include/asm/system.h | 6 +++--- 9 files changed, 29 insertions(+), 24 deletions(-) diff --git a/xen/arch/arm/include/asm/domain.h b/xen/arch/arm/include/asm/domain.h index 8218afb862..b7dc023a25 100644 --- a/xen/arch/arm/include/asm/domain.h +++ b/xen/arch/arm/include/asm/domain.h @@ -1,5 +1,5 @@ -#ifndef __ASM_DOMAIN_H__ -#define __ASM_DOMAIN_H__ +#ifndef ASM_ARM_DOMAIN_H +#define ASM_ARM_DOMAIN_H #include #include @@ -312,7 +312,7 @@ static inline void update_guest_memory_policy(struct vcpu *v, struct guest_memory_policy *gmp) {} -#endif /* __ASM_DOMAIN_H__ */ +#endif /* ASM_ARM_DOMAIN_H */ /* * Local variables: diff --git a/xen/arch/arm/include/asm/efibind.h b/xen/arch/arm/include/asm/efibind.h index 09dca7a8c9..689bf63232 100644 --- a/xen/arch/arm/include/asm/efibind.h +++ b/xen/arch/arm/include/asm/efibind.h @@ -1,2 +1,7 @@ +#ifndef ASM_ARM_EFI_BIND_H +#define ASM_ARM_EFI_BIND_H + #include #include + +#endif /* ASM_ARM_EFI_BIND_H */ diff --git a/xen/arch/arm/include/asm/event.h b/xen/arch/arm/include/asm/event.h index b14c166ad6..db5d5ea37a 100644 --- a/xen/arch/arm/include/asm/event.h +++ b/xen/arch/arm/include/asm/event.h @@ -1,5 +1,5 @@ -#ifndef __ASM_EVENT_H__ -#define __ASM_EVENT_H__ +#ifndef ASM_ARM_EVENT_H +#define ASM_ARM_EVENT_H #include @@ -52,7 +52,7 @@ static inline bool arch_virq_is_global(unsigned int virq) return true; } -#endif +#endif /* ASM_ARM_EVENT_H */ /* * Local variables: * mode: C diff --git a/xen/arch/arm/include/asm/grant_table.h b/xen/arch/arm/include/asm/grant_table.h index d3c518a926..0363c6aa1e 100644 --- a/xen/arch/arm/include/asm/grant_table.h +++ b/xen/arch/arm/include/asm/grant_table.h @@ -1,5 +1,5 @@ -#ifndef __ASM_GRANT_TABLE_H__ -#define __ASM_GRANT_TABLE_H__ +#ifndef ASM_ARM_GRANT_TABLE_H +#define ASM_ARM_GRANT_TABLE_H #include #include @@ -76,7 +76,7 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t frame, #define gnttab_need_iommu_mapping(d) \ (is_domain_direct_mapped(d) && is_iommu_enabled(d)) -#endif /* __ASM_GRANT_TABLE_H__ */ +#endif /* ASM_ARM_GRANT_TABLE_H */ /* * Local variables: * mode: C diff --git a/xen/arch/arm/include/asm/io.h b/xen/arch/arm/include/asm/io.h index e426804424..8b5f811ec8 100644 --- a/xen/arch/arm/include/asm/io.h +++ b/xen/arch/arm/include/asm/io.h @@ -1,5 +1,5 @@ -#ifndef _ASM_IO_H -#define _ASM_IO_H +#ifndef ASM_ARM_IO_H +#define ASM_ARM_IO_H #if defined(CONFIG_ARM_32) # include @@ -9,7 +9,7 @@ # error "unknown ARM variant" #endif -#endif +#endif /* ASM_ARM_IO_H */ /* * Local variables: * mode: C diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h index c8044b0371..48b46de51f 100644 --- a/xen/arch/arm/include/asm/irq.h +++ b/xen/arch/arm/include/asm/irq.h @@ -1,5 +1,5 @@ -#ifndef _ASM_HW_IRQ_H -#define _ASM_HW_IRQ_H +#ifndef ASM_ARM_IRQ_H +#define ASM_ARM_IRQ_H #include #include @@ -99,7 +99,7 @@ void irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask); */ bool irq_type_set_by_domain(const struct domain *d); -#endif /* _ASM_HW_IRQ_H */ +#endif /* ASM_ARM_IRQ_H */ /* * Local variables: * mode: C diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h index e99a3a3f53..44e4183470 100644 --- a/xen/arch/arm/include/asm/smp.h +++ b/xen/arch/arm/include/asm/smp.h @@ -1,5 +1,5 @@ -#ifndef __ASM_SMP_H -#define __ASM_SMP_H +#ifndef ASM_ARM_SMP_H +#define ASM_ARM_SMP_H #ifndef __ASSEMBLY__ #include @@ -39,7 +39,7 @@ extern unsigned int smp_get_max_cpus(void); #define cpu_physical_id(cpu) cpu_logical_map(cpu) -#endif +#endif /* ASM_ARM_SMP_H */ /* * Local variables: diff --git a/xen/arch/arm/include/asm/spinlock.h b/xen/arch/arm/include/asm/spinlock.h index 42b0f584fe..326005c39a 100644 --- a/xen/arch/arm/include/asm/spinlock.h +++ b/xen/arch/arm/include/asm/spinlock.h @@ -1,5 +1,5 @@ -#ifndef __ASM_SPINLOCK_H -#define __ASM_SPINLOCK_H +#ifndef ASM_ARM_SPINLOCK_H +#define ASM_ARM_SPINLOCK_H #define arch_lock_acquire_barrier() smp_mb() #define arch_lock_release_barrier() smp_mb() @@ -12,4 +12,4 @@ #define arch_lock_signal_wmb() arch_lock_signal() -#endif /* __ASM_SPINLOCK_H */ +#endif /* ASM_ARM_SPINLOCK_H */ diff --git a/xen/arch/arm/include/asm/system.h b/xen/arch/arm/include/asm/system.h index 65d5c8e423..faf9227f53 100644 --- a/xen/arch/arm/include/asm/system.h +++ b/xen/arch/arm/include/asm/system.h @@ -1,6 +1,6 @@ /* Portions taken from Linux arch arm */ -#ifndef __ASM_SYSTEM_H -#define __ASM_SYSTEM_H +#ifndef ASM_ARM_SYSTEM_H +#define ASM_ARM_SYSTEM_H #include #include @@ -62,7 +62,7 @@ static inline int local_abort_is_enabled(void) extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next); -#endif +#endif /* ASM_ARM_SYSTEM_H */ /* * Local variables: * mode: C From patchwork Mon Mar 11 08:59:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588377 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 D0BE3C54E58 for ; Mon, 11 Mar 2024 09:00:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691270.1077124 (Exim 4.92) (envelope-from ) id 1rjbW9-0000KW-Vr; Mon, 11 Mar 2024 09:00:21 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691270.1077124; Mon, 11 Mar 2024 09:00:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW9-0000Ek-7p; Mon, 11 Mar 2024 09:00:21 +0000 Received: by outflank-mailman (input) for mailman id 691270; Mon, 11 Mar 2024 09:00:18 +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 1rjbW6-0006iu-1H for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:18 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c7f9c963-df85-11ee-afdc-a90da7624cb6; Mon, 11 Mar 2024 10:00:17 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id D11F94EE0C95; Mon, 11 Mar 2024 10:00:16 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c7f9c963-df85-11ee-afdc-a90da7624cb6 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Maria Celeste Cesario , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu , Simone Ballarin Subject: [XEN PATCH v3 12/16] xen: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:21 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Modify creation rule for asm-offsets.h to conform to the new standard and to not generate conflicting guards between architectures (which is a violation of the directive). Modify generic-y creation rule to generate code without violations and to conform to the new standard. Mechanical change. --- Commit introduced in v3 Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/build.mk | 6 ++++-- xen/scripts/Makefile.asm-generic | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/xen/build.mk b/xen/build.mk index 0f490ca71b..bd8b93e2ae 100644 --- a/xen/build.mk +++ b/xen/build.mk @@ -45,6 +45,8 @@ asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c $(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $< $(call move-if-changed,$@.new,$@) +ARCHDIR = $(shell echo $(SRCARCH) | tr a-z A-Z) + arch/$(SRCARCH)/include/asm/asm-offsets.h: asm-offsets.s @(set -e; \ echo "/*"; \ @@ -54,8 +56,8 @@ arch/$(SRCARCH)/include/asm/asm-offsets.h: asm-offsets.s echo " *"; \ echo " */"; \ echo ""; \ - echo "#ifndef __ASM_OFFSETS_H__"; \ - echo "#define __ASM_OFFSETS_H__"; \ + echo "#ifndef ASM_$(ARCHDIR)_ASM_OFFSETS_H"; \ + echo "#define ASM_$(ARCHDIR)_ASM_OFFSETS_H"; \ echo ""; \ sed -rne "/^[^#].*==>/{s:.*==>(.*)<==.*:\1:; s: [\$$#]: :; p;}"; \ echo ""; \ diff --git a/xen/scripts/Makefile.asm-generic b/xen/scripts/Makefile.asm-generic index b0d356bfa3..3b538bc7a4 100644 --- a/xen/scripts/Makefile.asm-generic +++ b/xen/scripts/Makefile.asm-generic @@ -31,8 +31,22 @@ generated-y := $(addprefix $(obj)/, $(generated-y)) old-headers := $(wildcard $(obj)/*.h) unwanted := $(filter-out $(generic-y) $(generated-y),$(old-headers)) +define header_stub +#ifndef ASM_GENERIC_$(3)_$(2)_H +#define ASM_GENERIC_$(3)_$(2)_H + +#include + +#endif /* ASM_GENERIC_$(3)_$(2)_H */ +endef + +arch = $(shell echo $(SRCARCH) | tr a-z A-Z) + +header_body = $(call header_stub,$*,$(shell echo "$*" | tr a-z A-Z),$(arch)) +export header_body + quiet_cmd_wrap = WRAP $@ - cmd_wrap = echo "\#include " > $@ + cmd_wrap = echo "$$header_body" > $@ quiet_cmd_remove = REMOVE $(unwanted) cmd_remove = rm -f $(unwanted) From patchwork Mon Mar 11 08:59:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588375 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 10534C54E66 for ; Mon, 11 Mar 2024 09:00:30 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691272.1077133 (Exim 4.92) (envelope-from ) id 1rjbWB-0000er-6q; Mon, 11 Mar 2024 09:00:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691272.1077133; Mon, 11 Mar 2024 09:00:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbWA-0000aS-JB; Mon, 11 Mar 2024 09:00:22 +0000 Received: by outflank-mailman (input) for mailman id 691272; Mon, 11 Mar 2024 09:00:18 +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 1rjbW6-0006iu-Pw for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:18 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c85b0784-df85-11ee-afdc-a90da7624cb6; Mon, 11 Mar 2024 10:00:18 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 65B984EE0C9E; Mon, 11 Mar 2024 10:00:17 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c85b0784-df85-11ee-afdc-a90da7624cb6 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Maria Celeste Cesario , Simone Ballarin , Doug Goldstein , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu , =?utf-8?q?Roger_Pau_Mo?= =?utf-8?q?nn=C3=A9?= Subject: [XEN PATCH v3 13/16] xen: add deviations for MISRA C.2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:22 +0100 Message-Id: <787aa5a65135796c825d366b43e00ba018c0065b.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add safe deviation for *.c files, as estabilished in past discussion. Add SAF deviation for files that need an #include directive before guard. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- Commit introduced in v3 Link to the discussion thread: https://lists.xenproject.org/archives/html/xen-devel/2023-09/msg00239.html --- automation/eclair_analysis/ECLAIR/deviations.ecl | 5 +++++ docs/misra/deviations.rst | 7 +++++++ docs/misra/safe.json | 8 ++++++++ xen/include/public/arch-x86/xen.h | 1 + 4 files changed, 21 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl index 039ffaf52a..8082239ccc 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -69,6 +69,11 @@ conform to the directive." -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"} -doc_end +-doc_begin="Including multiple times a .c file is safe because every function or data item +it defines would (in the common case) be already defined. Peer reviewed by the community." +-config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(^.*\\.c$))"} +-doc_end + # # Series 5. # diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index ce855ddae6..7b32dbd23f 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -30,6 +30,13 @@ Deviations related to MISRA C:2012 Directives: not to add an additional encapsulation layer. - Tagged as `deliberate` for ECLAIR. + * - D4.10 + - Including multiple times a .c file is safe because every function or data item + it defines would in (the common case) be already defined. + Peer reviewed by the community. + - Tagged as `safe` for ECLAIR. + + Deviations related to MISRA C:2012 Rules: ----------------------------------------- diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 13208d18ec..dd61b47194 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -60,6 +60,14 @@ }, { "id": "SAF-7-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: include needed before guard", + "text": "These files need to start with an include directive to generate preprocessed code in the correct order." + }, + { + "id": "SAF-8-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h index c0f4551247..0b2e9271f8 100644 --- a/xen/include/public/arch-x86/xen.h +++ b/xen/include/public/arch-x86/xen.h @@ -7,6 +7,7 @@ * Copyright (c) 2004-2006, K A Fraser */ +/* SAF-7-safe include before guard needed for correct code generation */ #include "../xen.h" #ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__ From patchwork Mon Mar 11 08:59:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588380 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 C133BC54E66 for ; Mon, 11 Mar 2024 09:00:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691274.1077149 (Exim 4.92) (envelope-from ) id 1rjbWD-0001AV-0V; Mon, 11 Mar 2024 09:00:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691274.1077149; Mon, 11 Mar 2024 09:00:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbWC-00016O-IV; Mon, 11 Mar 2024 09:00:24 +0000 Received: by outflank-mailman (input) for mailman id 691274; Mon, 11 Mar 2024 09:00:20 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbW8-0006j9-7r for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:20 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c8a8545d-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:18 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 0C5F54EE0C99; Mon, 11 Mar 2024 10:00:18 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c8a8545d-df85-11ee-a1ee-f123f15fe8a2 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Maria Celeste Cesario , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu Subject: [XEN PATCH v3 14/16] xen/x86: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:23 +0100 Message-Id: <305d6474a84e16d44c193a93e2c2ca91d6dd0f7e.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Edit 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. --- Commit introduced in v3 Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- xen/arch/x86/include/asm/domain.h | 6 +++--- xen/arch/x86/include/asm/event.h | 6 +++--- xen/arch/x86/include/asm/grant_table.h | 6 +++--- xen/arch/x86/include/asm/io.h | 6 +++--- xen/arch/x86/include/asm/irq.h | 6 +++--- xen/arch/x86/include/asm/smp.h | 6 +++--- xen/arch/x86/include/asm/spinlock.h | 6 +++--- xen/arch/x86/include/asm/system.h | 6 +++--- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h index 622d22bef2..cb7b01f7ef 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -1,5 +1,5 @@ -#ifndef __ASM_DOMAIN_H__ -#define __ASM_DOMAIN_H__ +#ifndef ASM_X86_DOMAIN_H +#define ASM_X86_DOMAIN_H #include #include @@ -780,7 +780,7 @@ struct arch_vcpu_io { /* Maxphysaddr supportable by the paging infrastructure. */ unsigned int domain_max_paddr_bits(const struct domain *d); -#endif /* __ASM_DOMAIN_H__ */ +#endif /* ASM_X86_DOMAIN_H */ /* * Local variables: diff --git a/xen/arch/x86/include/asm/event.h b/xen/arch/x86/include/asm/event.h index 5e09ede6d7..c0b6088c91 100644 --- a/xen/arch/x86/include/asm/event.h +++ b/xen/arch/x86/include/asm/event.h @@ -6,8 +6,8 @@ * */ -#ifndef __ASM_EVENT_H__ -#define __ASM_EVENT_H__ +#ifndef ASM_X86_EVENT_H +#define ASM_X86_EVENT_H #include @@ -53,4 +53,4 @@ static inline bool arch_virq_is_global(unsigned int virq) (pv_shim && (chn)->port && (chn)->state == ECS_RESERVED) #endif -#endif +#endif /* ASM_X86_EVENT_H */ diff --git a/xen/arch/x86/include/asm/grant_table.h b/xen/arch/x86/include/asm/grant_table.h index 5c23cec90c..2468f21ad6 100644 --- a/xen/arch/x86/include/asm/grant_table.h +++ b/xen/arch/x86/include/asm/grant_table.h @@ -4,8 +4,8 @@ * Copyright (c) 2004-2005 K A Fraser */ -#ifndef __ASM_GRANT_TABLE_H__ -#define __ASM_GRANT_TABLE_H__ +#ifndef ASM_X86_GRANT_TABLE_H +#define ASM_X86_GRANT_TABLE_H #include @@ -72,4 +72,4 @@ static inline void gnttab_clear_flags(struct domain *d, #define gnttab_need_iommu_mapping(d) \ (!paging_mode_translate(d) && need_iommu_pt_sync(d)) -#endif /* __ASM_GRANT_TABLE_H__ */ +#endif /* ASM_X86_GRANT_TABLE_H */ diff --git a/xen/arch/x86/include/asm/io.h b/xen/arch/x86/include/asm/io.h index 9b19d2d389..9371784584 100644 --- a/xen/arch/x86/include/asm/io.h +++ b/xen/arch/x86/include/asm/io.h @@ -1,5 +1,5 @@ -#ifndef _ASM_IO_H -#define _ASM_IO_H +#ifndef ASM_X86_IO_H +#define ASM_X86_IO_H #include #include @@ -57,4 +57,4 @@ struct cpu_user_regs; unsigned int ioemul_handle_proliant_quirk( uint8_t opcode, char *io_emul_stub, const struct cpu_user_regs *regs); -#endif +#endif /* ASM_X86_IO_H */ diff --git a/xen/arch/x86/include/asm/irq.h b/xen/arch/x86/include/asm/irq.h index 082a3d6bbc..f8139842b4 100644 --- a/xen/arch/x86/include/asm/irq.h +++ b/xen/arch/x86/include/asm/irq.h @@ -1,5 +1,5 @@ -#ifndef _ASM_HW_IRQ_H -#define _ASM_HW_IRQ_H +#ifndef ASM_X86_IRQ_H +#define ASM_X86_IRQ_H /* (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar */ @@ -192,4 +192,4 @@ int allocate_and_map_gsi_pirq(struct domain *d, int index, int *pirq_p); int allocate_and_map_msi_pirq(struct domain *d, int index, int *pirq_p, int type, struct msi_info *msi); -#endif /* _ASM_HW_IRQ_H */ +#endif /* ASM_X86_IRQ_H */ diff --git a/xen/arch/x86/include/asm/smp.h b/xen/arch/x86/include/asm/smp.h index c8c7960134..cdfe9ea96f 100644 --- a/xen/arch/x86/include/asm/smp.h +++ b/xen/arch/x86/include/asm/smp.h @@ -1,5 +1,5 @@ -#ifndef __ASM_SMP_H -#define __ASM_SMP_H +#ifndef ASM_X86_SMP_H +#define ASM_X86_SMP_H /* * We need the APIC definitions automatically as part of 'smp.h' @@ -81,4 +81,4 @@ void *cpu_alloc_stack(unsigned int cpu); #endif /* !__ASSEMBLY__ */ -#endif +#endif /* ASM_X86_SMP_H */ diff --git a/xen/arch/x86/include/asm/spinlock.h b/xen/arch/x86/include/asm/spinlock.h index 56f6095752..2a86560343 100644 --- a/xen/arch/x86/include/asm/spinlock.h +++ b/xen/arch/x86/include/asm/spinlock.h @@ -1,5 +1,5 @@ -#ifndef __ASM_SPINLOCK_H -#define __ASM_SPINLOCK_H +#ifndef ASM_X86_SPINLOCK_H +#define ASM_X86_SPINLOCK_H #define _raw_read_unlock(l) \ BUILD_BUG_ON(sizeof((l)->lock) != 4); /* Clang doesn't support %z in asm. */ \ @@ -24,4 +24,4 @@ arch_lock_signal(); \ }) -#endif /* __ASM_SPINLOCK_H */ +#endif /* ASM_X86_SPINLOCK_H */ diff --git a/xen/arch/x86/include/asm/system.h b/xen/arch/x86/include/asm/system.h index 73cb16ca68..12e8b974b1 100644 --- a/xen/arch/x86/include/asm/system.h +++ b/xen/arch/x86/include/asm/system.h @@ -1,5 +1,5 @@ -#ifndef __ASM_SYSTEM_H -#define __ASM_SYSTEM_H +#ifndef ASM_X86_SYSTEM_H +#define ASM_X86_SYSTEM_H #include #include @@ -269,4 +269,4 @@ void load_system_tables(void); void percpu_traps_init(void); void subarch_percpu_traps_init(void); -#endif +#endif /* ASM_X86_SYSTEM_H */ From patchwork Mon Mar 11 08:59:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588382 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 0A6E5C54E58 for ; Mon, 11 Mar 2024 09:00:40 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691275.1077157 (Exim 4.92) (envelope-from ) id 1rjbWE-0001MF-7Z; Mon, 11 Mar 2024 09:00:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691275.1077157; Mon, 11 Mar 2024 09:00:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbWD-0001If-Bo; Mon, 11 Mar 2024 09:00:25 +0000 Received: by outflank-mailman (input) for mailman id 691275; Mon, 11 Mar 2024 09:00:21 +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 1rjbW9-0006j9-0y for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:21 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c8f7fdf3-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:19 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 831634EE0CA1; Mon, 11 Mar 2024 10:00:18 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c8f7fdf3-df85-11ee-a1ee-f123f15fe8a2 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Maria Celeste Cesario , Jan Beulich , Andrew Cooper , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Wei Liu , Simone Ballarin Subject: [XEN PATCH v3 15/16] x86/mtrr: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:24 +0100 Message-Id: <33413c877af70c8aed05ed1bc7b259c59087cb96.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add inclusion guard 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. Acked-by: Jan Beulich --- Commit introduced in v3 Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/arch/x86/cpu/mtrr/mtrr.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/x86/cpu/mtrr/mtrr.h b/xen/arch/x86/cpu/mtrr/mtrr.h index a9741e0cb0..632bf658be 100644 --- a/xen/arch/x86/cpu/mtrr/mtrr.h +++ b/xen/arch/x86/cpu/mtrr/mtrr.h @@ -1,6 +1,8 @@ /* * local mtrr defines. */ +#ifndef X86_CPU_MTRR_MTRR_H +#define X86_CPU_MTRR_MTRR_H #define MTRR_CHANGE_MASK_FIXED 0x01 #define MTRR_CHANGE_MASK_VARIABLE 0x02 @@ -25,3 +27,5 @@ extern u64 size_or_mask, size_and_mask; extern unsigned int num_var_ranges; void mtrr_state_warn(void); + +#endif /* X86_CPU_MTRR_MTRR_H */ From patchwork Mon Mar 11 08:59:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588381 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 E8B3BC54E67 for ; Mon, 11 Mar 2024 09:00:36 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691276.1077166 (Exim 4.92) (envelope-from ) id 1rjbWF-0001bA-9H; Mon, 11 Mar 2024 09:00:27 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691276.1077166; Mon, 11 Mar 2024 09:00:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rjbWE-0001TI-EW; Mon, 11 Mar 2024 09:00:26 +0000 Received: by outflank-mailman (input) for mailman id 691276; Mon, 11 Mar 2024 09:00:22 +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 1rjbWA-0006j9-1F for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:22 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c94b92b3-df85-11ee-a1ee-f123f15fe8a2; Mon, 11 Mar 2024 10:00:19 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id 0C23F4EE0C9C; Mon, 11 Mar 2024 10:00:19 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c94b92b3-df85-11ee-a1ee-f123f15fe8a2 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Maria Celeste Cesario , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu , Simone Ballarin Subject: [XEN PATCH v3 16/16] xen/lz4: address violations of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:25 +0100 Message-Id: <1d02e429534b9b1c53fd3c5b82588e3803434c92.1710145041.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 From: Maria Celeste Cesario Add inclusion guard 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. Acked-by: Jan Beulich --- Commit introduced in v3 Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin --- xen/common/lz4/defs.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/xen/common/lz4/defs.h b/xen/common/lz4/defs.h index 6d81113266..ecfbf07f83 100644 --- a/xen/common/lz4/defs.h +++ b/xen/common/lz4/defs.h @@ -8,6 +8,9 @@ * published by the Free Software Foundation. */ +#ifndef COMMON_LZ4_DEFS_H +#define COMMON_LZ4_DEFS_H + #ifdef __XEN__ #include #include @@ -166,3 +169,5 @@ typedef struct _U64_S { u64 v; } U64_S; LZ4_WILDCOPY(s, d, e); \ d = e; \ } while (0) + +#endif /* COMMON_LZ4_DEFS_H */