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 X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CF01C19425 for ; Wed, 9 Dec 2020 11:22:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D0EC12343F for ; Wed, 9 Dec 2020 11:22:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730664AbgLILVR (ORCPT ); Wed, 9 Dec 2020 06:21:17 -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-Google-Smtp-Source: ABdhPJy+RZN5YZE70pJEXGADA4yibSdAI8aJxjowtgSH9QR1iHKhytI8wUUYsRy7Qa7sG+nxaBUGbjy4r0F/blrkE+c= 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-gpio@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 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 X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85716C4361B for ; Wed, 9 Dec 2020 11:19:37 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 37199233A1 for ; Wed, 9 Dec 2020 11:19:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 37199233A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=creKJjhgai6zz1/aALb0lMFfAfA2f9knjF+qV29i3gg=; b=LLkufVHRGb7msGW4ftSQFhOBW Oxtt2zun+YXH8B7g7r9wb6H1Z6Vi0IHav1UEeib0FNZZEvdG2Ql4PyIUv3HOGJ6BUd+LF/onfttWE UkCsUPUtTQd3a9s81L3dODlpnasdEvx67+DxDE3Gh3lOE2yRDL5WBq7FJJ9DzSLoAU1Usz3hgQX3V qYFIoqbSZPwl3SnbWsUr4PypTdYe7IKmXzghcH8Y/EXSLTfJiISzfUeAepHC+DqKQA71y7ZyltK/Z AHajG+ro3FZWPn1beGEtTfwt9JipMssk/2PUSaZtoOHCrCGc7QaIla3/+zfvU58sWm6QG9GXu5kO9 Zq9vugu8A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmxVI-0006mD-UX; Wed, 09 Dec 2020 11:19:28 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kmxVH-0006lo-Lr for linux-riscv@lists.infradead.org; Wed, 09 Dec 2020 11:19:28 +0000 X-Gm-Message-State: AOAM532ETgqcNpV4z7D+jxoEM8Hvr7VWnDppYtzMTuoSWqBOy8yLGIyk ie2Gmii4t1rUeEpZH0aMKdo5Vnajdzk9L9JK7q4= 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-Google-Smtp-Source: ABdhPJy+RZN5YZE70pJEXGADA4yibSdAI8aJxjowtgSH9QR1iHKhytI8wUUYsRy7Qa7sG+nxaBUGbjy4r0F/blrkE+c= 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201209_061927_793630_FD1021AC X-CRM114-Status: GOOD ( 12.50 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Michael S. Tsirkin" , Jonathan Corbet , Jason Wang , Linux Doc Mailing List , "linux-kernel@vger.kernel.org" , virtualization@lists.linux-foundation.org, Bartosz Golaszewski , "Enrico Weigelt, metux IT consult" , "open list:GPIO SUBSYSTEM" , linux-riscv , "Enrico Weigelt, metux IT consult" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv