Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1221994rdb; Mon, 19 Feb 2024 08:03:03 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWh+iZtxXm5A8XkK1eQoE8cCJg4CtxdD/5BANCagwHIBo4X2JbPqHhHEG6gKCAg8rtaFYiLdaqHEilEfbOYiBIh6YHqHjIfK8fNnwy/rw== X-Google-Smtp-Source: AGHT+IFqMwNr3V+L5XErqqZkHdAZse8Vu2jM2rPA7sF8gYXeL7j1B1rEIJv/+Gc0zXR0mTkhzlAt X-Received: by 2002:a17:906:4ad9:b0:a3e:3fea:71d4 with SMTP id u25-20020a1709064ad900b00a3e3fea71d4mr3678329ejt.26.1708358583246; Mon, 19 Feb 2024 08:03:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708358583; cv=pass; d=google.com; s=arc-20160816; b=FvR4pb/Cwnj1O+kIYOk7Js7ra/tOlKy5bsqtOcLry+ziN4dM9TKgQ2gX8Mil1txdHX B1t8EStNMrIOhMt+gqZzkQft+DhJZ/coPE6160mDEMXnsJLKAN3ot5m/+s9ljdzpNLvv 5Egpnhgo0tLc/05XqIdUuJUN85pif38ezXJ60i5oiwgPqho/rzuDXsqTDjIQIh6otKKY 73d0vBTZ2oTB2gso26MwRet8tsSLCEEkJPqSTYmfVBXWpOJlkZMCp0Bv9ir1GpMujgg9 53Q5WC6B7nBiwxRdAR4AzAEzAFOoywaFPJCaog0a+3HbPR0vbx2hT9aqvKVaUOtcC00t IMOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:from:to:cc:subject:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=JuVnxXLKBjOZXpqRb8ZUGYryBu30CeayscqdEmLRicA=; fh=y3UL4CcK01OI3V5Jpo070DlkjDW5+5boZ4GyJMioLY0=; b=bGSag2HiLHJoI6G0YT96dSKZXlzvsMF3R0kNDG7fN+LZtPYPeU2RBKUSxlycClDdZ6 FgpR0YAg+7z+agPFwglVjN0Qds2GJ3hx47O/8VSb+5lbg7pm2PEPvNA/pp2JN6WDQhg4 j2NCdee9N1Lmg0GUFf0/yylhT7092tvX1yMypgWALQPupptb9n3oXFkz2Xaq5c2hNB9K rIm/totEghN7gk9t19qrWiogqChr9zQ1vPSSJmS2LWzwUh6bIMElVAuyW12yyNYqVgow q+xm54wynTP89oYd4CdwFSi3J5FWEHif+ShmTGqNw9puihT8c9bdGYInL3LcT+YHteAp BOvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=c2Musslz; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-71621-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v24-20020a170906181800b00a3cf8f53a42si2659872eje.353.2024.02.19.08.03.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 08:03:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71621-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=c2Musslz; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-71621-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71621-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.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 am.mirrors.kernel.org (Postfix) with ESMTPS id C431A1F25A8E for ; Mon, 19 Feb 2024 15:55:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 091BD3CF56; Mon, 19 Feb 2024 15:55:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="c2Musslz" Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 193E23A1B6; Mon, 19 Feb 2024 15:54:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708358101; cv=none; b=jMqsQ01YGHRFljX9N9cZUIPL92ENbm0u1ZtbJlknSSnx7snhi2WPxXsuukAEHXPB9iR1m6uPI8jJb00D+jtRsId+Sik0r6+Hx4ShWAqbzn67Njc7WTIVwViy1WSOVGZISvESmEWW4uuNjTAnpb4oDjEzbMYhwLmapNDWWO4l9IA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708358101; c=relaxed/simple; bh=nC6aNc13U8MY/Slx3JehF2zXFuomJ7JF1NoXY9rqw9E=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=lKA6x/h1rRskyE74xkGMVwvUZisFSlmYKbA/j5i91q1yLKaoKxWsHPqJocV5fBvNxNUWXRuzRCSkDALc16Wk/E7RKhdPk7Joilwl4GmDEFHALs3nuSrsZWyxbC9ZrVeNBQkcZ9VB7UP33vx8Smbp4782Y1oZ+dE4rOOAP4enO3M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=c2Musslz; arc=none smtp.client-ip=217.70.183.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 8374C40004; Mon, 19 Feb 2024 15:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708358096; h=from:from: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; bh=JuVnxXLKBjOZXpqRb8ZUGYryBu30CeayscqdEmLRicA=; b=c2MusslzRHELYgxEV8vD36ddn12pVPyko1ZZ/zs6hqIWrg1An262098RPUuU6Zt7BdqLCF 5Z8laMNgpFdVYKME13I4EgK13u6VQR+Xyu4Nb0YVurEsKAnL3IfCSZlHNQ+en3LcE/yiNM IHXUkIMNu4jNrbex14/R09P/kOCjcvluN5xxyQRmTjbsfRx5zULw9SNSDb1L6TzM1FlHii bM0Ae80hmG3isfFQanv7M7q53LuopxX9EpRjMoPffWJSmCEzg4XQcFOSU4IA4eSn8NRldK S9zWCUdapYB4zuP0vgAtcwWNImh9UFb+4omk1WeF5Z1hlGuAzXoD/ykvFwgOyg== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 19 Feb 2024 16:54:55 +0100 Message-Id: Subject: Re: [PATCH 16/23] gpio: nomadik: support shared GPIO IRQs Cc: "Linus Walleij" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Philipp Zabel" , "Thomas Bogendoerfer" , , , , , , "Gregory CLEMENT" , "Vladimir Kondratiev" , "Thomas Petazzoni" , "Tawfik Bayouk" To: "Bartosz Golaszewski" From: =?utf-8?q?Th=C3=A9o_Lebrun?= X-Mailer: aerc 0.15.2 References: <20240214-mbly-gpio-v1-0-f88c0ccf372b@bootlin.com> <20240214-mbly-gpio-v1-16-f88c0ccf372b@bootlin.com> In-Reply-To: X-GND-Sasl: theo.lebrun@bootlin.com Hello, On Mon Feb 19, 2024 at 4:48 PM CET, Bartosz Golaszewski wrote: > On Wed, Feb 14, 2024 at 5:24=E2=80=AFPM Th=C3=A9o Lebrun wrote: > > > > Support a single IRQs used by multiple GPIO banks. Change the IRQ > > handler type from a chained handler (as used by gpiolib > > for ->parent_handler) to a threaded IRQ. > > > > Use a fake raw spinlock to ensure generic_handle_irq() is called in a > > no-irq context. See Documentation/driver-api/gpio/driver.rst, "CHAINED > > CASCADED GPIO IRQCHIPS" for additional information. > > > > Any reason for not using preempt_disable()? I did what the doc recommended: > The generic_handle_irq() is expected to be called with IRQ disabled, > so the IRQ core will complain if it is called from an IRQ handler which i= s > forced to a thread. The "fake?" raw lock can be used to work around this > problem:: > > raw_spinlock_t wa_lock; > static irqreturn_t omap_gpio_irq_handler(int irq, void *gpiobank) > unsigned long wa_lock_flags; > raw_spin_lock_irqsave(&bank->wa_lock, wa_lock_flags); > generic_handle_irq(irq_find_mapping(bank->chip.irq.domain, bit)); > raw_spin_unlock_irqrestore(&bank->wa_lock, wa_lock_flags); If you confirm I should be using preempt_disable() that's what I'll do in the next revision. I could even throw in a documentation patch if the advice is outdated. Thanks Bartosz, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com