From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: n.shubin@yadro.com, 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>,
"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, 09 Apr 2025 08:42:30 +0200 [thread overview]
Message-ID: <87h62xg7jd.fsf@pond.sub.org> (raw)
In-Reply-To: <Z9qpeF9-LNLk_nON@redhat.com> ("Daniel P. Berrangé"'s message of "Wed, 19 Mar 2025 11:24:40 +0000")
Daniel P. Berrangé <berrange@redhat.com> writes:
> 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>
The commit message should briefly explain the purpose of the change.
>> ---
>> 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
Spell it GPIO in doc text, because it's an acronym.
>> +##
>> +
>> +##
>> +# @GpiodevInfo:
>> +#
>> +# Information about a gpio device.
>> +#
>> +# @label: the label of the gpio device
>> +#
>> +# Since: 9.2
Make that 10.1 everywhere.
>> +##
>> +{ '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
What buffer is being sized here?
>> +#
>> +# Since: 9.2
>> +##
>> + { 'struct': 'GpiodevChardev',
>> + 'data': { 'chardev': 'str',
>> + '*size': 'int' } }
Use 'size' instead of 'int' for byte counts, please.
>> +
>> +##
>> +# @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' } }
Why GpiodevChardevWrapper? Consistency with similar existing things?
The wrapper types are remnants of "simple" unions. New code should
avoid them, unless avoiding them would make things hard to use. For
instance, when adding a new branch to a union where the existing
branches are of such wrapper types, use a wrapper for the new one to
keep things consistent.
What other backend types do you have in mind?
> 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.
Good point. Nikita, do you see a use for chardevs other than sockets?
[...]
next prev parent reply other threads:[~2025-04-09 6:43 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é
2025-04-09 6:42 ` Markus Armbruster [this message]
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=87h62xg7jd.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=andrew@codeconstruct.com.au \
--cc=berrange@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.