-/* $OpenBSD: agintc.c,v 1.47 2023/01/27 23:11:59 kettenis Exp $ */
+/* $OpenBSD: agintc.c,v 1.48 2023/04/25 10:35:48 patrick Exp $ */
/*
* Copyright (c) 2007, 2009, 2011, 2017 Dale Rahn <drahn@dalerahn.com>
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
int agintc_ipi_combined(void *);
void agintc_send_ipi(struct cpu_info *, int);
+void agintc_msi_invall(void);
+
const struct cfattach agintc_ca = {
sizeof (struct agintc_softc), agintc_match, agintc_attach
};
cpu_dcache_wb_range((vaddr_t)&prop[irq],
sizeof(*prop));
__asm volatile("dsb sy");
+
+ /* XXX: Invalidate cache? */
}
+
+ /* Invalidate cache. */
+ agintc_msi_invall();
}
void
sizeof(*prop));
__asm volatile("dsb sy");
}
+
+ /* Invalidate cache. */
+ agintc_msi_invall();
}
void
cpu_dcache_wb_range((vaddr_t)&prop[irqno - LPI_BASE],
sizeof(*prop));
__asm volatile("dsb sy");
+
+ /* XXX: Invalidate cache? */
}
if (ih->ih_name != NULL)
#define MAPD 0x08
#define MAPC 0x09
#define MAPTI 0x0a
+#define INV 0x0c
+#define INVALL 0x0d
#define GITS_CMDQ_SIZE (64 * 1024)
#define GITS_CMDQ_NENTRIES (GITS_CMDQ_SIZE / sizeof(struct gits_cmd))
return agintc_msi_create_device(sc, deviceid);
}
+void
+agintc_msi_invall(void)
+{
+ struct cfdriver *cd = &agintcmsi_cd;
+ struct agintc_msi_softc *sc;
+ struct gits_cmd cmd;
+ int i, j;
+
+ for (i = 0; i < cd->cd_ndevs; i++) {
+ if (cd->cd_devs[i] == NULL)
+ continue;
+ sc = cd->cd_devs[i];
+ for (j = 0; j < ncpus; j++) {
+ memset(&cmd, 0, sizeof(cmd));
+ cmd.cmd = INVALL;
+ cmd.dw2 = j;
+ agintc_msi_send_cmd(sc, &cmd);
+ agintc_msi_wait_cmd(sc);
+ }
+ }
+}
+
void *
agintc_intr_establish_msi(void *self, uint64_t *addr, uint64_t *data,
int level, struct cpu_info *ci, int (*func)(void *), void *arg, char *name)