Re: [PATCH] x86/apic: Use the physical address for the local APIC resource

From: Ahmed Abdelfattah

Date: Fri Nov 20 2026 - 05:45:18 EST


On Fri, Nov 20, 2026 at 04:37:24PM +0800, Chao Gao wrote:
> What is the impact on end users if this isn't fixed? Please make it clear
> in the changelog, even if it is minor.
>
> No one else has noticed this since v6.6, so it looks to me that nothing
> depends on this "Local APIC" entry.

It is minor. Apart from the line missing in /proc/iomem, the page is no
longer a busy resource, so CONFIG_IO_STRICT_DEVMEM does not keep
/dev/mem away from it any more. I checked that on v7.4-rc3+ in a guest
booted with nox2apic: without the patch 0xfee00000 can be mapped
through /dev/mem, reads return the APIC registers and a write to the
TPR is accepted. With the patch the mmap() fails with EPERM, as it does
for the IOAPIC page.

I'll put that in the changelog.

> Using the virtual address is clearly a mistake, so this fix looks good to
> me. But the Fixes tag is wrong, as "apic_phys" already held the same
> virtual address before that commit.

You're right, thanks. It was 81287ad65da5 ("x86/apic: Sanitize APIC
address setup") that replaced

apic_phys = mp_lapic_addr;

with

apic_phys = apic_mmio_base = APIC_BASE;

and 78c32000848c only switched to the other variable. I'll fix the tag
and the description in v2.

Thanks for the review,
Ahmed