arm gicv3 its command time out / patch

titus <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
 cubie kernel: its0: <ARM GIC Interrupt Translation Service> mem 0x3440000-0x345ffff on gic0
 cubie kernel: its0: Timeout while waiting for CMD completion.

patch (not ignoring dt dma-noncoherent flag) (adapted from linux kernel)
p4.txt (text/plain, 1.6 KB)
--- /sys/arm64/arm64/gicv3_its.c	2025-06-06 03:04:21.000000000 +0300
+++ sys/arm64/arm64/gicv3_its.c	2025-11-25 23:44:36.615569000 +0200
@@ -289,6 +289,8 @@
 #define	ITS_FLAGS_LPI_CONF_FLUSH	0x00000002
 #define	ITS_FLAGS_ERRATA_CAVIUM_22375	0x00000004
 #define	ITS_FLAGS_LPI_PREALLOC		0x00000008
+#define ITS_FLAGS_NON_COHERENT		0x00000010
+
 	u_int sc_its_flags;
 	bool	trace_enable;
 	vm_page_t ma; /* fake msi page */
@@ -412,7 +414,8 @@

 	/* Read back to check for fixed value fields */
 	tmp = gic_its_read_8(sc, GITS_CBASER);
-
+	if (sc->sc_its_flags & ITS_FLAGS_NON_COHERENT)
+		tmp &= ~GITS_CBASER_SHARE_MASK;
 	if ((tmp & GITS_CBASER_SHARE_MASK) !=
 	    (GITS_CBASER_SHARE_IS << GITS_CBASER_SHARE_SHIFT)) {
 		/* Check if the hardware reported non-shareable */
@@ -2223,17 +2226,24 @@
 gicv3_its_fdt_attach(device_t dev)
 {
 	struct gicv3_its_softc *sc;
-	phandle_t xref;
+	phandle_t xref, node;
 	int err;

 	sc = device_get_softc(dev);
 	sc->dev = dev;
+
+	/* Register this device as a interrupt controller */
+	xref = OF_xref_from_node(node = ofw_bus_get_node(dev));
+	if (OF_hasprop(node, "dma-noncoherent")) {
+		if (bootverbose)
+			device_printf(dev, "dma-noncoherent\n");
+		sc->sc_its_flags |= ITS_FLAGS_NON_COHERENT;
+	}
+
 	err = gicv3_its_attach(dev);
 	if (err != 0)
 		return (err);

-	/* Register this device as a interrupt controller */
-	xref = OF_xref_from_node(ofw_bus_get_node(dev));
 	sc->sc_pic = intr_pic_register(dev, xref);
 	err = intr_pic_add_handler(device_get_parent(dev), sc->sc_pic,
 	    gicv3_its_intr, sc, sc->sc_irq_base, sc->sc_irq_length);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.