All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Jason Wang" <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <bgolaszewski@baylibre.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Jean-Philippe Brucker" <jean-philippe@linaro.org>,
	"Bill Mills" <bill.mills@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Enrico Weigelt, metux IT consult" <info@metux.net>,
	virtio-dev@lists.oasis-open.org,
	"Geert Uytterhoeven" <geert@linux-m68k.org>
Subject: [virtio-dev] Re: [PATCH V5 1/2] virtio-gpio: Add the device specification
Date: Mon, 19 Jul 2021 12:40:18 +0200	[thread overview]
Message-ID: <CAK8P3a1G-vUXeVB45e5EJvqfuSKxwZ1Zt2xxWAo6z1ZQPPCPrw@mail.gmail.com> (raw)
In-Reply-To: <20210719092937.jqwfeouaqwarg2op@vireshk-i7>

On Mon, Jul 19, 2021 at 11:29 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 16-07-21, 20:20, Arnd Bergmann wrote:
> > I still don't quite get it. Why would the guest care about a stable name?
>
> For Linux userspace, debugging mostly, at guest userspace. Like what you get out
> of /sys/class/gpio/gpiochipN/label or in debugfs.
>
> i.e. to easily identify the chip there since device names aren't fixed
> otherwise.
>
> Though this was initially added by Enrico and I never though of removing it. If
> you still think it is a waste, will get rid of it.

I still don't see it as an important enough part of the interface to be encoded
in the virtio spec. In the most likely use cases I can think of, you would never
need more than one gpio controller in a virtio machine, since you can have
an arbitrary number of lines connected to it already.

This also simplifies the host side, as it avoids requiring the host to configure
a name that ends up being the same almost always.

If Linus or Bartosz think we should have the name, leave it in there, otherwise
I'd remove it.

> > Right. Any thoughts about just having the names be part of the
> > metadata in the DT? I think that sounds easier than the request,
> > though both methods are fairly straightforward really.
>
> I think we shouldn't divide stuff in between spec and DT as the spec can be used
> without DT as well. And so keeping them entirely in the spec may be better. The
> same holds true otherwise for number of gpio lines as well, or the entire config
> structure.

Encoding the number of gpio lines in the config registers makes sense to me,
but I don't see how you can sensibly get away without some other structure
to describe what the lines are. It doesn't have to be DT, but that's what we use
in practice.

> > That should not be an issue. I think the reply would always be instantaneous
> > here, and the requests can just be processed in order.
>
> They aren't required to be in order after all. Lets say 3 different requests are
> added by 3 different threads in guest, they can all reach in random order at the
> host and the host can send response to them in any order. At least in Linux, you
> can attach a void *data with each transfer and we can easily use that to
> identify the transfer which completed.

Ok, good.

> > Even if the hardware requires the request/free style calls in case of
> > passing through a line to a guest, I would expect that can be handled
> > in host user space, i.e. the virtio device code calls 'request' before it
> > passes down a gpio line to a guest.
>
> That may not always work and this count of refcounting at the backend daemon may
> not be correct.
>
> So, the guest calls set-direction-out-with-val-1, the backend activates the GPIO
> pin, sets direction/value and then deactivates it ? That won't work, right ?
>
> On those lines, I think these operations must be renamed to ACTIVATE/DEACTIVATE
> instead of REQUEST/FREE, that is what we want to do here.

From the drivers you pointed to, it seems to be something like a 'disconnected'
state where the pin is neither input nor output, so this could perhaps
get reflected
in the interface as well, by having each pin be one of IN/OUT/NONE. Not sure
if that is any better.

     Arnd

---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


  reply	other threads:[~2021-07-19 10:40 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  7:39 [PATCH V5 0/2] virtio: Add specification for virtio-gpio Viresh Kumar
2021-07-16  7:39 ` [PATCH V5 1/2] virtio-gpio: Add the device specification Viresh Kumar
2021-07-16  8:23   ` Arnd Bergmann
2021-07-16 16:26     ` Viresh Kumar
2021-07-16 18:20       ` Arnd Bergmann
2021-07-19  9:29         ` Viresh Kumar
2021-07-19 10:40           ` Arnd Bergmann [this message]
2021-07-19 10:50             ` Viresh Kumar
2021-07-19 11:48             ` Geert Uytterhoeven
2021-07-19  7:32       ` Viresh Kumar
2021-07-16  9:13   ` Geert Uytterhoeven
2021-07-16 15:43     ` Viresh Kumar
2021-07-16 15:22   ` Michael S. Tsirkin
2021-07-16 15:41     ` Viresh Kumar
2021-07-16  7:39 ` [virtio-dev] [PATCH V5 2/2] virtio-gpio: Add support for interrupts Viresh Kumar
2021-07-16  9:02   ` Arnd Bergmann
2021-07-16 15:17     ` [virtio-dev] " Viresh Kumar
2021-07-16 16:19       ` Arnd Bergmann
2021-07-16 16:50         ` Viresh Kumar
2021-07-16 18:49           ` Arnd Bergmann
2021-07-20  5:47             ` Viresh Kumar
2021-07-20  7:01               ` Arnd Bergmann
2021-07-20  7:11                 ` Viresh Kumar
2021-07-20  7:22                   ` Arnd Bergmann
2021-07-19 10:24   ` Viresh Kumar
2021-07-19 12:00     ` Arnd Bergmann
2021-07-20  6:11       ` Viresh Kumar
2021-07-20  7:17         ` Arnd Bergmann
2021-07-20  7:53           ` Viresh Kumar
2021-07-20  8:10             ` Arnd Bergmann
2021-07-20  8:42               ` Viresh Kumar
2021-07-20  9:50             ` Michael S. Tsirkin
2021-07-19 15:11     ` Michael S. Tsirkin
2021-07-20  4:19       ` Viresh Kumar
2021-07-16  9:57 ` [PATCH V5 0/2] virtio: Add specification for virtio-gpio Arnd Bergmann
2021-07-16 16:57   ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK8P3a1G-vUXeVB45e5EJvqfuSKxwZ1Zt2xxWAo6z1ZQPPCPrw@mail.gmail.com \
    --to=arnd@kernel.org \
    --cc=alex.bennee@linaro.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=bill.mills@linaro.org \
    --cc=cohuck@redhat.com \
    --cc=geert@linux-m68k.org \
    --cc=info@metux.net \
    --cc=jasowang@redhat.com \
    --cc=jean-philippe@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=mst@redhat.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=virtio-dev@lists.oasis-open.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.