From patchwork Thu Jul 8 12:06:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 471216 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp215353jao; Thu, 8 Jul 2021 05:07:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz75TZUKfD+6goOEYx85sjMjj8S8nv/ZPb/LoLd8nx0IgMuO5+ubK6J+ghukGGny/SzW+EZ X-Received: by 2002:a05:6e02:921:: with SMTP id o1mr23212661ilt.57.1625746024091; Thu, 08 Jul 2021 05:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625746024; cv=none; d=google.com; s=arc-20160816; b=i3VPGYwuqoVj/Cy02uz7ihb8l+tb0BqXis/AtbPmaNnIKAu1GFKSIpKlB7EUkgzSXq CJVIQxneqAUZO35BT6/lFiTGCoeADP4XBiqlRR7kcsglZR2UBJhox4QrzVvKLiVhHbrC Gc4yS7AAVfeh+i4SuAw11CFkp3Hd80NDbdyZtWQQDuqIufjOFVaHjriOSxHtCfdM7Tix P5Jt0yVt7jNW2VR7Jcc9qn958vFHt9EOJf0ohG82DY/poP6r5hz69DyeyBf+IlssOhsP IdnoPCUh03FjlsqSX0ZYwqlJ4lIXNiDCjhd1fEqX+WNySz0TJjCK5RPNwZI3WEfEsFh/ T3QA== 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=WraCm6k694qyYZdK9xEDzADtbPmoM6wh7ruMF3c9sT0=; b=ikJ1rqnQ5AJsq9JFwF5rgN9JaOySj2CCmkP+EXaIynCGtQG9r52sUqeFoNpl41xnAB +VThyRg5Cm/q950kSKRXsbb08JEfKQ7PJ/k8X8gSVWtq3stpADi0+5LQkEgWe6xSZUhw kkDsK7rmmu3yyIhSb7r2n9QEWoH4DF5wioYLRlfghyG0BBf03v/7kCtFMhJ7KZDswSOv wNxOx8gM0ULgLZbW9MaLgwtJMgf/OQBkIZ2cRpXomBDidrFqxBbHGIu6ryYmALod8n6q rjaUkkh3CCFGEWDysiUWccUesbDfT2+ToQa/Ymr+p1xMwTqcsVFwPGMocZ3U8crPKD7o 4T+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ooXDU9ur; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 z16si2160661ilo.50.2021.07.08.05.07.03; Thu, 08 Jul 2021 05:07:04 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=ooXDU9ur; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S231543AbhGHMJl (ORCPT + 7 others); Thu, 8 Jul 2021 08:09:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231487AbhGHMJl (ORCPT ); Thu, 8 Jul 2021 08:09:41 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75F80C06175F for ; Thu, 8 Jul 2021 05:06:58 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id c9so571761qte.6 for ; Thu, 08 Jul 2021 05:06:58 -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=WraCm6k694qyYZdK9xEDzADtbPmoM6wh7ruMF3c9sT0=; b=ooXDU9ur9KqdBlX6bSV3k88fMSWEpbTCC5Kpt1F9uzG3Gzg4wQeTWPXlVVs9CylHHS eEKbJPm21Ur3c6zSEG0znz/VLOPWIK+jp1rF+BSYCuCgC8Bhofc0ILZ4MnTPhxUL2ES0 jzxbIwh4RqQLf4KddXHHVO0dEvmL373dxEjwkWbmfaoCQKz7GNengI4yO1Tz+YFITGb0 G9xTikM6/8K2mYvPZg8ZHaqxdoguMGdUwOrZRh3RX6EGCY6jQXAbfpzxt+sDfNsf0xfz y3flDutrawBHu0GtBOfyCHQjOPeenB1WZa99D1Xb0vGBGTsr6+xQ/J43WiJksKzZZI8i mhkQ== 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=WraCm6k694qyYZdK9xEDzADtbPmoM6wh7ruMF3c9sT0=; b=jLD7PHxWuikhi6b0frmNm555FjXftT3C6uCBEDYJKmRJYRL2T5WmQL28ukdrxt8IHP IRUmkCLXbiWDgM2/jvPOFGSoROpbF3mvnqtn+rAz6okAqLrCjgi1jM1cV2z3BzTV/44+ ipO+AYsnsh4eM62+hmEe9Mb6In3veNFdimRuur4b8eallW0X2jiombk/9GF95t2s4iyy E4MxXe654OkS1Ki6Es941fHNI4jTNWgYrkGqh9w7C9HJ5FwKHsrR12pCQVTiWvY22znR ibkaurqY28z7FDTZX1hu0txltSQI9CXptC8CJilrp7tsrflnZ52KF2tREww5CpmTRHQc hlNA== X-Gm-Message-State: AOAM532Lfe1FngqVa1VAYvT3QaquwEJ6fDX9OrpD7KV9zLSf5heLa7Ol +4LHccu60V4e0+TnpXnDnXQcCg== X-Received: by 2002:ac8:5c08:: with SMTP id i8mr28001007qti.129.1625746017582; Thu, 08 Jul 2021 05:06:57 -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 i2sm912541qko.43.2021.07.08.05.06.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 05:06:57 -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: 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 v3 0/6] Introduce LMh driver for Qualcomm SoCs Date: Thu, 8 Jul 2021 08:06:50 -0400 Message-Id: <20210708120656.663851-1-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@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 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: boot: dts: qcom: sdm45: Add support for LMh node arm64: boot: 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 | 100 ++++++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 162 ++---------- drivers/cpufreq/qcom-cpufreq-hw.c | 118 +++++++++ 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 | 239 ++++++++++++++++++ include/linux/qcom_scm.h | 14 + 9 files changed, 570 insertions(+), 136 deletions(-) create mode 100644 Documentation/devicetree/bindings/thermal/qcom-lmh.yaml create mode 100644 drivers/thermal/qcom/lmh.c -- 2.25.1