git: d851c6840205 - stable/15 - bhyve/riscv: fix PCIe FDT interrupt-map entry stride
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 19 Nov 2026 20:47:41 UTC
The branch stable/15 has been updated by jrtc27:
URL: https://cgit.FreeBSD.org/src/commit/?id=d851c68402058bb79b0a03fc76b2951af87d4fcf
commit d851c68402058bb79b0a03fc76b2951af87d4fcf
Author: Doongar Singh <doonbsd@gmail.com>
AuthorDate: 2026-11-13 12:35:14 +0000
Commit: Jessica Clarke <jrtc27@FreeBSD.org>
CommitDate: 2026-11-19 20:45:46 +0000
bhyve/riscv: fix PCIe FDT interrupt-map entry stride
In bhyve arm64, each PCIe interrupt-map entry spans 10 cells because the
ARM GIC specifies #interrupt-cells = 3. On RISC-V, the APLIC uses
#interrupt-cells = 2, so each entry spans only 9 cells.
When the PCIe FDT code was originally adapted from arm64, the property
allocation size and cell assignments were reduced to 9 cells per entry,
but the loop multiplier retained the 10-cell stride. This caused the
interrupt-map array to be packed incorrectly with gaps, breaking PCI
interrupt routing in guest operating systems and overflowing the
allocation by 16 cells.
Correct the loop stride to 9 cells so the interrupt map is properly
formed.
Reviewed by: jrtc27
Fixes: 7ab1a32cd43c ("bhyve/riscv: Initial import")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D61473
(cherry picked from commit fabdac3abcbb06551415ca64b69b0e29946834f9)
---
usr.sbin/bhyve/riscv/fdt.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/usr.sbin/bhyve/riscv/fdt.c b/usr.sbin/bhyve/riscv/fdt.c
index 3ccd7ae5dc79..b9fe5ae6c32f 100644
--- a/usr.sbin/bhyve/riscv/fdt.c
+++ b/usr.sbin/bhyve/riscv/fdt.c
@@ -312,15 +312,15 @@ fdt_add_pcie(int intrs[static 4])
pin = i % 4;
slot = i / 4;
intr = intrs[(pin + slot) % 4];
- SET_PROP_U32(prop, 10 * i + 0, slot << 11);
- SET_PROP_U32(prop, 10 * i + 1, 0);
- SET_PROP_U32(prop, 10 * i + 2, 0);
- SET_PROP_U32(prop, 10 * i + 3, pin + 1);
- SET_PROP_U32(prop, 10 * i + 4, aplic_phandle);
- SET_PROP_U32(prop, 10 * i + 5, 0);
- SET_PROP_U32(prop, 10 * i + 6, 0);
- SET_PROP_U32(prop, 10 * i + 7, intr);
- SET_PROP_U32(prop, 10 * i + 8, IRQ_TYPE_LEVEL_HIGH);
+ SET_PROP_U32(prop, 9 * i + 0, slot << 11);
+ SET_PROP_U32(prop, 9 * i + 1, 0);
+ SET_PROP_U32(prop, 9 * i + 2, 0);
+ SET_PROP_U32(prop, 9 * i + 3, pin + 1);
+ SET_PROP_U32(prop, 9 * i + 4, aplic_phandle);
+ SET_PROP_U32(prop, 9 * i + 5, 0);
+ SET_PROP_U32(prop, 9 * i + 6, 0);
+ SET_PROP_U32(prop, 9 * i + 7, intr);
+ SET_PROP_U32(prop, 9 * i + 8, IRQ_TYPE_LEVEL_HIGH);
}
fdt_end_node(fdt);