From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 878AACA0FF2 for ; Wed, 3 Sep 2025 11:51:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E0B5B8E000D; Wed, 3 Sep 2025 07:51:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE3508E0001; Wed, 3 Sep 2025 07:51:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF8668E000D; Wed, 3 Sep 2025 07:51:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id BDDF58E0001 for ; Wed, 3 Sep 2025 07:51:24 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 741B91605F2 for ; Wed, 3 Sep 2025 11:51:24 +0000 (UTC) X-FDA: 83847773688.10.3B9D132 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by imf08.hostedemail.com (Postfix) with ESMTP id 32A9F160010 for ; Wed, 3 Sep 2025 11:51:21 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WwwQj+ZQ; spf=pass (imf08.hostedemail.com: domain of andriy.shevchenko@intel.com designates 192.198.163.11 as permitted sender) smtp.mailfrom=andriy.shevchenko@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1756900282; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VIzMLsOLaDWB1GYhoINqzSJt837aONUkQA3ng3cfEkg=; b=yFoVrJvehvtSdrVn/c99T2opCiiml+g9hrJ5N52aDa0wgGz4ls07xE5BHXmzoGAoNRjGHa 3Rzp0turg34Xxuou/H0GQplgV9wEV67tRjTQOPWMyMGln3acKqmAHtTN/Yh0Yar4mTcOB+ UQ9PPMXBgAJ5RJiKxyZs65VsC5vr8l8= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=WwwQj+ZQ; spf=pass (imf08.hostedemail.com: domain of andriy.shevchenko@intel.com designates 192.198.163.11 as permitted sender) smtp.mailfrom=andriy.shevchenko@intel.com; dmarc=pass (policy=none) header.from=intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1756900282; a=rsa-sha256; cv=none; b=EGeoBUbd8bPUfrXbTdNPV/rS3rqhh1DOnL+EpwXcfIE+vDHo0Yf15KvTSJ00Z7DSzBDBhd KqGZohwP8yeh+UmxmZas8PygMWsmVTbuQAaf5LKn7H/VEM1dQI29l+k7ZZdBgc2bDvsFaU HOynzNteXdeSUboP7plDkR88EUw9odg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1756900281; x=1788436281; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=nDvbAiY6rHd3SKV/DYo7HnX4lUjAZdHwuJei+GGsRW8=; b=WwwQj+ZQYt/6BqYvYcHz7lWjbLg26wheztfaS2gTmdYfpxM5/MgwvfII BmBMFbCNBcsh5Kaz8VDNYj0d6DKUYdeoTgPIJF59OT97w0hNdf6OJCy+W Pm3y1faZw5lyBEJNILax+qF7ro175aFBhLXz3Xiq4j+hik6TNgODxwJCR v1tEek+nGSDaFEq73+53KqX9N/TV/bCocuy+74h+pIcloDSoU/uOc1zSe J2xfobxUZr6sjyb8IVIz/m622/2hadnvpNc+D9ZSuDiHC5ghUXlhrZqjt /e631TOHFuerOOohDB/7jIdZxxzlOJ1Q2l6ZGLnqsDYZe+IMmXz1TcwiE g==; X-CSE-ConnectionGUID: vmJENXytReq4jxFp+KXU0Q== X-CSE-MsgGUID: eE9fDQufRVyfS4TaBwZ1vQ== X-IronPort-AV: E=McAfee;i="6800,10657,11541"; a="69822601" X-IronPort-AV: E=Sophos;i="6.18,235,1751266800"; d="scan'208";a="69822601" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2025 04:51:19 -0700 X-CSE-ConnectionGUID: IwmxuAerSUCIeLGnj4/KSA== X-CSE-MsgGUID: exSghXJzT32WBa3jKCspRQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,235,1751266800"; d="scan'208";a="195199401" Received: from smile.fi.intel.com ([10.237.72.52]) by fmviesa002.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2025 04:51:09 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.98.2) (envelope-from ) id 1utm13-0000000AyQC-2iW1; Wed, 03 Sep 2025 14:51:05 +0300 Date: Wed, 3 Sep 2025 14:51:05 +0300 From: Andy Shevchenko To: Bartosz Golaszewski Cc: Andy Shevchenko , Linus Walleij , Bjorn Andersson , Konrad Dybcio , Alexey Klimov , Lorenzo Bianconi , Sean Wang , Matthias Brugger , AngeloGioacchino Del Regno , Paul Cercueil , Kees Cook , Andy Shevchenko , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Dong Aisheng , Fabio Estevam , Shawn Guo , Jacky Bai , Pengutronix Kernel Team , NXP S32 Linux Team , Sascha Hauer , Tony Lindgren , Haojian Zhuang , Geert Uytterhoeven , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Neil Armstrong , Mark Brown , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-hardening@vger.kernel.org, linux-mm@kvack.org, imx@lists.linux.dev, linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Bartosz Golaszewski , Konrad Dybcio Subject: Re: [PATCH v7 16/16] pinctrl: qcom: make the pinmuxing strict Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo X-Rspamd-Queue-Id: 32A9F160010 X-Rspamd-Server: rspam04 X-Rspam-User: X-Stat-Signature: mcswfujhrhmtjmtuxnyozgq7eo4i59wc X-HE-Tag: 1756900281-356675 X-HE-Meta: U2FsdGVkX19Ri2Bff0AP/fILI/CmArkPudbKI3o/qjm5HfajE+Iura7bjFDAw1oulWJXF6Fl2j4rVTfiYElFP6HUGNmz0VslQEja8u3U7VjEBS2JGUyIMQNT+l/Zb8UsY5QXPhJ4l0QzV/hwMGVYLZB6v1496dHBGNk433sGmW8BLqyrI38IpkW3NMgToqaXNOu2DWuBmsVswvqsh70GcVoPa6kpdFKa5W25omj4HZiQaORkRsGz1e0kLhGaV3T8YoC94Mc7bIMHklpG/VNO2mbuxAT61GxHC/U2DxOp2TV88Z3OccijS+Q8j6o6tRrfA2aa1LqdqaCB7mAx9zleRJTgiVn5XmREBHqYUhtd/WGk+0qiRaeJ+lmqo69ouihh3gQ+3Q+mDVhb9XV97lgFvXijo+B4egy2Tzx4b+sYxtXskfwJs5oizpAdMWeghfm6WlfkvVuVD4RgzfOCZmk6vjBmL8YxS//iUh1rHv0UMr5KfNTOxBXYfKV/p3Die6P4xsAmIDFn9GytA3D08jDBWKjaHla8Wb1DwT+aVwcVX8rOxSQT+mR+eZCbipo61TCSt467/CHlzKOwJRLUwxM3dwhby/z3V/kwcXD5wnKmfoeNg8z+OfG1jZc/tP1PZ2w8pbKi8u5pOU0+eaB2MA7HCPe8AOxiy2ZzpBQqvah06sDYPHgmYpQY1EpW5ee282fLwFQZXDZie9nd3DJANhDH9gRYg7MlnzAa0gySiEY08vlEkx40SdhB+ooQnD9l3ixU5BF1BXLgorfq4C+MbyS4mOhXGlbY3+gL45HPxuqAqo7snKWPivJ2ciKya6wiOfHDZIwkzb4H0PvjuMwCZjBX4HrpVvTYfNf0DHeMONPMOdTRu7tYVp1LXxwMRtHukWFFn1LxVyid2hZSISBb9ETXoOwK2vezIs9YyqHsLzflRSZV8yoTLZNUT7Vqdk0lkDfyRg4eOvwjyVb/lxLsDBp O12LhA6r dKPWSMXZtA5fMuE5sJa6easQ+vnP97I4wFW3+2R3ZKAFWt1A6gfGAjHo5x2SS0zFL4+2JIRvyP5TQ+dd5OHI7mYXf0BNqIlmJ5zkQKmSgv8HZ+sfjh+1jFn2MoZNJDp5yevpdgtpma2DM/y7LzQp5z8TKC4QvAcVJ153seYqQAXfB8Hp55acE1TgtubBo+SSADOHGW1QAM1Ei2mxzOIxVVZMHmkVUMMlkOrqI+dOB/VYJjDctVvhMdnrH/3krj/TFWFBquVn3IKuZTSZUN1caUHwjnMpS1NnBJukwzD8r1JXqSwebPaKsMI8dy1zxiV6y4TXBKiY64zvKViqMIQBZ5rYOSnoLFL2rBbmnalT1g00B85KXRy2mgx2wRtpWUXBe4b7p27I1E5amoD4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Sep 03, 2025 at 01:05:27PM +0200, Bartosz Golaszewski wrote: > On Wed, Sep 3, 2025 at 12:53 PM Andy Shevchenko > wrote: > > On Wed, Sep 03, 2025 at 12:41:48PM +0200, Bartosz Golaszewski wrote: > > > On Wed, Sep 3, 2025 at 12:38 PM Andy Shevchenko > > > wrote: > > > > On Wed, Sep 03, 2025 at 12:34:00PM +0200, Bartosz Golaszewski wrote: > > > > > On Wed, Sep 3, 2025 at 12:22 PM Andy Shevchenko > > > > > wrote: > > > > > > On Wed, Sep 03, 2025 at 09:33:34AM +0200, Bartosz Golaszewski wrote: > > > > > > > On Tue, Sep 2, 2025 at 10:46 PM Andy Shevchenko > > > > > > > wrote: > > > > > > > > On Tue, Sep 2, 2025 at 8:42 PM Bartosz Golaszewski wrote: > > > > > > > > > On Tue, Sep 2, 2025 at 4:38 PM Andy Shevchenko > > > > > > > > > wrote: > > > > > > > > > > On Tue, Sep 02, 2025 at 01:59:25PM +0200, Bartosz Golaszewski wrote: ... > > > > > > > > > > > The strict flag in struct pinmux_ops disallows the usage of the same pin > > > > > > > > > > > as a GPIO and for another function. Without it, a rouge user-space > > > > > > > > > > > process with enough privileges (or even a buggy driver) can request a > > > > > > > > > > > used pin as GPIO and drive it, potentially confusing devices or even > > > > > > > > > > > crashing the system. Set it globally for all pinctrl-msm users. > > > > > > > > > > > > > > > > > > > > How does this keep (or allow) I²C generic recovery mechanism to work? > > > > > > > > > > > > > > Anyway, what is your point? I don't think it has any impact on this. > > > > > > > > > > > > If we have a group of pins that are marked as I²C, and we want to use recovery > > > > > > via GPIOs, would it be still possible to request as GPIO when controller driver > > > > > > is in the strict mode? > > > > > > > > > > Yes, if you mark that function as a "GPIO" function in the pin > > > > > controller driver. > > > > > > > > How would it prevent from requesting from user space? > > > > > > It wouldn't, we don't discriminate between user-space and in-kernel > > > GPIO users. A function either is a GPIO or isn't. Can you point me to > > > the driver you're thinking about or is this a purely speculative > > > question? > > > > The recovery mechanism is in I²C core and many drivers use that. > > I'm not aware of Qualcomm drivers in particular. But mechanism is > > in use in I²C DesignWare which is distributed a lot among platforms, > > so using word 'purely' is incorrect, and word 'speculative' is a bit > > strong, but you can think of the issue coming later on when somebody > > does something like this. > > > > The same applies to the in-band wakeup UART mechanism. > > > > Which means that with this series we will relax it back anyway for > > the above mentioned cases. > > > > (Not sure, but SPI DesignWare requires programming SPI native chip selects even > > if the GPIO is used for that, this might have also some implications, but here > > it's for real 'purely speculative'.) > > The high-level answer is: yes, a pin that will be used by GPIOLIB > needs the function it's muxed to, to be marked as "GPIOable" in its > parent pin controller if it's strict. That's still better than the > current situation. > > I can imagine we could differentiate between in-kernel and user-space > users of GPIOs and then make it impossible for the latter to request > certain pins while they could still be requested in the kernel but > that's outside of the scope of this series. > > I don't see why this would stop these patches though, as they don't > break anything unless you decide to make your pin controller strict in > which situation you'd need to verify which functions can GPIOs anyway. It can't anyway, Linus already applied :-) -- With Best Regards, Andy Shevchenko