Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp519280ybk; Wed, 20 May 2020 05:38:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQgaDH+D/ok4yWyvlXIKI6AUtfvU/alv2l5CmC2j1/ESvmMINZI9uTKjary0lRPNmU93o9 X-Received: by 2002:a17:907:20ee:: with SMTP id rh14mr3670273ejb.158.1589978318072; Wed, 20 May 2020 05:38:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589978318; cv=none; d=google.com; s=arc-20160816; b=WxO25Uo6YVGET+Cs1TEUFexBdWQrX/OOcfvhCtdSImlI3nNHkmxfOmwD+5eweXd2OC Hj6IAAn9aXFfsmZosB8OyxGG3ZOby9an8rtdjQb3EbtrPGxpQdvROSN3NfDp2UCYaH7N 3U6ViNhTqOTj0JWIwhq+4EjpMuw6P+IEwsQKCJgvCQCA/8Y/+T9vc8WHu/80UVhk3HYV Q7MMg74M9Ylz7XEwelCNxB+l1c3zBJ7eEZEj7OgM7rqIoOp9YKGf3MFEaqXwkkh4Bkt1 iJjd6aL8uP0KzdoNwLvpVsH7IfaTeNUtrsJINRv2bM0eu8rb+MnWxxkvvIm9/Ss7G8nn vuAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=F/u+6tnly2BFfAMjAK8M1DKWCRzqZwn5wyDMJLDJi3s=; b=bfHiVIDL50txrUQJQnj7rYbvUpK1pCPef88tQQ816cmrf7/5PnFGZoZJIP7QDDlefB F+epYypvJ8SJjm0LH2jOXltIdPFgIxWrKsjzYFAPGB6i9dCTlHOHRntHDhPXtp7k+8FN 4ZMgoFw797Jv9ws94i1cAUQwMDC84Ia6UX3m+rDuKSq6EwBmDKYlVYHvsj6Pus28ouS4 Helw/qWxmSF4wgK7bNynniYEnjFAJLBGjKg0/9NFu8WpAJmdMQ/NcNN8c7qrS/hu+j1K 2CqzOqmiA5wAdN2EAr0FDfKTPV/7rNbWkWHT8xi6+S4RpSybXytCGcrBf003WyDAWwvs ekBw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g14si1440480edl.432.2020.05.20.05.38.15; Wed, 20 May 2020 05:38:38 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbgETMfF (ORCPT + 99 others); Wed, 20 May 2020 08:35:05 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:37503 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbgETMe7 (ORCPT ); Wed, 20 May 2020 08:34:59 -0400 Received: by mail-oi1-f196.google.com with SMTP id r25so2762003oij.4; Wed, 20 May 2020 05:34:58 -0700 (PDT) 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; bh=F/u+6tnly2BFfAMjAK8M1DKWCRzqZwn5wyDMJLDJi3s=; b=lYT9RRCH6Z3f847C4QRguS5MW3TKtYbUoOvBU26yXjn67k3CdUZSiGtoC2i4l5n8NE 8Zf5ED+8lxj4mXuJeycTsKxWt2Hr+VJrWXznE7uSyAuvG4mX3IqcgBtOFa0NE0OPUGdA BcVFG/EkdffKBAuj+BhSgXTIBWTZdpeVBS/AEHzAXU/WETTAnhqk4QGusOXZi4tfGUNI yTbzAQHqG6MTk28jt7F+gY2dbgUd8epv+7eDzjp5rK8Cev2HkGFf3u83Kb75MU4TSVOf i+SuSrPDuQyQk7UxGnRmFb6x5DGPAkfPiGlQFkGzf6MTBf+WpzqdGXNcQEQYVSCLPxxE InEA== X-Gm-Message-State: AOAM532t/xcHgD8hl27b5G2+B1EUQY8YxC3AXkM7X5DuGVy4OQblcqcn Jr2o33p4OeSiMn7fb4IPlKS7KZsf0RjvVdNc0xU= X-Received: by 2002:aca:210a:: with SMTP id 10mr1526706oiz.153.1589978097806; Wed, 20 May 2020 05:34:57 -0700 (PDT) MIME-Version: 1.0 References: <20200511145257.22970-1-geert+renesas@glider.be> <20200520121420.GA1867563@smile.fi.intel.com> In-Reply-To: <20200520121420.GA1867563@smile.fi.intel.com> From: Geert Uytterhoeven Date: Wed, 20 May 2020 14:34:46 +0200 Message-ID: Subject: Re: [PATCH v7 0/6] gpio: Add GPIO Aggregator To: Andy Shevchenko Cc: Linus Walleij , Bartosz Golaszewski , Jonathan Corbet , Harish Jenny K N , Eugeniu Rosca , Alexander Graf , Peter Maydell , Paolo Bonzini , Phil Reid , Marc Zyngier , Christoffer Dall , Magnus Damm , "open list:GPIO SUBSYSTEM" , "open list:DOCUMENTATION" , Linux-Renesas , Linux Kernel Mailing List , QEMU Developers Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, On Wed, May 20, 2020 at 2:14 PM Andy Shevchenko wrote: > On Mon, May 11, 2020 at 04:52:51PM +0200, Geert Uytterhoeven wrote: > > GPIO controllers are exported to userspace using /dev/gpiochip* > > character devices. Access control to these devices is provided by > > standard UNIX file system permissions, on an all-or-nothing basis: > > either a GPIO controller is accessible for a user, or it is not. > > Currently no mechanism exists to control access to individual GPIOs. > > > > Hence this adds a GPIO driver to aggregate existing GPIOs, and expose > > them as a new gpiochip. This is useful for implementing access control, > > and assigning a set of GPIOs to a specific user. Furthermore, this > > simplifies and hardens exporting GPIOs to a virtual machine, as the VM > > can just grab the full GPIO controller, and no longer needs to care > > about which GPIOs to grab and which not, reducing the attack surface. > > This has been implemented for ARM virt in QEMU[1]. > > > > Recently, other use cases have been discovered[2], like describing > > simple GPIO-operated devices in DT, and using the GPIO Aggregator as a > > generic GPIO driver for userspace, which is useful for industrial > > control. > > > > Note that the first patch of this series ("i2c: i801: Use GPIO_LOOKUP() > > helper macro") has been applied to i2c/for-next. > > Sorry for late reply, recently noticed this nice idea. > The comment I have is, please, can we reuse bitmap parse algorithm and syntax? > We have too many different formats and parsers in the kernel and bitmap's one > seems suitable here. Thank you, I wasn't aware of that. Which one do you mean? The documentation seems to be confusing, and incomplete. My first guess was bitmap_parse(), but that one assumes hex values? And given it processes the unsigned long bitmap in u32 chunks, I guess it doesn't work as expected on big-endian 64-bit? bitmap_parselist() looks more suitable, and the format seems to be compatible with what's currently used, so it won't change ABI. Is that the one you propose? > (Despite other small clean ups, like strstrip() use) Aka strim()? There are too many of them, to know all of them by heart ;-) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds