mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/apic: Use the physical address for the LAPIC resource
@ 2026-10-06 11:25 pwhMass
  0 siblings, 0 replies; only message in thread
From: pwhMass @ 2026-10-06 11:25 UTC (permalink / raw)
  To: x86
  Cc: pwhMass, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, H. Peter Anvin, linux-kernel, stable

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@vger.kernel.org
Assisted-by: LLM
Signed-off-by: pwhMass <a203865235@gmail.com>
---
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);
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-06 11:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06 11:25 [PATCH] x86/apic: Use the physical address for the LAPIC resource pwhMass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®