Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2820015lqz; Wed, 3 Apr 2024 09:25:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW4yKVHES2VFZaiIhM+tjlF5qpkRXKYY3U/d5Gci/84vUKQZ9mvWCeai8E5Tiv4lsu7NmVgpbxrQJ+7Qi9M2bxlBXy3tCkMG/pV6DVTXg== X-Google-Smtp-Source: AGHT+IGzeb2yoksMVmuE9kDF0NWOmW6IfOn4ltXlZTQrE970/brkopCAehpla52jeozF4qXOL34F X-Received: by 2002:a17:90a:f3ca:b0:29b:c31:1fe1 with SMTP id ha10-20020a17090af3ca00b0029b0c311fe1mr197272pjb.10.1712161553580; Wed, 03 Apr 2024 09:25:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712161553; cv=pass; d=google.com; s=arc-20160816; b=ZMWNAdHKf1y/FcDN6HO7hIDveFSgDAdyySha/ltD2w2dF9ZuTib3odQNYMdCwRrXgf cAt3jgXsEed0jLN02xWMf8qgdf8/WZJTqTBfRToj2+/EQzGQ9gzwe182yOAgVypHkGP4 7peTdXwyEK/9s9eyrRD9WqlTRDRmSJJm9+8u8w8kvuTbFG1/sqUA1iJDj+Oi51X0lUfX 4yVZ72+z+9vQcLTMGR/5PAZlO/yx8WKXC1Ce0z+Oh3/5ez5ZCU0Pup1/WtV/NuWUgheV S2AlNFUblp9HKueCwsn+wHIbmlmlnPc0U7aIuTBVtZYC0edmLr7tkk0/m1blwofAHDur RWVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=anvTbSfajifS8+HOZj/bj6yQtrDh1aSZHN65COxOUFg=; fh=1WI8GTYG2FpxfqIJPEh4RDfKxHHctO/qCBqvgKx40ew=; b=qy++d10KhwIylaRsuGPDGfdHfU0/niXQ47NNUZAyLlIGdyZiTvVm2uoYbONbd0EFOj qc5fjzRLk60e6pHYoQzVZM9/ND6jCebjxQVfwfZX7kecDE2BXA6C8Qfx25eAKKMLN7AR 9LQbDUHc2lFpgt3qrkyqqbBNrCt7pG8xClY9sAjoR1zsyLW3/CLw1x/fhbfN3yPOK0gB 3kEeTDBvLdagPbFL/gxwtIYWf2elglVU7BLMttfPam5DID+liDP7U/LTCajbSDSzbQBH qkG6Qt20E6+o29ntvjUyCUtOnK39mGRSIDLv7RrdYL3uwjMwx5m5Kd97u/WLsF7n8Y4Y 2pbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-130187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p2-20020a17090a2d8200b002a2546a0bfasi3515416pjd.129.2024.04.03.09.25.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 09:25:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-130187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EEAF3280CE8 for ; Wed, 3 Apr 2024 16:24:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D761515253C; Wed, 3 Apr 2024 16:23:28 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F184D15218F; Wed, 3 Apr 2024 16:23:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712161408; cv=none; b=fAtN3KhKF+oxT6fG77f+M3zyYcswJ5FOaCObpm65+CVytNEo/pUHaMTFyAoNZLJvfsrKKVkFMbLThEFhU7DaXei36pDRm7QCHLwLoKGBLVoulrXqWB2XWBSaFZwIurgH9U3vOtshlMpC8MYm2Y+FterIHC8wyhfkW1rSZuy+Kdg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712161408; c=relaxed/simple; bh=0eUlnvrqigfBBPIoBqRDi/ZXh4M8CY7dC6afPqLOJW8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LkLoZajq1UWwUv9l1pnsGL/SHNs69UMELK4KCLGTzxx/NBACnV26fqmPC6zY1YosWiVF84pyCoii1sQRzVysBdQ0oUv16OtRstCpd0vYPm2b9O2YUpFogsOfUQJm7reBCkbcllECDkRl4KuaLlHGtNHTbH62xENUDNkoh0Tt+e8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5430D1684; Wed, 3 Apr 2024 09:23:57 -0700 (PDT) Received: from e129166.arm.com (unknown [10.57.72.191]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6A56D3F7B4; Wed, 3 Apr 2024 09:23:24 -0700 (PDT) From: Lukasz Luba To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: lukasz.luba@arm.com, dietmar.eggemann@arm.com, linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, cristian.marussi@arm.com, linux-samsung-soc@vger.kernel.org, rafael@kernel.org, viresh.kumar@linaro.org, quic_sibis@quicinc.com Subject: [PATCH 2/2] cpufreq: scmi: Update Energy Model with allowed performance limits Date: Wed, 3 Apr 2024 17:23:15 +0100 Message-Id: <20240403162315.1458337-3-lukasz.luba@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240403162315.1458337-1-lukasz.luba@arm.com> References: <20240403162315.1458337-1-lukasz.luba@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The Energy Model (EM) supports performance limits updates. Use the SCMI notifications to get information from FW about allowed frequency scope for the CPUs. Signed-off-by: Lukasz Luba --- drivers/cpufreq/scmi-cpufreq.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index d946b7a082584..90c8448578cb1 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -185,12 +185,25 @@ static int scmi_limit_notify_cb(struct notifier_block *nb, unsigned long event, { struct scmi_data *priv = container_of(nb, struct scmi_data, limit_notify_nb); struct scmi_perf_limits_report *limit_notify = data; + unsigned int limit_freq_max_khz, limit_freq_min_khz; struct cpufreq_policy *policy = priv->policy; - unsigned int limit_freq_khz; + struct em_perf_domain *pd; + int ret; + + limit_freq_max_khz = limit_notify->range_max_freq / HZ_PER_KHZ; + limit_freq_min_khz = limit_notify->range_min_freq / HZ_PER_KHZ; - limit_freq_khz = limit_notify->range_max_freq / HZ_PER_KHZ; + pd = em_cpu_get(policy->cpu); + if (pd) { + ret = em_update_performance_limits(pd, limit_freq_min_khz, + limit_freq_max_khz); + if (ret) + dev_warn(priv->cpu_dev, + "EM perf limits update failed\n"); + } - policy->max = clamp(limit_freq_khz, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); + policy->max = clamp(limit_freq_max_khz, policy->cpuinfo.min_freq, + policy->cpuinfo.max_freq); cpufreq_update_pressure(policy); -- 2.25.1