From nobody Fri Oct 31 03:54:05 2025 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; dkim=pass; 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; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1750728004; cv=none; d=zohomail.com; s=zohoarc; b=UdgbIKZX6RT8lxQIRpgByFt5RN0DwkNcXbLQbkHZoJiO/4hzuMHPe539+9jsmEBFDSTAc0MP7iDWt7JezJaPV04hylcRjZ2juG5MI6b91xCbsdw+AOQSIgXEHNkLGXwEaAnCTodhOpijfXw4b7Yt4wFEZJsAamAGFecAa33QAiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750728004; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=m4ZBATkLBzDfNVCF9HmoZIgqZtR4GJB6k2vrfleF0pk=; b=kjbNy19fLrMhNnLGfqs/MKO+Skx5D8+VlvvB9fvB0IbbxrT3YqUWjh/FxJeGI3wfT5xUtWcYWNLJoR5IPfEmISeCbMsG/GRjbZO4hCHylumU3ldXqYRY+ddvg4nw4om2nYeIAkZzwqAnVOYk2slS30YO2+so++oGtQ3UYd2ciVw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1750728004480754.9525132371832; Mon, 23 Jun 2025 18:20:04 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1022887.1398743 (Exim 4.92) (envelope-from ) id 1uTsK2-0003pf-VF; Tue, 24 Jun 2025 01:19:38 +0000 Received: by outflank-mailman (output) from mailman id 1022887.1398743; Tue, 24 Jun 2025 01:19:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uTsK2-0003pY-Si; Tue, 24 Jun 2025 01:19:38 +0000 Received: by outflank-mailman (input) for mailman id 1022887; Tue, 24 Jun 2025 01:19: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 1uTsK1-0003pS-QO for xen-devel@lists.xenproject.org; Tue, 24 Jun 2025 01:19:37 +0000 Received: from dfw.source.kernel.org (dfw.source.kernel.org [2604:1380:4641:c500::1]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 47f52eee-5099-11f0-b894-0df219b8e170; Tue, 24 Jun 2025 03:19:32 +0200 (CEST) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 503D75C58EF; Tue, 24 Jun 2025 01:17:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22030C4CEEA; Tue, 24 Jun 2025 01:19:29 +0000 (UTC) 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: 47f52eee-5099-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750727970; bh=H2NzpB9T6zopmrvfQu3ZhSnewVqp8QgCwnhKlfRNEA8=; h=Date:From:To:cc:Subject:From; b=iA7rDorrz581RR5U1VKVgyW67Yqir+g42APsjWifQQgWBYOzv+HDOZZkRz//Z7KoL F792YHAIsY2CEFjEub0gnIRAEFjv/V6LITIRx6tAWW5WqlwZKcX+iwBDg0qhGz1Jrv dr01vP/ZtrcqPVer6kq3mKqymVvM+SgNL5Kdi9wz5yIJ3AZb1ZHSY1zL7JF5AcplsH cY+CfIwkjYASt3+W526KRjo7aRxifqIS7ldNdHqhX7jbz9QVmNOEqB5sVrYMELpf+v G2FaNMWx/vY2t3rPTCP7lk1jX2AT0r3N5quj3n+GKMxrBYxaSWdlw80OemGQKno2dj a4tgryreXmjGw== Date: Mon, 23 Jun 2025 18:19:27 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop To: xen-devel@lists.xenproject.org cc: Andrew Cooper , michal.orzel@amd.com, jbeulich@suse.com, julien@xen.org, roger.pau@citrix.com, sstabellini@kernel.org, bertrand.marquis@arm.com, federico.serafini@bugseng.com, Nicola Vetrini , sstabellini@kernel.org Subject: [PATCH v6] automation/eclair: update configuration of D4.10 Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1750728005443116600 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" MISRA C Directive 4.10 states that "Precautions shall be taken in order to prevent the contents of a header file being included more than once". Add a SAF tag and update the comment on top of cpufeatures.h. Add a header inclusion guard to compile.h. Generate header guards for hypercall-defs.h Update ECLAIR configuration to: - extend existing deviation to other comments explicitly saying a file is intended for multiple inclusion; - extend existing deviation to other autogenerated files; - tag the guidelines as clean. Update deviations.rst accordingly. Signed-off-by: Federico Serafini Signed-off-by: Stefano Stabellini Acked-by: Jan Beulich # x86 --- Changes in v6: - remove in-code comment and use SAF-8-safe instead - add header guards for hypercall-defs.h Successful pipeline: https://gitlab.com/xen-project/people/sstabellini/xen/-/pipelines/1885561040 --- diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index 9c67358d46..3b5bc87e1d 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -72,11 +72,14 @@ they are not instances of commented-out code." -config=3DMC3A2.D4.3,reports+=3D{deliberate, "any_area(any_loc(file(arm64_= bitops))&&context(name(int_clear_mask16)))"} -doc_end =20 --doc_begin=3D"Files that are intended to be included more than once do not= need to -conform to the directive." +-doc_begin=3D"Files that are intended to be included more than once (and h= ave +a comment that says this explicitly) do not need to conform to the directi= ve." -config=3DMC3A2.D4.10,reports+=3D{safe, "first_area(text(^/\\* This file i= s intended to be included multiple times\\. \\*/$, begin-4))"} --config=3DMC3A2.D4.10,reports+=3D{safe, "first_area(text(^/\\* Generated f= ile, do not edit! \\*/$, begin-3))"} --config=3DMC3A2.D4.10,reports+=3D{safe, "all_area(all_loc(file(^xen/includ= e/generated/autoconf.h$)))"} +-config=3DMC3A2.D4.10,reports+=3D{safe, "first_area(text(^/\\* Generated f= ile, do not edit! \\*/$, begin-3...begin-2))"} +-doc_end + +-doc_begin=3D"Autogenerated files that do not need to conform to the direc= tive." +-config=3DMC3A2.D4.10,reports+=3D{safe, "all_area(all_loc(file(^xen/includ= e/generated/autoconf\\.h$)))"} -doc_end =20 -doc_begin=3D"Including multiple times a .c file is safe because every fun= ction or data item diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/ecl= air_analysis/ECLAIR/tagging.ecl index f9da5d5f4d..b95f07feb0 100644 --- a/automation/eclair_analysis/ECLAIR/tagging.ecl +++ b/automation/eclair_analysis/ECLAIR/tagging.ecl @@ -23,6 +23,7 @@ "MC3A2.D1.1|| MC3A2.D2.1|| MC3A2.D4.1|| +MC3A2.D4.10|| MC3A2.D4.11|| MC3A2.D4.14|| MC3A2.R1.1|| diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index fe0b1e10a2..63caa8f4a2 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -30,6 +30,18 @@ Deviations related to MISRA C:2012 Directives: not to add an additional encapsulation layer. - Tagged as `deliberate` for ECLAIR. =20 + * - D4.10 + - Files that are intended to be included more than once (and have + a comment that says this explicitly) do not need to conform to the + directive. + - Tagged as `safe` for ECLAIR. + + * - D4.10 + - There are autogenerated files that do not need to comply to the + directive. + - Tagged as `safe` for ECLAIR. Such files are: + - xen/include/generated/autoconf.h + * - 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. diff --git a/xen/arch/x86/include/asm/cpufeatures.h b/xen/arch/x86/include/= asm/cpufeatures.h index 9e3ed21c02..dce0713adf 100644 --- a/xen/arch/x86/include/asm/cpufeatures.h +++ b/xen/arch/x86/include/asm/cpufeatures.h @@ -1,7 +1,6 @@ -/* - * Explicitly intended for multiple inclusion. - */ +/* This file is intended to be included multiple times. */ =20 +/* SAF-8-safe */ #include =20 /* Number of capability words covered by the featureset words. */ diff --git a/xen/include/xen/compile.h.in b/xen/include/xen/compile.h.in index 3151d1e7d1..9206341ba6 100644 --- a/xen/include/xen/compile.h.in +++ b/xen/include/xen/compile.h.in @@ -1,3 +1,6 @@ +#ifndef XEN_COMPILE_H +#define XEN_COMPILE_H + #define XEN_COMPILE_DATE "@@date@@" #define XEN_COMPILE_TIME "@@time@@" #define XEN_COMPILE_BY "@@whoami@@" diff --git a/xen/scripts/gen_hypercall.awk b/xen/scripts/gen_hypercall.awk index 1a7e051fde..47a18cd75e 100644 --- a/xen/scripts/gen_hypercall.awk +++ b/xen/scripts/gen_hypercall.awk @@ -2,6 +2,8 @@ # the calls of the handlers inside a switch() statement. =20 BEGIN { + printf("#ifndef XEN_HYPERCALL_DEFS_H\n"); + printf("#define XEN_HYPERCALL_DEFS_H\n\n"); printf("/* Generated file, do not edit! */\n\n"); e =3D 0; n =3D 0; @@ -311,4 +313,5 @@ END { printf("[__HYPERVISOR_%s] =3D %d, \\\n", fn[call_fn[i]], n= _args[call_fn[i]]); printf("}\n"); } + printf("\n#endif /* XEN_HYPERCALL_DEFS_H */\n"); } diff --git a/xen/tools/process-banner.sed b/xen/tools/process-banner.sed index 56c76558bc..4cf3f9a116 100755 --- a/xen/tools/process-banner.sed +++ b/xen/tools/process-banner.sed @@ -12,3 +12,8 @@ s_(.*)_"\1\\n"_ =20 # Trailing \ on all but the final line. $!s_$_ \\_ + +# Append closing header guard +$a\ +\ +#endif /* XEN_COMPILE_H */