Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4376083pxu; Wed, 9 Dec 2020 15:53:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVGQyFl6q1y1T45sq6TvLJhXMbjP+sBEQdEo6gJf5bzWjkP10JuTBx9yrTq0M/uHI23+8B X-Received: by 2002:a50:f61b:: with SMTP id c27mr4241355edn.61.1607558017364; Wed, 09 Dec 2020 15:53:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607558017; cv=none; d=google.com; s=arc-20160816; b=ii7tbS1TheLWETFTSPcke5otIsTqthwPF1YWZ3HknTA0uJR+2Z6cTX56GVYZmpj08h 8SyqdOWW/Dq6EqiLNsDWks0hvsWZx8/D/CwJJjcarhJzEtbJJNe9NGZ6aZUep6TIC+Bz dYSDas3/YD/JfdEtFc8hpHa7FKz8Hm70WZEg4ojy9i+xyzgSXaRGsJazF/VULCJdurev fpDetSGngaxW3I/BX8jB3haAZRj6KfByCnyepDotHlfOScbF0R0I41FXubJEeerrdSyj VGcLpuW9RctIXFsbKKbMiY68SiJOn4Af86ao/kV2mmJpZc8Z/I0yIT/aVp9TXWfKuXyC CX3w== 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=L5rOC0nK2V8CtXONH0irUjTFDTH3VBOTheMIaeX2Bwc=; b=ikDYaTr9IzNPLbNJJdWfJQCXT+aTFxIwofVJYx5W1ZNGurgdlLARrlkgGz9eIgYUZN Ib5BHqfXGSSzEhJTtReJHdf60TGSKe7HkV+ggX4OOywwRinHVUMy3ONqs9HJQibMr6XF mzdnpBfOYeQmONjyAR6lfDHZ2fBOQdV66XS8wll52pccphO6nZr/1fdGblSFooRLaCxi zIcvixKyp5Wn1/Z9fAekICYwaT55cYuLtG2XuIgdoYY/jl1392CQNdJ1+tA/Lk2LQsxe sHixPAYnBVMi6Q66pLBd+F7vAfFfsirP1yZ68C3Zo0IVd4X4uVw4fw2LituYxcJB8pSZ DYKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m2wotAQG; 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 f12si1930825edx.584.2020.12.09.15.53.15; Wed, 09 Dec 2020 15:53:37 -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=m2wotAQG; 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 S2387636AbgLIUje (ORCPT + 99 others); Wed, 9 Dec 2020 15:39:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:46082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728508AbgLIUjU (ORCPT ); Wed, 9 Dec 2020 15:39:20 -0500 X-Gm-Message-State: AOAM531bf7FqyU+G1r0+QRPNn5r+N6GGPsQjCork7EQrw+7LiU09Or1Q zfLboIJKOT9iklMBouZqK14YMUvw1jLNlVBgvcI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607546320; bh=Ha7lLzOpXQ1X99veTNG7S+85hi9hDdUnwFrOdFxJkFY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=m2wotAQGycNW3fNMRpvScONvUE+gNQJa/7UXeuv/E5/eArPXRVUCPnYQLNrImG/mi EJQV7WMwocrOB73rk8fCLhZCKjNIIiR/bzljek61mxBTwLpxZP82Xn6jRhlnEUKATY iEBAwk/CSGD9Xo47fY9oJGPZG78DcYthsCzyjY+hsWhf7D9e50RNKkGKje4//M6lnX 86DGjo+2ZTer6Q7yhGH0UvyBu2prkduSQAGOLKN5qBU3EyEyp7I4BzaQZcPiejMXMM 6hNi9fuj/ykVQO5y8Oy4vK4OaddGLZhWOG0zHrOv8NhJ1xIkzjm0yvECImZOpff6AX yJ8H5FndHMpDA== X-Received: by 2002:a9d:6317:: with SMTP id q23mr3381889otk.251.1607546319268; Wed, 09 Dec 2020 12:38:39 -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> <2827855a-dc4f-2e17-aca3-4b1b9f0d5084@ti.com> In-Reply-To: <2827855a-dc4f-2e17-aca3-4b1b9f0d5084@ti.com> From: Arnd Bergmann Date: Wed, 9 Dec 2020 21:38:22 +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: Grygorii Strashko Cc: Linus Walleij , "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:22 PM Grygorii Strashko wrote: > On 09/12/2020 14:53, Linus Walleij wrote: > > On Wed, Dec 9, 2020 at 12:19 PM Arnd Bergmann wrote: > >> 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. > > > > Performance/latency-wise that would also be strongly encouraged. > > > > Tglx isn't super-happy about the chained interrupts at times, as they > > can create really nasty bugs, but a pure IRQ in fastpath of some > > kinde is preferable and intuitive either way. > > In my opinion the problem here is that proposed patch somehow describes Front end, but > says nothing about Backend and overall design. > > What is expected to be virtualized? whole GPIO chip? or set of GPIOs from different GPIO chips? > Most often nobody want to give Guest access to the whole GPIO chip, so, most probably, smth. similar to > GPIO Aggregator will be needed. I would argue that it does not matter, the virtual GPIO chip could really be anything. Certain functions such as a gpio based keyboard require interrupts, so it sounds useful to make them work. Arnd