From 15e1ce75e7d2457f11b4d78399b32bbbf68fea9a Mon Sep 17 00:00:00 2001 From: patrick Date: Wed, 19 Jun 2024 22:10:45 +0000 Subject: [PATCH] The GICv3 redistributor spacing on the X1E80100 (Snapdragon X Elite) does not follow the regular scheme and needs to be read out of the redistributor-stride property. ok kettenis@ --- sys/arch/arm64/dev/agintc.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/sys/arch/arm64/dev/agintc.c b/sys/arch/arm64/dev/agintc.c index fbd2ec77d9d..e0fe1de31fb 100644 --- a/sys/arch/arm64/dev/agintc.c +++ b/sys/arch/arm64/dev/agintc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: agintc.c,v 1.56 2024/05/13 01:15:50 jsg Exp $ */ +/* $OpenBSD: agintc.c,v 1.57 2024/06/19 22:10:45 patrick Exp $ */ /* * Copyright (c) 2007, 2009, 2011, 2017 Dale Rahn * Copyright (c) 2018 Mark Kettenis @@ -312,6 +312,7 @@ agintc_attach(struct device *parent, struct device *self, void *aux) uint32_t pmr, oldpmr; uint32_t ctrl, bits; uint32_t affinity; + uint64_t redist_stride; int i, nbits, nintr; int offset, nredist; #ifdef MULTIPROCESSOR @@ -434,15 +435,20 @@ agintc_attach(struct device *parent, struct device *self, void *aux) /* find the redistributors. */ offset = 0; + redist_stride = OF_getpropint64(faa->fa_node, "redistributor-stride", 0); for (nredist = 0; ; nredist++) { - int32_t sz = (64 * 1024 * 2); uint64_t typer; + int32_t sz; typer = bus_space_read_8(sc->sc_iot, sc->sc_redist_base, offset + GICR_TYPER); - if (typer & GICR_TYPER_VLPIS) - sz += (64 * 1024 * 2); + if (redist_stride == 0) { + sz = (64 * 1024 * 2); + if (typer & GICR_TYPER_VLPIS) + sz += (64 * 1024 * 2); + } else + sz = redist_stride; #ifdef DEBUG_AGINTC printf("probing redistributor %d %x\n", nredist, offset); @@ -466,14 +472,18 @@ agintc_attach(struct device *parent, struct device *self, void *aux) /* submap and configure the redistributors. */ offset = 0; for (nredist = 0; nredist < sc->sc_num_redist; nredist++) { - int32_t sz = (64 * 1024 * 2); uint64_t typer; + int32_t sz; typer = bus_space_read_8(sc->sc_iot, sc->sc_redist_base, offset + GICR_TYPER); - if (typer & GICR_TYPER_VLPIS) - sz += (64 * 1024 * 2); + if (redist_stride == 0) { + sz = (64 * 1024 * 2); + if (typer & GICR_TYPER_VLPIS) + sz += (64 * 1024 * 2); + } else + sz = redist_stride; affinity = bus_space_read_8(sc->sc_iot, sc->sc_redist_base, offset + GICR_TYPER) >> 32; -- 2.20.1