[PATCH] x86/apic: Use the physical address for the LAPIC resource
From: pwhMass
Date: Tue Oct 06 2026 - 07:25:59 EST
apic_mmio_base holds the fixmap virtual address used to access the local
APIC. Using it as lapic_resource.start passes a virtual address to the
physical iomem resource tree. On x86-64, the resulting range exceeds the
physical address limit of iomem_resource, so insert_resource() fails and
the Local APIC entry is missing from /proc/iomem.
Commit 81287ad65da5 ("x86/apic: Sanitize APIC address setup") replaced the
assignment of mp_lapic_addr to apic_phys with the fixmap virtual address.
The later removal of apic_phys retained that virtual address for the
resource.
Use mp_lapic_addr, which is the physical address passed to
set_fixmap_nocache(), as the resource start. Keep the apic_mmio_base guard
so that the resource is only registered when the MMIO mapping exists.
On an unmodified v7.3-rc2 x86-64 kernel under QEMU/KVM with nox2apic,
/proc/iomem has no Local APIC entry. With this change and the same kernel
configuration and VM parameters, it contains:
fee00000-fee00fff : Local APIC
Fixes: 81287ad65da5 ("x86/apic: Sanitize APIC address setup")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: pwhMass <a203865235@xxxxxxxxx>
---
AI assistance was used to trace the missing /proc/iomem entry, prepare
this one-line fix and description, and execute the comparison tests.
Tested with clang/LLD 18.1.3, a virtme-ng generated configuration,
Q35/KVM, 1 GiB RAM, two vCPUs and nox2apic nokaslr. Both kernels built
and booted successfully. No HyperEnclave patches or modules were used
for this upstream reproduction.
Reproducer (run as root in the guest):
grep -F 'Local APIC' /proc/iomem
Before: no match (exit 1).
After: fee00000-fee00fff : Local APIC (exit 0).
arch/x86/kernel/apic/apic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2667,7 +2667,7 @@
return -1;
/* Put local APIC into the resource map. */
- lapic_resource.start = apic_mmio_base;
+ lapic_resource.start = mp_lapic_addr;
lapic_resource.end = lapic_resource.start + PAGE_SIZE - 1;
insert_resource(&iomem_resource, &lapic_resource);