Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2612939ybh; Mon, 5 Aug 2019 03:59:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqza+5x+NUHsOVTOv8x45XS06i+/OaowZqmVoWxpJvvlCQ3O+7rFrrzcinuiCQSvJP+hCCC+ X-Received: by 2002:a17:90a:d791:: with SMTP id z17mr16691301pju.40.1565002790956; Mon, 05 Aug 2019 03:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565002790; cv=none; d=google.com; s=arc-20160816; b=HtoIsFQ6T3osggH6SOD2pEDA6+eg6OJ/Wbl8ZdGjZadylMrxBPveN9l7diZEGvAF3l PJtab5YdM+YzgKh2vaMO6Njo4TypIr9pGHRHS5RETQRS2141sNaNbyEEu9x5EQWvB+H7 BTRY0BzxRMt8dNdWJlFqgojNLNfcd7KjXjPOOP5H2qwsCzk/2z9Po2oXXp8qqZbLJEe/ 9BnYb1LS/fZ5KBxTl79fbjBy3cIPEAq9u9FLjNgcg1CqaAGz2E+hOinPFRqnnJA/xVBi /e7aZA59PCUy2Q6Uc4ZjwCUB3xNgxar2cNQfnRchYwbS0BWc/vzKhQ+9Cq1GT9QwptIg ORpQ== 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:dkim-signature; bh=TzWdXtLAUrrMBEEWJP4I6zJKWMOnmN0iEzqlYudmigQ=; b=yYEstaZceobF3CGfm0/RQZJdl5QdgbRQn41epetooqIA9K4/87RdvlkYO4PETgf6B/ r9zbTq1+0IdqzTM799Eet4nDPAsGWsZD2qNOJOiyDwVUcZBPOrYWs0ekAXhpfININO3x bJ9RX1FOM11vpWr0tXD7fnBRXjCWPoBLiyvjINu6luinKPlJSXPUZBjekv87ogHhnWw6 PjPM8YpgLQyBEJJgcsBerbNbQLoa23gjmNBIt/IH0PMnu7854jYmDBO4e0SdjhUc2Uaq 5/19YvYfgwow57fSWrBFy3P5MpDSFLOKR7zJ4hb9fpKZX6/y6jU6YZAIygHDck2+IHWM SkoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g4W9SBDY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c5si45179423pfr.25.2019.08.05.03.59.34; Mon, 05 Aug 2019 03:59:50 -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; dkim=pass header.i=@linaro.org header.s=google header.b=g4W9SBDY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728441AbfHEK5M (ORCPT + 99 others); Mon, 5 Aug 2019 06:57:12 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:39762 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728015AbfHEK5M (ORCPT ); Mon, 5 Aug 2019 06:57:12 -0400 Received: by mail-lj1-f196.google.com with SMTP id v18so78849105ljh.6 for ; Mon, 05 Aug 2019 03:57:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TzWdXtLAUrrMBEEWJP4I6zJKWMOnmN0iEzqlYudmigQ=; b=g4W9SBDYNYE5i6F+dksQYRpRO4BX2DMuzPAdV16wK7x2aQ1wGkFgxbu8+Tm/ur7a3i fmcqYRfAGMb3NMQvgoiabqFOLHynxWg53UaSlj7K/wrkcAU5FMjV3+Lcf/+sGDDxbnmw k7SEsjCRBO7OjRk2s8QOVRy+yoD8ERWCA0PbeB81hAVC5DZkNBXrg3564rgc9pzeW07v aHFrc4YuUeKwM2k5K/dv54tQ9x/2x06HRmePnl1L4VhnCeQ03Q8yZvab3XCChSThFnXx m9AzVUheQtNyQnM/qz9047gQ6G40pShUOtDkiea2+tKcN0K9jmjGdGJsJWZheJGJaZLm tKAg== 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=TzWdXtLAUrrMBEEWJP4I6zJKWMOnmN0iEzqlYudmigQ=; b=fY6b/SfPjPFJ+06FTJu0kdh/Wlrv2KIb5TL7DfByh/x2o7Cd1/5YLdgC0A1sPNTf0H 8Cf37XNvCfFCOOPtiEyJeYmysxssCN/+Vi17Xq6jn5kfLxISGbDgjFTRxEfDtiEMFuwY bfUi2DwKOKXax7gvNb7COSyRNWoxR5K2JOQSsPuykfpzcv5ccfIv85UpxpuK28VffS7u ja1tFz/ZkQGmyBzr5Koa1L35GQNW4durjbtTEcJhSYaYdgMj3qjX6QQdwchn3P/YItZj hmLRGZ4Yxfnf4QUFKqjdGoXDC41/EmkhjO6xXZ6dowFQIxQdy9dHKrtElq487Q5Q44jc YlxQ== X-Gm-Message-State: APjAAAUfaFM9Dhh7147L+sNevJoBfMD8E0HRmS0ylZJFzYxqowLYYCVM SQQbvz5+sjThY0iIFxd40mjXy1WrxEZ16acuMfrDBDro X-Received: by 2002:a05:651c:28c:: with SMTP id b12mr13843059ljo.69.1565002630201; Mon, 05 Aug 2019 03:57:10 -0700 (PDT) MIME-Version: 1.0 References: <20190705160536.12047-1-geert+renesas@glider.be> In-Reply-To: From: Linus Walleij Date: Mon, 5 Aug 2019 12:56:58 +0200 Message-ID: Subject: Re: [PATCH RFC] gpio: Add Virtual Aggregator GPIO Driver To: Marc Zyngier Cc: Geert Uytterhoeven , christoffer.dall@arm.com, Bartosz Golaszewski , Alexander Graf , Peter Maydell , Paolo Bonzini , Magnus Damm , "open list:GPIO SUBSYSTEM" , QEMU Developers , Linux-Renesas , "linux-kernel@vger.kernel.org" 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 On Mon, Aug 5, 2019 at 12:21 PM Marc Zyngier wrote: > On 01/08/2019 09:41, Linus Walleij wrote: > > I would even go so far as to call it "gpio-virtualization" or > > "gpio-virtualized" rather than "gpio-virtual" so it is clear what the > > intended usecase is. We have a bit of confusion in the kernel > > because people misuse the word "virtual" left and right, like for > > "virtual IRQ number" (Linux IRQ numbers) which are just some > > random number space, but not really "virtual", it's a semantic > > disease similar to the confusion of using the word "manual" in > > computer code. > > I'd drop the notion of "virtual" altogether. Nothing is virtual in this > thing at all (the GPIOs are very real, from what I gather). Instead (and > assuming I got it right, which is a long shot), what you have is a > "synthetic" GPIO controller, made from the GPIOs belonging to other > controllers. I'd call it "GPIO aggregator". +1 on this. Next thing that will predictably follow is a userspace ABI to create those aggregators and have them go away if the process creating it dies. Something to think of... > > If QEMU can deal in a simple and straight-forward way with this > > I see it quickly becoming a very useful tool for industrial automation > > where you want to run each control system in isolation and just > > respawn the virtual machine if something goes wrong. > > What the VMM (QEMU, kvmtool) would need to do is to present this as a > "standard" GPIO IP, and use the backend aggregator to emulate it. > Certainly doable. The nice part is that all the work is in userspace, > and thus completely off my plate! ;-) Yeah there is not really any "standard" GPIO, but if the user is running e.g. a Versatile Express model, that has a PL061 GPIO, and then a user would create an "aggregator GPIO" with say 8 lines and QEMU would pick that up as /dev/gpiochipN and bind it inside of QEMU to the lines of the virttualized PL061 GPIO controller, so the machine thinks it is using a PL061 but in reality it is just 8 GPIO lines on the host computer. > You also may want to look into not emulating a standard IP, but use > something virtio-based instead. The ACRN project seems to have something > like this in progress, but I know nothing about it. That sounds quite interesting as well. Then the virtualized machine can just pick this "virtio GPIO" and some command line switches or config file on the host can set up and route a GPIO aggregator. Yours, Linus Walleij