Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4352207pxu; Wed, 9 Dec 2020 15:07:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyuB0zmq8jLkigk4lj0Y5mt6VqXyYh5N8RjaCeqizaTvmFv4jR9bIilmLPWI1mlFs5G4iGU X-Received: by 2002:aa7:ce8a:: with SMTP id y10mr4197979edv.264.1607555249865; Wed, 09 Dec 2020 15:07:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607555249; cv=none; d=google.com; s=arc-20160816; b=J4BJ08axIJAmOke8r5XaKUO/ZsTsrptfUf8OnUhEMUgYMVBkbS/94dMRXUAAT4iyaE vIlCyw/v8t82XeRpsvvui2JjDLph9Z7f1UUzptBydctJKShftGrgUm83059z/7UdkQI6 JJwqNj+Du7VZt0kihrthyZgiQGFrsnN6/6LlhW180zvP3COmszvsuDWviOBN2nSDWJY8 cASI7mGzIBM6ExjBlj/UDVZJSMQVplu8S94nOjPhCCCioA/lK/LCoQQ/5XE9YUNC3e9B xXWpNaesFCAoWYboZO9aY3va3JCt7Uk+zQML+LQK6hi1d16zeFYIaeC7AwwCQHY9zIhp zGLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=X8Hk6JiqQhUSdQmHPgsMm+pVGEEK1cEHuoC5kUG0Iu0=; b=GzdtxmPOcgaFBWNmUHm+Hvoj+SUesd2cEjS5Z49Zyni4Jz0B+5zj1dXvYI2Csd6Dyz DQ8BvIBdf3iac6YVX+orwik7DwLL4ORNbsRKc3aQBnUhtDiT/acbdup6kZl89BQoV5kr E5oxCRZ1JR2S2etxGxkEa7PVI3kHaUtJ858DHPoNoX8Tdol3+PuxqxsenaBdKUpTXu+7 JuS77HLhlGbC9UnXE8aF84z0WvOt6FIRkzsVK91ZvtZVZ/A0Thmq/7y183WwE9Hlj+ut 0KEgGNQzCMRclIeeV+MhfPdJZRFatYIHISxwsJXS6IE8El9SmevzhaR8T+f9X0+K/DzM OTsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CZbfYp5e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si1868487edo.433.2020.12.09.15.07.07; Wed, 09 Dec 2020 15:07:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CZbfYp5e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730323AbgLILVS (ORCPT + 99 others); Wed, 9 Dec 2020 06:21:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:36270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbgLILUH (ORCPT ); Wed, 9 Dec 2020 06:20:07 -0500 X-Gm-Message-State: AOAM532+D1hj72eNWbigRJ36XrBNtiQmRz5DI82g8Yf9iTfbpsBahqes ErwYIaeDpOESo7af9GUCqOGwN8m9PPUD1sC8EYc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607512766; bh=U8CiCE+927eWk1WjnrHEeDDVKhi+XWJxlcOhS4QhpHE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CZbfYp5eMW4vCNbBV9SJiILwyOwti8/kZsAVsYvK2NDemL3iD6lIVzx6OIJEzAsWN K7x05Wm2fieBTM1ho1osVEiUn4PDp5UA/CU+Z08ZXp4Zz0dKo11UaIjzG6QhQ0V8kk PtKS7Mx+K8wZf/TTtpqjFwiyKbSmLsa5ATNjqokNb/UtL8Te498LaiXp/3Sv+J7B0+ fEyxHwC6s2/HAlh66Tv3eglhNIQdcjWYfLF610MdIfaY8OjsdW/JTUqSY3wvAtnGAl 7QogIuRU22jLlxkLW6zhhTRccEomhcXrCKo8BJhDFfjA3QRJ48x00BzLy2atC0/7rv gm5xle3EZOSYA== X-Received: by 2002:a9d:6317:: with SMTP id q23mr1277831otk.251.1607512765731; Wed, 09 Dec 2020 03:19:25 -0800 (PST) MIME-Version: 1.0 References: <20201203191135.21576-1-info@metux.net> <20201203191135.21576-2-info@metux.net> <0080d492-2f07-d1c6-d18c-73d4204a5d40@metux.net> <51d3efb7-b7eb-83d7-673a-308dd51616d3@metux.net> In-Reply-To: From: Arnd Bergmann Date: Wed, 9 Dec 2020 12:19:09 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Howto listen to/handle gpio state changes ? Re: [PATCH v2 2/2] drivers: gpio: add virtio-gpio guest driver To: Linus Walleij Cc: "Enrico Weigelt, metux IT consult" , "Michael S. Tsirkin" , Jason Wang , Jonathan Corbet , Linux Doc Mailing List , "linux-kernel@vger.kernel.org" , virtualization@lists.linux-foundation.org, Bartosz Golaszewski , "open list:GPIO SUBSYSTEM" , linux-riscv , "Enrico Weigelt, metux IT consult" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 9, 2020 at 9:51 AM Linus Walleij wrote: > On Tue, Dec 8, 2020 at 3:07 PM Enrico Weigelt, metux IT consult wrote: > What we need to understand is if your new usecase is an outlier > so it is simplest modeled by a "mock" irq_chip or we have to design > something new altogether like notifications on changes. I suspect > irq_chip would be best because all drivers using GPIOs for interrupts > are expecting interrupts, and it would be an enormous task to > change them all and really annoying to create a new mechanism > on the side. I would expect the platform abstraction to actually be close enough to a chained irqchip that it actually works: the notification should come in via vring_interrupt(), which is a normal interrupt handler that calls vq->vq.callback(), calling generic_handle_irq() (and possibly chained_irq_enter()/chained_irq_exit() around it) like the other gpio drivers do should just work here I think, and if it did not, then I would expect this to be just a bug in the driver rather than something missing in the gpio framework. Arnd