From nobody Mon Sep 16 19:24:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722557280545.1123072287171; Tue, 23 Jul 2024 01:15:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762674.1172890 (Exim 4.92) (envelope-from ) id 1sWAgN-0008AV-Di; Tue, 23 Jul 2024 08:15:39 +0000 Received: by outflank-mailman (output) from mailman id 762674.1172890; Tue, 23 Jul 2024 08:15:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgN-0008AO-9W; Tue, 23 Jul 2024 08:15:39 +0000 Received: by outflank-mailman (input) for mailman id 762674; Tue, 23 Jul 2024 08:15:37 +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 1sWAgL-0007w0-CQ for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:37 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bcebe19c-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:15:35 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 4B9634EE0742; Tue, 23 Jul 2024 10:15:33 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bcebe19c-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alessandro Zucchelli Subject: [XEN PATCH v5 01/17] misra: add deviation for headers that explicitly avoid guards Date: Tue, 23 Jul 2024 10:14:53 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722558951116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin Some headers, under specific circumstances (documented in a comment at the beginning of the file), explicitly do not have strict 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 Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- Changes in v5: - edit deviation description - edit commit message 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 | 8 ++++++++ xen/include/public/arch-x86/cpufeatureset.h | 1 + xen/include/public/errno.h | 1 + 3 files changed, 10 insertions(+) diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 3f18ef401c..44d1c4890e 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -68,6 +68,14 @@ }, { "id": "SAF-8-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: headers that leave it up to the caller to i= nclude them correctly", + "text": "Headers that deliberatively leave the responsability = of their correct inclusion to the caller are allowed." + }, + { + "id": "SAF-9-safe", "analyser": {}, "name": "Sentinel", "text": "Next ID to be used" diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/publ= ic/arch-x86/cpufeatureset.h index d9eba5e9a7..3962ba9342 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. */ =20 +/* SAF-8-safe inclusion procedure left to caller */ #ifndef XEN_CPUFEATURE =20 /* diff --git a/xen/include/public/errno.h b/xen/include/public/errno.h index 5a78a7607c..b9fc6762fb 100644 --- a/xen/include/public/errno.h +++ b/xen/include/public/errno.h @@ -17,6 +17,7 @@ * will unilaterally #undef XEN_ERRNO(). */ =20 +/* SAF-8-safe inclusion procedure left to caller */ #ifndef XEN_ERRNO =20 /* --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722555105229.59743177968278; Tue, 23 Jul 2024 01:15:55 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762675.1172900 (Exim 4.92) (envelope-from ) id 1sWAgO-0008P3-Kp; Tue, 23 Jul 2024 08:15:40 +0000 Received: by outflank-mailman (output) from mailman id 762675.1172900; Tue, 23 Jul 2024 08:15:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgO-0008Ow-Hg; Tue, 23 Jul 2024 08:15:40 +0000 Received: by outflank-mailman (input) for mailman id 762675; Tue, 23 Jul 2024 08:15:39 +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 1sWAgN-0008AN-JK for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:39 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id be7d88b8-48cb-11ef-bbfe-fd08da9f4363; Tue, 23 Jul 2024 10:15:38 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id DF8D44EE0743; Tue, 23 Jul 2024 10:15:35 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: be7d88b8-48cb-11ef-bbfe-fd08da9f4363 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Doug Goldstein , Stefano Stabellini , Andrew Cooper , Jan Beulich , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Alessandro Zucchelli Subject: [XEN PATCH v5 02/17] misra: modify deviations for empty and generated headers Date: Tue, 23 Jul 2024 10:14:54 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722557260116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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 Signed-off-by: Alessandro Zucchelli Signed-off-by: Nicola Vetrini --- Changes in v4: - rebased against current staging tree 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 | 8 ++++++++ xen/arch/arm/efi/runtime.h | 1 + xen/include/Makefile | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index 0af1cb93d1..1c39a9a16d 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -72,13 +72,6 @@ they are not instances of commented-out code." -config=3DMC3R1.D4.3,reports+=3D{deliberate, "any_area(any_loc(file(arm64_= bitops))&&context(name(int_clear_mask16)))"} -doc_end =20 --doc_begin=3D"This header file is autogenerated or empty, therefore it pos= es no -risk if included more than once." --file_tag+=3D{empty_header, "^xen/arch/arm/efi/runtime\\.h$"} --file_tag+=3D{autogen_headers, "^xen/include/xen/compile\\.h$||^xen/includ= e/generated/autoconf.h$||^xen/include/xen/hypercall-defs.h$"} --config=3DMC3R1.D4.10,reports+=3D{safe, "all_area(all_loc(file(empty_heade= r||autogen_headers)))"} --doc_end - -doc_begin=3D"Files that are intended to be included more than once do not= need to conform to the directive." -config=3DMC3R1.D4.10,reports+=3D{safe, "first_area(text(^/\\* This file i= s legitimately included multiple times\\. \\*/$, begin-4))"} diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 44d1c4890e..ffa8bfdc4a 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -76,6 +76,14 @@ }, { "id": "SAF-9-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-10-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..4d2d40bf3c 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-9-safe empty header */ diff --git a/xen/include/Makefile b/xen/include/Makefile index 2e61b50139..058b0a566b 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -53,7 +53,7 @@ cmd_compat_h =3D \ mv -f $@.new $@ =20 quiet_cmd_stub_h =3D GEN $@ -cmd_stub_h =3D echo '/* empty */' >$@ +cmd_stub_h =3D echo '/* SAF-9-safe empty header */' >$@ =20 quiet_cmd_compat_i =3D CPP $@ cmd_compat_i =3D $(CPP) $(filter-out -Wa$(comma)% -include %/include/xen/c= onfig.h,$(XEN_CFLAGS)) $(cppflags-y) -o $@ $< --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722562325495.684915138856; Tue, 23 Jul 2024 01:16:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762676.1172910 (Exim 4.92) (envelope-from ) id 1sWAgR-0000FO-So; Tue, 23 Jul 2024 08:15:43 +0000 Received: by outflank-mailman (output) from mailman id 762676.1172910; Tue, 23 Jul 2024 08:15:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgR-0000FF-Pm; Tue, 23 Jul 2024 08:15:43 +0000 Received: by outflank-mailman (input) for mailman id 762676; Tue, 23 Jul 2024 08:15:43 +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 1sWAgQ-0007w0-V8 for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:42 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c03feec9-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:15:41 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id A5D214EE0744; Tue, 23 Jul 2024 10:15:38 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c03feec9-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alessandro Zucchelli Subject: [XEN PATCH v5 03/17] misra: add deviations for direct inclusion guards Date: Tue, 23 Jul 2024 10:14:55 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722563025116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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. Note that with SAF-10-safe in place, failures to have proper guards later in the header files will not be reported Signed-off-by: Simone Ballarin Signed-off-by: Alessandro Zucchelli Signed-off-by: Nicola Vetrini Reviewed-by: Stefano Stabellini --- Changes in v5: - rebase against the current staging tree Changes in v4: - Added comment clarifying that no further checks will be performed on a file that has a SAF-10-safe deviation against missing inclusion guards. - rebased against the current staging tree 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 ffa8bfdc4a..684346386e 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -84,6 +84,14 @@ }, { "id": "SAF-10-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: direct inclusion guard before", + "text": "Headers with just the direct inclusion guard before t= he inclusion guard are safe." + }, + { + "id": "SAF-11-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/as= m/hypercall.h index ccd26c5184..07e231f8b5 100644 --- a/xen/arch/arm/include/asm/hypercall.h +++ b/xen/arch/arm/include/asm/hypercall.h @@ -1,3 +1,4 @@ +/* SAF-10-safe direct inclusion guard before */ #ifndef __XEN_HYPERCALL_H__ #error "asm/hypercall.h should not be included directly - include xen/hype= rcall.h instead" #endif diff --git a/xen/arch/x86/include/asm/hypercall.h b/xen/arch/x86/include/as= m/hypercall.h index ec2edc771e..389fa62af2 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 */ =20 +/* SAF-10-safe direct inclusion guard before */ #ifndef __XEN_HYPERCALL_H__ #error "asm/hypercall.h should not be included directly - include xen/hype= rcall.h instead" #endif --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722565282576.2128023855423; Tue, 23 Jul 2024 01:16:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762680.1172920 (Exim 4.92) (envelope-from ) id 1sWAgV-0000Yc-46; Tue, 23 Jul 2024 08:15:47 +0000 Received: by outflank-mailman (output) from mailman id 762680.1172920; Tue, 23 Jul 2024 08:15:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgV-0000YV-1L; Tue, 23 Jul 2024 08:15:47 +0000 Received: by outflank-mailman (input) for mailman id 762680; Tue, 23 Jul 2024 08:15:46 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgU-0007w0-4B for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:46 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c228f9dd-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:15:44 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id D04FC4EE073E; Tue, 23 Jul 2024 10:15:41 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c228f9dd-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Alessandro Zucchelli Subject: [XEN PATCH v5 04/17] xen/arm: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:14:56 +0200 Message-Id: <33365a3adcf26a814f760005fd4d87adcac9c3e2.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722566973116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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 Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- Changes in v5: - edit inclusion guard, according to the feedback received Changes in v4: - Dropped ARCH_ string from the guard, according to the feedback received 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 199f526022..612c20f96f 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 @@ -992,6 +996,8 @@ static void __init efi_arch_flush_dcache_area(const voi= d *vaddr, UINTN size) __flush_dcache_area(vaddr, size); } =20 +#endif /* ARM__EFI__EFI_BOOT_H */ + /* * Local variables: * mode: C --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722570758258.8764386482086; Tue, 23 Jul 2024 01:16:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762681.1172930 (Exim 4.92) (envelope-from ) id 1sWAgX-0000rZ-IZ; Tue, 23 Jul 2024 08:15:49 +0000 Received: by outflank-mailman (output) from mailman id 762681.1172930; Tue, 23 Jul 2024 08:15:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgX-0000rP-Es; Tue, 23 Jul 2024 08:15:49 +0000 Received: by outflank-mailman (input) for mailman id 762681; Tue, 23 Jul 2024 08:15:47 +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 1sWAgV-0008AN-E6 for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:47 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c37ed557-48cb-11ef-bbfe-fd08da9f4363; Tue, 23 Jul 2024 10:15:46 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 0A11F4EE073F; Tue, 23 Jul 2024 10:15:44 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c37ed557-48cb-11ef-bbfe-fd08da9f4363 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alessandro Zucchelli Subject: [XEN PATCH v5 05/17] xen/x86: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:14:57 +0200 Message-Id: <4395577d2a07f6edaebbef937cb96028bb92de31.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722571007116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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 Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Acked-by: Jan Beulich --- Changes in v5: - remove hard tab that slipped in the makefile - edit inclusion guards and makefile Changes in v4: - modified inclusion guards and makefile. 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 removing them since there was a deviation for generated headers. Now, in v2, they are required since the deviation has been removed by another patch of this series. --- xen/arch/x86/Makefile | 9 +++++---- 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, 20 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile index d902fb7acc..31197dfd96 100644 --- a/xen/arch/x86/Makefile +++ b/xen/arch/x86/Makefile @@ -260,17 +260,18 @@ $(objtree)/arch/x86/include/asm/asm-macros.h: $(obj)/= asm-macros.i $(src)/Makefil $(call filechk,asm-macros.h) =20 define filechk_asm-macros.h + guard=3D$$(echo ASM__${SRCARCH}__ASM_MACROS_H | tr a-z A-Z); \ + echo '#ifndef $$guard'; \ + echo '#define $$guard'; \ 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 /* $$guard */' endef =20 $(obj)/efi.lds: AFLAGS-y +=3D -DEFI diff --git a/xen/arch/x86/cpu/cpu.h b/xen/arch/x86/cpu/cpu.h index 8be65e975a..8e52f24e10 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); @@ -26,3 +29,5 @@ void amd_init_spectral_chicken(void); void detect_zen2_null_seg_behaviour(void); =20 void intel_unlock_cpuid_leaves(struct cpuinfo_x86 *c); + +#endif /* X86__CPU__CPU_H */ diff --git a/xen/arch/x86/x86_64/mmconfig.h b/xen/arch/x86/x86_64/mmconfig.h index 3da4b21e9b..0b51d2179e 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 */ =20 +#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 =20 @@ -72,3 +75,5 @@ int pci_mmcfg_reserved(uint64_t address, unsigned int seg= ment, int pci_mmcfg_arch_init(void); int pci_mmcfg_arch_enable(unsigned int idx); void pci_mmcfg_arch_disable(unsigned int idx); + +#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 0fa26ba00a..940d511b06 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. */ =20 +#ifndef X86__X86_EMULATE__PRIVATE_H +#define X86__X86_EMULATE__PRIVATE_H + #ifdef __XEN__ =20 # include @@ -836,3 +839,5 @@ static inline int read_ulong(enum x86_segment seg, *val =3D 0; return ops->read(seg, offset, val, bytes, ctxt); } + +#endif /* X86__X86_EMULATE__PRIVATE_H */ --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722568475696.0270399755584; Tue, 23 Jul 2024 01:16:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762683.1172935 (Exim 4.92) (envelope-from ) id 1sWAgX-0000vZ-VD; Tue, 23 Jul 2024 08:15:49 +0000 Received: by outflank-mailman (output) from mailman id 762683.1172935; Tue, 23 Jul 2024 08:15:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgX-0000v1-On; Tue, 23 Jul 2024 08:15:49 +0000 Received: by outflank-mailman (input) for mailman id 762683; Tue, 23 Jul 2024 08:15:49 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgX-0008AN-6Z for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:49 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c496bb2e-48cb-11ef-bbfe-fd08da9f4363; Tue, 23 Jul 2024 10:15:48 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 210094EE0744; Tue, 23 Jul 2024 10:15:46 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c496bb2e-48cb-11ef-bbfe-fd08da9f4363 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alessandro Zucchelli , Stefano Stabellini Subject: [XEN PATCH v5 06/17] x86/EFI: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:14:58 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722568982116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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 Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- Changes in v5: - Remove double blank lines - edit inclusion guards Changes in v4: - Modified inclusion guard. Changes in v3: - remove trailing underscores - change inclusion guard name to adhere to the new standard Changes in v2: - remove changes in "xen/arch/x86/efi/efi-boot.h" --- xen/arch/x86/efi/efi-boot.h | 5 +++++ xen/arch/x86/efi/runtime.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index f282358435..4f7b7b67dc 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -3,6 +3,9 @@ * 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 @@ -912,6 +915,8 @@ void asmlinkage __init efi_multiboot2(EFI_HANDLE ImageH= andle, efi_exit_boot(ImageHandle, SystemTable); } =20 +#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..c88c0a6bbd 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 */ --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722576216833.1557731508104; Tue, 23 Jul 2024 01:16:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762687.1172950 (Exim 4.92) (envelope-from ) id 1sWAgb-0001a0-4A; Tue, 23 Jul 2024 08:15:53 +0000 Received: by outflank-mailman (output) from mailman id 762687.1172950; Tue, 23 Jul 2024 08:15:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAga-0001Zg-W2; Tue, 23 Jul 2024 08:15:53 +0000 Received: by outflank-mailman (input) for mailman id 762687; Tue, 23 Jul 2024 08:15:52 +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 1sWAga-0007w0-95 for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:52 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c5d28af4-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:15:50 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id AC4754EE0743; Tue, 23 Jul 2024 10:15:48 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c5d28af4-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Alessandro Zucchelli Subject: [XEN PATCH v5 07/17] xen/common: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:14:59 +0200 Message-Id: <734dc1456dcd31a8940b74b8e157a7c0b1959a47.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722577029116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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 Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli --- Changes in v5: - edit inclusion guards 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..2d5a99451d 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__ =20 #include @@ -23,3 +26,5 @@ #define large_free free =20 #endif + +#endif /* COMMON__DECOMPRESS_H */ diff --git a/xen/common/event_channel.h b/xen/common/event_channel.h index 45219ca67c..3a8c240b40 100644 --- a/xen/common/event_channel.h +++ b/xen/common/event_channel.h @@ -1,5 +1,8 @@ /* Event channel handling private header. */ =20 +#ifndef COMMON__EVENT_CHANNEL_H +#define COMMON__EVENT_CHANNEL_H + #include =20 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_arra= y); void evtchn_fifo_destroy(struct domain *d); =20 +#endif /* COMMON__EVENT_CHANNEL_H */ + /* * Local variables: * mode: C --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722568630800.0854352421364; Tue, 23 Jul 2024 01:16:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762689.1172960 (Exim 4.92) (envelope-from ) id 1sWAgd-00024X-Dm; Tue, 23 Jul 2024 08:15:55 +0000 Received: by outflank-mailman (output) from mailman id 762689.1172960; Tue, 23 Jul 2024 08:15:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgd-00023d-9o; Tue, 23 Jul 2024 08:15:55 +0000 Received: by outflank-mailman (input) for mailman id 762689; Tue, 23 Jul 2024 08:15:54 +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 1sWAgc-0007w0-0D for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:54 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c6dc7cd9-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:15:52 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id EC21C4EE073E; Tue, 23 Jul 2024 10:15:50 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c6dc7cd9-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Jan Beulich , Stefano Stabellini , Alessandro Zucchelli Subject: [XEN PATCH v5 08/17] xen/efi: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:15:00 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722568976116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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 Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli --- Changes in v5: - edit inclusion guard 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..3876d15207 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); =20 const void *pe_find_section(const void *image, const UINTN image_size, const CHAR16 *section_name, UINTN *size_out); + +#endif /* COMMON__EFI__EFI_H */ --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722598204515.6945234779679; Tue, 23 Jul 2024 01:16:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762715.1172994 (Exim 4.92) (envelope-from ) id 1sWAh1-0004R6-Od; Tue, 23 Jul 2024 08:16:19 +0000 Received: by outflank-mailman (output) from mailman id 762715.1172994; Tue, 23 Jul 2024 08:16: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 1sWAh1-0004QP-Jy; Tue, 23 Jul 2024 08:16:19 +0000 Received: by outflank-mailman (input) for mailman id 762715; Tue, 23 Jul 2024 08:16: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 1sWAge-0007w0-O3 for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:56 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c8727ee1-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:15:55 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id AC9154EE0747; Tue, 23 Jul 2024 10:15:52 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c8727ee1-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Julien Grall , Alessandro Zucchelli Subject: [XEN PATCH v5 09/17] xen: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:15:01 +0200 Message-Id: <8776f366569c1e789eaaabc8d9204d11abbf1a48.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722599127116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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 Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Acked-by: Jan Beulich --- Changes in v5: - edit inclusion guards, according to the feedback received 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..45988e0cbb 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__ERR_H +#define XEN__ERR_H +#ifndef __ASSEMBLY__ =20 #include #include @@ -41,4 +42,5 @@ static inline int __must_check PTR_RET(const void *ptr) return IS_ERR(ptr) ? PTR_ERR(ptr) : 0; } =20 -#endif /* __XEN_ERR_H__ */ +#endif /* __ASSEMBLY__ */ +#endif /* XEN__ERR_H */ diff --git a/xen/include/xen/pci_ids.h b/xen/include/xen/pci_ids.h index e798477a7e..7f74954d6a 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 =20 #define PCI_VENDOR_ID_NVIDIA 0x10de @@ -11,3 +14,5 @@ #define PCI_VENDOR_ID_BROADCOM 0x14e4 =20 #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..5fd57160df 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__SOFTIRQ_H +#define XEN__SOFTIRQ_H +#ifndef __ASSEMBLY__ =20 /* 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); =20 -#endif /* __XEN_SOFTIRQ_H__ */ +#endif /* __ASSEMBLY__ */ +#endif /* XEN__SOFTIRQ_H */ diff --git a/xen/include/xen/vmap.h b/xen/include/xen/vmap.h index 0c16baa85f..a8475bd05b 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__VMAP_H +#define XEN__VMAP_H +#ifdef VMAP_VIRT_START =20 #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= ()); } =20 -#endif /* __XEN_VMAP_H__ */ +#endif /* VMAP_VIRT_START */ +#endif /* XEN__VMAP_H */ --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722594137663.5618262304367; Tue, 23 Jul 2024 01:16:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762713.1172980 (Exim 4.92) (envelope-from ) id 1sWAgy-0003y6-0S; Tue, 23 Jul 2024 08:16:16 +0000 Received: by outflank-mailman (output) from mailman id 762713.1172980; Tue, 23 Jul 2024 08:16: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 1sWAgx-0003xz-Sz; Tue, 23 Jul 2024 08:16:15 +0000 Received: by outflank-mailman (input) for mailman id 762713; Tue, 23 Jul 2024 08:16: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 1sWAgh-0007w0-A0 for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:15:59 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c9ca172c-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:15:57 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 73C734EE0745; Tue, 23 Jul 2024 10:15:55 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c9ca172c-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Simone Ballarin , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Alessandro Zucchelli Subject: [XEN PATCH v5 10/17] x86/asm: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:15:02 +0200 Message-Id: <20e1d32d9e384f9682fc25d9a55480edd11e344e.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722595374116600 Content-Type: text/plain; charset="utf-8" From: Simone Ballarin 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 Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- Changes in v5: - rebase against current staging tree - remove an unused path in Makefile that was mistakenly left in - edit inclusion guards, according to feedback received Changes in v4: - changed guard creation for autogenerated headers in Makefile 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 | 9 +++++++-- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/docs/misra/safe.json b/docs/misra/safe.json index 684346386e..6ede5c91c2 100644 --- a/docs/misra/safe.json +++ b/docs/misra/safe.json @@ -92,6 +92,14 @@ }, { "id": "SAF-11-safe", + "analyser": { + "eclair": "MC3R1.D4.10" + }, + "name": "Dir 4.10: file intended for multiple inclusion", + "text": "Files intended for multiple inclusion are not suppose= d to comply with D4.10." + }, + { + "id": "SAF-12-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/c= ompat.h index 818cad87db..98ed170b95 100644 --- a/xen/arch/x86/include/asm/compat.h +++ b/xen/arch/x86/include/asm/compat.h @@ -2,6 +2,9 @@ * compat.h */ =20 +#ifndef ASM__X86__COMPAT_H +#define ASM__X86__COMPAT_H + #ifdef CONFIG_COMPAT =20 #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 ba3df174b7..d590fe31ea 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-11-safe file intended for multiple inclusion */ #include =20 /* 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..57c712748a 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 058b0a566b..1ff9468eeb 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -105,9 +105,14 @@ xlat-y :=3D $(shell sed -ne 's,@arch@,$(compat-arch-y)= ,g' -re 's,^[?!][[:blank:]]+ xlat-y :=3D $(filter $(patsubst compat/%,%,$(headers-y)),$(xlat-y)) =20 quiet_cmd_xlat_h =3D GEN $@ -cmd_xlat_h =3D \ - cat $(filter %.h,$^) >$@.new; \ +define cmd_xlat_h + guard=3D$$(echo ASM__${SRCARCH}__COMPAT__XLAT_H | tr a-z A-Z); \ + echo "#ifndef $$guard" > $@.new; \ + echo "#define $$guard" >> $@.new; \ + cat $(filter %.h,$^) >> $@.new; \ + echo "#endif /* $$guard */" >> $@.new; \ mv -f $@.new $@ +endef =20 $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) FORCE $(call if_changed,xlat_h) --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722596735871.0310486868412; Tue, 23 Jul 2024 01:16:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762714.1172990 (Exim 4.92) (envelope-from ) id 1sWAh1-0004Nc-EO; Tue, 23 Jul 2024 08:16:19 +0000 Received: by outflank-mailman (output) from mailman id 762714.1172990; Tue, 23 Jul 2024 08:16: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 1sWAh1-0004NP-Ae; Tue, 23 Jul 2024 08:16:19 +0000 Received: by outflank-mailman (input) for mailman id 762714; Tue, 23 Jul 2024 08:16: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 1sWAgl-0007w0-Ak for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:16:03 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id caeb7072-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:15:59 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 776EA4EE0739; Tue, 23 Jul 2024 10:15:57 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: caeb7072-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Maria Celeste Cesario , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Alessandro Zucchelli Subject: [XEN PATCH v5 11/17] xen/arm: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:15:03 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722597130116600 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini -- Change in v5: - edit inclusion guards, according to feedback received Changes in v4: - fix typo in include guard for arm efibind Commit introduced in v3 --- 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/d= omain.h index f1d72c6e48..f27353d9c8 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 =20 #include #include @@ -310,7 +310,7 @@ static inline void update_guest_memory_policy(struct vc= pu *v, struct guest_memory_policy *= gmp) {} =20 -#endif /* __ASM_DOMAIN_H__ */ +#endif /* ASM__ARM__DOMAIN_H */ =20 /* * Local variables: diff --git a/xen/arch/arm/include/asm/efibind.h b/xen/arch/arm/include/asm/= efibind.h index 09dca7a8c9..88e0307ef1 100644 --- a/xen/arch/arm/include/asm/efibind.h +++ b/xen/arch/arm/include/asm/efibind.h @@ -1,2 +1,7 @@ +#ifndef ASM__ARM__EFIBIND_H +#define ASM__ARM__EFIBIND_H + #include #include + +#endif /* ASM__ARM__EFIBIND_H */ diff --git a/xen/arch/arm/include/asm/event.h b/xen/arch/arm/include/asm/ev= ent.h index b14c166ad6..c495994437 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 =20 #include =20 @@ -52,7 +52,7 @@ static inline bool arch_virq_is_global(unsigned int virq) return true; } =20 -#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..b104fc890c 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 =20 #include #include @@ -76,7 +76,7 @@ int replace_grant_host_mapping(uint64_t gpaddr, mfn_t fra= me, #define gnttab_need_iommu_mapping(d) \ (is_domain_direct_mapped(d) && is_iommu_enabled(d)) =20 -#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..837c864fac 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 =20 #if defined(CONFIG_ARM_32) # include @@ -9,7 +9,7 @@ # error "unknown ARM variant" #endif =20 -#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 ec437add09..019147ef11 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 =20 #include #include @@ -101,7 +101,7 @@ bool irq_type_set_by_domain(const struct domain *d); void irq_end_none(struct irq_desc *irq); #define irq_end_none irq_end_none =20 -#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..1a3088dfb9 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 =20 #ifndef __ASSEMBLY__ #include @@ -39,7 +39,7 @@ extern unsigned int smp_get_max_cpus(void); =20 #define cpu_physical_id(cpu) cpu_logical_map(cpu) =20 -#endif +#endif /* ASM__ARM__SMP_H */ =20 /* * Local variables: diff --git a/xen/arch/arm/include/asm/spinlock.h b/xen/arch/arm/include/asm= /spinlock.h index 42b0f584fe..b1fd46336f 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 =20 #define arch_lock_acquire_barrier() smp_mb() #define arch_lock_release_barrier() smp_mb() @@ -12,4 +12,4 @@ =20 #define arch_lock_signal_wmb() arch_lock_signal() =20 -#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/s= ystem.h index 65d5c8e423..cf548089d8 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 =20 #include #include @@ -62,7 +62,7 @@ static inline int local_abort_is_enabled(void) =20 extern struct vcpu *__context_switch(struct vcpu *prev, struct vcpu *next); =20 -#endif +#endif /* ASM__ARM__SYSTEM_H */ /* * Local variables: * mode: C --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722623638811.5836282685354; Tue, 23 Jul 2024 01:17:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762734.1173020 (Exim 4.92) (envelope-from ) id 1sWAhQ-0006Qy-FN; Tue, 23 Jul 2024 08:16:44 +0000 Received: by outflank-mailman (output) from mailman id 762734.1173020; Tue, 23 Jul 2024 08:16:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAhQ-0006Qm-CH; Tue, 23 Jul 2024 08:16:44 +0000 Received: by outflank-mailman (input) for mailman id 762734; Tue, 23 Jul 2024 08:16:42 +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 1sWAgl-0008AN-4q for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:16:03 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cc2013c5-48cb-11ef-bbfe-fd08da9f4363; Tue, 23 Jul 2024 10:16:01 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 3F21C4EE0743; Tue, 23 Jul 2024 10:15:59 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cc2013c5-48cb-11ef-bbfe-fd08da9f4363 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Maria Celeste Cesario , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Alessandro Zucchelli Subject: [XEN PATCH v5 12/17] xen: address violations of MISRA C:2012 Directive 4.10 Date: Tue, 23 Jul 2024 10:15:04 +0200 Message-Id: <42fbbb9ffb85893d049c80812b547ffb10ccda7e.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722625387116600 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- Changes in v5: - edit inclusion guards of autogenerated files Commit introduced in v3 --- xen/build.mk | 7 ++++--- xen/scripts/Makefile.asm-generic | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/xen/build.mk b/xen/build.mk index 0f490ca71b..32624d3097 100644 --- a/xen/build.mk +++ b/xen/build.mk @@ -47,6 +47,7 @@ asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c =20 arch/$(SRCARCH)/include/asm/asm-offsets.h: asm-offsets.s @(set -e; \ + guard=3D$$(echo ASM__${SRCARCH}__ASM_OFFSETS_H | tr a-z A-Z); \ echo "/*"; \ echo " * DO NOT MODIFY."; \ echo " *"; \ @@ -54,12 +55,12 @@ 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 $$guard"; \ + echo "#define $$guard"; \ echo ""; \ sed -rne "/^[^#].*=3D=3D>/{s:.*=3D=3D>(.*)<=3D=3D.*:\1:; s: [\$$#]: :; = p;}"; \ echo ""; \ - echo "#endif") <$< >$@ + echo "#endif /* $$guard */") <$< >$@ =20 build-dirs :=3D $(patsubst %/built_in.o,%,$(filter %/built_in.o,$(ALL_OBJS= ) $(ALL_LIBS))) =20 diff --git a/xen/scripts/Makefile.asm-generic b/xen/scripts/Makefile.asm-ge= neric index b0d356bfa3..2d2fd9f76e 100644 --- a/xen/scripts/Makefile.asm-generic +++ b/xen/scripts/Makefile.asm-generic @@ -32,7 +32,13 @@ old-headers :=3D $(wildcard $(obj)/*.h) unwanted :=3D $(filter-out $(generic-y) $(generated-y),$(old-headers)) =20 quiet_cmd_wrap =3D WRAP $@ - cmd_wrap =3D echo "\#include " > $@ +cmd_wrap =3D \ + guard=3D$$(echo ASM_GENERIC__${SRCARCH}__$*_H | tr a-z A-Z); \ + echo "\#ifndef $$guard" >$@.new; \ + echo "\#define $$guard" >>$@.new; \ + echo "\#include " >>$@.new; \ + echo "\#endif /* $$guard */" >>$@.new; \ + mv -f $@.new $@ =20 quiet_cmd_remove =3D REMOVE $(unwanted) cmd_remove =3D rm -f $(unwanted) --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722603512703.0750637436508; Tue, 23 Jul 2024 01:16:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762719.1173001 (Exim 4.92) (envelope-from ) id 1sWAh2-0004Xa-4l; Tue, 23 Jul 2024 08:16:20 +0000 Received: by outflank-mailman (output) from mailman id 762719.1173001; Tue, 23 Jul 2024 08:16: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 1sWAh1-0004V7-U9; Tue, 23 Jul 2024 08:16:19 +0000 Received: by outflank-mailman (input) for mailman id 762719; Tue, 23 Jul 2024 08:16: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 1sWAgm-0008AN-55 for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:16:04 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cd5f11af-48cb-11ef-bbfe-fd08da9f4363; Tue, 23 Jul 2024 10:16:03 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 473514EE0742; Tue, 23 Jul 2024 10:16:01 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cd5f11af-48cb-11ef-bbfe-fd08da9f4363 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Nicola Vetrini , Simone Ballarin , Doug Goldstein , Stefano Stabellini , Andrew Cooper , Jan Beulich , Julien Grall , Alessandro Zucchelli Subject: [XEN PATCH v5 13/17] xen: add deviations for MISRA C 2012 Dir D4.10 Date: Tue, 23 Jul 2024 10:15:05 +0200 Message-Id: <1a47750ebed47a3429269112fad6da58bfb6ee96.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722605176116600 Content-Type: text/plain; charset="utf-8" From: Nicola Vetrini Add safe deviation for *.c files, as estabilished in past discussion. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Signed-off-by: Nicola Vetrini Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- Changes in v4: - split the commit from the unrelated SAF deviation 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 | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index 1c39a9a16d..c6b1a10bcf 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -78,6 +78,11 @@ conform to the directive." -config=3DMC3R1.D4.10,reports+=3D{safe, "first_area(text(^/\\* Generated f= ile, do not edit! \\*/$, begin-3))"} -doc_end =20 +-doc_begin=3D"Including multiple times a .c file is safe because every fun= ction or data item +it defines would (in the common case) be already defined. Peer reviewed by= the community." +-config=3DMC3R1.D4.10,reports+=3D{safe, "all_area(all_loc(^.*\\.c$))"} +-doc_end + # # Series 5. # diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index 1ecce1469a..d51aa422b5 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -30,6 +30,12 @@ Deviations related to MISRA C:2012 Directives: not to add an additional encapsulation layer. - Tagged as `deliberate` for ECLAIR. =20 + * - D4.10 + - Including multiple times a .c file is safe because every function o= r 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: ----------------------------------------- =20 --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722656928335.84388697740144; Tue, 23 Jul 2024 01:17:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762751.1173049 (Exim 4.92) (envelope-from ) id 1sWAhw-0008Lc-Bz; Tue, 23 Jul 2024 08:17:16 +0000 Received: by outflank-mailman (output) from mailman id 762751.1173049; Tue, 23 Jul 2024 08:17: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 1sWAhw-0008LS-90; Tue, 23 Jul 2024 08:17:16 +0000 Received: by outflank-mailman (input) for mailman id 762751; Tue, 23 Jul 2024 08:17: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 1sWAgo-0007w0-B7 for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:16:06 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id cda0c08d-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:16:03 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 4C3AB4EE073F; Tue, 23 Jul 2024 10:16:03 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cda0c08d-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Maria Celeste Cesario , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Alessandro Zucchelli Subject: [XEN PATCH v5 14/17] xen/x86: rename inclusion guards for consistency Date: Tue, 23 Jul 2024 10:15:06 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722657403116600 Content-Type: text/plain; charset="utf-8" From: Maria Celeste Cesario Edit inclusion guards in order to make them consistent with the estabilished naming conventions. No functional change. Signed-off-by: Maria Celeste Cesario Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini Signed-off-by: Alessandro Zucchelli Acked-by: Jan Beulich --- Changs in v5: - edit inclusion guards, according to feedback received Changes in v4: - Improve commit message Commit introduced in v3 --- 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/d= omain.h index f5daeb182b..9818835805 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 =20 #include #include @@ -779,7 +779,7 @@ struct arch_vcpu_io { /* Maxphysaddr supportable by the paging infrastructure. */ unsigned int domain_max_paddr_bits(const struct domain *d); =20 -#endif /* __ASM_DOMAIN_H__ */ +#endif /* ASM__X86__DOMAIN_H */ =20 /* * Local variables: diff --git a/xen/arch/x86/include/asm/event.h b/xen/arch/x86/include/asm/ev= ent.h index 5e09ede6d7..8932727d5a 100644 --- a/xen/arch/x86/include/asm/event.h +++ b/xen/arch/x86/include/asm/event.h @@ -6,8 +6,8 @@ * */ =20 -#ifndef __ASM_EVENT_H__ -#define __ASM_EVENT_H__ +#ifndef ASM__X86__EVENT_H +#define ASM__X86__EVENT_H =20 #include =20 @@ -53,4 +53,4 @@ static inline bool arch_virq_is_global(unsigned int virq) (pv_shim && (chn)->port && (chn)->state =3D=3D ECS_RESERVED) #endif =20 -#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..67a4f84cbb 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 */ =20 -#ifndef __ASM_GRANT_TABLE_H__ -#define __ASM_GRANT_TABLE_H__ +#ifndef ASM__X86__GRANT_TABLE_H +#define ASM__X86__GRANT_TABLE_H =20 #include =20 @@ -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)) =20 -#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 1cb4217cff..6b56a18850 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 =20 #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); =20 -#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 5f445299be..a73141a15e 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 =20 /* (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar */ =20 @@ -231,4 +231,4 @@ int allocate_and_map_gsi_pirq(struct domain *d, int ind= ex, int *pirq_p); int allocate_and_map_msi_pirq(struct domain *d, int index, int *pirq_p, int type, struct msi_info *msi); =20 -#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..72cf218b8c 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 =20 /* * We need the APIC definitions automatically as part of 'smp.h' @@ -81,4 +81,4 @@ void *cpu_alloc_stack(unsigned int cpu); =20 #endif /* !__ASSEMBLY__ */ =20 -#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..11bec91e7f 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 =20 #define _raw_read_unlock(l) \ BUILD_BUG_ON(sizeof((l)->lock) !=3D 4); /* Clang doesn't support %z in= asm. */ \ @@ -24,4 +24,4 @@ arch_lock_signal(); \ }) =20 -#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/s= ystem.h index 73cb16ca68..4e1480c497 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 =20 #include #include @@ -269,4 +269,4 @@ void load_system_tables(void); void percpu_traps_init(void); void subarch_percpu_traps_init(void); =20 -#endif +#endif /* ASM__X86__SYSTEM_H */ --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722624997405.0862577059586; Tue, 23 Jul 2024 01:17:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762735.1173024 (Exim 4.92) (envelope-from ) id 1sWAhQ-0006UF-OL; Tue, 23 Jul 2024 08:16:44 +0000 Received: by outflank-mailman (output) from mailman id 762735.1173024; Tue, 23 Jul 2024 08:16:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAhQ-0006Sv-Ji; Tue, 23 Jul 2024 08:16:44 +0000 Received: by outflank-mailman (input) for mailman id 762735; Tue, 23 Jul 2024 08:16:42 +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 1sWAgq-0007w0-BE for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:16:08 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id cddf2a28-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:16:04 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id B2FCF4EE0746; Tue, 23 Jul 2024 10:16:03 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: cddf2a28-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Alessandro Zucchelli , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [XEN PATCH v5 15/17] xen/build: address violation of MISRA C Directive 4.10 Date: Tue, 23 Jul 2024 10:15:07 +0200 Message-Id: <08fe3472d3da3035357b72d4684295cbe79b77c1.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722625384116600 Content-Type: text/plain; charset="utf-8" This addresses violations of MISRA C:2012 Rule 4.10 which states as following: Precautions shall be taken in order to prevent the contents of a header file being included more than once. Changes are made for autogenerated header files: include/xen/compile.h and include/xen/hypercall-defs.h. No functional change. Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- Changes in v5: - edit inclusion guards for autogenerated header files --- xen/build.mk | 6 +++++- xen/include/Makefile | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/build.mk b/xen/build.mk index 32624d3097..ebb2d06b3c 100644 --- a/xen/build.mk +++ b/xen/build.mk @@ -18,6 +18,8 @@ quiet_cmd_compile.h =3D UPD $@ define cmd_compile.h if [ ! -r $@ -o -O $@ ]; then \ cat .banner; \ + echo '#ifndef XEN__COMPILE_H' > $(dot-target).tmp; \ + echo '#define XEN__COMPILE_H' >> $(dot-target).tmp; \ sed -e 's/@@date@@/$(XEN_BUILD_DATE)/g' \ -e 's/@@time@@/$(XEN_BUILD_TIME)/g' \ -e 's/@@whoami@@/$(XEN_WHOAMI)/g' \ @@ -28,8 +30,9 @@ define cmd_compile.h -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \ -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \ -e 's!@@changeset@@!$(shell $(srctree)/tools/scmversion $(XEN_ROOT) |= | echo "unavailable")!g' \ - < $< > $(dot-target).tmp; \ + < $< >> $(dot-target).tmp; \ sed -rf $(srctree)/tools/process-banner.sed < .banner >> $(dot-target).tm= p; \ + echo '#endif /* XEN__COMPILE_H */' >> $(dot-target).tmp; \ mv -f $(dot-target).tmp $@; \ fi endef @@ -40,6 +43,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner F= ORCE =20 targets +=3D include/xen/compile.h =20 + -include $(wildcard .asm-offsets.s.d) asm-offsets.s: arch/$(SRCARCH)/$(ARCH)/asm-offsets.c $(CC) $(call cpp_flags,$(c_flags)) -S -g0 -o $@.new -MQ $@ $< diff --git a/xen/include/Makefile b/xen/include/Makefile index 1ff9468eeb..35df93c82e 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -119,7 +119,10 @@ $(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/= ,$(xlat-y)) FORCE =20 quiet_cmd_genhyp =3D GEN $@ define cmd_genhyp - awk -f $(srctree)/scripts/gen_hypercall.awk <$< >$@ + echo "#ifndef XEN__HYPERCALL_DEFS_H" >$@; \ + echo "#define XEN__HYPERCALL_DEFS_H" >>$@; \ + awk -f $(srctree)/scripts/gen_hypercall.awk <$< >>$@; \ + echo "#endif /* XEN__HYPERCALL_DEFS_H */" >>$@ endef =20 all: $(obj)/xen/hypercall-defs.h --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17217226368831003.1856119077654; Tue, 23 Jul 2024 01:17:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762743.1173040 (Exim 4.92) (envelope-from ) id 1sWAhf-0007Xq-VG; Tue, 23 Jul 2024 08:16:59 +0000 Received: by outflank-mailman (output) from mailman id 762743.1173040; Tue, 23 Jul 2024 08:16:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAhf-0007Xh-RB; Tue, 23 Jul 2024 08:16:59 +0000 Received: by outflank-mailman (input) for mailman id 762743; Tue, 23 Jul 2024 08:16:57 +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 1sWAgr-0007w0-BE for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:16:09 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ce190a55-48cb-11ef-8776-851b0ebba9a2; Tue, 23 Jul 2024 10:16:04 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 200CB4EE0743; Tue, 23 Jul 2024 10:16:04 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ce190a55-48cb-11ef-8776-851b0ebba9a2 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Alessandro Zucchelli , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [XEN PATCH v5 16/17] CODING_STYLE: Add a section on header guards naming conventions Date: Tue, 23 Jul 2024 10:15:08 +0200 Message-Id: <14a663eaab02a78e688e1d260e1a4eb1799b13c5.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722637305116600 Content-Type: text/plain; charset="utf-8" This section explains which format should be followed by header inclusion guards via a drop-down list of rules. No functional change. Signed-off-by: Alessandro Zucchelli --- Changes in v5: - edit inclusion guards naming conventions, according to feedback received --- CODING_STYLE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CODING_STYLE b/CODING_STYLE index 7f6e9ad065..f4f26a3cd8 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -159,6 +159,27 @@ Emacs local variables A comment block containing local variables for emacs is permitted at the end of files. It should be: =20 +Header inclusion guards +----------------------- + +Unless differently specified all header files should have proper inclusion +guards in order to avoid being included multiple times. +The following naming conventions have been devised: + +- private headers -> ___H + - arch/arm/arm64/lib/something.h -> ARM__ARM64__LIB__SOMETHING_H + - arch/arm/arm32/lib/something.h -> ARM__ARM32__LIB__SOMETHING_H + - arch/x86/lib/something.h -> X86__LIB__SOMETHING_H + +- asm-generic headers -> ASM_GENERIC___H + - include/asm-generic/something.h -> ASM_GENERIC__SOMETHING_H + +- arch//include/asm//.h -> ASM_______H + - arch/x86/include/asm/something.h -> ASM__X86__SOMETHING_H + +- include/xen -> XEN___H + - include/xen/something.h -> XEN__SOMETHING_H + /* * Local variables: * mode: C --=20 2.34.1 From nobody Mon Sep 16 19:24:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1721722594600145.7218925643989; Tue, 23 Jul 2024 01:16:34 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.762708.1172969 (Exim 4.92) (envelope-from ) id 1sWAgv-0003cJ-O0; Tue, 23 Jul 2024 08:16:13 +0000 Received: by outflank-mailman (output) from mailman id 762708.1172969; Tue, 23 Jul 2024 08:16:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sWAgv-0003cA-Kn; Tue, 23 Jul 2024 08:16:13 +0000 Received: by outflank-mailman (input) for mailman id 762708; Tue, 23 Jul 2024 08:16:11 +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 1sWAgp-0008AN-5Z for xen-devel@lists.xenproject.org; Tue, 23 Jul 2024 08:16:07 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ce620007-48cb-11ef-bbfe-fd08da9f4363; Tue, 23 Jul 2024 10:16:05 +0200 (CEST) Received: from delta.bugseng.com.homenet.telecomitalia.it (host-79-35-51-193.retail.telecomitalia.it [79.35.51.193]) by support.bugseng.com (Postfix) with ESMTPSA id 7E3FB4EE0744; Tue, 23 Jul 2024 10:16:04 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ce620007-48cb-11ef-bbfe-fd08da9f4363 From: Alessandro Zucchelli To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, Alessandro Zucchelli , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu Subject: [XEN PATCH v5 17/17] include/asm-generic: rename inclusion guards for consistency Date: Tue, 23 Jul 2024 10:15:09 +0200 Message-Id: <79c020c608d59c1c5d4156e307acba046b1ad17e.1721720583.git.alessandro.zucchelli@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1721722595392116600 Content-Type: text/plain; charset="utf-8" Edit inclusion guards in asm-generic header files in order to make them consistent with the estabilished naming convention. No functional change. Signed-off-by: Alessandro Zucchelli Reviewed-by: Stefano Stabellini --- xen/include/asm-generic/altp2m.h | 6 +++--- xen/include/asm-generic/atomic-ops.h | 6 +++--- xen/include/asm-generic/device.h | 6 +++--- xen/include/asm-generic/div64.h | 6 +++--- xen/include/asm-generic/hardirq.h | 6 +++--- xen/include/asm-generic/iocap.h | 6 +++--- xen/include/asm-generic/monitor.h | 6 +++--- xen/include/asm-generic/paging.h | 6 +++--- xen/include/asm-generic/percpu.h | 6 +++--- xen/include/asm-generic/random.h | 6 +++--- xen/include/asm-generic/softirq.h | 6 +++--- xen/include/asm-generic/vm_event.h | 6 +++--- 12 files changed, 36 insertions(+), 36 deletions(-) diff --git a/xen/include/asm-generic/altp2m.h b/xen/include/asm-generic/alt= p2m.h index 39865a842a..34ae943145 100644 --- a/xen/include/asm-generic/altp2m.h +++ b/xen/include/asm-generic/altp2m.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_ALTP2M_H -#define __ASM_GENERIC_ALTP2M_H +#ifndef ASM_GENERIC__ALTP2M_H +#define ASM_GENERIC__ALTP2M_H =20 #include =20 @@ -22,7 +22,7 @@ static inline unsigned int altp2m_vcpu_idx(const struct v= cpu *v) return 0; } =20 -#endif /* __ASM_GENERIC_ALTP2M_H */ +#endif /* ASM_GENERIC__ALTP2M_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/atomic-ops.h b/xen/include/asm-generic= /atomic-ops.h index 98dd907942..50f1db909d 100644 --- a/xen/include/asm-generic/atomic-ops.h +++ b/xen/include/asm-generic/atomic-ops.h @@ -4,8 +4,8 @@ * forward inline declaration that can be synthesized from other atomic * functions or being created from scratch. */ -#ifndef _ASM_GENERIC_ATOMIC_OPS_H_ -#define _ASM_GENERIC_ATOMIC_OPS_H_ +#ifndef ASM_GENERIC__ATOMIC_OPS_H_ +#define ASM_GENERIC__ATOMIC_OPS_H_ =20 #include #include @@ -94,4 +94,4 @@ static inline int atomic_add_negative(int i, atomic_t *v) } #endif =20 -#endif /* _ASM_GENERIC_ATOMIC_OPS_H_ */ +#endif /* ASM_GENERIC__ATOMIC_OPS_H_ */ diff --git a/xen/include/asm-generic/device.h b/xen/include/asm-generic/dev= ice.h index 1acd1ba1d8..eccd3159a9 100644 --- a/xen/include/asm-generic/device.h +++ b/xen/include/asm-generic/device.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_DEVICE_H__ -#define __ASM_GENERIC_DEVICE_H__ +#ifndef ASM_GENERIC__DEVICE_H +#define ASM_GENERIC__DEVICE_H =20 #include =20 @@ -127,7 +127,7 @@ __section(".adev.info") =3D { = \ =20 #endif /* CONFIG_ACPI */ =20 -#endif /* __ASM_GENERIC_DEVICE_H__ */ +#endif /* ASM_GENERIC__DEVICE_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/div64.h b/xen/include/asm-generic/div6= 4.h index 068d8a11ad..c1770561c6 100644 --- a/xen/include/asm-generic/div64.h +++ b/xen/include/asm-generic/div64.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_DIV64 -#define __ASM_GENERIC_DIV64 +#ifndef ASM_GENERIC__DIV64_H +#define ASM_GENERIC__DIV64_H =20 #include =20 @@ -15,7 +15,7 @@ =20 #endif /* BITS_PER_LONG */ =20 -#endif +#endif /* ASM_GENERIC__DIV64_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/hardirq.h b/xen/include/asm-generic/ha= rdirq.h index ddccf460b9..09260b1b08 100644 --- a/xen/include/asm-generic/hardirq.h +++ b/xen/include/asm-generic/hardirq.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_HARDIRQ_H -#define __ASM_GENERIC_HARDIRQ_H +#ifndef ASM_GENERIC__HARDIRQ_H +#define ASM_GENERIC__HARDIRQ_H =20 #include #include @@ -17,7 +17,7 @@ typedef struct { #define irq_enter() (local_irq_count(smp_processor_id())++) #define irq_exit() (local_irq_count(smp_processor_id())--) =20 -#endif /* __ASM_GENERIC_HARDIRQ_H */ +#endif /* ASM_GENERIC__HARDIRQ_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/iocap.h b/xen/include/asm-generic/ioca= p.h index dd7cb45488..1001fb629a 100644 --- a/xen/include/asm-generic/iocap.h +++ b/xen/include/asm-generic/iocap.h @@ -1,11 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_IOCAP_H__ -#define __ASM_GENERIC_IOCAP_H__ +#ifndef ASM_GENERIC__IOCAP_H +#define ASM_GENERIC__IOCAP_H =20 #define cache_flush_permitted(d) \ (!rangeset_is_empty((d)->iomem_caps)) =20 -#endif /* __ASM_GENERIC_IOCAP_H__ */ +#endif /* ASM_GENERIC__IOCAP_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/monitor.h b/xen/include/asm-generic/mo= nitor.h index 1ade289099..e53f0823cb 100644 --- a/xen/include/asm-generic/monitor.h +++ b/xen/include/asm-generic/monitor.h @@ -9,8 +9,8 @@ * */ =20 -#ifndef __ASM_GENERIC_MONITOR_H__ -#define __ASM_GENERIC_MONITOR_H__ +#ifndef ASM_GENERIC__MONITOR_H +#define ASM_GENERIC__MONITOR_H =20 #include #include @@ -52,7 +52,7 @@ void arch_monitor_cleanup_domain(struct domain *d) /* No arch-specific domain cleanup on GENERIC. */ } =20 -#endif /* __ASM_GENERIC_MONITOR_H__ */ +#endif /* ASM_GENERIC__MONITOR_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/paging.h b/xen/include/asm-generic/pag= ing.h index 8df534cfdc..1a8fae6543 100644 --- a/xen/include/asm-generic/paging.h +++ b/xen/include/asm-generic/paging.h @@ -1,13 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_PAGING_H__ -#define __ASM_GENERIC_PAGING_H__ +#ifndef ASM_GENERIC__PAGING_H +#define ASM_GENERIC__PAGING_H =20 #include =20 #define paging_mode_translate(d) ((void)(d), true) #define paging_mode_external(d) ((void)(d), true) =20 -#endif /* __ASM_GENERIC_PAGING_H__ */ +#endif /* ASM_GENERIC__PAGING_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/percpu.h b/xen/include/asm-generic/per= cpu.h index 60af4f9ff9..7302edb00c 100644 --- a/xen/include/asm-generic/percpu.h +++ b/xen/include/asm-generic/percpu.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_PERCPU_H__ -#define __ASM_GENERIC_PERCPU_H__ +#ifndef ASM_GENERIC__PERCPU_H +#define ASM_GENERIC__PERCPU_H =20 #ifndef __ASSEMBLY__ =20 @@ -25,7 +25,7 @@ void percpu_init_areas(void); =20 #endif =20 -#endif /* __ASM_GENERIC_PERCPU_H__ */ +#endif /* ASM_GENERIC__PERCPU_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/random.h b/xen/include/asm-generic/ran= dom.h index d0d35dd217..f2e6c1c11c 100644 --- a/xen/include/asm-generic/random.h +++ b/xen/include/asm-generic/random.h @@ -1,13 +1,13 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_RANDOM_H__ -#define __ASM_GENERIC_RANDOM_H__ +#ifndef ASM_GENERIC__RANDOM_H +#define ASM_GENERIC__RANDOM_H =20 static inline unsigned int arch_get_random(void) { return 0; } =20 -#endif /* __ASM_GENERIC_RANDOM_H__ */ +#endif /* ASM_GENERIC__RANDOM_H */ =20 /* * Local variables: diff --git a/xen/include/asm-generic/softirq.h b/xen/include/asm-generic/so= ftirq.h index 83be855e50..92144c7eca 100644 --- a/xen/include/asm-generic/softirq.h +++ b/xen/include/asm-generic/softirq.h @@ -1,12 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef __ASM_GENERIC_SOFTIRQ_H__ -#define __ASM_GENERIC_SOFTIRQ_H__ +#ifndef ASM_GENERIC__SOFTIRQ_H +#define ASM_GENERIC__SOFTIRQ_H =20 #define NR_ARCH_SOFTIRQS 0 =20 #define arch_skip_send_event_check(cpu) 0 =20 -#endif /* __ASM_GENERIC_SOFTIRQ_H__ */ +#endif /* ASM_GENERIC__SOFTIRQ_H */ /* * Local variables: * mode: C diff --git a/xen/include/asm-generic/vm_event.h b/xen/include/asm-generic/v= m_event.h index 620c7b971c..ff538b6ba4 100644 --- a/xen/include/asm-generic/vm_event.h +++ b/xen/include/asm-generic/vm_event.h @@ -5,8 +5,8 @@ * Copyright (c) 2015 Tamas K Lengyel (tamas@tklengyel.com) */ =20 -#ifndef __ASM_GENERIC_VM_EVENT_H__ -#define __ASM_GENERIC_VM_EVENT_H__ +#ifndef ASM_GENERIC__VM_EVENT_H +#define ASM_GENERIC__VM_EVENT_H =20 #include #include @@ -52,4 +52,4 @@ void vm_event_reset_vmtrace(struct vcpu *v) /* Nothing to do. */ } =20 -#endif /* __ASM_GENERIC_VM_EVENT_H__ */ +#endif /* ASM_GENERIC__VM_EVENT_H */ --=20 2.34.1