From nobody Wed Jul 27 00:14:01 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LsvQf1Tvrz4XgmY; Wed, 27 Jul 2022 00:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LsvQf0kmVz3j6Q; Wed, 27 Jul 2022 00:14:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658880842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o4sAxMSajSx5AB19FETcH9nP0JfhWxNeFR9CChkOLBk=; b=ijxEhIKKQlYiVqOI6K1NIetdD4LZq/LAViyRBcwyp83rstPEhrVdYnQNtCGgmdERpZkF/p lfR3D/70WyC9pU+DeE0/96lNhzQDT05P9Dnd4obIVJbS9EgenzFWPKU3LEifb2oZjMEyr9 83Q8KQJDUlmeLyy638cTQ8QVVEA2KKmKCrK8eTYqvEKWxoDM9bh3ZUADSMtw+6OXTlWWST /NazDjpS4rSXefzn8P7k0Hf5W3JgEileVEv2NjLCHgRtnSw9TPYNVvGrYM6PHlZwpR5Muo 9zs/t/pt97DBEiVnVnxupNtG7KZlot8/T5rs3NBDVIEMjitJfEVe37VWOWwRTQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LsvQd6wwczwVD; Wed, 27 Jul 2022 00:14:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26R0E12l015288; Wed, 27 Jul 2022 00:14:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26R0E1eA015287; Wed, 27 Jul 2022 00:14:01 GMT (envelope-from git) Date: Wed, 27 Jul 2022 00:14:01 GMT Message-Id: <202207270014.26R0E1eA015287@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: b3189b3295d6 - stable/13 - arm64, qoriq_therm: configure the number of sites base don SoC List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b3189b3295d6bd2342001c35dacb24ac6365dc2b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658880842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=o4sAxMSajSx5AB19FETcH9nP0JfhWxNeFR9CChkOLBk=; b=vCNcRhieRgAWsl3x+RJWLf04f4nUhNRGtUBKcttswj6z/G0ejTd59mBMKN14/jYQidICFU mSMLuTt/aOAc58epaWcZC2hxwrDJGOBxqx8o69arE7ZKXE+CnYOtFYVtzRF141kl4PHQyH 3ly4UHDcUYMTCqoSuHLPV9lbAZLO9P9q1C/D+GesMwua2GwUigxi4f052RCgF/l/q31ZoA 4mpyyHXGQvv0oz7aJMn2XhPCW8SgVPvw5qtgcwMBerwjbZRpumEmM4klZf9DGq9PJHGLOU h0r33B02G0ediyP50zR1fSSUWNHPL42hzUHGdtRMTV6HPgBM3agjLVu1m+Bjsw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658880842; a=rsa-sha256; cv=none; b=V2uKUxkGfwM2bt3fCyL1brIMCCgju28DeHhojDEP+BboMNFMWmY9R8GVHjguDXDNPKP5x7 Y68pZDUmJ/x4HJIkBKfT5GbL8rSo2iQSLssG+HUavSA1ijR2+FdEfkmSev8fpplzXRl5Bf CjD9ckxmZn2hd1oNz1YiibWOjahO02i2SsxgF0k6oxKkwU/yCRlJAHPEhgJPuyNU+e8Lm3 JaX63FbkM9fwpnbCjncSE/TLYE+LDzMi2Uu2EelVfearLI7E0Xsuw3Z01NIOQYWE9zZfTf 8qEAc9Pi7E3OKW8J/XRjFi5Vx5Lp3MM9OU8ibrAqR6MxD1FICwej1cIx0V8Kng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=b3189b3295d6bd2342001c35dacb24ac6365dc2b commit b3189b3295d6bd2342001c35dacb24ac6365dc2b Author: Bjoern A. Zeeb AuthorDate: 2022-07-09 00:30:17 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-07-26 22:41:38 +0000 arm64, qoriq_therm: configure the number of sites base don SoC Configure the number of sites (sensors) based on SoC. This avoids timeouts reading non-existent sensors. The changes are based on mmel's initial work at: https://github.com/strejda/freebsd/commit/914e3f0098b090cb5c1492b0d24992012c5c553b Sponsored by: Traverse Technologies (providing Ten64 HW for testing) Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D35759 (cherry picked from commit 394453302bca7a5147db126ce01a3497eb3415f7) --- sys/arm64/qoriq/qoriq_therm.c | 131 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 120 insertions(+), 11 deletions(-) diff --git a/sys/arm64/qoriq/qoriq_therm.c b/sys/arm64/qoriq/qoriq_therm.c index 33237fc94c07..1374a6d96558 100644 --- a/sys/arm64/qoriq/qoriq_therm.c +++ b/sys/arm64/qoriq/qoriq_therm.c @@ -88,13 +88,104 @@ static struct sysctl_ctx_list qoriq_therm_sysctl_ctx; struct tsensor default_sensors[] = { - { 0, "site0", 0}, - { 1, "site1", 1}, - { 2, "site2", 2}, - { 3, "site3", 3}, - { 4, "site4", 4}, - { 5, "site5", 5}, - { 6, "site6", 6}, + { 0, "site0", 0 }, + { 1, "site1", 1 }, + { 2, "site2", 2 }, + { 3, "site3", 3 }, + { 4, "site4", 4 }, + { 5, "site5", 5 }, + { 6, "site6", 6 }, + { 7, "site7", 7 }, + { 8, "site8", 8 }, + { 9, "site9", 9 }, + { 10, "site10", 10 }, + { 11, "site11", 11 }, + { 12, "site12", 12 }, + { 13, "site13", 13 }, + { 14, "site14", 14 }, + { 15, "site15", 15 }, +}; + +static struct tsensor imx8mq_sensors[] = +{ + { 0, "cpu", 0 }, + { 1, "gpu", 1 }, + { 2, "vpu", 2 }, +}; + +static struct tsensor ls1012_sensors[] = +{ + { 0, "cpu-thermal", 0 }, +}; + +static struct tsensor ls1028_sensors[] = +{ + { 0, "ddr-controller", 0 }, + { 1, "core-cluster", 1 }, +}; + +static struct tsensor ls1043_sensors[] = +{ + { 0, "ddr-controller", 0 }, + { 1, "serdes", 1 }, + { 2, "fman", 2 }, + { 3, "core-cluster", 3 }, +}; + +static struct tsensor ls1046_sensors[] = +{ + { 0, "ddr-controller", 0 }, + { 1, "serdes", 1 }, + { 2, "fman", 2 }, + { 3, "core-cluster", 3 }, + { 4, "sec", 4 }, +}; + +static struct tsensor ls1088_sensors[] = +{ + { 0, "core-cluster", 0 }, + { 1, "soc", 1 }, +}; + +/* Note: tmu[1..7] not [0..6]. */ +static struct tsensor lx2080_sensors[] = +{ + { 1, "ddr-controller1", 0 }, + { 2, "ddr-controller2", 1 }, + { 3, "ddr-controller3", 2 }, + { 4, "core-cluster1", 3 }, + { 5, "core-cluster2", 4 }, + { 6, "core-cluster3", 5 }, + { 7, "core-cluster4", 6 }, +}; + +static struct tsensor lx2160_sensors[] = +{ + { 0, "cluster6-7", 0 }, + { 1, "ddr-cluster5", 1 }, + { 2, "wriop", 2 }, + { 3, "dce-qbman-hsio2", 3 }, + { 4, "ccn-dpaa-tbu", 4 }, + { 5, "cluster4-hsio3", 5 }, + { 6, "cluster2-3", 6 }, +}; + +struct qoriq_therm_socs { + const char *name; + struct tsensor *tsensors; + int ntsensors; +} qoriq_therm_socs[] = { +#define _SOC(_n, _a) { _n, _a, nitems(_a) } + _SOC("fsl,imx8mq", imx8mq_sensors), + _SOC("fsl,ls1012a", ls1012_sensors), + _SOC("fsl,ls1028a", ls1028_sensors), + _SOC("fsl,ls1043a", ls1043_sensors), + _SOC("fsl,ls1046a", ls1046_sensors), + _SOC("fsl,ls1088a", ls1088_sensors), + _SOC("fsl,ls2080a", lx2080_sensors), + _SOC("fsl,lx2160a", lx2160_sensors), + { NULL, NULL, 0 } +#undef _SOC }; static struct ofw_compat_data compat_data[] = { @@ -260,7 +351,8 @@ static int qoriq_therm_attach(device_t dev) { struct qoriq_therm_softc *sc; - phandle_t node; + struct qoriq_therm_socs *soc; + phandle_t node, root; uint32_t sites; int rid, rv; @@ -307,9 +399,26 @@ qoriq_therm_attach(device_t dev) sc->ver = (RD4(sc, TMU_VERSION) >> 8) & 0xFF; - /* XXX add per SoC customization */ - sc->ntsensors = nitems(default_sensors); - sc->tsensors = default_sensors; + /* Select per SoC configuration. */ + root = OF_finddevice("/"); + if (root < 0) { + device_printf(dev, "Cannot get root node: %d\n", root); + goto fail; + } + soc = qoriq_therm_socs; + while (soc != NULL && soc->name != NULL) { + if (ofw_bus_node_is_compatible(root, soc->name)) + break; + soc++; + } + if (soc == NULL) { + device_printf(dev, "Unsupported SoC, using default sites.\n"); + sc->tsensors = default_sensors; + sc->ntsensors = nitems(default_sensors); + } else { + sc->tsensors = soc->tsensors; + sc->ntsensors = soc->ntsensors; + } /* stop monitoring */ WR4(sc, TMU_TMR, 0);