git: 5429e194212e - main - gicv3: Add logging for when its_device_alloc fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 01 Sep 2023 10:07:14 UTC
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=5429e194212e7d2fd7b4771bcf348f0917a0d505
commit 5429e194212e7d2fd7b4771bcf348f0917a0d505
Author: Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-08-23 17:44:38 +0000
Commit: Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-09-01 09:56:42 +0000
gicv3: Add logging for when its_device_alloc fails
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D41566
---
sys/arm64/arm64/gicv3_its.c | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
index a126a166c4c9..777e20649f33 100644
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -1277,21 +1277,44 @@ its_device_alloc(struct gicv3_its_softc *sc, int devid)
/* No device table */
if (sc->sc_dev_table_idx < 0) {
- if (devid < (1 << sc->sc_devbits))
- return (true);
- return (false);
+ if (devid >= (1 << sc->sc_devbits)) {
+ if (bootverbose) {
+ device_printf(sc->dev,
+ "%s: Device out of range for hardware "
+ "(%x >= %x)\n", __func__, devid,
+ 1 << sc->sc_devbits);
+ }
+ return (false);
+ }
+ return (true);
}
ptable = &sc->sc_its_ptab[sc->sc_dev_table_idx];
/* Check the devid is within the table limit */
if (!ptable->ptab_indirect) {
- return (devid < ptable->ptab_l1_nidents);
+ if (devid >= ptable->ptab_l1_nidents) {
+ if (bootverbose) {
+ device_printf(sc->dev,
+ "%s: Device out of range for table "
+ "(%x >= %x)\n", __func__, devid,
+ ptable->ptab_l1_nidents);
+ }
+ return (false);
+ }
+
+ return (true);
}
/* Check the devid is within the allocated range */
index = devid / ptable->ptab_l2_nidents;
- if (index >= ptable->ptab_l1_nidents)
+ if (index >= ptable->ptab_l1_nidents) {
+ if (bootverbose) {
+ device_printf(sc->dev,
+ "%s: Index out of range for table (%x >= %x)\n",
+ __func__, index, ptable->ptab_l1_nidents);
+ }
return (false);
+ }
table = (uint64_t *)ptable->ptab_vaddr;
/* We have an second level table */