Branch: refs/heads/main Home: https://github.com/OpenAMP/libmetal Commit: 17148ddb10e555b833084cfdb602d2de3617bd5f https://github.com/OpenAMP/libmetal/commit/17148ddb10e555b833084cfdb602d2de3... Author: Ben Levinsky ben.levinsky@amd.com Date: 2026-08-26 (Wed, 26 Aug 2026)
Changed paths: M lib/system/linux/device.c
Log Message: ----------- lib: linux: preserve device-open errors
The Linux bus open path may try more than one backend driver for a device. When a backend finds the device but fails while opening it, the common open loop currently discards that errno and returns -ENODEV after all drivers have been tried.
Keep the first useful backend open error, preferring non-ENODEV failures over a plain miss. This preserves the existing not-found result while letting callers see real failures such as UIO map population errors.
Signed-off-by: Ben Levinsky ben.levinsky@amd.com
Commit: ec3f4d7c90f38ef0963b18956fd2c4a98b4f0aeb https://github.com/OpenAMP/libmetal/commit/ec3f4d7c90f38ef0963b18956fd2c4a98... Author: Ben Levinsky ben.levinsky@amd.com Date: 2026-08-26 (Wed, 26 Aug 2026)
Changed paths: M lib/system/linux/device.c
Log Message: ----------- lib: linux: fix UIO mmap offset handling
UIO map offsets identify the usable resource start inside the page-aligned mapping exposed by sysfs. The Linux backend previously exposed and unmapped the adjusted virtual address directly.
Keep the raw mmap base and length for close, expose the usable virtual address as raw mapping plus offset, and derive the libmetal physical base and size from the usable portion of the UIO map.
Use the sysfs map size as the mmap length. For an unaligned resource, UIO already reports a page-aligned address and a full mmap length, so adding the offset to that length can over-map the resource and fail.
Reject offsets outside the system page size, reject offsets beyond the map size, and report overflow before attempting to mmap the region.
Signed-off-by: Ben Levinsky ben.levinsky@amd.com
Commit: 6fa7ee61b57d86bd15a3ca840517cd12cc08819e https://github.com/OpenAMP/libmetal/commit/6fa7ee61b57d86bd15a3ca840517cd12c... Author: Ben Levinsky ben.levinsky@amd.com Date: 2026-08-26 (Wed, 26 Aug 2026)
Changed paths: M lib/system/linux/device.c M lib/system/linux/irq.c M lib/system/linux/irq.h
Log Message: ----------- lib: linux: clear UIO IRQ bookkeeping on close
A UIO-backed device registers its file descriptor with the Linux IRQ controller so interrupt handling can find the owning metal device. Closing the device must clear that association before closing the fd.
Add an internal unregister helper that detaches the device pointer after the IRQ consumer has disabled the IRQ. Keep IRQ handler and enable-state teardown owned by the standard IRQ disable and unregister paths.
Signed-off-by: Ben Levinsky ben.levinsky@amd.com
Commit: f36b09679479ffda6eb4ae173162663e25d1d00b https://github.com/OpenAMP/libmetal/commit/f36b09679479ffda6eb4ae173162663e2... Author: Ben Levinsky ben.levinsky@amd.com Date: 2026-08-26 (Wed, 26 Aug 2026)
Changed paths: M lib/system/linux/device.c
Log Message: ----------- lib: linux: factor common UIO populate path
Split the UIO open flow into two stages. The parent-bus path still opens the platform or PCI sysfs device, binds it to the selected UIO driver, finds the child UIO class device, and records the resolved class and /dev paths.
Move the common stage into metal_uio_populate(). That helper waits for the /dev/uioX node, opens it, reads each UIO map, maps the full mmap extent, exposes the usable region after the sysfs offset, and registers IRQ bookkeeping when the UIO fd supports interrupts.
Keep close-time cleanup unchanged by storing the raw mmap address and length alongside the adjusted libmetal I/O region. On populate failure, unmap any regions mapped so far and close the UIO fd locally before the generic open path releases parent sysfs and driver override state.
Also make local error paths close the temporary UIO child list before returning.
Signed-off-by: Ben Levinsky ben.levinsky@amd.com
Commit: a39557108e22b4c392b554b05325262a6a9d3617 https://github.com/OpenAMP/libmetal/commit/a39557108e22b4c392b554b05325262a6... Author: Ben Levinsky ben.levinsky@amd.com Date: 2026-08-26 (Wed, 26 Aug 2026)
Changed paths: M lib/system/linux/device.c
Log Message: ----------- lib: linux: add UIO class-name lookup
Add the resolver used by the synthetic uio bus. It scans every /sys/class/uio/uioX/name file, compares the first line against the requested libmetal device name, and rejects duplicate matches because they cannot be opened deterministically.
When a unique match is found, fill the same linux_device fields that the parent-bus UIO path fills: cls_path points at the UIO sysfs class directory, dev_path points at /dev/uioX, and the UIO name and device node name are saved for diagnostics and future callers.
The class-name open callback then reuses metal_uio_populate(), so UIO class opens and parent-bus UIO opens share mmap setup, IRQ registration, DMA handling, and close-time cleanup.
Signed-off-by: Ben Levinsky ben.levinsky@amd.com
Commit: 02e46d91d3d864b343ba0d03ebaa031f9558707e https://github.com/OpenAMP/libmetal/commit/02e46d91d3d864b343ba0d03ebaa031f9... Author: Ben Levinsky ben.levinsky@amd.com Date: 2026-08-26 (Wed, 26 Aug 2026)
Changed paths: M lib/system/linux/device.c
Log Message: ----------- lib: linux: register synthetic UIO bus
Register a synthetic Linux uio bus so callers can use the existing metal_device_open("uio", name, ...) API shape to open UIO devices by the value exported in /sys/class/uio/uioX/name.
This bus is not backed by a sysfs bus directory or a probed kernel driver handle. During Linux bus initialization, register it only when /sys/class/uio exists, and skip the normal sysfs bus and driver probing that platform and PCI devices require.
During device open, allow the synthetic uio driver to run its class-name open callback without an sdrv handle. The callback resolves the UIO class device and then uses the shared populate path added earlier, so the new bus preserves the same mmap, IRQ, DMA, and close semantics as existing UIO-backed platform and PCI opens.
Also make bus close tolerate the missing sysfs bus handle and copy the requested device name with snprintf() so oversized names fail cleanly.
Signed-off-by: Ben Levinsky ben.levinsky@amd.com
Compare: https://github.com/OpenAMP/libmetal/compare/43a59cdd505a...02e46d91d3d8
To unsubscribe from these emails, change your notification settings at https://github.com/OpenAMP/libmetal/settings/notifications