From patchwork Sat May 24 07:30:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 893297 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD8771D130E for ; Sat, 24 May 2025 07:30:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748071854; cv=none; b=NpKrSYpA/1RVnoNDh2xdm4PuNuM5M1Umv0/YeogyvLY6tJdf+d2DfZmH+2/dAlJqmYVJSJeF7qsKSAUUU8P1T6oqWWMdJPuJ91juAjhOYbh54ytO9Zy3QMEaOnlxAdVV6Rsc+xTIw+8z4HfDhTvubdziHCZiMvfYS7IyjVb/Oms= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748071854; c=relaxed/simple; bh=O0HVjXkPpQ+hRZJ3BsTB4d4LrVlN7b2E11+rn3JSmv0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n05AUjkzdUaLWJMbPx3qsBZ9XKnIJuqPEGGiKgvpRZikRxl+NHR8IPyah4Q/a3kvJgC4LDjkCDpg+CfK6hr/uj9gKMBVxRAAJ+bvgbup7eXbeypOfYJF7LbHC2T8htIMUeDTOQLvJjguQWOR+GfpenY+LwP9cef1yt7JmhbGd00= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=yZIWcg1h; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yZIWcg1h" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3a3683d8314so436617f8f.3 for ; Sat, 24 May 2025 00:30:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748071851; x=1748676651; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ZmciNu0LzBJkCwAxE+xP2RniPnh6vstV6TXm+/dhXAk=; b=yZIWcg1hyQtW1nvlEACuGJ2992VIPKucVhU95FVk6ONlEV5lmYtSf5a2PMP31wfoVi SrIfeajHXpkUXR1a4Zw+qAfmppkMpVZyuKg4QzZFiFiw1NGiY0mgIIR55JYcRWr+HiXo CnXpMtAfWS1mXAdZDZgOga5b/PCsQFzcuCMa8/HcPrErjbqt4t1DduM/XfvbRhRq9mJx GWrp3tiG4vHQ2VbG1hMo0tVwUuzkekjqXmLbdD68mtk4lg3kRkgNDvuJXAjY9WT+Hy9b Ny/Gih81f0Z89JGN7NwU69PlLlT5UippC5pF1yJ8vAtRWEC/DYk4gdYisFCOOAhknCnh YMHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748071851; x=1748676651; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZmciNu0LzBJkCwAxE+xP2RniPnh6vstV6TXm+/dhXAk=; b=Cvigi0c+lsN/OVC4YaLGRZMpj8JE9iOhQCVJbZCuPc4GJydkm8cFHuh1ha4/Y+tu98 5TYdpWyAO85jEwBOlqOKuRCBV9i4t7KtQinoe4jG2ZoiHaBHa/yY8rS2hwTn1c49Ny4o Y56S96Vfw8Cqi5XRElF5VQ2532GUwFZrItR7/1g06b39OSFdhuCEUfKU7+814ijZ7530 YRP3hhvcv2ILjLJ4lbNNPoRjOuR81Qb4p+PiY92dGEcAcgb2e7TfSiNcP15BwreKd0jw BXfnAmh/31kxWEvlOZygEV5CrXoP00DB7dJB0StepDZDRZqoy9kOq1yYtbuQlOyhOcfr BvZw== X-Forwarded-Encrypted: i=1; AJvYcCWyK8Z/EOFHAAoDgQJUtsY+zzHC8A88x1xyclPbzOwrpebGSfVB56PgxTXEnEGikeC/wY9ay4QOMOcpzH9GAPIuCw==@vger.kernel.org X-Gm-Message-State: AOJu0YwivuebSuVQkKPummaWgLnilman+hpgJhcnIc+hlET11JC32Cfd /q29YFM2lD9+L2PMNy7OlKSYrk71LPiiWIgA/GS52+YDHMqlWtCBQidhN0SOo62Tgy0= X-Gm-Gg: ASbGncsBMeomjxnoNpR2I1wNAoIeKFUipCdHYuLIq0Q4YWid13KHfnNvQkgTUWMQN9T UiCJHGjUJD/c6h/QHhiS7K+VturwRIMXbXgfbq4QjJf13F/9VwkwCLl8noSfbw9Lnxyq5bqAIiC Xxgu6Cz8qGDCUa7IRsAmOWHs/FEwKi0azNPO/p3Ac59RQCnwETBe5e/QPuYPk6L7v1QxRGOO0K+ wP9TGErr2d8qxQtXcpKCvLE2hT8cAbeOeh3QMBDIK8dpaNUcrVRAZQo6YqAEpioD2Xz9i6Zx2RQ r/10CiVZr0ZxSeT0S3F786Gz0h7OZgGW3Yv8c7cbzpwXTZY1rNfB9BExr7UullfzERzjJBOakmJ RhHfhT64= X-Google-Smtp-Source: AGHT+IG3Ci8gKkZTNURWKOCr4Gya8iUahrzHV+bC1Sl6TvVnxfZLPGWzu66llvg0ow/aQlaOFzwp3g== X-Received: by 2002:a5d:5846:0:b0:3a4:bafb:adc0 with SMTP id ffacd0b85a97d-3a4cb47b7abmr1811022f8f.31.1748071851019; Sat, 24 May 2025 00:30:51 -0700 (PDT) Received: from gpeter-l.roam.corp.google.com ([212.105.145.168]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a3ca066eb7sm10924273f8f.2.2025.05.24.00.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 May 2025 00:30:50 -0700 (PDT) From: Peter Griffin Date: Sat, 24 May 2025 08:30:29 +0100 Subject: [PATCH 1/2] arm64: dts: exynos: gs101: Add 'local-timer-stop' to cpuidle nodes Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250524-gs101-cpuidle-v1-1-aea77a7842a6@linaro.org> References: <20250524-gs101-cpuidle-v1-0-aea77a7842a6@linaro.org> In-Reply-To: <20250524-gs101-cpuidle-v1-0-aea77a7842a6@linaro.org> To: =?utf-8?q?Andr=C3=A9_Draszik?= , Tudor Ambarus , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Krzysztof Kozlowski Cc: William Mcvicker , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Peter Griffin , Will Deacon , Youngmin Nam X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2028; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=YOBJe4JQl9jqFc/zsJIf4PxMvh4EMREF5cXBQbIBA7Y=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBoMXWmsxp9Uy82tClf5s61NuoYnyaOBZdxLp10l q7TTH3NYf+JAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaDF1pgAKCRDO6LjWAjRy unU1D/41OXg9QXtmWQJnnjdXLGulkJ+wCDBdcRAn/wUh2RWSgqGI02bMgMVihzdJcnJOfG03Lp+ vd0CGC1CeypVlnLzTodx/ofUrU0SYY50EDhSOWuA6yDvWXgcDup2GhJ/MRvt/nhjIQneh+9GXOD rlp4sDeeR6pJ9pbI4hCOjzy1RWeFJMuxJR3kZGaGqQiDvvgzTssrQ8aJJTT89IpZoK+I8ooyeKt xD5Pe04SyIDpMLDsZu4x7Evzir+odIOOvKtRBYltVZ6BSfKWvKnj+bdsuleQ1aKZTooZP2uW2yd 4qjuklYJkwWSXKFW6NrexhoCQ3m3TBNBDjaTdf/34gjH6WgafDWNcdkkqsX8kHEgmDnYhYK6nsB cT8AXkiRVkDeFd26OR99bnDq3i08Kb89ctFbCe2kXkvo2eJvkmGehf6cdbSN2LJdgjpZmGHuWcz l2ySFBhvJqaNA49ISF1qiuYfGVBxFqUdXcYNLAOnui5t4CbovkkDOfVsZqlSPIR/vFpNvRhBEhz 45XNa1nnj+I1OK4L273LmA9tu0ckNz9X1pOZ2XLwzGCKywqoaCS7/IiLHosXLV55KaF4qw8VUQ1 xUFN1BBPhlGZK0ubJgKgMV0EbOI6Wsu0aDfhxmuGKvsJHrXhT9Ov7+PeO15/9aECA/bZHxLKEHQ lEnnr4kQ1D4CV5g== X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA From: Will Deacon In preparation for switching to the architected timer as the primary clockevents device, mark the cpuidle nodes with the 'local-timer-stop' property to indicate that an alternative clockevents device must be used for waking up from the "c2" idle state. Signed-off-by: Will Deacon [Original commit from https://android.googlesource.com/kernel/gs/+/a896fd98638047989513d05556faebd28a62b27c] Signed-off-by: Will McVicker Reviewed-by: Youngmin Nam Tested-by: Youngmin Nam Fixes: ea89fdf24fd9 ("arm64: dts: exynos: google: Add initial Google gs101 SoC support") Signed-off-by: Peter Griffin --- arch/arm64/boot/dts/exynos/google/gs101.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/exynos/google/gs101.dtsi b/arch/arm64/boot/dts/exynos/google/gs101.dtsi index 48c691fd0a3ae430b5d66b402610d23b72b144d7..94aa0ffb9a9760c58818c0417001fd187b048ea8 100644 --- a/arch/arm64/boot/dts/exynos/google/gs101.dtsi +++ b/arch/arm64/boot/dts/exynos/google/gs101.dtsi @@ -155,6 +155,7 @@ ananke_cpu_sleep: cpu-ananke-sleep { idle-state-name = "c2"; compatible = "arm,idle-state"; arm,psci-suspend-param = <0x0010000>; + local-timer-stop; entry-latency-us = <70>; exit-latency-us = <160>; min-residency-us = <2000>; @@ -164,6 +165,7 @@ enyo_cpu_sleep: cpu-enyo-sleep { idle-state-name = "c2"; compatible = "arm,idle-state"; arm,psci-suspend-param = <0x0010000>; + local-timer-stop; entry-latency-us = <150>; exit-latency-us = <190>; min-residency-us = <2500>; @@ -173,6 +175,7 @@ hera_cpu_sleep: cpu-hera-sleep { idle-state-name = "c2"; compatible = "arm,idle-state"; arm,psci-suspend-param = <0x0010000>; + local-timer-stop; entry-latency-us = <235>; exit-latency-us = <220>; min-residency-us = <3500>; From patchwork Sat May 24 07:30:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 892417 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BE401DFD84 for ; Sat, 24 May 2025 07:30:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748071856; cv=none; b=lTU6Vla5vdNCS6BjqS22kii3vsdXfTb7Xst7SwoT7ThjzrWsB/1wDpM7qFzemJURTR6S9fM/+dPdbDVdW2AL9Jtzm0kNl5d8O+vBcevDXL6b3ZDk9QdbShiRqLPZhf0p0E2ln1kPGutDpasQUbofMCukX92BgZkcn1WkKahig1U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748071856; c=relaxed/simple; bh=7U9tlCoZc/rOj7EH40BDPDvRFAVAP6sWxjfHvLHGmLE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qW1w0q7YsRtGyt2Hmrcawjqy2fYyABDPBAuv/RG9wa2gWg0ceoQaJYe2Ndi9a39yPR7Y+StC/+NeNeTqZ803aXJKlZF5f5zmmdsBzuw2uK4bHWaD3DktZ0rdi39c8+9jzeJ/8WRezXZxayS/x87GMhLaIyYQ754Jf/kdRGUfuv4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Qx6xcIG+; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Qx6xcIG+" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3a4c4e6a0ccso359124f8f.3 for ; Sat, 24 May 2025 00:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1748071852; x=1748676652; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dpN965PXtFApJwEIkCDxa4SlX4t9L4NYatiQcXWo3sM=; b=Qx6xcIG+sPZUrqp+YfccHJRqxp0H31111HcAhdSelhcHmPhQQk05tZ+XNJKiufzBsV Ih1W5hOUN9ks3Ucxb0iM3lQhbFDfHTdUy26doEU+Sq5bMoOy/NllGwj2XEKQ7+u/aGqn jZV6aN9msvOGVl0/j+u/fS59uTYTH/livak64ESXYRgy1/Qu9s9qbIk+mNCn4NTseyi5 KaGcKBi4HCEAz2xxBvNxsFpSO7IsHXqXKHsj/8S2QO8xEJzRvZVyLN10fSMGbwYKfAG7 Zih75p+PCxqrb7hm2CAq/aWSe0cywyqfPq0mrhxbotshD9RfoJx3s+jVdXjCFxWNa7Ew Ptag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748071853; x=1748676653; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dpN965PXtFApJwEIkCDxa4SlX4t9L4NYatiQcXWo3sM=; b=DRV4BsKMHdoX/GkwmKn/13S7mxkcMYRkeGiG7BtMq+a5vEZ1NUUpw5SqGOTsksAmqN SVozUh7em25GkexFKPa/AwAOdunMfqJoIdkm4FuCp3FZJxQXdWEP82guQ5lc3BSd7Ij0 SskN9MDgLL26xYakRjIM2bBcnCJehCPutcOuHAYwWxYLzT+rtplp2g7ZgmNzojFf+KRM Edt+9p1i2PRl06B13ZYzMwr4v1g713/ViZvuAETzDSd0cO+DbBy9f0DaZvKiQgo6IPT8 /c64EVhzIrs/ZbPMcI0Jy7U5UasyKoBsq9CjSdXRRN1+cdd1J/BMMf3HUiybk6syuILs 7/tg== X-Forwarded-Encrypted: i=1; AJvYcCV3x1k0jnLlirVtBNawmy+t/C9JW6dNJsu0szQM7OlNG8XnOx6hJi/DlThY6qYOUqB0pCa0CD73T8FOYhyW1l5ITg==@vger.kernel.org X-Gm-Message-State: AOJu0YxRsqM3vhkoyNk9CgRDBpQeFcAZOZv+/7DE1NdnddbHhCa8PD8i NHKscMHDOILWBhQEtLwb7Ov11c1BlsjU2aNhgI893exYiGo32uCShWSEybQzNSwymL8= X-Gm-Gg: ASbGncvzH2ZQlrQUQX1LO+COGdKDPo1CfLl0plt2MAjM/26/RiCxGwMLEVqj0g5KDI9 sN5vhmkp5upmG0XoP+L2fKwVUQ5uNyDwQfpy91E1h0mOqbIDGZXQt6k+vHLzGxtX6IxNAMkBmue M/kTrcQ9Wqtj3bgpNwmUoohxPMzoxqsvpr34/hn++eHHW4SywXMUDS4xxG4M7s/CeziGzSYKRqw WUEAh2iFOilI7RqS4YzHkZpEO/rvoi+VqvUgPSELhuU03FaIyWbF3JK0F6RjYTdtDQf/tAtvjKS Yk/fF3uCZBRW/8ZQyxeEOiYWkteQrOOhn++ZzsKuqmg81jhQc7svIPM0Nyntjdax44OJlshLR76 TN7A4+mU= X-Google-Smtp-Source: AGHT+IF0wVjcuoZd4VTJ0sGnuwAU+9jQIdeBlKfJuU5uEJZ08QXI5uRMh7/aqwevs21KvTC+SndKRA== X-Received: by 2002:a05:6000:2890:b0:391:23de:b19a with SMTP id ffacd0b85a97d-3a4cb464885mr1858085f8f.31.1748071852553; Sat, 24 May 2025 00:30:52 -0700 (PDT) Received: from gpeter-l.roam.corp.google.com ([212.105.145.168]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a3ca066eb7sm10924273f8f.2.2025.05.24.00.30.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 May 2025 00:30:52 -0700 (PDT) From: Peter Griffin Date: Sat, 24 May 2025 08:30:30 +0100 Subject: [PATCH 2/2] soc: samsung: exynos-pmu: Enable CPU Idle for gs101 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250524-gs101-cpuidle-v1-2-aea77a7842a6@linaro.org> References: <20250524-gs101-cpuidle-v1-0-aea77a7842a6@linaro.org> In-Reply-To: <20250524-gs101-cpuidle-v1-0-aea77a7842a6@linaro.org> To: =?utf-8?q?Andr=C3=A9_Draszik?= , Tudor Ambarus , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , Krzysztof Kozlowski Cc: William Mcvicker , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Peter Griffin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6895; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=7U9tlCoZc/rOj7EH40BDPDvRFAVAP6sWxjfHvLHGmLE=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBoMXWmtDVOeQQo+H2c8AvBH76fkztXnDVtGuqHJ H/MOqEBp7iJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaDF1pgAKCRDO6LjWAjRy uvt+D/0bEVtxwCaxiKJJL5LsmcMbQ09zGgPLJNXhqcCbb4XRLAVXkYKJnwc/7SC54L78zeTcBmS sVdtvXO2LLihhhB4gE/dZrdoL6DFKdfv+p7EWTWY39yAluPT8Ws9dyu60bmSnwtETaB5TvRORLr CVpi1KXEZFqcLRd76WdwhOC3TfZGZdKTlfSQoVISIYZY30N1svryxaDJ0jtyVJ9yq4bmGGg6yNb r6LsXie6JJH/SL2iCEDXGj6JoNT+cbicc5ezR22b+edZqR16pQufrH1sDH1jDTnmmboNUHnYDzC fSI3li6BxlMIgZ4Tge/XxCGIQ1OcK1G3+nV9hoxZM0AkQ65EQ/mY14m1e1zYl7rVHXTC4UAqIce ab9dpeA/rDq/7AXDV05Rt8Qrp60mvG//C+R7tp+MyEv/cofB6mydmzHb2H/PdlZwhk7a2I1fMY0 kf15KNkn87hfj9rZZmqXMAdMORi5G44moutqZKAJ4ZR9vuXN4to1tTl2QoccSM7w0eMK3lnMH8U 4lvxY++hVNk6J9uWZd5nmql7NqnfqaXKRXU72FRvSsoOS0tN6Uvlc2PuAkXpNx83FbV8obI6J+V Bgqtlt24gLXBORP35mOAIFPwUyshxgEdlzr8g5+QrqtFVNSjwWEONlnxDPG1lwRG7N2h9W2Z2ub fXQSh7iXFNUrK4Q== X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA Register cpu pm notifiers for gs101 which call the gs101_cpu_pmu_online/offline callbacks which in turn program the ACPM hint. This is required to actually enter the idle state. A couple of corner cases are handled, namely when the system is rebooting or suspending we ignore the request. Additionally the request is ignored if the CPU is in CPU hot plug. Note: this patch has a runtime dependency on adding 'local-timer-stop' dt property to the CPU nodes. This informs the time framework to switch to a broadcast timer as the local timer will be shutdown. Without that DT property specified the system hangs in early boot with this patch applied. Signed-off-by: Peter Griffin --- drivers/soc/samsung/exynos-pmu.c | 135 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 4 deletions(-) diff --git a/drivers/soc/samsung/exynos-pmu.c b/drivers/soc/samsung/exynos-pmu.c index a77288f49d249f890060c595556708334383c910..314f543d46b82dc3e991a5928fea50b81d4f92b7 100644 --- a/drivers/soc/samsung/exynos-pmu.c +++ b/drivers/soc/samsung/exynos-pmu.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #include @@ -35,6 +37,10 @@ struct exynos_pmu_context { const struct exynos_pmu_data *pmu_data; struct regmap *pmureg; struct regmap *pmuintrgen; + spinlock_t cpupm_lock; /* serialization lock */ + bool __percpu *hotplug_ing; + atomic_t sys_suspended; + atomic_t sys_rebooting; }; void __iomem *pmu_base_addr; @@ -336,7 +342,7 @@ EXPORT_SYMBOL_GPL(exynos_get_pmu_regmap_by_phandle); #define CPU_INFORM_CLEAR 0 #define CPU_INFORM_C2 1 -static int gs101_cpuhp_pmu_online(unsigned int cpu) +static int gs101_cpu_pmu_online(unsigned int cpu) { unsigned int cpuhint = smp_processor_id(); u32 reg, mask; @@ -358,10 +364,26 @@ static int gs101_cpuhp_pmu_online(unsigned int cpu) return 0; } -static int gs101_cpuhp_pmu_offline(unsigned int cpu) +static int gs101_cpuhp_pmu_online(unsigned int cpu) +{ + gs101_cpu_pmu_online(cpu); + + /* + * Mark this CPU as having finished the hotplug. + * This means this CPU can now enter C2 idle state. + */ + *per_cpu_ptr(pmu_context->hotplug_ing, cpu) = false; + + return 0; +} + +static int gs101_cpu_pmu_offline(unsigned int cpu) { u32 reg, mask; - unsigned int cpuhint = smp_processor_id(); + unsigned int cpuhint; + + spin_lock(&pmu_context->cpupm_lock); + cpuhint = smp_processor_id(); /* set cpu inform hint */ regmap_write(pmu_context->pmureg, GS101_CPU_INFORM(cpuhint), @@ -379,16 +401,89 @@ static int gs101_cpuhp_pmu_offline(unsigned int cpu) regmap_read(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_UPEND, ®); regmap_write(pmu_context->pmuintrgen, GS101_GRP1_INTR_BID_CLEAR, reg & mask); + + spin_unlock(&pmu_context->cpupm_lock); + return 0; +} + +static int gs101_cpuhp_pmu_offline(unsigned int cpu) +{ + /* + * Mark this CPU as entering hotplug. So as not to confuse + * ACPM the CPU entering hotplug should not enter C2 idle state. + */ + *per_cpu_ptr(pmu_context->hotplug_ing, cpu) = true; + + gs101_cpu_pmu_offline(cpu); + return 0; } +static int gs101_cpu_pm_notify_callback(struct notifier_block *self, + unsigned long action, void *v) +{ + int cpu = smp_processor_id(); + + switch (action) { + case CPU_PM_ENTER: + /* + * Ignore CPU_PM_ENTER event in reboot or + * suspend sequence. + */ + + if (atomic_read(&pmu_context->sys_suspended) || + atomic_read(&pmu_context->sys_rebooting)) + return NOTIFY_OK; + + if (*per_cpu_ptr(pmu_context->hotplug_ing, cpu)) + return NOTIFY_BAD; + + gs101_cpu_pmu_offline(cpu); + + break; + case CPU_PM_EXIT: + + if (atomic_read(&pmu_context->sys_rebooting)) + return NOTIFY_OK; + + gs101_cpu_pmu_online(cpu); + + break; + } + + return NOTIFY_OK; +} + +static struct notifier_block gs101_cpu_pm_notifier = { + .notifier_call = gs101_cpu_pm_notify_callback, + .priority = INT_MAX /* we want to be called first */ +}; + +static int exynos_cpupm_reboot_notifier(struct notifier_block *nb, + unsigned long event, void *v) +{ + switch (event) { + case SYS_POWER_OFF: + case SYS_RESTART: + atomic_set(&pmu_context->sys_rebooting, 1); + break; + } + + return NOTIFY_OK; +} + +static struct notifier_block exynos_cpupm_reboot_nb = { + .priority = INT_MAX, + .notifier_call = exynos_cpupm_reboot_notifier, +}; + static int exynos_pmu_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct regmap_config pmu_regmcfg; struct regmap *regmap; struct resource *res; - int ret; + int ret, cpu; pmu_base_addr = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(pmu_base_addr)) @@ -444,6 +539,12 @@ static int exynos_pmu_probe(struct platform_device *pdev) */ dev_warn(&pdev->dev, "pmu-intr-gen syscon unavailable\n"); } else { + pmu_context->hotplug_ing = alloc_percpu(bool); + + /* set PMU to power on */ + for_each_online_cpu(cpu) + gs101_cpuhp_pmu_online(cpu); + cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "soc/exynos-pmu:prepare", gs101_cpuhp_pmu_online, NULL); @@ -451,6 +552,12 @@ static int exynos_pmu_probe(struct platform_device *pdev) cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "soc/exynos-pmu:online", NULL, gs101_cpuhp_pmu_offline); + + cpu_pm_register_notifier(&gs101_cpu_pm_notifier); + spin_lock_init(&pmu_context->cpupm_lock); + atomic_set(&pmu_context->sys_rebooting, 0); + atomic_set(&pmu_context->sys_suspended, 0); + register_reboot_notifier(&exynos_cpupm_reboot_nb); } } @@ -471,10 +578,30 @@ static int exynos_pmu_probe(struct platform_device *pdev) return 0; } +static int exynos_cpupm_suspend_noirq(struct device *dev) +{ + atomic_set(&pmu_context->sys_suspended, 1); + return 0; +} + +static int exynos_cpupm_resume_noirq(struct device *dev) +{ + atomic_set(&pmu_context->sys_suspended, 0); + return 0; +} + +static const struct dev_pm_ops cpupm_pm_ops = { + .suspend_noirq = exynos_cpupm_suspend_noirq, + .resume_noirq = exynos_cpupm_resume_noirq, +}; + static struct platform_driver exynos_pmu_driver = { .driver = { .name = "exynos-pmu", .of_match_table = exynos_pmu_of_device_ids, +#ifdef CONFIG_PM_SLEEP + .pm = &cpupm_pm_ops, +#endif }, .probe = exynos_pmu_probe, };