All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: n.shubin@yadro.com
Cc: qemu-devel@nongnu.org, "Linus Walleij" <linus.walleij@linaro.org>,
	"Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Enrico Weigelt, metux IT consult" <info@metux.net>,
	"Viresh Kumar" <vireshk@kernel.org>,
	"Eric Blake" <eblake@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Michael Roth" <michael.roth@amd.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Steven Lee" <steven_lee@aspeedtech.com>,
	"Troy Lee" <leetroy@gmail.com>,
	"Jamin Lin" <jamin_lin@aspeedtech.com>,
	"Andrew Jeffery" <andrew@codeconstruct.com.au>,
	"Joel Stanley" <joel@jms.id.au>,
	qemu-arm@nongnu.org, "Nikita Shubin" <nikita.shubin@maquefel.me>,
	"Nikita Shubin" <nshubin@yadro.com>
Subject: Re: [PATCH PoC 1/7] QAPI: gpio JSON
Date: Wed, 19 Mar 2025 11:24:40 +0000	[thread overview]
Message-ID: <Z9qpeF9-LNLk_nON@redhat.com> (raw)
In-Reply-To: <20250319-gpiodev-v1-1-76da4e5800a1@yadro.com>

On Wed, Mar 19, 2025 at 10:57:51AM +0300, Nikita Shubin via B4 Relay wrote:
> From: Nikita Shubin <nshubin@yadro.com>
> 
> Signed-off-by: Nikita Shubin <nshubin@yadro.com>
> ---
>  qapi/gpio.json        | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  qapi/meson.build      |  1 +
>  qapi/qapi-schema.json |  1 +
>  3 files changed, 70 insertions(+)
> 
> diff --git a/qapi/gpio.json b/qapi/gpio.json
> new file mode 100644
> index 0000000000000000000000000000000000000000..1c2b7af36813ff52cbb3a44e64a2e5a5d8658d62
> --- /dev/null
> +++ b/qapi/gpio.json
> @@ -0,0 +1,68 @@
> +# -*- Mode: Python -*-
> +# vim: filetype=python
> +#
> +
> +##
> +# = Gpio devices
> +##
> +
> +##
> +# @GpiodevInfo:
> +#
> +# Information about a gpio device.
> +#
> +# @label: the label of the gpio device
> +#
> +# Since: 9.2
> +##
> +{ 'struct': 'GpiodevInfo',
> +  'data': { 'label': 'str' } }
> +
> +##
> +# @GpiodevBackendKind:
> +#
> +# @chardev: chardevs
> +#
> +# Since: 9.2
> +##
> +{ 'enum': 'GpiodevBackendKind',
> +  'data': [ 'chardev' ] }
> +
> +##
> +# @GpiodevChardev:
> +#
> +# Configuration info for chardev gpiodevs.
> +#
> +# @chardev: chardev id
> +#
> +# @size: buffer size, default is 65536
> +#
> +# Since: 9.2
> +##
> +  { 'struct': 'GpiodevChardev',
> +    'data': { 'chardev': 'str',
> +              '*size': 'int' } }
> +
> +##
> +# @GpiodevChardevWrapper:
> +#
> +# @data: Configuration info for chardev gpiodevs
> +#
> +# Since: 9.2
> +##
> +{ 'struct': 'GpiodevChardevWrapper',
> +  'data': { 'data': 'GpiodevChardev' } }
> +
> +##
> +# @GpiodevBackend:
> +#
> +# Configuration info for the new chardev backend.
> +#
> +# @type: backend type
> +#
> +# Since: 9.2
> +##
> +{ 'union': 'GpiodevBackend',
> +  'base': { 'type': 'GpiodevBackendKind' },
> +  'discriminator': 'type',
> +  'data': { 'chardev': 'GpiodevChardevWrapper' } }

While historically we've just wired things up to chardevs in QEMU,
in most cases this is just a hack to get the ability too configure
a socket, with the other chardev backends being never used. The
downside of this is that chardev APIs internally are not very nice
to work with, especally if you want/need to be aware of client
connection establishment/closure.

These days we've got common socket APIs and QAPI schema available
and can bypass the chardevs (which have a pretty unpleasant
internal API) if all we need is a socket backend connecting to
an external server. This would let code directly work with the
QIOChannelSocket object, instead of that object being hidden
behind the chardev APIs.

 { 'enum': 'GpiodevBackendKind',
   'data': [ 'socket' ] }

 { 'struct': 'GpiodevSocket',
   'data': { 'addr': 'SocketAddress',
             '*size': 'int'} }

 { 'struct': 'GpiodevSocketWrapper',
   'data': { 'data': 'GpiodevSocket' } }


 { 'union': 'GpiodevBackend',
   'base': { 'type': 'GpiodevBackendKind' },
   'discriminator': 'type',
   'data': { 'socket': 'GpiodevSocketWrapper' } }

if you need to switch between client/server mode some further
additions would be needed.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


  reply	other threads:[~2025-03-19 11:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-19  7:57 [PATCH PoC 0/7] Interact with QEMU GPIO models via gpiodev Nikita Shubin
2025-03-19  7:57 ` Nikita Shubin via B4 Relay
2025-03-19  7:57 ` [PATCH PoC 1/7] QAPI: gpio JSON Nikita Shubin
2025-03-19  7:57   ` Nikita Shubin via B4 Relay
2025-03-19 11:24   ` Daniel P. Berrangé [this message]
2025-04-09  6:42     ` Markus Armbruster
2025-03-19  7:57 ` [PATCH PoC 2/7] Add gpiodev dummy Nikita Shubin
2025-03-19  7:57   ` Nikita Shubin via B4 Relay
2025-03-19  7:57 ` [PATCH PoC 3/7] gpiodev: Add GPIO device frontend Nikita Shubin
2025-03-19  7:57   ` Nikita Shubin via B4 Relay
2025-03-19  7:57 ` [PATCH PoC 4/7] gpiodev: Add GPIO backend over chardev Nikita Shubin
2025-03-19  7:57   ` Nikita Shubin via B4 Relay
2025-03-19  7:57 ` [PATCH PoC 5/7] hw/gpio/aspeed: Add gpiodev support Nikita Shubin
2025-03-19  7:57   ` Nikita Shubin via B4 Relay
2025-03-19  7:57 ` [PATCH PoC 6/7] hw/arm: ast2600: set id for gpio Nikita Shubin
2025-03-19  7:57   ` Nikita Shubin via B4 Relay
2025-03-19  7:57 ` [PATCH PoC 7/7] gpiodev: Add gpiobackend over GUSE Nikita Shubin
2025-03-19  7:57   ` Nikita Shubin via B4 Relay
2025-04-09  6:56   ` Markus Armbruster

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=Z9qpeF9-LNLk_nON@redhat.com \
    --to=berrange@redhat.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=armbru@redhat.com \
    --cc=brgl@bgdev.pl \
    --cc=clg@kaod.org \
    --cc=eblake@redhat.com \
    --cc=eduardo@habkost.net \
    --cc=info@metux.net \
    --cc=jamin_lin@aspeedtech.com \
    --cc=joel@jms.id.au \
    --cc=leetroy@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=n.shubin@yadro.com \
    --cc=nikita.shubin@maquefel.me \
    --cc=nshubin@yadro.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=steven_lee@aspeedtech.com \
    --cc=vireshk@kernel.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.