[PATCH] x86/apic: Use the physical address for the local APIC resource
From: Ahmed Abdelfattah via B4 Relay
Date: Fri Nov 06 2026 - 17:08:25 EST
From: Ahmed Abdelfattah <me@xxxxxxxxxxxxxxxxxxxx>
Since v6.6 the "Local APIC" entry is missing from /proc/iomem whenever
the kernel maps the xAPIC itself.
lapic_insert_resource() used to take the address from apic_phys. When
apic_phys went away it was switched to apic_mmio_base, but that holds
the fixmap virtual address, not the physical one:
APIC: Mapped APIC to ffffffffff5fc000 ( fee00000)
insert_resource() rejects that range because it lies outside
iomem_resource, and as the return value is not checked, the failure
goes unnoticed.
Use mp_lapic_addr, which is the address apic_set_fixmap() maps. Keep
the apic_mmio_base check, so the resource is still only added when the
APIC was actually mapped.
Fixes: 78c32000848c ("x86/apic: Get rid of apic_phys")
Signed-off-by: Ahmed Abdelfattah <me@xxxxxxxxxxxxxxxxxxxx>
---
This showed up while comparing /proc/iomem with the memory map of a
QEMU guest.
Tested on QEMU q35 with KVM (x86_64_defconfig + kvm_guest.config),
booting with and without nox2apic. Without the patch there is no
"Local APIC" entry in either case; with it both show
fee00000-fee00fff : Local APIC
as before 78c32000848c.
---
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
index 90025451ace2..17525b5daa0d 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -2667,7 +2667,7 @@ static int __init lapic_insert_resource(void)
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);
---
base-commit: d48723711bae9b8cdc56719c448ba42fef28cbee
change-id: 20261107-x86-apic-lapic-resource-e2f88ada8677
Best regards,
--
Ahmed Abdelfattah <me@xxxxxxxxxxxxxxxxxxxx>