From: Markus Armbruster <armbru@redhat.com>
To: Nikita Shubin via B4 Relay <devnull+n.shubin.yadro.com@kernel.org>
Cc: qemu-devel@nongnu.org, n.shubin@yadro.com,
"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>,
"Daniel P. Berrangé" <berrange@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>
Subject: Re: [PATCH PoC 7/7] gpiodev: Add gpiobackend over GUSE
Date: Wed, 09 Apr 2025 08:56:44 +0200 [thread overview]
Message-ID: <875xjdg6vn.fsf@pond.sub.org> (raw)
In-Reply-To: <20250319-gpiodev-v1-7-76da4e5800a1@yadro.com> (Nikita Shubin via's message of "Wed, 19 Mar 2025 10:57:57 +0300")
Nikita Shubin via B4 Relay <devnull+n.shubin.yadro.com@kernel.org>
writes:
> From: Nikita Shubin <n.shubin@yadro.com>
>
> Add GUSE (FUSE based kernel module similiar to CUSE) based backend.
>
> This allows transparent usage of Linux GPIO UAPI based tools like
> in kernel tools/gpio or libgpiod.
>
> libgpiod requires some modification to allow "/sys/class/guse" in
> gpiod_check_gpiochip_device().
>
> It requires guse module to be loaded and providing DEVICE()->id
> for GPIO module, for example:
>
> ```
> DEVICE(&s->gpio)->id = g_strdup("aspeed-gpio0");
> ```
>
> The id should be provided to gpiodev with any `devname` that doesn't
> exists in /dev:
>
> ```
> -gpiodev guse,id=aspeed-gpio0,devname=gpiochip10
> ```
>
> That /dev/gpiochip10 can be used in the same way we usually operate with
> gpiochip's.
>
> Link: http://git.maquefel.me/?p=qemu-gpiodev/libgpiod.git;a=shortlog;h=refs/heads/nshubin/guse-fix
> Link: http://git.maquefel.me/?p=qemu-gpiodev/guse.git;a=summary
> Link: http://git.maquefel.me/?p=qemu-gpiodev/libfuse.git;a=shortlog;h=refs/heads/nshubin/guse
> Signed-off-by: Nikita Shubin <n.shubin@yadro.com>
[...]
> diff --git a/qapi/gpio.json b/qapi/gpio.json
> index 1c2b7af36813ff52cbb3a44e64a2e5a5d8658d62..e3cdca793260212622a30947eaea61bd523e98fb 100644
> --- a/qapi/gpio.json
> +++ b/qapi/gpio.json
> @@ -21,12 +21,36 @@
> ##
> # @GpiodevBackendKind:
> #
> -# @chardev: chardevs
> +# @chardev: Gpio dev over chardev backend
> +# @gusedev: Gpio dev over GUSE FUSE module
> #
> # Since: 9.2
10.1
> ##
> { 'enum': 'GpiodevBackendKind',
> - 'data': [ 'chardev' ] }
> + 'data': [ 'chardev',
> + { 'name': 'gusedev', 'if': 'CONFIG_LINUX' } ] }
> +
> +##
> +# @GpiodevGusedev:
> +#
> +# Configuration info for guse gpiodevs.
> +#
> +# @devname: Name of device created in /dev
Existing names for similar things elsewhere:
* @dev in AudiodevAlsaPerDirectionOptions
* @device in ChardevHostdev
* @devname in NetdevNetmapOptions
* @vhostdev in NetdevVhostUserOptions
* @sev-device in SevCommonProperties
* @filename in RngRandomProperties
* @path in BlockdevOptionsNvmeIoUring,
BlockdevOptionsVirtioBlkVhostVdpa, TPMPassthroughOptions
What a mess.
@filename and @path are clearly bad.
I'd prefer @device or @gpio-device, or maybe @dev.
> +#
> +# Since: 9.2
> +##
> + { 'struct': 'GpiodevGusedev',
> + 'data': { 'devname': 'str' } }
> +
> +##
> +# @GpiodevGusedevWrapper:
> +#
> +# @data: Configuration info for chardev gpiodevs
> +#
> +# Since: 9.2
> +##
> +{ 'struct': 'GpiodevGusedevWrapper',
> + 'data': { 'data': 'GpiodevGusedev' } }
Avoid the wrapper?
>
> ##
> # @GpiodevChardev:
> @@ -65,4 +89,5 @@
> { 'union': 'GpiodevBackend',
> 'base': { 'type': 'GpiodevBackendKind' },
> 'discriminator': 'type',
> - 'data': { 'chardev': 'GpiodevChardevWrapper' } }
> \ No newline at end of file
> + 'data': { 'chardev': 'GpiodevChardevWrapper',
> + 'gusedev': { 'type': 'GpiodevGusedevWrapper', 'if': 'CONFIG_LINUX' } } }
> \ No newline at end of file
Please add a newline at the end of the file.
prev parent reply other threads:[~2025-04-09 6:57 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
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 [this message]
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=875xjdg6vn.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=devnull+n.shubin.yadro.com@kernel.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=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.