From nobody Mon Jul 18 11:50:51 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 4LmgJr1Q2dz4X7sn; Mon, 18 Jul 2022 11:50:52 +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 4LmgJr1016z3Rlk; Mon, 18 Jul 2022 11:50:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658145052; 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=9JjGTsdwv3M1WVOXrxr5xZDyCs1KWM9ofGJkvdIKy7U=; b=VryilBPMrjzt/DmR8zlgvl/4PKmTQBF8FsCtFpJt3XJe8aTZnpTMJCFO6H0m1Iy15Z/zfr tmMlKv1GGYjCLSTnNfsKKjHkZdHGne3L+um7v2LXXAK45HT9IinY/PTIMl/hGhtnH7b/a3 AG5vtusaEK/LKjOL4KdyUkYyjWOhk5TAXWBMR62CQ7QoOBUiTuT2DnZNQin7KKS3EpTF4Y met7upeYateSPhRgJJnmqyVaDiXXG00WLrSRfnSH4+tBTJo5c4oqZK+PgAcBam7Tq/ExmX joIgnf4vK3YkZbv+Y0eia09drzsZhcxCJLGP3EDTASCmHgdhES9l3Z9EJiBkhA== 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 4LmgJr058DzdZ9; Mon, 18 Jul 2022 11:50:52 +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 26IBoppl005657; Mon, 18 Jul 2022 11:50:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26IBopkD005656; Mon, 18 Jul 2022 11:50:51 GMT (envelope-from git) Date: Mon, 18 Jul 2022 11:50:51 GMT Message-Id: <202207181150.26IBopkD005656@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 394453302bca - main - 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/main X-Git-Reftype: branch X-Git-Commit: 394453302bca7a5147db126ce01a3497eb3415f7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658145052; 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=9JjGTsdwv3M1WVOXrxr5xZDyCs1KWM9ofGJkvdIKy7U=; b=LTuURTIlsN1deHVh/6lvy4uhEelz8PUCY01aPYWlKNeH96a9IRpdqEz89h/TvUTer6iuuJ 026xrQX21lL+2NjQyuoH8vR/otxz97ezfblzw+4oukCDtJNPA5tqCYcWxJM69UiOjRoxyI 6RL7ilNP+8K9QTeZYWq737/ykzJ710Ccg2XMk901z2/RYqC9e0K1EzC8TdlSzrNXCdOSs5 MzSJJtdrTdhmf6u4ZHXcDWtzVHhZvewi3/oWiWWf5KvyEy5cH+AcgDGfGhwo0e8wvMSa8M Zn4q2J+lpjbuFLIgNAccbrQyZU+Cjfl/9qg2SUvWBfUJ6LUZwVQ4Z2zMEGtXyA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658145052; a=rsa-sha256; cv=none; b=qrcvtAgHAjsYPq8Zo3NE4a32xbKv7CUsX6E9/ZKCEf7k1P164bgHTuycQqZ/Gwhce1Gp74 dO86Mb3YH45O2X9HolKUvBPbDxuYodc88seWfF0EgfURNwD0zcU3w3hD1oOste3FhPEy/w sGC5PUE8LP8O8Wd9CRAsLEpUjscymbuIp2sWMRrlXivHnQhQmNlbqNomidriZsWpwDhSON nYelh3W3fjVhpAS8ZYJ3O+hH1/zMbvhYc09Kn0pEfsHRvGYHmuAHPxFheFmpVCyNfQ95Ry xgluJV2gqJEPyqC4R6+m9MQtV/ge+4gSJHoiIIw88D57gwqhuzhlvBxMtBA8cg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=394453302bca7a5147db126ce01a3497eb3415f7 commit 394453302bca7a5147db126ce01a3497eb3415f7 Author: Bjoern A. Zeeb AuthorDate: 2022-07-09 00:30:17 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-07-18 11:47:16 +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 MFC after: 1 week Sponsored by: Traverse Technologies (providing Ten64 HW for testing) Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D35759 --- 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 cdac26881a13..f0c1dc1775eb 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[] = { @@ -259,7 +350,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; @@ -308,9 +400,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);