stand/powerpc/ofw: do not truncate device tree properties to 1024 bytes

When the OpenFirmware loader flattens the firmware device tree into the
FDT it hands to the kernel (usefdt=1, i.e. on every real-mode OF system
such as pSeries LPARs and QEMU pseries guests), add_node_to_fdt() clamps
every property value to 1024 bytes.  Any larger property reaches the
kernel truncated.

On QEMU pseries the PCI host bridge's "interrupt-map" is 3584 bytes
(32 slots x 4 pins x 7 cells), so only the entries for slots 0-8 survive
and the entry for slot 9 is cut in the middle.  A PCI device in slot 9
or above therefore gets no INTx routing (irq 0), and with INVARIANTS the
partial trailing entry trips the "ofw_bus_search_intrmap: truncated map"
assertion in ofw_bus_search_intrmap() during PCI attach, panicking the
kernel as soon as such a device is present.  "ibm,drc-indexes",
"ibm,drc-names" and "ibm,drc-power-domains" are cut the same way.

Drop the clamp.  fdt_setprop() already reports a property that does not
fit into the FDT buffer, so no separate limit is needed.

Fixes:	5ecf8e3852 ("Clean up some FDT-related code in the PowerPC bootloader, improving error checking and robustness. Prevents errors and crashes in FDT commands on PowerMac G5 systems.")

Differential Revision:	https://reviews.freebsd.org/D60086
This commit is contained in:
Piotr Kubaj committed 2026-09-29 10:28:46 +02:00
1 parent 34f9f5680c
commit 081f751823
1 file changed
-2
-2
View File
@@ -47,8 +47,6 @@ add_node_to_fdt(void *buffer, phandle_t node, int fdt_offset)
/* Detect and correct for errors and strangeness */
if (proplen < 0)
proplen = 0;
if (proplen > 1024)
proplen = 1024;
propbuf = malloc(proplen);
if (propbuf == NULL) {