From patchwork Mon Nov 23 21:42:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 330683 Delivered-To: patch@linaro.org Received: by 2002:a17:907:2110:0:0:0:0 with SMTP id qn16csp3859588ejb; Mon, 23 Nov 2020 13:44:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJxzrlhUxNz1lv8N41x5M/W88oYuGymexNOP+JR81BLiapasza6WknpzjUoYG1C+xUlHl9m6 X-Received: by 2002:a05:6402:411:: with SMTP id q17mr1190987edv.125.1606167848394; Mon, 23 Nov 2020 13:44:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606167848; cv=none; d=google.com; s=arc-20160816; b=efonflpShA3QP24QOULnFk4boTJ0MMBJmRywTBBWxfg6/TXv8d8+SM68M3xRy+9v6X Bas9loySc/qToA69luZ5g3OgKvxYl4dTUv5vRGSp5gFB7bDlHFdnCaVFE7ku7qBHhx9p TMVvCPEfML0J4Js6GawDv6inRzCavXzmXM3v4RaWy6Xiqh15u6YqLB8HBcPOwLORdZM3 IokCtuFuzCZbA53sbVau+9epced1rIcdxI92F2dhYp2xeXVurwmW5pnMcxQotBp3oCis 4enR8E+tZkel6wm1z5xm9zWcGtX0cTVgiF+DwcySPpXImUmJNqbBdgUIRb6iLitsB045 7Esw== 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=FURT5aJ8Y84zCkcTMva4r1vaAztUoaAN182A6565glQ=; b=0Xrr7XI8X0H4HChKiiyuGkJnsu/FXKHxNF5Ldbhvdo2ExqIup5C8wDhWYYsNcBhkYE ZIUebje+rfDcvO03Matx6pa5eBRexMf9pcVPWuiEzlXIZ/wuInKKoo4HSSVNjq7aYVoQ hJ0fJFkVTvxC4UIAOmyy8MX3roLiTUjCodOeawZUDVOKNELOxRuvPU4rAK7KWP/dAmNx Ik8SuDQwaHcmeA8h0qEOxQPxzOFb17fu9KZIv9xFkdeucXWsoAitT6+/PEvPbnfSSRuA VY5Z3aYeX769Ha9eDJebwuivtiwWE6OOXBE6YNjKaoWe2yX20xkRaP+arTkCYqSsjkLY AuQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MTjtpKkU; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 be11si7076134edb.164.2020.11.23.13.44.08; Mon, 23 Nov 2020 13:44:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-pm-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=MTjtpKkU; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-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 S1731435AbgKWVmW (ORCPT + 8 others); Mon, 23 Nov 2020 16:42:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727725AbgKWVmV (ORCPT ); Mon, 23 Nov 2020 16:42:21 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5A22C061A4D for ; Mon, 23 Nov 2020 13:42:19 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id r3so1973467wrt.2 for ; Mon, 23 Nov 2020 13:42:19 -0800 (PST) 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=FURT5aJ8Y84zCkcTMva4r1vaAztUoaAN182A6565glQ=; b=MTjtpKkU+YwmI1AycB693SeABSqeeKRW43pQSRko+D52FGBzBj5GQA495bL1s7YX7x K7eV7Ygp9x4KCPPuAIVfUQvIl+fXsghVLEzy1EQeEKmxP3eomyN17NrC9gLwGRij8uVY H64YyeDSPxfCk8JmoKDvdNQEhJmh78Fwy0FbjA/wOzfhlcoykJO70sDBeeVqO1GrImd0 SXwohJ8duggSGepknmCxaVz/FYtI95mRECmdmwIjfW7NRiFqpVEEA+y5X9QHXppiHu2S 04XMKUNZrxqc8MTl4PdO5tjAEobMUeKR9zaH4rNmJDi5TVJVpXmato9o3mqoVrncyaXd J9gg== 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=FURT5aJ8Y84zCkcTMva4r1vaAztUoaAN182A6565glQ=; b=lJ3y7T7/m6MqqT2FVKIJlTzSs6eqAa3eC4I9W6/RksMTH6v4puarfk9FUepoGbQ0i8 japnNlpmB1l+tyaSz51QDfiJ3hw6Qv1aIJZW90hggCmAaXUyJ3JGtXIx1t8xatsQLSRn v6+Yx8p52T4keBFr3viwjyCH2PNUtW/ZKCHDXI0wwHjnu4yUKOFoAe6aHxVxSickOTIX JkqHYE1NpxHWdT5DBOYYP3QJQfgRNTPsF1X40nLWWsxvih1J2AJR70LBiHsK6ps1trU7 hzvRdY20+Vdy12iTZ0e29qI6QEAaNK7Jb9lrPFj1FiTCSoNEUhiwgPYaQW1nxUOh4UsR C5OQ== X-Gm-Message-State: AOAM530OEQKv2Rzb39xpVonBw/37Z2BOD4OTSrLHLXcTnzHhPhZmQ2t6 lQCIf4OQ34CfNbqAS3C4aiX9/A== X-Received: by 2002:a5d:4084:: with SMTP id o4mr1665471wrp.278.1606167738095; Mon, 23 Nov 2020 13:42:18 -0800 (PST) Received: from localhost.localdomain (lns-bzn-59-82-252-157-164.adsl.proxad.net. [82.252.157.164]) by smtp.gmail.com with ESMTPSA id 35sm22400598wro.71.2020.11.23.13.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 13:42:17 -0800 (PST) From: Daniel Lezcano To: rjw@rjwysocki.net Cc: daniel.lezcano@linaro.org, corbet@lwn.net, ulf.hansson@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, ilina@codeaurora.org, lukasz.luba@arm.com, rkumbako@codeaurora.org, rui.zhang@intel.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH V2 0/4] powercap/dtpm: Add the DTPM framework Date: Mon, 23 Nov 2020 22:42:04 +0100 Message-Id: <20201123214208.11007-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The density of components greatly increased the last decade bringing a numerous number of heating sources which are monitored by more than 20 sensors on recent SoC. The skin temperature, which is the case temperature of the device, must stay below approximately 45°C in order to comply with the legal requirements. The skin temperature is managed as a whole by an user space daemon, which is catching the current application profile, to allocate a power budget to the different components where the resulting heating effect will comply with the skin temperature constraint. This technique is called the Dynamic Thermal Power Management. The Linux kernel does not provide any unified interface to act on the power of the different devices. Currently, the thermal framework is changed to export artificially the performance states of different devices via the cooling device software component with opaque values. This change is done regardless of the in-kernel logic to mitigate the temperature. The user space daemon uses all the available knobs to act on the power limit and those differ from one platform to another. This series provides a Dynamic Thermal Power Management framework to provide an unified way to act on the power of the devices. Changelog: V3: - Fixed power-limit computation in addition with the hotplugging - Improved the encapsulation - Added specific ops for the leaves of the tree - Simplified API and self-encapsulation - Fixed documentation and generated it to check the content V2: - Fixed indentation - Fixed typos in comments - Fixed missing kfree for dtpm_cpu - Capitalize letters in the Kconfig description - Reduced name description - Stringified section name - Added more debug traces in the code - Removed duplicate initialization in the dtpm cpu Daniel Lezcano (4): units: Add Watt units Documentation/powercap/dtpm: Add documentation for dtpm powercap/drivers/dtpm: Add API for dynamic thermal power management powercap/drivers/dtpm: Add CPU energy model based support Documentation/power/index.rst | 1 + Documentation/power/powercap/dtpm.rst | 210 ++++++++++++ drivers/powercap/Kconfig | 13 + drivers/powercap/Makefile | 2 + drivers/powercap/dtpm.c | 441 ++++++++++++++++++++++++++ drivers/powercap/dtpm_cpu.c | 252 +++++++++++++++ include/asm-generic/vmlinux.lds.h | 11 + include/linux/cpuhotplug.h | 1 + include/linux/dtpm.h | 78 +++++ include/linux/units.h | 4 + 10 files changed, 1013 insertions(+) create mode 100644 Documentation/power/powercap/dtpm.rst create mode 100644 drivers/powercap/dtpm.c create mode 100644 drivers/powercap/dtpm_cpu.c create mode 100644 include/linux/dtpm.h -- 2.17.1