Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2818519imu; Thu, 29 Nov 2018 10:42:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wt0OAgMFCIFHcKyTqbwj2eX9jFCZL/lvtcl3of5ctKy+9W/1JBVXU5Aptp8PvrVPUULnjs X-Received: by 2002:a63:e711:: with SMTP id b17mr2104477pgi.363.1543516975479; Thu, 29 Nov 2018 10:42:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543516975; cv=none; d=google.com; s=arc-20160816; b=e36C8cPA+QL3H5hgrZUaKgfdMCd/hF4V7TG8ryHQcdKCEZ+VXG9N/cEBaoewzVlCmk LZDmb6BbEsHabwGoN5GNz+j4AVMQSWI0b+YEuq5oMq2Y4BgeG1sAftpZalg9Czfx8fMw 4BiH6Ed9gRtmbvpPkx6rEzOiwEGQgsoegovRSOpVnNhE1Eeo84RTdT14rJ3n3+FnbJ1N hVsQxQSwD8zsBimSxE4vfvNX5SAhh8SQ4Shd7Qsh+EQglbmpnzmw1szQRFdV02m+OND5 NK16B0PAyc73YT69lNFsagp+5RXD7ajzh6X+1FTo2Kn3SbkQBxIbVaWVoOveL29ISS9L 5RwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=FH1hSZp5djSfn0FxlLfHbvVqU9a8CRDO/lrWQOsW92w=; b=fesqjQOHNDnGujdPi7xAx9DEc5CsRgdCvH7saFI+1WLkP7jq9IVUEVtzgsf33p5+W6 56yFyEVMkMUvXIb+bzgJh263vehiv9ROkkP+Qw6w9lk8cD3M/3WgJ/MTEw4R1CLYvVQh FlztYCEW66tdOVpud7s+11UxqjdK8nVTrWjnLrMXuqMI+E5DeiUYtW1xyt5Y3FKZi0+H WeNxr0TaRt+SqcdCSkbcvz44AR5Tjf6z5rssvSVHIOBMDUOzmPnSiBnQt0JmRsw7h39v ROOSKGWj1HhqfrL4S4UE3S4Fwf4Hp2ioCH4ZUTAT7WsudQhTuRVjEKTjOmX79MSPOpRJ 2fIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=hZuv+0ya; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d12si2774236pla.351.2018.11.29.10.42.40; Thu, 29 Nov 2018 10:42:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=hZuv+0ya; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727400AbeK3FVM (ORCPT + 99 others); Fri, 30 Nov 2018 00:21:12 -0500 Received: from mail-it1-f194.google.com ([209.85.166.194]:37407 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbeK3FVL (ORCPT ); Fri, 30 Nov 2018 00:21:11 -0500 Received: by mail-it1-f194.google.com with SMTP id b5so5164762iti.2 for ; Thu, 29 Nov 2018 10:14:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=FH1hSZp5djSfn0FxlLfHbvVqU9a8CRDO/lrWQOsW92w=; b=hZuv+0ya5vyC/MT/xnLyUFENNezvxjcjROjGg8qmA+65oXO/pt+kTuoUs72b7ipQy6 5SORCzZ2Vg9CiYQLCYRSR6jCR1ousU8250T4CAwg2LPQQAMyALvG7UXzO/cvy+gLTwjc ubFpW1zCQmOQfFGz6o3UWNl0BagmvX4NfRH4jMQjJqHgibFgCD1b+Ev3MGPZ6bLkmneP w46JhxB+CIOdbflT0BAuG1yI4A6sVsy2iUTkPSXt5RmGlnPi/pn2gyfcTlnFoO2rHcza 2VrvXUfMYn1wFvyXiYcEvPf4VRmJ6ZAGNBwVqHDWUA2mQUethm7SUzp57GkSsqIT+3F2 KVUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=FH1hSZp5djSfn0FxlLfHbvVqU9a8CRDO/lrWQOsW92w=; b=ubyNtqLR74El8xBOvWXXny5VfJaB0XsO0uq/5Ir5MP1dEpsCBpysWEdSJI3mcQqG3E 2xzrGtuBLrjBNAJ06Du5DoTqpnmmkFSVUY1CoDc0403jgNPAVPQrT+/XBRHXpvHM41F0 +wKN93zyKkkh/dHpQLEVhtj6Pz/kADjuq6fuL8LHkOVdNroG0nmdVFyL7EzgiLxGDrVM SmWSKiFpkci4ggoX8mtNUXsyaTTfwOPall//toWVXEjqXF6u3uubF7NlCtkLsX8Yv0qO jUNukH4vOOFNV+OI4/QUyxlkorUc1Wx6B156LL+zhAd3ZlU1pLAImG2wDdZukrfX+UwY 8S2g== X-Gm-Message-State: AA+aEWaQ4RGFxOkepT8jKV3ZwFimLhrWD394cw/iex59IbfWLLzm7gHA 3MY8ruciy37T3SYzGOntHIHhvyHXcrdl0R2rE1kTj95C6Ai9Yw== X-Received: by 2002:a24:f909:: with SMTP id l9mr2378213ith.74.1543515296443; Thu, 29 Nov 2018 10:14:56 -0800 (PST) MIME-Version: 1.0 References: <20181120134032.31645-1-brgl@bgdev.pl> <20181120134032.31645-2-brgl@bgdev.pl> <20181120171742.gkwb4s4qbcqvnefj@pengutronix.de> <20181121191509.ia2vcklvx4q2rh56@pengutronix.de> <20181125211854.idnqxz4pco3r7ydr@pengutronix.de> In-Reply-To: <20181125211854.idnqxz4pco3r7ydr@pengutronix.de> From: Bartosz Golaszewski Date: Thu, 29 Nov 2018 19:14:45 +0100 Message-ID: Subject: Re: [PATCH 1/2] irq/irq_sim: provide irq_sim_fire_edge() To: Thomas Gleixner , Linus Walleij , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= Cc: Linux Kernel Mailing List , "open list:GPIO SUBSYSTEM" , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org niedz., 25 lis 2018 o 22:18 Uwe Kleine-K=C3=B6nig napisa=C5=82(a): > > On Fri, Nov 23, 2018 at 04:59:46PM +0100, Bartosz Golaszewski wrote: > > =C5=9Br., 21 lis 2018 o 20:15 Uwe Kleine-K=C3=B6nig > > napisa=C5=82(a): > > > > > > Hello Bartosz, > > > > > > On Wed, Nov 21, 2018 at 05:34:32PM +0100, Bartosz Golaszewski wrote: > > > > wt., 20 lis 2018 o 18:17 Uwe Kleine-K=C3=B6nig > > > > napisa=C5=82(a): > > > > > > > > > > On Tue, Nov 20, 2018 at 02:40:31PM +0100, Bartosz Golaszewski wro= te: > > > > > > From: Bartosz Golaszewski > > > > > > > > > > > > The irq_sim irqchip doesn't allow to configure the sensitivity = so every > > > > > > call to irq_sim_fire() fires a dummy interrupt. This used to no= t matter > > > > > > for gpio-mockup (one of the irq_sim users) until commit fa38869= b0161 > > > > > > ("gpiolib: Don't support irq sharing for userspace") which made= it > > > > > > impossible for gpio-mockup to ignore certain events (e.g. only = receive > > > > > > notifications about rising edge events). > > > > > > > > > > > > Introduce a specialized variant of irq_sim_fire() which takes a= nother > > > > > > argument called edge. allowing to specify the trigger type for = the > > > > > > dummy interrupt. > > > > > > > > > > I wonder if it's worth the effort to fix irq_sim. If you take a l= ook in > > > > > my gpio-simulator patch, it is trivial to get it right without ex= ternal > > > > > help with an amount of code that is usual for a driver that handl= es > > > > > irqs. > > > > > > > > You're basically recommending handcrafting another local piece of c= ode > > > > for simulating interrupts - something that multiple users may be > > > > interested in. You did that in your proposed gpio-simulator and I > > > > still can't understand why you couldn't reuse the existing solution= . > > > > Even if it's broken for your use-case, it's surely easier to fix it > > > > than to rewrite and duplicate it? There are very few cases where co= de > > > > consolidation is not a good thing and I don't think this is one of > > > > them. > > > > > > I don't say that factoring out common stuff is bad. But if in the end > > > you call > > > > > > irq_sim_something(some, parameters, offset); > > > > > > with the simulator and if you don't use the irq simulator you do > > > > > > irq =3D irq_find_mapping(irqdomain, offset); > > > generic_handle_irq(irq); > > > > > > I prefer the latter because it's only a single additional line and in > > > return it's more obvious what it does because it's the same that many > > > other drivers (for real hardware) also do. > > > > I'm not sure I'm following you. You still need to add ~150 LOC for the > > gpio_simulator_irqtrigger() worker and gpio_simulator_irq_*() routines > > locally as you did in your gpio-simulator patch. A generic simulator + > > using the irq_work saves you that. > > If you teach the irq-sim driver everything that the gpio-simulator does > in the functions you pointed out then this is for sure functionality > that other users of the irq-sim code won't make use of. This is about > tracking the level of the gpio/irq line and the interrupt enable and raw > status bits that usually happen in hardware. The dummy iio driver won't > need that for sure as it only cares about triggering an irq and doesn't > even specify an irq type. > We're getting too much into details of how to handle simulated interrupts and we can continue discussing it, but meanwhile I'd like to address a different thing: Thomas, Linus: after commit fa38869b0161 ("gpiolib: Don't support irq sharing for userspace") some libgpiod tests are failing because we can no longer depend on reading the value of a dummy GPIO after detecting an interrupt to know the edge of the interrupt. While these interrupts are triggered from debugfs and debugfs is not required to maintain compatibility, I thing having a working test suite for the GPIO subsystem and uAPI is worth applying these two patches and also the previous one[1]. Can we have them applied for 4.20 or are there any objections? Best regards, Bartosz Golaszewski [1] https://lkml.org/lkml/2018/11/9/1418