Only HYPERV_GUEST has a need for an executable fixmap, so with that option
unset __set_fixmap_x() (and l1_fixmap_x[] in turn) is unreachable. Address
this Misra rule 2.1 violation by introduction ofa new FIXMAP_X Kconfig
setting.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
Why is __set_fixmap_x() not found by Eclair as a rule 2.1 violation in the
x86_64-amd job?
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -269,6 +269,9 @@ config MCE_NONFATAL
config GUEST
bool
+config FIXMAP_X
+ bool
+
config XEN_GUEST
bool "Xen Guest"
select GUEST
@@ -309,6 +312,7 @@ config PV_SHIM_EXCLUSIVE
config HYPERV_GUEST
bool "Hyper-V Guest"
+ select FIXMAP_X
select GUEST
help
Support for Xen detecting when it is running under Hyper-V.
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -142,13 +142,13 @@ END(l2_directmap)
/*
* L2 mapping the Xen text/data/bss region, constructed dynamically.
- * Executable fixmap is hooked up statically.
+ * Executable fixmap, when in use, is hooked up statically.
* Uses 1x 4k page.
*/
DATA(l2_xenmap, PAGE_SIZE)
idx = 0
.rept L2_PAGETABLE_ENTRIES
- .if idx == l2_table_offset(FIXADDR_X_TOP - 1)
+ .if IS_ENABLED(CONFIG_FIXMAP_X) && idx == l2_table_offset(FIXADDR_X_TOP - 1)
.quad sym_offs(l1_fixmap_x) + __PAGE_HYPERVISOR
.else
.quad 0
--- a/xen/arch/x86/include/asm/fixmap.h
+++ b/xen/arch/x86/include/asm/fixmap.h
@@ -95,6 +95,8 @@ static inline unsigned long virt_to_fix(
return __virt_to_fix(vaddr);
}
+#ifdef CONFIG_FIXMAP_X
+
enum fixed_addresses_x {
/* Index 0 is reserved since fix_x_to_virt(0) == FIXADDR_X_TOP. */
FIX_X_RESERVED,
@@ -118,6 +120,12 @@ extern void __set_fixmap_x(
#define __fix_x_to_virt(x) (FIXADDR_X_TOP - ((x) << PAGE_SHIFT))
#define fix_x_to_virt(x) ((void *)__fix_x_to_virt(x))
+#else /* !CONFIG_FIXMAP_X */
+
+#define FIXADDR_X_SIZE 0
+
+#endif /* CONFIG_FIXMAP_X */
+
#endif /* __ASSEMBLER__ */
#endif
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -147,8 +147,6 @@
/* Mapping of the fixmap space needed early. */
l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
l1_fixmap[L1_PAGETABLE_ENTRIES];
-l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
- l1_fixmap_x[L1_PAGETABLE_ENTRIES]; /* SAF-1-safe */
bool __read_mostly machine_to_phys_mapping_valid;
@@ -6180,6 +6178,11 @@ void __set_fixmap(
map_pages_to_xen(__fix_to_virt(idx), _mfn(mfn), 1, flags);
}
+#ifdef CONFIG_FIXMAP_X
+
+l1_pgentry_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
+ l1_fixmap_x[L1_PAGETABLE_ENTRIES]; /* SAF-1-safe */
+
void __set_fixmap_x(
enum fixed_addresses_x idx, unsigned long mfn, unsigned long flags)
{
@@ -6187,6 +6190,8 @@ void __set_fixmap_x(
map_pages_to_xen(__fix_x_to_virt(idx), _mfn(mfn), 1, flags);
}
+#endif /* CONFIG_FIXMAP_X */
+
void *__init arch_vmap_virt_end(void)
{
return fix_to_virt(__end_of_fixed_addresses);
On 03.11.2026 10:42, Jan Beulich wrote: > Only HYPERV_GUEST has a need for an executable fixmap, so with that option > unset __set_fixmap_x() (and l1_fixmap_x[] in turn) is unreachable. Address > this Misra rule 2.1 violation by introduction ofa new FIXMAP_X Kconfig > setting. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> > --- > Why is __set_fixmap_x() not found by Eclair as a rule 2.1 violation in the > x86_64-amd job? Same question actually for both functions converted to static by [1]. This apparently being a wider problem, are we (again / still) having an issue with the scanning of the linking steps? Jan [1] https://lists.xen.org/archives/html/xen-devel/2026-10/msg01537.html
© 2016 - 2026 Red Hat, Inc.