Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8087673ybi; Tue, 9 Jul 2019 09:00:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQTXueuFm5o5P0E7jeVj6u03twj/7sFZdhpkMEhu269okMnffkn2Px08HoClH2SOI6Rj+T X-Received: by 2002:a63:1c22:: with SMTP id c34mr21871270pgc.56.1562688033162; Tue, 09 Jul 2019 09:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562688033; cv=none; d=google.com; s=arc-20160816; b=S6nP32pYNKzk/7taFPuKYeoEh+VB6h5qIxHgqzUE8M7xWlHgqgFaT32BAXibV2bHpD jRRZArXzEImzFP4btriw9uUUFqmEV0aiTnxm1f/6jckIV5SfyTjEvzaq8v+dlLvGWd5K IaiIBqZoPvCQB3DeaygIoEUKp34ajwby4RiZa3UHJZM10k3MgFPPmOSYNiNABZ3edXIc HRDLItTnSFZfFlQLYIX1CvbuygQI41OaJppkylpJdT2mv0/yhSuXoBfqukS7/fE4b994 toD1NF8BzRXFB5+gbU9nPt/P9k/w3DzOj9PRMxxmRsiY93Zh1cbLln9ASNhqMO01gh6z 3qfw== 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; bh=dzuThDe5PHW7Vx34Ev3xi1f6w6Ry+/4CufPt47Qdgg4=; b=TqIzQEZhBw+S5nla7if2C9aZIsO9I1pgozZz1Gl2dcLTiraTxjGTT6or8rJBXhkumb D9WuVYCAqf9/WPih3UNBxeoIv6lWryJ6NHKvWOhjYkw2r8ckIX0aNo3hFyW8YLrjzaVJ 0HwWu77PF5A6cl11DvWUdQELmqtg1vawK8pbpFgk33SVzvr0bfHkxgY2Qvj8sqKJpli9 Cvn1C82hvbb1bC7wyIbb+KMW/P3F98L+HZgVLlSCXHnjlKjoMndUfa6TgqLHOYlug9EU 1FElaYvbIjj2cI3/MOJsNEwSaFngkq+t2vXBae76JLrzTSxVxMS47c1Gy+SUBwM7qpeD KhaA== ARC-Authentication-Results: i=1; mx.google.com; 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 i188si23914316pfe.96.2019.07.09.09.00.17; Tue, 09 Jul 2019 09:00:33 -0700 (PDT) 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; 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 S1726444AbfGIP77 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 9 Jul 2019 11:59:59 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:36426 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726154AbfGIP77 (ORCPT ); Tue, 9 Jul 2019 11:59:59 -0400 Received: by mail-ot1-f68.google.com with SMTP id r6so20465645oti.3; Tue, 09 Jul 2019 08:59: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:content-transfer-encoding; bh=z1mIOFo8Yb9qP+Xw6RYXcy8nIe448VjUC8u9ee+We+c=; b=DN1Yz6XZQGdg8wm3bC6Y92cUilI9MVDcNvrseB4ITW5Ruf3tKPRdPtW5RtoR81X9UN F1Jwu6UGTz1vE3Hq4YoChLudvzcAZanEMH2yoSJlKMEQDT555mQ1x/nHe+xCMB8MY3T7 M6eLcZkBq65RRRnkERz3rvsEgDexkCgv5EBUayxUMV97iL5opDZfuKso4rzbWmxmhrte XGyT3hx6y8QQW9XVquNHCvIhyNU7+H1skmWgdzzpyF413X/cGwmKaqaHkSZayAYQsuFD m4hrgqMbk+hTA8rgwZrza9S/pvIceiGSlURqk3PKWZx1VPhcPhJepO2xHpx6Mz1wqPIa IfLQ== X-Gm-Message-State: APjAAAWFEv/IpSy2+wLVPRWGNPnxGal1qow6TIgr73dk5M2++aZHs0es b/K1k5UwPSUEldbo+d2W8bMZme7umzPann+quRA= X-Received: by 2002:a05:6830:210f:: with SMTP id i15mr2448511otc.250.1562687998070; Tue, 09 Jul 2019 08:59:58 -0700 (PDT) MIME-Version: 1.0 References: <20190705160536.12047-1-geert+renesas@glider.be> In-Reply-To: From: Geert Uytterhoeven Date: Tue, 9 Jul 2019 17:59:47 +0200 Message-ID: Subject: Re: [PATCH RFC] gpio: Add Virtual Aggregator GPIO Driver To: Bartosz Golaszewski Cc: Geert Uytterhoeven , Linus Walleij , Alexander Graf , Peter Maydell , Paolo Bonzini , Magnus Damm , linux-gpio , QEMU Developers , Linux-Renesas , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Bartosz, On Tue, Jul 9, 2019 at 4:59 PM Bartosz Golaszewski wrote: > pon., 8 lip 2019 o 12:24 Geert Uytterhoeven napisał(a): > > On Mon, Jul 8, 2019 at 11:45 AM Bartosz Golaszewski > > wrote: > > > pt., 5 lip 2019 o 18:05 Geert Uytterhoeven napisał(a): > > > > 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 add a virtual GPIO driver to aggregate existing GPIOs (up to 32), > > > > 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, it would simplify and harden exporting GPIOs to a virtual > > > > machine, as the VM can just grab the full virtual GPIO controller, and > > > > no longer needs to care about which GPIOs to grab and which not, > > > > reducing the attack surface. > > > > > > > > Virtual GPIO controllers are instantiated by writing to the "new_device" > > > > attribute file in sysfs: > > > > > > > > $ echo " [ ...]" > > > > "[, [ ...]] ...]" > > > > > /sys/bus/platform/drivers/gpio-virt-agg/new_device > > > > > > > > Likewise, virtual GPIO controllers can be destroyed after use: > > > > > > > > $ echo gpio-virt-agg. \ > > > > > /sys/bus/platform/drivers/gpio-virt-agg/delete_device > Am I doing it right? I'm trying to create a device and am only getting this: > > # echo gpiochip2 23 > new_device > [ 707.507039] gpio-virt-agg gpio-virt-agg.0: Cannot find gpiochip gpiochip2 > > gpiochip2 *does* exist in the system. Please try the name of the platform device instead. I.e. for my koelsch (R-Car M2-W), it needs "e6052000.gpio" instead of "gpiochip2". Probably the driver should match on both. > I see. I'll try to review it more thoroughly once I get to play with > it. So far I'm stuck on creating the virtual chip. Thanks, good luck! 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