From patchwork Mon Nov 9 09:09:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Titov X-Patchwork-Id: 3984 Return-Path: X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mxe881.netcup.net (Postfix) with ESMTPS id 540B91C72CB for ; Mon, 9 Nov 2026 10:20:42 +0100 (CET) Authentication-Results: mxe881; dkim=pass header.d=wirenboard.com; spf=pass (sender IP is 104.64.211.4) smtp.mailfrom=linux-sunxi+bounces-27411-noreply=patchwork.local@lists.linux.dev smtp.helo=sin.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 104.64.211.4 as permitted sender) client-ip=104.64.211.4; envelope-from=linux-sunxi+bounces-27411-noreply=patchwork.local@lists.linux.dev; helo=sin.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 0F9663E9F7 for ; Mon, 9 Nov 2026 09:09:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794215360; b=ctMGzax+MTVRIJElXOmBpNFhH8fzgwyYWcaOIiRAtvKTNJqTTFDtzmvqXPaPwGs0iTft BDLnje608cjKQDLQK1y4cZI4gm3KW66U9qJQH1xdkcLrJki2f12fvjj4kg+x1/S3Z0sht ZGy4KzYGTgHf1rfZdvO6cW3ZnZsOo10OLmldvLJPUn8eU2fecyxNWDi/8wf+gzQBr9vfR 7S1HezLc3NiC4Hqx/AeEd1t9pqGwm2lOVmfRSgI2bOj255utNZjOlusD7A4/Bc3LHtgB7 fQDEV0B2X8TrsYDcdEEOMONFtZdRqLQPrqXn6BeKzJFDTCBC8l4b9y8a0uzVEud8Ggg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794215360; h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature: X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State: X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID: X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=+KBLzQyqsR334QCpiwaANoenKn13j8vn07qxRoKBlVI=; b=Nqu/jBdEvQx46mk+geyeyK1Ll1bALGe3Nx4PihEEQ/nVLOFSADgIQiD9snPL5aCaqV6n peh2tKu69Pc/9qpE/Kznq7JGlkmxFfgHMYWjJpoEC4Oxd4uISW6nOU1nHVokJy3y81+Y3 toacjJ8w/x/zJhC7Mt56qIV1Fz5PtitLfuy2LY80fBzJ/v2ANi0sjK8amMFGpp2c7TAAr l4/M9kPsPvSmsLM1aF0bZSgCmtWnFto6OuJj8SZs0VyNW9IblLV0GV/2CNtY4wRhBbCf1 acrhV6D1EHpDoBo39DHLDVCOb/SV1aNAEXGTwfiqMg6q2C17YGXEwOqM0tvjJVt+9XQ== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=wirenboard.com header.i=@wirenboard.com header.a=rsa-sha256 header.s=google header.b=iaXLFkkb; dmarc=pass header.from=wirenboard.com; spf=pass smtp.mailfrom=wirenboard.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D21D606A33B; Mon, 9 Nov 2026 09:09:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wirenboard.com header.i=@wirenboard.com header.a=rsa-sha256 header.s=google header.b=iaXLFkkb X-Original-To: linux-sunxi@lists.linux.dev Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794215360; b=sGcUANv2ecqKrlzx/WxngIVmOdL2YkCFnzFE146ndLwiFZYkv8XLH3yPBr3ogfDeQvDX PJYxmZ7PIT5cqSBjV4g0bUeAHgNWk9g2Sr/6GfxQYl9b0QWZ8LPYiYmhXxCEk61zl8aeu +6u7pZrvyavu/2umw4Y7QPbV4fCdQ1Qnz/M/Q07TwTtgo2DO/suJqAjEdgKH4iJ/hpMhZ Aeex2hrKhMNUtLWbFkgbUNQbCfyT4d6kziVakDfK2nxpFuMmOGNFENE6YeJqJELPWCn0H 16raW2eQwvczS7bPZiRkWmczfmS618oWy5T0jLRQ6zbinbSpdJn8DDRwybUtVkABkMg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794215360; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=+KBLzQyqsR334QCpiwaANoenKn13j8vn07qxRoKBlVI=; b=tAJ8zUp4xdWVuFdf40Wqt07fQzXR+jT23I8j9rbAvdcAa+YIdmYGq44eFnmicSYJ7I8G GbWYn+T1+x+Or5N89pq21Yb664LAVhSJiBFRhEeonKnLSkIbDk4ZgX3penxj+Im3snf9K BpUOa7AoZOMCbm8PpZvhvXU1y6BwlP3DbaCug/kBpb4iFB6CBSYNLBREKh6CadtpOPiTQ syft54cHeBpqjv4xPty/vxK9JCEeuN8VkHsWbNeXpQ+zKsmdnX9kvp1Ah1NdgGGx0jUjI PzUxTttZFxAMaGucJvvtKZUzXRpO2Rf9zVvtWGAt31A+Uvuk2WSMqHgZMmN9a16ZLkA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=wirenboard.com; spf=pass smtp.mailfrom=wirenboard.com; dkim=pass header.d=wirenboard.com header.i=@wirenboard.com header.a=rsa-sha256 header.s=google header.b=iaXLFkkb; arc=none smtp.remote-ip=209.85.128.42 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABDF3606A335 for ; Mon, 9 Nov 2026 09:09:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org ABDF3606A335 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wirenboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wirenboard.com Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4a214c5c4c0so6089535e9.3 for ; Mon, 09 Nov 2026 01:09:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wirenboard.com; s=google; t=1794215358; x=1794820158; darn=lists.linux.dev; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=+KBLzQyqsR334QCpiwaANoenKn13j8vn07qxRoKBlVI=; b=iaXLFkkbiHOX+6qEVwM5kL7Jy6S5QhBsw6h+cdXB6V7DiwnigzW4kz+ZGT3rsBHVb5 cZyOWndr10b/h3AgWBOUtEYb6a65tgNW6s5fqs1gsSuI51yY4F59jsOPhw1rHeU4ie81 h0Dn3H42pHIa51tCG/ncpvU9ipMqb/CApDhkMrwvew2eL+OEoHv0Ec02lGEPQJ/eNzy9 UAyJrKh1yOBJAOTBJeWWSadSElvC11j4w7GhR3czQ5Bpe1kUTGiRfS7v1g1QH+gIbr2V SfBYTlraTen4Oc/+TlAK263qe1h21X7f3YHT3MCUR9pSA53LL7IWrUeDJ16ud2YKYrkr ZEPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794215358; x=1794820158; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+KBLzQyqsR334QCpiwaANoenKn13j8vn07qxRoKBlVI=; b=CLv6/HVMmJMZe3T4oSQLWDwbl10+/2ahpCzHqfCKLAP+iPw4aUon6o8ObZ5+LU6jnL sYCn+XdgpGuQwMnOyxsRiqYVQdegeC3WYIRTDkJLVz+cP4jxjs6ouoSEyoc9Wey40z0m PCaZx959xp0Uw9V8tIvDapUMqYikg47oOYHTUG//JCagTfYozuPHL4j2GtbM7YihFvjR hTZ10Z05hF2rJBtZk/+ItiTpkSCetwo+g+KDZ6xkTt4eC8B4jEJIODcNyYaYgFbRW/IS uPrVGneygPJeWf5wBJIvhJzcYi6wql28ZKfKIPlqBXRLGLrxMIcWFkl/y8BiyIPzjuXf KCMw== X-Forwarded-Encrypted: i=1; AL+hErG1iOzkB5P/Z+xVEZkdKLd62MoI2rWfPMzl0K9gHwLUSiCMMSa5gHaEDluLZi9+6G1Szg8rmThv9rlqJw==@lists.linux.dev X-Gm-Message-State: APuU4Z9FkEJsJMkHHCOwrA5mvUrr+asjs/ir3mDbz7q4zimNgv/I1ihh u6xVA8cPvp0vQVPAjbfJF1uHWshV1KM7lBI/jWtQkVgt+o5uDBKYGICA+tqnSdssH/k= X-Gm-Gg: AYBFou24+JcueUC6sN6BDS7QdA1QRvZK70IJqWcUge4pMfPDs5v5RvKCJj4sIZOavHY TguL0hTZW2MaGMc0uVUGgUO3vryuruo9XpwC2XxkTGNz9wlJZqwbNaSSL9MeuOunssfpIB/1e6X qOYQDc9F+utO2vXvKJ7B8ig5w5Lj4U+kUYzijyyOoCcG3B/SDLRB6nxvZ/qt6k8JccuiO+FfW/j BkVSJuN6L3nr+K5sBa3DfxZXc/k5IBWZNHvY0BsAh1alnPec2QPRzZIRW9lEoohDFPL/3oB7+Jr Q8gW+AmuylEikKIA7OOvKeOfbKs8/qaU8dtC/rhcn2tdNwsUOHdsYNmDo0okkwt5HYxaGYAX9LZ 1XZ4ve5WD+VRbGZ9rR0+pR5gEVkPHYfoOxo1e77qE0RThKKrTITm/q1DyNVlzyKcn2buEQAQvJ2 xSLfkY1VmD1h58sAc6MbxGgOzMLja7m8Wz/201mb6XhhRQkqthoGEBY4PKavxc6Bl4jxXYG9DZt XpPa+a34rUvB9ceeKlzQ7AaxdQ1RArHaWmRGaLxaGTRGstj8UVhNXu6kfccaoOCKf64hYCZjWiy JxW9O7ihkaWWaI+C7sDplrFd2+zdxpEEBDBwdbGbEJTANfnsQV1P/l60zCkdsfU= X-Received: by 2002:a05:600c:474a:b0:4b5:2c72:651c with SMTP id 5b1f17b1804b1-4b963c6cac0mr68998635e9.5.1794215358048; Mon, 09 Nov 2026 01:09:18 -0800 (PST) Received: from localhost.localdomain ([85.137.25.106]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-49592f398a4sm8250905f8f.6.2026.11.09.01.09.16 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Nov 2026 01:09:17 -0800 (PST) From: Ilya Titov To: sboyd@kernel.org, wens@kernel.org, jernej.skrabec@gmail.com, samuel@sholland.org, andre.przywara@arm.com Cc: bmasney+clk@redhat.com, jbrunet+clk@baylibre.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Ilya Titov Subject: [PATCH] clk: sunxi-ng: h616: register CPU PLL notifier before mux notifier Date: Mon, 9 Nov 2026 12:09:14 +0300 Message-ID: <20261109090914.46872-1-ilya.titov@wirenboard.com> X-Mailer: git-send-email 2.54.0 X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [5.81 / 15.00]; RBL_SENDERSCORE(2.00)[104.64.211.4:from]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; DMARC_POLICY_SOFTFAIL(1.00)[wirenboard.com : SPF not aligned (relaxed), No valid DKIM,none]; R_MISSING_CHARSET(0.50)[]; MAILLIST(-0.18)[generic]; BAD_REP_POLICIES(0.10)[]; MIME_GOOD(-0.10)[text/plain]; HAS_LIST_UNSUB(-0.01)[]; TAGGED_RCPT(0.00)[clk]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[wirenboard.com:email,sin.lore.kernel.org:helo,sin.lore.kernel.org:rdns]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWELVE(0.00)[13]; FORGED_SENDER_MAILLIST(0.00)[]; RCVD_COUNT_FIVE(0.00)[6]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc20261015:i=2]; TAGGED_FROM(0.00)[bounces-27411-noreply=patchwork.local]; R_SPF_ALLOW(0.00)[+ip4:104.64.211.4]; TO_DN_SOME(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[85.137.25.106:received,100.77.114.92:received,209.85.128.42:received]; FROM_NEQ_ENVFROM(0.00)[ilya.titov@wirenboard.com,linux-sunxi@lists.linux.dev]; FREEMAIL_TO(0.00)[kernel.org,gmail.com,sholland.org,arm.com]; MIME_TRACE(0.00)[0:+]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; ASN(0.00)[asn:63949, ipnet:104.64.192.0/19, country:SG]; RCVD_TLS_LAST(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[104.64.211.4:from] X-Rspamd-Queue-Id: 540B91C72CB X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: INBOX Currently the CPU mux notifier is registered first, so on POST_RATE_CHANGE the CPU is switched back to PLL_CPUX before the PLL notifier re-locks it. The CPU then runs from the PLL while it is still settling. The comment for ccu_pll_notifier_cb() says it must be registered first, and the other sunxi-ng drivers (A33, H3, R40, A64, A100) do it in that order. We see random hangs and oopses on T507 based boards when cpufreq switches frequency often. In the oopses and JTAG dumps we captured, CPU0 was always in ccu_mux_notifier_cb() or ccu_pll_notifier_cb(). Other CPUs were usually stuck on dsb after tlbi, waiting for CPU0. Running a random walk over all OPPs with some load on other cores, two boards hung 20+ times in about 3 days. With the PLL notifier registered first there were no hangs in the same time. Fixes: 087b4083d3f9 ("clk: sunxi-ng: h616: Reparent CPU clock during frequency changes") Cc: stable@vger.kernel.org Signed-off-by: Ilya Titov --- drivers/clk/sunxi-ng/ccu-sun50i-h616.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-h616.c b/drivers/clk/sunxi-ng/ccu-sun50i-h616.c index 955c614830fa..00b7811f3a84 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-h616.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-h616.c @@ -1235,13 +1235,16 @@ static int sun50i_h616_ccu_probe(struct platform_device *pdev) if (ret) return ret; + /* + * Re-lock the CPU PLL after any rate changes. Must be registered + * before the mux notifier, so CPU goes back to a locked PLL. + */ + ccu_pll_notifier_register(&sun50i_h616_pll_cpu_nb); + /* Reparent CPU during CPU PLL rate changes */ ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk, &sun50i_h616_cpu_nb); - /* Re-lock the CPU PLL after any rate changes */ - ccu_pll_notifier_register(&sun50i_h616_pll_cpu_nb); - /* Reparent GPU during GPU PLL rate changes */ ccu_mux_notifier_register(pll_gpu_clk.common.hw.clk, &sun50i_h616_gpu_nb);