From patchwork Mon Mar 11 08:59:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simone Ballarin X-Patchwork-Id: 13588367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD5D4C54E66 for ; Mon, 11 Mar 2024 09:00:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.691260.1077031 (Exim 4.92) (envelope-from ) id 1rjbW1-0006j7-2K; Mon, 11 Mar 2024 09:00:13 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 691260.1077031; Mon, 11 Mar 2024 09:00: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 1rjbW0-0006j0-Vr; Mon, 11 Mar 2024 09:00:12 +0000 Received: by outflank-mailman (input) for mailman id 691260; Mon, 11 Mar 2024 09:00:12 +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 1rjbW0-0006iu-Ip for xen-devel@lists.xenproject.org; Mon, 11 Mar 2024 09:00:12 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c42047f1-df85-11ee-afdc-a90da7624cb6; Mon, 11 Mar 2024 10:00:11 +0100 (CET) Received: from beta.station (net-93-144-106-196.cust.vodafonedsl.it [93.144.106.196]) by support.bugseng.com (Postfix) with ESMTPSA id E48FD4EE0C90; Mon, 11 Mar 2024 10:00:09 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c42047f1-df85-11ee-afdc-a90da7624cb6 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu , =?utf-8?q?Roger_Pau_Mo?= =?utf-8?q?nn=C3=A9?= , Doug Goldstein , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [XEN PATCH v3 00/16] xen: address violation of MISRA C:2012 Directive 4.10 Date: Mon, 11 Mar 2024 09:59:09 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 The Xen sources contain violations of MISRA C:2012 Directive 4.10 whose headline states: "Precautions shall be taken in order to prevent the contents of a header file being included more than once". As stated in v2, the following naming convention has been estabilished: - arch/.../include/asm/ headers -> ASM__H - private headers -> __H - asm-generic headers -> ASM_GENERIC__H Since there would have been conflicting guards between architectures (which is a violation of the directive), there has been a need for ASM headers to specify if the inclusion guard referred to ARM or X86. Hence it has been decided to adopt instead: - arch//include/asm//.h -> ASM____H The subdir used is the smallest possible to avoid collisions. For example, it has been observed that in "xen/arch/arm/include/asm/arm32" and "xen/arch/arm/include/asm/arm64" there are plenty of header files with the same name, hence _ARMxx_ was added as subdirectory. There has been a need to define a standard for generated headers too: - include/generated//.h-> GENERATED___H - arch//include/generated/asm/.h-> _GENERATED_ASM__H To summarize, here are all the rules that have been applied: - private headers -> __H - asm-generic headers -> ASM_GENERIC__H - arch//include/asm//.h -> ASM____H - include/generated//.h-> GENERATED___H - arch//include/generated/asm/.h-> _GENERATED_ASM__H Links to the discussions: https://lists.xenproject.org/archives/html/xen-devel/2023-09/msg01928.html https://lists.xenproject.org/archives/html/xen-devel/2023-10/msg01784.html https://lists.xenproject.org/archives/html/xen-devel/2023-10/msg02073.html Changes in v3: Add/amend inclusion guards to address violations of the Directive and the new naming convention. Remove trailing underscores. 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). Maria Celeste Cesario (6): xen/arm: address violations of MISRA C:2012 Directive 4.10 xen: address violations of MISRA C:2012 Directive 4.10 xen: add deviations for MISRA C.2012 Directive 4.10 xen/x86: address violations of MISRA C:2012 Directive 4.10 x86/mtrr: address violations of MISRA C:2012 Directive 4.10 xen/lz4: address violations of MISRA C:2012 Directive 4.10 Simone Ballarin (10): misra: add deviation for headers that explicitly avoid guards misra: modify deviations for empty and generated headers misra: add deviations for direct inclusion guards xen/arm: address violations of MISRA C:2012 Directive 4.10 xen/x86: address violations of MISRA C:2012 Directive 4.10 x86/EFI: address violations of MISRA C:2012 Directive 4.10 xen/common: address violations of MISRA C:2012 Directive 4.10 xen/efi: address violations of MISRA C:2012 Directive 4.10 xen: address violations of MISRA C:2012 Directive 4.10 x86/asm: address violations of MISRA C:2012 Directive 4.10 .../eclair_analysis/ECLAIR/deviations.ecl | 12 +++--- docs/misra/deviations.rst | 7 ++++ docs/misra/safe.json | 40 +++++++++++++++++++ xen/arch/arm/efi/efi-boot.h | 6 +++ xen/arch/arm/efi/runtime.h | 1 + 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/hypercall.h | 1 + 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 +-- xen/arch/x86/Makefile | 10 +++-- xen/arch/x86/cpu/cpu.h | 5 +++ xen/arch/x86/cpu/mtrr/mtrr.h | 4 ++ xen/arch/x86/efi/efi-boot.h | 7 ++++ xen/arch/x86/efi/runtime.h | 5 +++ xen/arch/x86/include/asm/compat.h | 5 +++ xen/arch/x86/include/asm/cpufeatures.h | 5 +-- xen/arch/x86/include/asm/domain.h | 6 +-- xen/arch/x86/include/asm/efibind.h | 5 +++ xen/arch/x86/include/asm/event.h | 6 +-- xen/arch/x86/include/asm/grant_table.h | 6 +-- xen/arch/x86/include/asm/hypercall.h | 1 + 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 +-- xen/arch/x86/x86_64/mmconfig.h | 5 +++ xen/arch/x86/x86_emulate/private.h | 5 +++ xen/build.mk | 6 ++- xen/common/decompress.h | 5 +++ xen/common/efi/efi.h | 5 +++ xen/common/event_channel.h | 5 +++ xen/common/lz4/defs.h | 5 +++ xen/include/Makefile | 12 ++++-- xen/include/public/arch-x86/cpufeatureset.h | 1 + xen/include/public/arch-x86/xen.h | 1 + xen/include/public/errno.h | 1 + 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 ++-- xen/scripts/Makefile.asm-generic | 16 +++++++- 48 files changed, 233 insertions(+), 78 deletions(-)