On Thu, 28 May 2026, Peter Maydell wrote:
On Thu, 28 May 2026 at 10:23, Sebastian Ott <[email protected]> wrote:ACPI PCI hotplug of a PCI device using a bar > 2M fails on ARM with a resource allocation failure in the guest kernel (Linux): qemu-system-aarch64 [..] -device pcie-root-port,id=rp1,bus=pcie.0 \ -global acpi-ged.acpi-pci-hotplug-with-bridge-support=on \ -pflash /usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.qcow2 (qemu) device_add pci-testdev,bus=rp1,membar=4M [ 55.106283] pci 0000:01:00.0: [1b36:0005] type 00 class 0x00ff00 conventional PCI endpoint [ 55.107627] pci 0000:01:00.0: BAR 0 [mem 0x00000000-0x00000fff] [ 55.107864] pci 0000:01:00.0: BAR 1 [io 0x0000-0x00ff] [ 55.108015] pci 0000:01:00.0: BAR 2 [mem 0x00000000-0x003fffff 64bit pref] [ 55.118609] pci 0000:01:00.0: BAR 2 [mem size 0x00400000 64bit pref]: can't assign; no space [ 55.118653] pci 0000:01:00.0: BAR 2 [mem size 0x00400000 64bit pref]: failed to assign [ 55.118671] pci 0000:01:00.0: BAR 0 [mem 0x10000000-0x10000fff]: assigned [ 55.122828] pci 0000:01:00.0: BAR 1 [io 0x1000-0x10ff]: assigned [ 55.127090] pci 0000:01:00.0: BAR 0 [mem 0x10000000-0x10000fff]: releasing [ 55.127098] pci 0000:01:00.0: BAR 2 [mem size 0x00400000 64bit pref]: can't assign; no space [ 55.127102] pci 0000:01:00.0: BAR 2 [mem size 0x00400000 64bit pref]: failed to assign [ 55.127106] pci 0000:01:00.0: BAR 0 [mem 0x10000000-0x10000fff]: assigned This behavior is exactly the same on x86 - except the busses are created with a default window size of 256M there. If the PCI devices being hotplugged use a bar > 256M you get the same failure like on ARM. The workaround on x86 is to specify "pref64-reserve=" for the PCIe root-port. On ARM this is currently ignored.From the perspective of somebody who doesn't know much about ACPI or PCI, this commit message doesn't really tell me why QEMU needs to change. The above reads like "this is a kernel problem" to me. Why is the kernel unable to allocate this BAR?
Lack of resources on the parent bus/bridge device - the bridge windows are 2M per default on ARM. The native PCIe hotplug controller would add the additional resources to the parent bridge and retry allocation. The ACPI PCI hotplug controller does not do that. I'm curently playing with a hack that adds this to acpiphp. Sebastian
