Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2930458pxt; Mon, 9 Aug 2021 12:17:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOr+o+24DfrxfWFwg0/xJSd+RoKjGIxy/0YGuCngfg8nU3dyfLHHyeOi/r8O/O5qJnfBB6 X-Received: by 2002:a02:a117:: with SMTP id f23mr16083396jag.9.1628536627139; Mon, 09 Aug 2021 12:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628536627; cv=none; d=google.com; s=arc-20160816; b=CNi9qKX6z11R90qabgCBxfKA6uKF9RXQrCzRaJwriRp09TTG56XwtpRdtI6T5oAsfp chgYLMtKMg07MRqvJ0aMPctF03mzO/RcoCW2BNhFxwh3I4D8ahK5biCDLy4E/6n4bzv6 Lvnvwa9onX1gNXWEpTc4KzxKsjAcpz26g92DDPsd2wcS1Eg+kZud0pYNo4zaIEl2Y2Sz QxoJIzoYVedJrqUrFSQ3u7lzlGFgZunhhW/+I7Hg/i69T/xwK+kLt2hPNPx1dNb8LmFb QMiq4Y0qySdZpVu6OJVconMdy+gfdxNZ4rhyWjqIJ2cgV4CL5xtd0bA4WEHVDsNJkynP Lt2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=eNbXDUTDq2s+IaNPv/bGr5+o3NzigRzKhkvSyNsXN88=; b=IrDLWigVQdq+JzUBmPFkaM0MVLH5sNjhry4f7U23T+sGQPTjEV1ownAXsNvUCIzipj 4/36JaN0rbxwfsETmriHIapbF/8gNj3/0K8/Neqa3FUS/BhMZyd8ag8hsE2uFtSTE4su 59AMoXzRfGM8WnxQcwd9RgerEYwnYbYd36Vd5brx7NalR8/8rfabQ87cSZwbpbxplonR CaWCD1EpggVrMfD6FO7PdWbmQtPOaaKtNtCY/dsvPRcnMEk+9gMVCAp5OC1TBheGEOEd op1oES0SvIzds8rsam5T/7b1BfXf6scWiBa9MaOjGih1DJoxmMH/MbalUtDAxIZfuTBY 5BNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zZQPvJUN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si747932iow.93.2021.08.09.12.16.53; Mon, 09 Aug 2021 12:17:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zZQPvJUN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235913AbhHITQ3 (ORCPT + 99 others); Mon, 9 Aug 2021 15:16:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235918AbhHITQ2 (ORCPT ); Mon, 9 Aug 2021 15:16:28 -0400 Received: from mail-qv1-xf2c.google.com (mail-qv1-xf2c.google.com [IPv6:2607:f8b0:4864:20::f2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB110C0613D3 for ; Mon, 9 Aug 2021 12:16:07 -0700 (PDT) Received: by mail-qv1-xf2c.google.com with SMTP id db14so9554122qvb.10 for ; Mon, 09 Aug 2021 12:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eNbXDUTDq2s+IaNPv/bGr5+o3NzigRzKhkvSyNsXN88=; b=zZQPvJUNvjfkbD+0j59Ay36EtKRba9d/7e1T3pbuBzJksLb46H1gcjWWVQ3JVhcwfb ZQopmiE3aK1C8xme5PRrrW0HvQC7Ps+8JhK8LoEP+io9kR1AyQxjTNwHP7AmFzf+gpN7 M362d3zSAxYXoVreM6mKyTADldvuG58E/gaA3E3YYjdR7/P35nL/Hy1RbxQRNBqHFOrx I1FLsmXvBQaZPRkdVNTAOn3huJoiCmrEzqcaL7wpf6h523pWon2pj2As/JsSPJ0ZNZnd dR5jD5x5+GxwsqCHU9S5tuByklaS/zZ0j/jAAJsYFvuI6HVO0SmeTM7Oocj0sUTMYG0N Cjpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eNbXDUTDq2s+IaNPv/bGr5+o3NzigRzKhkvSyNsXN88=; b=qUiHYWkGsDKXyQcT5JvyRJ553owGbzMWIKzCbVuFiCaPUu8BT/cATqNElQvNVHy4tE Lmqe4hDg8d34xXVQCHpmQQ78QnuHRW1TIvSfctLCysYjZvDkl4VyRq8DHQvyILiH3LwZ s8S0olbWu7GDJZF65UIM046VVmM36Fs2BN8ZPO5LWVT94wU7HjAb6Ssk5xY3Gm8VrpCN 9yK/JCZrNbOo7RQBo9u1PX6kgkCnP/cskOq38JxBqsaJw8LxEG3+Mb6coUqP2zeNINoY 1zwAttQKkePW6JZu0VmxlrjgARro/CmyHJjMGwIXeNUeNl+SjIi2Tr85GUuh1wJzw0Fl huVg== X-Gm-Message-State: AOAM530QgjJl3mEUjLBxeQx0r6AStpWw8WQZXPy+HpBGyxo4xT3JvIzu Jn2PZNe4aSMxoswUmC3Dip/8Lg== X-Received: by 2002:a05:6214:570:: with SMTP id cj16mr4212867qvb.41.1628536566949; Mon, 09 Aug 2021 12:16:06 -0700 (PDT) Received: from pop-os.fios-router.home (pool-71-163-245-5.washdc.fios.verizon.net. [71.163.245.5]) by smtp.googlemail.com with ESMTPSA id n14sm7303398qti.47.2021.08.09.12.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Aug 2021 12:16:06 -0700 (PDT) From: Thara Gopinath To: agross@kernel.org, bjorn.andersson@linaro.org, rui.zhang@intel.com, daniel.lezcano@linaro.org, viresh.kumar@linaro.org, rjw@rjwysocki.net, robh+dt@kernel.org Cc: steev@kali.org, tdas@codeaurora.org, mka@chromium.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [Patch v5 0/6] Introduce LMh driver for Qualcomm SoCs Date: Mon, 9 Aug 2021 15:15:58 -0400 Message-Id: <20210809191605.3742979-1-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Limits Management Hardware(LMh) is a hardware infrastructure on some Qualcomm SoCs that can enforce temperature and current limits as programmed by software for certain IPs like CPU. On many newer SoCs LMh is configured by firmware/TZ and no programming is needed from the kernel side. But on certain SoCs like sdm845 the firmware does not do a complete programming of the h/w block. On such SoCs kernel software has to explicitly set up the temperature limits and turn on various monitoring and enforcing algorithms on the hardware. Introduce support for enabling and programming various limit settings and monitoring capabilities of Limits Management Hardware(LMh) associated with cpu clusters. Also introduce support in cpufreq hardware driver to monitor the interrupt associated with cpu frequency throttling so that this information can be conveyed to the schdeuler via thermal pressure interface. With this patch series following cpu performance improvement(30-70%) is observed on sdm845. The reasoning here is that without LMh being programmed properly from the kernel, the default settings were enabling thermal mitigation for CPUs at too low a temperature (around 70-75 degree C). This in turn meant that many a time CPUs were never actually allowed to hit the maximum possible/required frequencies. UnixBench whets and dhry (./Run whets dhry) System Benchmarks Index Score Without LMh Support With LMh Support 1 copy test 1353.7 1773.2 8 copy tests 4473.6 7402.3 Sysbench cpu sysbench cpu --threads=8 --time=60 --cpu-max-prime=100000 run Without LMh Support With LMh Support Events per second 355 614 Avg Latency(ms) 21.84 13.02 v4->v5: - Rebased to v5.14-rc5. v3->v4: - Rebased to v5.14-rc2. v2->v3: - Included patch adding dt binding documentation for LMh nodes. - Rebased to v5.13 Thara Gopinath (6): firmware: qcom_scm: Introduce SCM calls to access LMh thermal: qcom: Add support for LMh driver cpufreq: qcom-cpufreq-hw: Add dcvs interrupt support arm64: dts: qcom: sdm45: Add support for LMh node arm64: dts: qcom: sdm845: Remove cpufreq cooling devices for CPU thermal zones dt-bindings: thermal: Add dt binding for QCOM LMh .../devicetree/bindings/thermal/qcom-lmh.yaml | 82 +++++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 162 ++---------- drivers/cpufreq/qcom-cpufreq-hw.c | 147 +++++++++++ drivers/firmware/qcom_scm.c | 58 +++++ drivers/firmware/qcom_scm.h | 4 + drivers/thermal/qcom/Kconfig | 10 + drivers/thermal/qcom/Makefile | 1 + drivers/thermal/qcom/lmh.c | 232 ++++++++++++++++++ include/linux/qcom_scm.h | 14 ++ 9 files changed, 574 insertions(+), 136 deletions(-) create mode 100644 Documentation/devicetree/bindings/thermal/qcom-lmh.yaml create mode 100644 drivers/thermal/qcom/lmh.c -- 2.25.1