Hi Oleksandr,
Finally I am getting around Xen grants and haven't got a running setup
yet. There are few questions I have at the moment:
- Xen's libxl_arm.c creates the iommu nodes only if backend isn't in
Dom0. Why are we forcing it this way ?
I am not running my backend in a separate dom as of now, as they
need to share a unix socket with dom0 (with vhost-user-fronend (our
virtio-disk counterpart)) for vhost-user protocol and am not sure
how to set it up. Maybe I need to use "channel" ? or something else
?
- I tried to hack it up, to keep backend in Dom0 only and create the
iommu nodes unconditionally and the guest kernel is crashing in
drivers/iommu/iommu.c:332
iommu_dev = ops->probe_device(dev);
Since grant_dma_iommu_ops have all the fields set to NULL.
- Anything else you might want to share ?
--
viresh
Hi,
As part of looking at implementing vhost-user daemons which don't have
complete access to a guests address space we noticed the vhost-user spec
has a definition for VHOST_USER_SLAVE_IOTLB_MSG's. Specifically the
message VHOST_IOTLB_ACCESS_FAIL looks like it could be used to delegate
the mapping of memory by the master/frontend so the backend can access
it.
As far as I can see no backends currently use this message and the
specific handling of VHOST_IOTLB_ACCESS_FAIL in QEMU doesn't do much
more than report an error.
The VHOST_IOTLB_MISS does have some handling but the commentary seems to
imply this is needed for the in kernel vhost kernel support (perhaps
when real hardware is filling in a buffer being forwarded to a VirtIO
device?).
Can anyone point to any backends that implement these messages?
We have implemented a Xen Vhost User Frontend:
https://github.com/vireshk/xen-vhost-frontend
which currently uses a lightly hacked Xen privcmd device to map all of
the guests memory. We want to investigate using the stricter gntdev
device where buffers for individual transactions can be mapped into the
backend domains before being released at the end of the transaction. We
want to keep the hypervisor specific code in the frontend so the backend
can stay portable between different hypervisors.
Thanks,
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
The field 'base' in 'struct libxl_device_virtio' is defined as uint64,
while we are printing it with '%lu', which is 32bit only 32-bit
platforms. And so generates a error like:
libxl_internal.h:4388:51: error: format '%lu' expects argument of type 'long
unsigned int', but argument 3 has type 'uint64_t' {aka 'long long unsigned
int'} [-Werror=format=]
Fix the same by using PRIx64 instead.
Now that the base name is available in hexadecimal format, prefix it
with '0x' as well, which strtoul() also depends upon since base passed
is 0.
Fixes: 43ba5202e2ee ("libxl: add support for generic virtio device")
Signed-off-by: Viresh Kumar <viresh.kumar(a)linaro.org>
---
Couldn't test on 32-bit platforms yet, but works fine for 64 bit one.
tools/libs/light/libxl_virtio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/libs/light/libxl_virtio.c b/tools/libs/light/libxl_virtio.c
index 6a38def2faf5..2217bda8a253 100644
--- a/tools/libs/light/libxl_virtio.c
+++ b/tools/libs/light/libxl_virtio.c
@@ -45,12 +45,12 @@ static int libxl__set_xenstore_virtio(libxl__gc *gc, uint32_t domid,
const char *transport = libxl_virtio_transport_to_string(virtio->transport);
flexarray_append_pair(back, "irq", GCSPRINTF("%u", virtio->irq));
- flexarray_append_pair(back, "base", GCSPRINTF("%lu", virtio->base));
+ flexarray_append_pair(back, "base", GCSPRINTF("0x%"PRIx64, virtio->base));
flexarray_append_pair(back, "type", GCSPRINTF("%s", virtio->type));
flexarray_append_pair(back, "transport", GCSPRINTF("%s", transport));
flexarray_append_pair(front, "irq", GCSPRINTF("%u", virtio->irq));
- flexarray_append_pair(front, "base", GCSPRINTF("%lu", virtio->base));
+ flexarray_append_pair(front, "base", GCSPRINTF("0x%"PRIx64, virtio->base));
flexarray_append_pair(front, "type", GCSPRINTF("%s", virtio->type));
flexarray_append_pair(front, "transport", GCSPRINTF("%s", transport));
--
2.31.1.272.g89b43f80a514
Hello,
This patchset adds toolstack support for I2C, GPIO and generic virtio devices.
This is inspired from the work done by Oleksandr for the Disk device.
This is developed as part of Linaro's Project Stratos, where we are working
towards Hypervisor agnostic Rust based backends [1].
This is based of Xen's master branch.
V9->V10:
- Swap I2C/GPIO compatible strings, they were wrongly added earlier.
- Arrange tags in timely order and add new ones.
V8->V9:
- Drop changes to tools/ocaml/libs/xl/genwrap.py file.
- Replace GPIO with I2C in a comment.
- Add Reviewed-by tags.
V7->V8:
- Use macros for compatible string names.
- Use strcmp() instead of strncmp() at several places.
- Rename "virtio,devices" to "virtio,device" in commit log.
- Remove extra call to fdt_end_node().
- Disallow "unknown" in xenstore transport.
- Use libxl__strdup().
- Update documentation.
- Remove DEVICE_ADDREMOVE(virtio).
V6->V7:
- Support generic virtio devices too. They are passed with type=virtio,device,
and we only create the MMIO DT node for them.
- Add links to DT bindings of I2C and GPIO, in code and documentation.
- Call libxl__device_add() for all hypervisor types.
- Add (0, "UNKNOWN") for libxl_virtio_transport.
- Removed libxl_virtio_backend and libxl_virtioinfo, as they were unused.
- Remove unnecessary stuff from libxl__virtio_from_xenstore() and add support
for type and transport.
- Add backend=domid in documentation and replace compatible with type.
- Improved commit logs.
V5->V6:
- The cleanup patches are sent separately [2].
- We don't add I2C or GPIO specific device changes anymore, rather we create
generic "virtio" devices. The "type" of a virtio devices helps us identify the
right device, and create an entry in the DT node. The same can be used for all
Virtio devices now.
- Update man page xl.cfg.
V4->V5:
- Fixed indentation at few places.
- Removed/added blank lines.
- Added few comments.
- Added review tags from Oleksandr.
- Rebased over latest staging branch.
V3->V4:
- Update virtio_enabled independently of all devices, so we don't miss setting
it to true.
- Add iommu handling for i2c/gpio and move it as part of
make_virtio_mmio_node_common(), which gets backend_domid parameter as a
result.
V2->V3:
- Rebased over latest tree and made changes according to changes in Oleksandr's
patches from sometime back.
- Minor cleanups.
V1->V2:
- Patches 3/6 and 4/6 are new.
- Patches 5/6 and 6/6 updated based on the above two patches.
- Added link to the bindings for I2C and GPIO.
- Rebased over latest master branch.
Thanks.
--
Viresh
[1] https://lore.kernel.org/xen-devel/20220414092358.kepxbmnrtycz7mhe@vireshk-i…
Viresh Kumar (3):
libxl: Add support for generic virtio device
xl: Add support to parse generic virtio device
docs: Add documentation for generic virtio devices
docs/man/xl.cfg.5.pod.in | 33 +++++
tools/libs/light/Makefile | 1 +
tools/libs/light/libxl_arm.c | 100 +++++++++++++++
tools/libs/light/libxl_create.c | 4 +
tools/libs/light/libxl_internal.h | 6 +
tools/libs/light/libxl_types.idl | 18 +++
tools/libs/light/libxl_types_internal.idl | 1 +
tools/libs/light/libxl_virtio.c | 144 ++++++++++++++++++++++
tools/xl/xl_parse.c | 81 ++++++++++++
9 files changed, 388 insertions(+)
create mode 100644 tools/libs/light/libxl_virtio.c
--
2.31.1.272.g89b43f80a514
Hello,
This patchset adds toolstack support for I2C, GPIO and generic virtio devices.
This is inspired from the work done by Oleksandr for the Disk device.
This is developed as part of Linaro's Project Stratos, where we are working
towards Hypervisor agnostic Rust based backends [1].
This is based of Xen's master branch.
V8->V9:
- Drop changes to tools/ocaml/libs/xl/genwrap.py file.
- Replace GPIO with I2C in a comment.
- Add Reviewed-by tags.
V7->V8:
- Use macros for compatible string names.
- Use strcmp() instead of strncmp() at several places.
- Rename "virtio,devices" to "virtio,device" in commit log.
- Remove extra call to fdt_end_node().
- Disallow "unknown" in xenstore transport.
- Use libxl__strdup().
- Update documentation.
- Remove DEVICE_ADDREMOVE(virtio).
V6->V7:
- Support generic virtio devices too. They are passed with type=virtio,device,
and we only create the MMIO DT node for them.
- Add links to DT bindings of I2C and GPIO, in code and documentation.
- Call libxl__device_add() for all hypervisor types.
- Add (0, "UNKNOWN") for libxl_virtio_transport.
- Removed libxl_virtio_backend and libxl_virtioinfo, as they were unused.
- Remove unnecessary stuff from libxl__virtio_from_xenstore() and add support
for type and transport.
- Add backend=domid in documentation and replace compatible with type.
- Improved commit logs.
V5->V6:
- The cleanup patches are sent separately [2].
- We don't add I2C or GPIO specific device changes anymore, rather we create
generic "virtio" devices. The "type" of a virtio devices helps us identify the
right device, and create an entry in the DT node. The same can be used for all
Virtio devices now.
- Update man page xl.cfg.
V4->V5:
- Fixed indentation at few places.
- Removed/added blank lines.
- Added few comments.
- Added review tags from Oleksandr.
- Rebased over latest staging branch.
V3->V4:
- Update virtio_enabled independently of all devices, so we don't miss setting
it to true.
- Add iommu handling for i2c/gpio and move it as part of
make_virtio_mmio_node_common(), which gets backend_domid parameter as a
result.
V2->V3:
- Rebased over latest tree and made changes according to changes in Oleksandr's
patches from sometime back.
- Minor cleanups.
V1->V2:
- Patches 3/6 and 4/6 are new.
- Patches 5/6 and 6/6 updated based on the above two patches.
- Added link to the bindings for I2C and GPIO.
- Rebased over latest master branch.
Thanks.
--
Viresh
[1] https://lore.kernel.org/xen-devel/20220414092358.kepxbmnrtycz7mhe@vireshk-i…
Viresh Kumar (3):
libxl: Add support for generic virtio device
xl: Add support to parse generic virtio device
docs: Add documentation for generic virtio devices
docs/man/xl.cfg.5.pod.in | 33 +++++
tools/libs/light/Makefile | 1 +
tools/libs/light/libxl_arm.c | 100 +++++++++++++++
tools/libs/light/libxl_create.c | 4 +
tools/libs/light/libxl_internal.h | 6 +
tools/libs/light/libxl_types.idl | 18 +++
tools/libs/light/libxl_types_internal.idl | 1 +
tools/libs/light/libxl_virtio.c | 144 ++++++++++++++++++++++
tools/xl/xl_parse.c | 81 ++++++++++++
9 files changed, 388 insertions(+)
create mode 100644 tools/libs/light/libxl_virtio.c
--
2.31.1.272.g89b43f80a514
Hello,
This patchset adds toolstack support for I2C, GPIO and generic virtio devices.
This is inspired from the work done by Oleksandr for the Disk device.
This is developed as part of Linaro's Project Stratos, where we are working
towards Hypervisor agnostic Rust based backends [1].
This is based of Julien's for-next/4.18 branch [2].
V6->V7:
- Support generic virtio devices too. They are passed with type=virtio,device,
and we only create the MMIO DT node for them.
- Add links to DT bindings of I2C and GPIO, in code and documentation.
- Call libxl__device_add() for all hypervisor types.
- Add (0, "UNKNOWN") for libxl_virtio_transport.
- Removed libxl_virtio_backend and libxl_virtioinfo, as they were unused.
- Remove unnecessary stuff from libxl__virtio_from_xenstore() and add support
for type and transport.
- Add backend=domid in documentation and replace compatible with type.
- Improved commit logs.
V5->V6:
- The cleanup patches are sent separately [2].
- We don't add I2C or GPIO specific device changes anymore, rather we create
generic "virtio" devices. The "type" of a virtio devices helps us identify the
right device, and create an entry in the DT node. The same can be used for all
Virtio devices now.
- Update man page xl.cfg.
V4->V5:
- Fixed indentation at few places.
- Removed/added blank lines.
- Added few comments.
- Added review tags from Oleksandr.
- Rebased over latest staging branch.
V3->V4:
- Update virtio_enabled independently of all devices, so we don't miss setting
it to true.
- Add iommu handling for i2c/gpio and move it as part of
make_virtio_mmio_node_common(), which gets backend_domid parameter as a
result.
V2->V3:
- Rebased over latest tree and made changes according to changes in Oleksandr's
patches from sometime back.
- Minor cleanups.
V1->V2:
- Patches 3/6 and 4/6 are new.
- Patches 5/6 and 6/6 updated based on the above two patches.
- Added link to the bindings for I2C and GPIO.
- Rebased over latest master branch.
Thanks.
--
Viresh
[1] https://lore.kernel.org/xen-devel/20220414092358.kepxbmnrtycz7mhe@vireshk-i…
[2] https://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=shortlo…
Viresh Kumar (3):
libxl: Add support for generic virtio device
xl: Add support to parse generic virtio device
docs: Add documentation for generic virtio devices
docs/man/xl.cfg.5.pod.in | 28 +++++
tools/libs/light/Makefile | 1 +
tools/libs/light/libxl_arm.c | 103 ++++++++++++++++
tools/libs/light/libxl_create.c | 4 +
tools/libs/light/libxl_internal.h | 1 +
tools/libs/light/libxl_types.idl | 18 +++
tools/libs/light/libxl_types_internal.idl | 1 +
tools/libs/light/libxl_virtio.c | 144 ++++++++++++++++++++++
tools/ocaml/libs/xl/genwrap.py | 1 +
tools/ocaml/libs/xl/xenlight_stubs.c | 1 +
tools/xl/xl_parse.c | 80 ++++++++++++
11 files changed, 382 insertions(+)
create mode 100644 tools/libs/light/libxl_virtio.c
--
2.31.1.272.g89b43f80a514
Hello,
This patchset adds toolstack support for I2C and GPIO virtio devices. This is
inspired from the work done by Oleksandr for the Disk device.
This is developed as part of Linaro's Project Stratos, where we are working
towards Hypervisor agnostic Rust based backend [1].
This is based of origin/staging (e61a78981364 xen/arm: add iounmap after initrd
has been loaded in domain_build) and the earlier posted cleanup patches [2].
V5->V6:
- The cleanup patches are sent separately [2].
- We don't add I2C or GPIO specific device changes anymore, rather we create
generic "virtio" devices. The "type" of a virtio devices helps us identify the
right device, and create an entry in the DT node. The same can be used for all
Virtio devices now.
- Update man page xl.cfg.
V4->V5:
- Fixed indentation at few places.
- Removed/added blank lines.
- Added few comments.
- Added review tags from Oleksandr.
- Rebased over latest staging branch.
V3->V4:
- Update virtio_enabled independently of all devices, so we don't miss setting
it to true.
- Add iommu handling for i2c/gpio and move it as part of
make_virtio_mmio_node_common(), which gets backend_domid parameter as a
result.
V2->V3:
- Rebased over latest tree and made changes according to changes in Oleksandr's
patches from sometime back.
- Minor cleanups.
V1->V2:
- Patches 3/6 and 4/6 are new.
- Patches 5/6 and 6/6 updated based on the above two patches.
- Added link to the bindings for I2C and GPIO.
- Rebased over latest master branch.
Thanks.
--
Viresh
[1] https://lore.kernel.org/xen-devel/20220414092358.kepxbmnrtycz7mhe@vireshk-i…
[2] https://lore.kernel.org/all/cover.1662626550.git.viresh.kumar@linaro.org/
Viresh Kumar (3):
libxl: Add support for generic virtio device
xl: Add support to parse generic virtio device
docs: Add documentation for generic virtio devices
docs/man/xl.cfg.5.pod.in | 21 ++++
tools/libs/light/Makefile | 1 +
tools/libs/light/libxl_arm.c | 89 +++++++++++++++
tools/libs/light/libxl_create.c | 5 +
tools/libs/light/libxl_internal.h | 1 +
tools/libs/light/libxl_types.idl | 29 +++++
tools/libs/light/libxl_types_internal.idl | 1 +
tools/libs/light/libxl_virtio.c | 127 ++++++++++++++++++++++
tools/ocaml/libs/xl/genwrap.py | 1 +
tools/ocaml/libs/xl/xenlight_stubs.c | 1 +
tools/xl/xl_parse.c | 84 ++++++++++++++
11 files changed, 360 insertions(+)
create mode 100644 tools/libs/light/libxl_virtio.c
--
2.31.1.272.g89b43f80a514
Hello,
This was earlier sent as part of a patch series [1] adding support for GPIO/I2C
virtio devices. The device specific patches would require some rework and
possibly several versions, and so this series separates out the generic
independent patches into a series of their own.
This series makes some of the generic code independent of the disk device, since
it can be used for other device types later on.
Rebased over staging branch from today.
V5->V6:
- Separated into a patch series of their own.
- Updated commit log of 1st patch to cover all changes.
- Rename make_virtio_mmio_node_simple() as make_virtio_mmio_node().
- New patch 3/3, separated code from device specific patch.
--
Viresh
Viresh Kumar (3):
libxl: arm: Create alloc_virtio_mmio_params()
libxl: arm: Split make_virtio_mmio_node()
libxl: arm: make creation of iommu node independent of disk device
tools/libs/light/libxl_arm.c | 83 +++++++++++++++++++++++++-----------
1 file changed, 57 insertions(+), 26 deletions(-)
--
2.31.1.272.g89b43f80a514
--
Viresh
[1] https://lore.kernel.org/all/cover.1661159474.git.viresh.kumar@linaro.org/
Hello,
Here is another version of the rust bindings, based of the master branch.
Pushed here:
https://github.com/vireshk/libgpiod v10
V9->V10:
- Removed auto-built bindings.rs files.
- Updated license and copyright information for all files.
- Renamed gpiosim crate as gpiosim-sys.
- Cargo specific .gitnore changes moved to bindings/rust/.gitignore.
- Fixed few SAFETY comments.
- Added Reviewed-by tag from Kent. Since the changes were all minor, I haven't
dropped them.
V8->V9:
- Merged the last patch (supporting Events) with the other patches.
- Events implementation is simplified and made efficient. nth() is also
implemented for the iterator.
- Unnecessary comment removed from Cargo.toml files.
- Updated categories in libgpiod's Cargo.toml.
- Updated gpio_events example to show cloned events live past another
read_edge_events().
- Implement AsRawFd for Chip.
- Other minor changes.
V7->V8:
- Several updates to cargo.toml files, like license, version, etc.
- Removed Sync support for chip and gpiosim.
- Implemented, in a separate patch, iterator support for Events.
- Fixed missing SAFETY comments.
- Fixed build for 32 bit systems.
- Use errno::Errno.
- Removed Clone derive for many structures, that store raw pointers.
- line setting helpers return the object back, so another helper can be called
directly on them. Also made all helpers public and used the same in tests and
example for single configurations.
- Enums for gpiosim constants.
- New examples to demonstrate parallelism and event handling.
- Separated out HTE tests and marked as #[ignore] now.
- Updated commit subjects.
- Other minor changes.
V6->V7:
- Don't let buffer read new events if the earlier events are still referenced.
- BufferIntenal is gone now, to make the above work.
- Update example and tests too for the same.
V5->V6:
- Updates according to the new line-settings interface.
- New file, line_settings.rs.
- Renamed 'enum Setting' as 'SettingVal' to avoid conflicting names, as we also
have 'struct Settings' now.
- Support for HTE clock type.
- Implement 'Eq' for public structure/enums (reported by build).
- Remove 'SettingKindMap' and 'SettingMap' as they aren't required anymore.
- Updated tests based on new interface.
V4->V5:
- Arrange as workspace with crates for libgpiod-sys, libgpiod, gpiosim.
- Use static libgpiod and libgpiosim libraries instead of rebuilding again.
- Arrange in modules instead of flattened approach.
- New enums like Setting and SettingKind and new types based on them SettingMap
and SettingKindMap.
- New property independent helpers for line_config, like set_prop_default().
- Improved tests/examples, new example for gpiowatch.
- Add pre-built bindings for gpiosim too.
- Many other changes.
V3->V4:
- Rebased on top of new changes, and made changes accordingly.
- Added rust integration tests with gpiosim.
- Found a kernel bug with tests, sent a patch for that to LKML.
V2->V3:
- Remove naming redundancy, users just need to do this now
use libgpiod:{Chip, Direction, LineConfig} now (Bartosz);
- Fix lifetime issues between event-buffer and edge-event modules, the event
buffer is released after the last edge-event reference is dropped (Bartosz).
- Allow edge-event to be copied, and freed later (Bartosz).
- Add two separate rust crates, sys and wrapper (Gerard).
- Null-terminate the strings passed to libgpiod (Wedson).
- Drop unnecessary checks to validate string returned from chip:name/label/path.
- Fix SAFETY comments (Wedson).
- Drop unnecessary clone() instances (Bartosz).
V1->V2:
- Added examples (I tested everything except gpiomon.rs, didn't have right
hardware/mock device to test).
- Build rust bindings as part of Make, update documentation.
Thanks.
--
Viresh
Viresh Kumar (6):
bindings: rust: Add libgpiod-sys rust crate
bindings: rust: Add libgpiod crate
bindings: rust: Add gpiosim-sys crate
bindings: rust: Add examples to libgpiod crate
bindings: rust: Add tests for libgpiod crate
bindings: rust: Integrate building of bindings with make
README | 8 +-
TODO | 8 -
bindings/Makefile.am | 6 +
bindings/rust/.gitignore | 4 +
bindings/rust/Cargo.toml | 11 +
bindings/rust/Makefile.am | 19 +
bindings/rust/gpiosim-sys/Cargo.toml | 23 +
bindings/rust/gpiosim-sys/README.md | 14 +
bindings/rust/gpiosim-sys/build.rs | 43 ++
bindings/rust/gpiosim-sys/src/lib.rs | 74 +++
bindings/rust/gpiosim-sys/src/sim.rs | 330 ++++++++++++
bindings/rust/libgpiod-sys/Cargo.toml | 21 +
bindings/rust/libgpiod-sys/README.md | 14 +
bindings/rust/libgpiod-sys/build.rs | 41 ++
bindings/rust/libgpiod-sys/src/lib.rs | 11 +
bindings/rust/libgpiod/Cargo.toml | 25 +
.../rust/libgpiod/examples/gpio_events.rs | 88 +++
.../examples/gpio_threaded_info_events.rs | 132 +++++
bindings/rust/libgpiod/examples/gpiodetect.rs | 30 ++
bindings/rust/libgpiod/examples/gpiofind.rs | 36 ++
bindings/rust/libgpiod/examples/gpioget.rs | 45 ++
bindings/rust/libgpiod/examples/gpioinfo.rs | 97 ++++
bindings/rust/libgpiod/examples/gpiomon.rs | 74 +++
bindings/rust/libgpiod/examples/gpioset.rs | 63 +++
bindings/rust/libgpiod/examples/gpiowatch.rs | 53 ++
bindings/rust/libgpiod/src/chip.rs | 309 +++++++++++
bindings/rust/libgpiod/src/edge_event.rs | 92 ++++
bindings/rust/libgpiod/src/event_buffer.rs | 168 ++++++
bindings/rust/libgpiod/src/info_event.rs | 68 +++
bindings/rust/libgpiod/src/lib.rs | 478 ++++++++++++++++
bindings/rust/libgpiod/src/line_config.rs | 134 +++++
bindings/rust/libgpiod/src/line_info.rs | 161 ++++++
bindings/rust/libgpiod/src/line_request.rs | 226 ++++++++
bindings/rust/libgpiod/src/line_settings.rs | 296 ++++++++++
bindings/rust/libgpiod/src/request_config.rs | 94 ++++
bindings/rust/libgpiod/tests/chip.rs | 97 ++++
bindings/rust/libgpiod/tests/common/config.rs | 142 +++++
bindings/rust/libgpiod/tests/common/mod.rs | 9 +
bindings/rust/libgpiod/tests/edge_event.rs | 297 ++++++++++
bindings/rust/libgpiod/tests/info_event.rs | 166 ++++++
bindings/rust/libgpiod/tests/line_config.rs | 95 ++++
bindings/rust/libgpiod/tests/line_info.rs | 275 ++++++++++
bindings/rust/libgpiod/tests/line_request.rs | 509 ++++++++++++++++++
bindings/rust/libgpiod/tests/line_settings.rs | 203 +++++++
.../rust/libgpiod/tests/request_config.rs | 38 ++
configure.ac | 16 +
46 files changed, 5132 insertions(+), 11 deletions(-)
create mode 100644 bindings/rust/.gitignore
create mode 100644 bindings/rust/Cargo.toml
create mode 100644 bindings/rust/Makefile.am
create mode 100644 bindings/rust/gpiosim-sys/Cargo.toml
create mode 100644 bindings/rust/gpiosim-sys/README.md
create mode 100644 bindings/rust/gpiosim-sys/build.rs
create mode 100644 bindings/rust/gpiosim-sys/src/lib.rs
create mode 100644 bindings/rust/gpiosim-sys/src/sim.rs
create mode 100644 bindings/rust/libgpiod-sys/Cargo.toml
create mode 100644 bindings/rust/libgpiod-sys/README.md
create mode 100644 bindings/rust/libgpiod-sys/build.rs
create mode 100644 bindings/rust/libgpiod-sys/src/lib.rs
create mode 100644 bindings/rust/libgpiod/Cargo.toml
create mode 100644 bindings/rust/libgpiod/examples/gpio_events.rs
create mode 100644 bindings/rust/libgpiod/examples/gpio_threaded_info_events.rs
create mode 100644 bindings/rust/libgpiod/examples/gpiodetect.rs
create mode 100644 bindings/rust/libgpiod/examples/gpiofind.rs
create mode 100644 bindings/rust/libgpiod/examples/gpioget.rs
create mode 100644 bindings/rust/libgpiod/examples/gpioinfo.rs
create mode 100644 bindings/rust/libgpiod/examples/gpiomon.rs
create mode 100644 bindings/rust/libgpiod/examples/gpioset.rs
create mode 100644 bindings/rust/libgpiod/examples/gpiowatch.rs
create mode 100644 bindings/rust/libgpiod/src/chip.rs
create mode 100644 bindings/rust/libgpiod/src/edge_event.rs
create mode 100644 bindings/rust/libgpiod/src/event_buffer.rs
create mode 100644 bindings/rust/libgpiod/src/info_event.rs
create mode 100644 bindings/rust/libgpiod/src/lib.rs
create mode 100644 bindings/rust/libgpiod/src/line_config.rs
create mode 100644 bindings/rust/libgpiod/src/line_info.rs
create mode 100644 bindings/rust/libgpiod/src/line_request.rs
create mode 100644 bindings/rust/libgpiod/src/line_settings.rs
create mode 100644 bindings/rust/libgpiod/src/request_config.rs
create mode 100644 bindings/rust/libgpiod/tests/chip.rs
create mode 100644 bindings/rust/libgpiod/tests/common/config.rs
create mode 100644 bindings/rust/libgpiod/tests/common/mod.rs
create mode 100644 bindings/rust/libgpiod/tests/edge_event.rs
create mode 100644 bindings/rust/libgpiod/tests/info_event.rs
create mode 100644 bindings/rust/libgpiod/tests/line_config.rs
create mode 100644 bindings/rust/libgpiod/tests/line_info.rs
create mode 100644 bindings/rust/libgpiod/tests/line_request.rs
create mode 100644 bindings/rust/libgpiod/tests/line_settings.rs
create mode 100644 bindings/rust/libgpiod/tests/request_config.rs
--
2.31.1.272.g89b43f80a514
Hello,
Here is another version of the rust bindings, based of the master branch.
Pushed here:
https://github.com/vireshk/libgpiod v9
V8->V9:
- Merged the last patch (supporting Events) with the other patches.
- Events implementation is simplified and made efficient. nth() is also
implemented for the iterator.
- Unnecessary comment removed from Cargo.toml files.
- Updated categories in libgpiod's Cargo.toml.
- Updated gpio_events example to show cloned events live past another
read_edge_events().
- Implement AsRawFd for Chip.
- Other minor changes.
V7->V8:
- Several updates to cargo.toml files, like license, version, etc.
- Removed Sync support for chip and gpiosim.
- Implemented, in a separate patch, iterator support for Events.
- Fixed missing SAFETY comments.
- Fixed build for 32 bit systems.
- Use errno::Errno.
- Removed Clone derive for many structures, that store raw pointers.
- line setting helpers return the object back, so another helper can be called
directly on them. Also made all helpers public and used the same in tests and
example for single configurations.
- Enums for gpiosim constants.
- New examples to demonstrate parallelism and event handling.
- Separated out HTE tests and marked as #[ignore] now.
- Updated commit subjects.
- Other minor changes.
V6->V7:
- Don't let buffer read new events if the earlier events are still referenced.
- BufferIntenal is gone now, to make the above work.
- Update example and tests too for the same.
V5->V6:
- Updates according to the new line-settings interface.
- New file, line_settings.rs.
- Renamed 'enum Setting' as 'SettingVal' to avoid conflicting names, as we also
have 'struct Settings' now.
- Support for HTE clock type.
- Implement 'Eq' for public structure/enums (reported by build).
- Remove 'SettingKindMap' and 'SettingMap' as they aren't required anymore.
- Updated tests based on new interface.
V4->V5:
- Arrange as workspace with crates for libgpiod-sys, libgpiod, gpiosim.
- Use static libgpiod and libgpiosim libraries instead of rebuilding again.
- Arrange in modules instead of flattened approach.
- New enums like Setting and SettingKind and new types based on them SettingMap
and SettingKindMap.
- New property independent helpers for line_config, like set_prop_default().
- Improved tests/examples, new example for gpiowatch.
- Add pre-built bindings for gpiosim too.
- Many other changes.
V3->V4:
- Rebased on top of new changes, and made changes accordingly.
- Added rust integration tests with gpiosim.
- Found a kernel bug with tests, sent a patch for that to LKML.
V2->V3:
- Remove naming redundancy, users just need to do this now
use libgpiod:{Chip, Direction, LineConfig} now (Bartosz);
- Fix lifetime issues between event-buffer and edge-event modules, the event
buffer is released after the last edge-event reference is dropped (Bartosz).
- Allow edge-event to be copied, and freed later (Bartosz).
- Add two separate rust crates, sys and wrapper (Gerard).
- Null-terminate the strings passed to libgpiod (Wedson).
- Drop unnecessary checks to validate string returned from chip:name/label/path.
- Fix SAFETY comments (Wedson).
- Drop unnecessary clone() instances (Bartosz).
V1->V2:
- Added examples (I tested everything except gpiomon.rs, didn't have right
hardware/mock device to test).
- Build rust bindings as part of Make, update documentation.
Thanks.
--
Viresh
Viresh Kumar (8):
bindings: rust: Add libgpiod-sys rust crate
bindings: rust: Add pre generated bindings for libgpiod-sys
bindings: rust: Add gpiosim crate
bindings: rust: Add pre generated bindings for gpiosim
bindings: rust: Add libgpiod crate
bindings: rust: Add examples to libgpiod crate
bindings: rust: Add tests for libgpiod crate
bindings: rust: Integrate building of bindings with make
.gitignore | 5 +
README | 8 +-
TODO | 8 -
bindings/Makefile.am | 6 +
bindings/rust/Cargo.toml | 7 +
bindings/rust/Makefile.am | 18 +
bindings/rust/gpiosim/Cargo.toml | 22 +
bindings/rust/gpiosim/README.md | 11 +
bindings/rust/gpiosim/build.rs | 43 +
bindings/rust/gpiosim/src/bindings.rs | 180 +++
bindings/rust/gpiosim/src/lib.rs | 79 ++
bindings/rust/gpiosim/src/sim.rs | 331 +++++
bindings/rust/libgpiod-sys/Cargo.toml | 20 +
bindings/rust/libgpiod-sys/README.md | 11 +
bindings/rust/libgpiod-sys/build.rs | 41 +
bindings/rust/libgpiod-sys/src/bindings.rs | 1173 +++++++++++++++++
bindings/rust/libgpiod-sys/src/lib.rs | 13 +
bindings/rust/libgpiod/Cargo.toml | 21 +
.../rust/libgpiod/examples/gpio_events.rs | 89 ++
.../examples/gpio_threaded_info_events.rs | 133 ++
bindings/rust/libgpiod/examples/gpiodetect.rs | 31 +
bindings/rust/libgpiod/examples/gpiofind.rs | 37 +
bindings/rust/libgpiod/examples/gpioget.rs | 46 +
bindings/rust/libgpiod/examples/gpioinfo.rs | 98 ++
bindings/rust/libgpiod/examples/gpiomon.rs | 75 ++
bindings/rust/libgpiod/examples/gpioset.rs | 64 +
bindings/rust/libgpiod/examples/gpiowatch.rs | 54 +
bindings/rust/libgpiod/src/chip.rs | 310 +++++
bindings/rust/libgpiod/src/edge_event.rs | 93 ++
bindings/rust/libgpiod/src/event_buffer.rs | 167 +++
bindings/rust/libgpiod/src/info_event.rs | 69 +
bindings/rust/libgpiod/src/lib.rs | 479 +++++++
bindings/rust/libgpiod/src/line_config.rs | 135 ++
bindings/rust/libgpiod/src/line_info.rs | 162 +++
bindings/rust/libgpiod/src/line_request.rs | 227 ++++
bindings/rust/libgpiod/src/line_settings.rs | 297 +++++
bindings/rust/libgpiod/src/request_config.rs | 95 ++
bindings/rust/libgpiod/tests/chip.rs | 98 ++
bindings/rust/libgpiod/tests/common/config.rs | 143 ++
bindings/rust/libgpiod/tests/common/mod.rs | 10 +
bindings/rust/libgpiod/tests/edge_event.rs | 298 +++++
bindings/rust/libgpiod/tests/info_event.rs | 167 +++
bindings/rust/libgpiod/tests/line_config.rs | 96 ++
bindings/rust/libgpiod/tests/line_info.rs | 276 ++++
bindings/rust/libgpiod/tests/line_request.rs | 510 +++++++
bindings/rust/libgpiod/tests/line_settings.rs | 204 +++
.../rust/libgpiod/tests/request_config.rs | 39 +
configure.ac | 16 +
48 files changed, 6504 insertions(+), 11 deletions(-)
create mode 100644 bindings/rust/Cargo.toml
create mode 100644 bindings/rust/Makefile.am
create mode 100644 bindings/rust/gpiosim/Cargo.toml
create mode 100644 bindings/rust/gpiosim/README.md
create mode 100644 bindings/rust/gpiosim/build.rs
create mode 100644 bindings/rust/gpiosim/src/bindings.rs
create mode 100644 bindings/rust/gpiosim/src/lib.rs
create mode 100644 bindings/rust/gpiosim/src/sim.rs
create mode 100644 bindings/rust/libgpiod-sys/Cargo.toml
create mode 100644 bindings/rust/libgpiod-sys/README.md
create mode 100644 bindings/rust/libgpiod-sys/build.rs
create mode 100644 bindings/rust/libgpiod-sys/src/bindings.rs
create mode 100644 bindings/rust/libgpiod-sys/src/lib.rs
create mode 100644 bindings/rust/libgpiod/Cargo.toml
create mode 100644 bindings/rust/libgpiod/examples/gpio_events.rs
create mode 100644 bindings/rust/libgpiod/examples/gpio_threaded_info_events.rs
create mode 100644 bindings/rust/libgpiod/examples/gpiodetect.rs
create mode 100644 bindings/rust/libgpiod/examples/gpiofind.rs
create mode 100644 bindings/rust/libgpiod/examples/gpioget.rs
create mode 100644 bindings/rust/libgpiod/examples/gpioinfo.rs
create mode 100644 bindings/rust/libgpiod/examples/gpiomon.rs
create mode 100644 bindings/rust/libgpiod/examples/gpioset.rs
create mode 100644 bindings/rust/libgpiod/examples/gpiowatch.rs
create mode 100644 bindings/rust/libgpiod/src/chip.rs
create mode 100644 bindings/rust/libgpiod/src/edge_event.rs
create mode 100644 bindings/rust/libgpiod/src/event_buffer.rs
create mode 100644 bindings/rust/libgpiod/src/info_event.rs
create mode 100644 bindings/rust/libgpiod/src/lib.rs
create mode 100644 bindings/rust/libgpiod/src/line_config.rs
create mode 100644 bindings/rust/libgpiod/src/line_info.rs
create mode 100644 bindings/rust/libgpiod/src/line_request.rs
create mode 100644 bindings/rust/libgpiod/src/line_settings.rs
create mode 100644 bindings/rust/libgpiod/src/request_config.rs
create mode 100644 bindings/rust/libgpiod/tests/chip.rs
create mode 100644 bindings/rust/libgpiod/tests/common/config.rs
create mode 100644 bindings/rust/libgpiod/tests/common/mod.rs
create mode 100644 bindings/rust/libgpiod/tests/edge_event.rs
create mode 100644 bindings/rust/libgpiod/tests/info_event.rs
create mode 100644 bindings/rust/libgpiod/tests/line_config.rs
create mode 100644 bindings/rust/libgpiod/tests/line_info.rs
create mode 100644 bindings/rust/libgpiod/tests/line_request.rs
create mode 100644 bindings/rust/libgpiod/tests/line_settings.rs
create mode 100644 bindings/rust/libgpiod/tests/request_config.rs
--
2.31.1.272.g89b43f80a514