From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.216.43 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796440280; b=qEWT1JMNuVaIFcYK35vbp2RUfPHW9a/6mHSp+yodTwfU21fkdyj8cy+DPWJpkI1HjjNP 4Ga+r+OVrukC77/2vcG2CdFSSBg3M1D2T/YNpstocca3yHbhrS8+wmQvblPtca20ykBj7 GXoSQluZh2bxAKHCUysNsMPc9YxL348qhIo+nrZLBPP12bB/0M9rLiYSTIT6uFXxFIebS 3d/hFvkWoykNgr00I/XprffLkMLCCuRjYY2+AR7ntF6Jl3pOFZWqbxVIWfdrEzyOYUT3F KMBqMRu51I5YL1jlQu5LA64CAM86vXNcHOJwgqrPewPiiQFf1scfRBInHGOXbM6mc8w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796440280; 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:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=jWMAvEz+qVQoKQUYa+S07N2REGYeLniRc794F61C+B4=; b=hEL06UVmPojNqnM/8aScDIKLB7SL/AnMs4WQE/fUho5P7HpM/g+X3B9X1sdyoZ7Vwbah fJwgZYcHZeDLtaIUGocSNZr8CkuU2k+st0vgIWXQcaP9TOopCj/1XuUOzMX8Mku4QVfEq T7r4iSlmvMhxraktUc04VqtMMkaTYHNnF6SiHuq8313nG5Zb6MBEPHMS14qyikVwgxSWq /0TUHeEZKbafwtZY2N6miAY646pKSCtTkXdPUJc6CKHCs4v6y3V+tl/0y0lmBL54qcOyA Ek1Hqn+QW5+u6H4mDgI/8/IVEAQ9RxscZcrzFp7Ii1+X/Yq5sTJApVuVmaw2sp/G7ow== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=kK8TayUx; arc=none smtp.remote-ip=209.85.216.43 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 B7203606A332 for ; Sat, 5 Dec 2026 03:11:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B7203606A332 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=kK8TayUx Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-3b40f4d4b5dso833672a91.1 for ; Fri, 04 Dec 2026 19:11:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796440279; x=1797045079; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=jWMAvEz+qVQoKQUYa+S07N2REGYeLniRc794F61C+B4=; b=kK8TayUxSgipgIioy25FRXuOouiEmDEl5BURCbS7kxlsEarpLzXrX4e3mbrsW1SGZF tN6krWMPLsy7w09HMTpAOEUz0oPBoWZnrkju7GM+5rwEtwapOYeUExvOcDz4h1X8G+cv eybBAj8K5AWu2eEQ6hoOZpQEq1R1xEatwoDJ99THnZwb+dLHXC7SX+WvwItX5ke2ENiW GeBarr4I8CQLvYQmg/ZHptHeZXRmKlThHfumK8lpa659h7z157Ky09V1H7hm3SqKGsxI h6B7LWEjy7CTDUO+rQWcL6xLc1Pel/2Ktr5lFOMJUfZWmzh5InSTJ1/7448H7LQhoAO6 EApA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796440279; x=1797045079; h=content-transfer-encoding:mime-version:references:in-reply-to :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=jWMAvEz+qVQoKQUYa+S07N2REGYeLniRc794F61C+B4=; b=17tlfAZg4qD7D/VTtkFictVSj05qlRfI0kOA1ykzALz2sIoi7oTZhRJpARvFX6mT8M 7KgChi5SM3XHnszdXzl0jRww9YRWkxo12FO8p5Qe5SVh56keEmpISTJUSJDE3gwCahwf zYVXNJPNcLeIicWd/1uY2t/gOUqTKXuT9eCYcVEMEfbjNVYpfBpxJzRJOR+kQEEOn128 +09boHt8sBvcZX9t0kPhG53gAYwaidx8eKxjQ9PrmA3/aGC0tELPuqJaAHp9LpUOUyTl 7LxENgvWxdrPZ3vt8dyBkEt9rZbHTsxj/lentayT2TE9+HYsvVehPmxvUhQM0aIlY4Cu HglA== X-Forwarded-Encrypted: i=1; AL+hErHBttyVla1gBpr0E9yNqI/2N5dLXcr20l8JT+2aDHEDMsLBDrZyT9q7BSSnEK06qqlGtb8CgQXc6Vbm@vger.kernel.org X-Gm-Message-State: AB4q+uGvHb0Am46FpNOICS6f5wTAypPg1cuylJ+0IwCWsA4E0va3nifr 6Pn+lwUth73btHZJXzPAiBONznUn71VsjXrKLKDZdh8B4zmR46N5gmlg X-Gm-Gg: AZFdTZeSMiznWDMn2xR6+9VnHJChrfShqKCqoMhVZPG9lgNHA6fOg3KxSlZWgVxYFnz hUghtFDmmJPkzV+0KkLve2EW0IBGfJPHbRGjoq9Y7mLZvbDzaPZvaIvzrPQQ3aIXNqPPPvJmSqZ /uBN66ozaAwuEjS/LJb11MwMsemjQeT5ZE39GhjZZZ1qZBweop6LGJikv5gac3A3x3dIcgbyway lMC/pIaGLdRCemjMey8pJInUx+u5w5mv0uMH9byZHUxSlx1TkT/FY80VXJxUsQv6Rr3aDmiMuSs /zisgcseIgTCD5+We4NKUhw+QgBQ9UpnyeiZ4MoHxu4PxLLjlOG3/3MaAU2L8J5wzcnYviJNipI 5s5SMj+uJRYeqgPsQBkqAUeIYI/eV0wSC+bQha6GTd+ccwlJX+z4Ic4MqsjNwSYM3aC2WNlD6EM MAsVtdyKS/NynN3joLjWlAZIFRK7bhyydhFippuHRcb2XDs7goZq5mKPn4N7WKcMscU4ENVJGsy A9IZFdkzKs6PtqQKXbNuo2NCMWizKPfddIjh6JlBiDq/DsJc/ts/E5K6rAaCKJcxnfE2o2Ev5tV k1BaDswZg8mv7aYMtdXHsRzVxQPFOTngkZP6Lr6mBfIwbGfEMKM+uhurEMRi1Y0s8xV3eXIy/dC jycqSMmICBpEHJhSphpj2q+lkAV4VdeU7wUt1sCqYkX4rrVA/n1kp4DdFRVf888GVGMjcleb2Eo VP/g== X-Received: by 2002:a17:90b:53c8:b0:3b3:b750:d2ed with SMTP id 98e67ed59e1d1-3b5e054f0e8mr3453301a91.8.1796440278821; Fri, 04 Dec 2026 19:11:18 -0800 (PST) Received: from ryzen.lan ([2601:644:8000:37f::e35]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b5c7d10d11sm12273663a91.6.2026.12.04.19.11.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 19:11:18 -0800 (PST) From: Rosen Penev To: Linus Walleij , Bartosz Golaszewski , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Gregory CLEMENT , Rosen Penev , Rob Herring , Thierry Reding , Ralph Sennhauser , Andrew Lunn Cc: Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-rt-devel@lists.linux.dev Subject: [PATCH v2 1/5] gpio: mvebu: use a raw-locked regmap on Armada 7K/8K too Date: Fri, 4 Dec 2026 19:11:07 -0800 Message-ID: <20261205031111.12306-2-rosenp@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261205031111.12306-1-rosenp@gmail.com> References: <20261205031111.12306-1-rosenp@gmail.com> X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 42269cdb3d3b ("gpio: mvebu: fix sleeping-while-atomic in mvebu_gpio_level_irq_mask()") made the driver's MMIO regmaps use raw spinlocks, because the irq_chip mask/unmask callbacks write the mask registers while holding the generic chip's raw gc->lock. That only covers the regmaps the driver creates itself. On Armada 7K/8K ("marvell,armada-8k-gpio") the GPIO block sits inside a system controller and the driver uses the parent's syscon regmap, which syscon creates with an ordinary spinlock. On PREEMPT_RT that lock sleeps, so masking or unmasking a GPIO interrupt there still sleeps in atomic context. The syscon regmap's lock cannot be changed from here, and nothing else accesses the GPIO bank's registers at its offset, so the shared lock is not protecting anything this driver needs. Map the parent's register range again and create a regmap of our own with the raw-locked mvebu_gpio_regmap_config, as the non-syscon path already does. The mapping is not requested, as syscon does not request it either. Fixes: b6730b20837e ("gpio: mvebu: Add support for the Armada 7K/8K SoCs") Signed-off-by: Rosen Penev --- drivers/gpio/gpio-mvebu.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 6c2bcc5d749c..ab350c8686e3 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -42,8 +42,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -1163,7 +1163,29 @@ static int mvebu_gpio_probe_raw(struct platform_device *pdev, static int mvebu_gpio_probe_syscon(struct platform_device *pdev, struct mvebu_gpio_chip *mvchip) { - mvchip->regs = syscon_node_to_regmap(pdev->dev.parent->of_node); + struct device_node *np = pdev->dev.parent->of_node; + void __iomem *base; + struct resource res; + int ret; + + /* + * The GPIO registers live inside the parent system controller, but + * don't use its syscon regmap: that one is created with a normal + * spinlock, which sleeps on PREEMPT_RT, and the irq_chip callbacks + * write the mask registers under the raw gc->lock. This driver is + * the only user of the registers at its offset, so map the parent's + * range again and access it through a raw-locked regmap of our own. + */ + ret = of_address_to_resource(np, 0, &res); + if (ret) + return ret; + + base = devm_ioremap(&pdev->dev, res.start, resource_size(&res)); + if (!base) + return -ENOMEM; + + mvchip->regs = devm_regmap_init_mmio(&pdev->dev, base, + &mvebu_gpio_regmap_config); if (IS_ERR(mvchip->regs)) return PTR_ERR(mvchip->regs); -- 2.56.1