[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/6] xen/x86: add inclusion guards


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Date: Fri, 16 May 2025 16:21:26 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hOfLncgDV8d5Q1wUOwc7gzU+soF9bg8LoZ3vX+hETX0=; b=rtTlNKFby8cQfn8irbtFwtWEE3cUoZCmL+Dsspe8nSfaHKjQythtmrRfeVfeDaWuezwy8VcSYwqM7z+FR5d9dxnLShZ//wUM5Q1Pk3w0DMPsJlKXH4pYP2Wv/hIzTJSuyUaD8rqqu6UKQOJtl9U9T4TVR9ILy1d5DUmIKWvj0F5nZyZ1vAmAWVZbkrBZw4AHwr7IYolY4xvGKqH5iOphz4HbF/ERXb3GKB/86/OmBuZEP4f4sksw/bi0516W0168ZIwRqd7h6o2xHuNiDKo85Vz0pfbhF4RTeolep1dLTu/104uKOpfkRpcHmYdzWuNumxM898YPDI4+mjxAyCg61Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=IPwM/EYi1QPTSXZ4KDn1/9i4Pd0LexesI1nf4/nfOpVDRFBO42NlwapMPWOBejXnRKeiAommHBjyTpWriTBS8XS9YrdI2zxOfbFjE5dCvQXSYNfbreMjepgrJH0FIOjzUCjAkAIWXgcELgvp2EmN4UNODJIx90wELNU891+O+jVoqfU8t7HMkxF4aFDLMnc2+hm+nXzJg7ltejO9CDmysW/RCTyJHWQ9SdYlasyyhr4mzSEKTXTUlSQKUFHUh9RJ94pSjSxNToV8bzzwWlDTI96zCMvEMC+tHKgmG3LsycqWmwI2QGwLmU84a/mMwY9nsW/LTbejQDrcp62G5T+ABw==
  • Cc: <andrew.cooper3@xxxxxxxxxx>, <michal.orzel@xxxxxxx>, <jbeulich@xxxxxxxx>, <julien@xxxxxxx>, <roger.pau@xxxxxxxxxx>, <sstabellini@xxxxxxxxxx>, <bertrand.marquis@xxxxxxx>, Federico Serafini <federico.serafini@xxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Delivery-date: Fri, 16 May 2025 23:21:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Federico Serafini <federico.serafini@xxxxxxxxxxx>

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 inclusion guards where missing to address violations of the
guideline.

Signed-off-by: Federico Serafini <federico.serafini@xxxxxxxxxxx>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
---
 xen/arch/x86/cpu/cpu.h             | 6 ++++++
 xen/arch/x86/efi/efi-boot.h        | 6 ++++++
 xen/arch/x86/efi/runtime.h         | 5 +++++
 xen/arch/x86/include/asm/compat.h  | 5 +++++
 xen/arch/x86/include/asm/efibind.h | 5 +++++
 xen/arch/x86/x86_64/mmconfig.h     | 5 +++++
 xen/arch/x86/x86_emulate/private.h | 5 +++++
 7 files changed, 37 insertions(+)

diff --git a/xen/arch/x86/cpu/cpu.h b/xen/arch/x86/cpu/cpu.h
index 8be65e975a..cbb434f3a2 100644
--- a/xen/arch/x86/cpu/cpu.h
+++ b/xen/arch/x86/cpu/cpu.h
@@ -1,4 +1,8 @@
 /* attempt to consolidate cpu attributes */
+
+#ifndef X86_CPU_H
+#define X86_CPU_H
+
 struct cpu_dev {
        void            (*c_early_init)(struct cpuinfo_x86 *c);
        void            (*c_init)(struct cpuinfo_x86 * c);
@@ -26,3 +30,5 @@ void amd_init_spectral_chicken(void);
 void detect_zen2_null_seg_behaviour(void);
 
 void intel_unlock_cpuid_leaves(struct cpuinfo_x86 *c);
+
+#endif /* X86_CPU_H */
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 1d8902a9a7..0ecf4ca53f 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -3,6 +3,10 @@
  * is intended to be included by common/efi/boot.c _only_, and
  * therefore can define arch specific global variables.
  */
+
+#ifndef X86_EFI_EFI_BOOT_H
+#define X86_EFI_EFI_BOOT_H
+
 #include <xen/vga.h>
 
 #include <asm/boot-helpers.h>
@@ -908,6 +912,8 @@ void __init efi_multiboot2(EFI_HANDLE ImageHandle,
     efi_exit_boot(ImageHandle, SystemTable);
 }
 
+#endif /* X86_EFI_EFI_BOOT_H */
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/efi/runtime.h b/xen/arch/x86/efi/runtime.h
index 77866c5f21..88ab5651e9 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 <xen/domain_page.h>
 #include <xen/mm.h>
 #include <asm/atomic.h>
@@ -17,3 +20,5 @@ void efi_update_l4_pgtable(unsigned int l4idx, l4_pgentry_t 
l4e)
     }
 }
 #endif
+
+#endif /* X86_EFI_RUNTIME_H */
diff --git a/xen/arch/x86/include/asm/compat.h 
b/xen/arch/x86/include/asm/compat.h
index 818cad87db..30ed8f2fd0 100644
--- a/xen/arch/x86/include/asm/compat.h
+++ b/xen/arch/x86/include/asm/compat.h
@@ -2,6 +2,9 @@
  * compat.h
  */
 
+#ifndef X86_COMPAT_H
+#define X86_COMPAT_H
+
 #ifdef CONFIG_COMPAT
 
 #define COMPAT_BITS_PER_LONG 32
@@ -18,3 +21,5 @@ int switch_compat(struct domain *);
 #include <xen/errno.h>
 static inline int switch_compat(struct domain *d) { return -EOPNOTSUPP; }
 #endif
+
+#endif /* X86_COMPAT_H */
diff --git a/xen/arch/x86/include/asm/efibind.h 
b/xen/arch/x86/include/asm/efibind.h
index bce02f3707..ab46341281 100644
--- a/xen/arch/x86/include/asm/efibind.h
+++ b/xen/arch/x86/include/asm/efibind.h
@@ -1,2 +1,7 @@
+#ifndef X86_EFIBIND_H
+#define X86_EFIBIND_H
+
 #include <xen/types.h>
 #include <asm/x86_64/efibind.h>
+
+#endif /* X86_EFIBIND_H */
diff --git a/xen/arch/x86/x86_64/mmconfig.h b/xen/arch/x86/x86_64/mmconfig.h
index 3da4b21e9b..722bf67975 100644
--- a/xen/arch/x86/x86_64/mmconfig.h
+++ b/xen/arch/x86/x86_64/mmconfig.h
@@ -5,6 +5,9 @@
  * Author: Allen Kay <allen.m.kay@xxxxxxxxx> - adapted from linux
  */
 
+#ifndef X86_64_MMCONFIG_H
+#define X86_64_MMCONFIG_H
+
 #define PCI_DEVICE_ID_INTEL_E7520_MCH    0x3590
 #define PCI_DEVICE_ID_INTEL_82945G_HB    0x2770
 
@@ -72,3 +75,5 @@ int pci_mmcfg_reserved(uint64_t address, unsigned int segment,
 int pci_mmcfg_arch_init(void);
 int pci_mmcfg_arch_enable(unsigned int idx);
 void pci_mmcfg_arch_disable(unsigned int idx);
+
+#endif /* X86_64_MMCONFIG_H */
diff --git a/xen/arch/x86/x86_emulate/private.h 
b/xen/arch/x86/x86_emulate/private.h
index 30be595470..467bce3c84 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -6,6 +6,9 @@
  * Copyright (c) 2005-2007 XenSource Inc.
  */
 
+#ifndef X86_EMULATE_PRIVATE_H
+#define X86_EMULATE_PRIVATE_H
+
 #ifdef __XEN__
 
 # include <xen/bug.h>
@@ -843,3 +846,5 @@ static inline int read_ulong(enum x86_segment seg,
     *val = 0;
     return ops->read(seg, offset, val, bytes, ctxt);
 }
+
+#endif /* X86_EMULATE_PRIVATE_H */
-- 
2.25.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.