Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Sep 2023 12:01:38 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: fc7460a5ca4b - stable/14 - gicv3: Add logging for when its_device_alloc fails
Message-ID:  <202309251201.38PC1cpY058724@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=fc7460a5ca4bddfd54cb093a7eea70c491650d21

commit fc7460a5ca4bddfd54cb093a7eea70c491650d21
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2023-08-23 17:44:38 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2023-09-25 12:01:28 +0000

    gicv3: Add logging for when its_device_alloc fails
    
    Sponsored by:   Arm Ltd
    Differential Revision:  https://reviews.freebsd.org/D41566
    
    (cherry picked from commit 5429e194212e7d2fd7b4771bcf348f0917a0d505)
---
 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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309251201.38PC1cpY058724>