Re: [PATCH] x86/tdx: Fix crash on kexec with CONFIG_EISA
From: Maciej W. Rozycki
Date: Sat Aug 24 2024 - 18:29:51 EST
On Thu, 22 Aug 2024, Kirill A. Shutemov wrote:
> This issue causes real problems:
>
> 1. If the kernel is compiled with EISA support, it will attempt to probe
> EISA by reading 4 bytes from the 0x0FFFD9 address (see eisa_bus_probe()).
> The kernel treats this read as MMIO and accesses this memory via
> shared mapping as we do for MMIO.
>
> KVM converts memory to shared upon such access.
>
> 2. The same memory range (0xF0000-0x100000) is scanned to look for the MP
> table (see mpparse_find_mptable()). However, this is not MMIO and it
> is accessed via private mapping.
>
> This will cause a crash if the memory is not private.
>
> During normal boot, the kernel scans for SMP information before probing
> for EISA, and it boots fine. However, the memory becomes shared and causes
> issues on kexec when the second kernel attempts to scan for SMP information.
ISTM that `eisa_bus_probe' has to be updated to `memremap' analogously to
`mpparse_find_mptable', complementing changes such as commit f7750a795687
("x86, mpparse, x86/acpi, x86/PCI, x86/dmi, SFI: Use memremap() for RAM
mappings") or commit 5997efb96756 ("x86/boot: Use memremap() to map the
MPF and MPC data"). Both just access BIOS memory.
Can you please try and verify if my proposed change at:
<https://lore.kernel.org/r/alpine.DEB.2.21.2408242025210.30766@xxxxxxxxxxxxxxxxx>
has fixed the problem for you?
Maciej