CV-Bowen opened a new pull request, #22453:
URL: https://github.com/apache/nuttx/pull/22453

   ## Summary
   
   `ivshmem` is a bus: backends (PCI today) register devices, and drivers
   (ramdisk, uio, rptun) bind to them.  It lived inside `drivers/pci`, so a 
board
   without PCI could not use it, and every driver in it carried a `pci_` prefix.
   
   - `include/nuttx/pci: evaluate dev in the MMIO accessors`: the
     `pci_{read,write}_mmio_*()` macros take `dev` and never expand it, so a 
local
     that only feeds `dev` is reported unused.  After the split below,
     `pci_ivshmem_kick_peer()` has `priv` for exactly that purpose:
   
     ```
     drivers/pci/pci_ivshmem.c:94:29: warning: unused variable 'priv'
     ```
   
     Evaluate it as `(void)(dev)`, as the I/O accessors already do.
   - `drivers/ivshmem: split the ivshmem bus out of pci_ivshmem`: the device and
     driver matching moves to `drivers/ivshmem/ivshmem.c`, with its own header
     `include/nuttx/ivshmem.h`.  `drivers/pci/pci_ivshmem.c` keeps the PCI
     backend and registers each probed device on the bus.
   - `drivers/ivshmem: let the backend choose the device id`: the bus numbered
     devices in registration order; a backend may now set the id it needs, and
     the bus assigns the next one only when it is negative.  It comes before the
     move because a later backend takes its id from its own configuration.
   - `drivers/ivshmem: move the ivshmem drivers out of drivers/pci`: the ramdisk
     and uio drivers move to `drivers/ivshmem/`, the rptun ivshmem driver's
     registration moves with them, and their Kconfig and API names lose the
     `pci_` prefix.
   
   ## Impact
   
   - A new `drivers/ivshmem/` directory with its own Kconfig, Make.defs and
     CMakeLists.txt.  Boards without PCI can select `IVSHMEM` once a non-PCI
     backend is added.
   - Kconfig renames: `PCI_RAMDISK_IVSHMEM` -> `RAMDISK_IVSHMEM`,
     `PCI_UIO_IVSHMEM` -> `UIO_IVSHMEM`, and the same for their `_IDTABLE` and
     `_NPOLLWAITERS` options.  No in-tree defconfig selects the old names.
   - `RPTUN_IVSHMEM` now depends on `IVSHMEM` rather than `PCI_IVSHMEM`, so it 
is
     available to any backend.
   - Public API renames, all in-tree callers updated:
   
     | was | now |
     |---|---|
     | `pci_register_rptun_ivshmem_driver()` | `rptun_ivshmem_register()` |
     | `pci_register_rptun_ivshmem_slave_driver()` | 
`rptun_ivshmem_register_slave()` |
     | `pci_register_ramdisk_ivshmem_driver()` | `ivshmem_ramdisk_register()` |
     | `pci_register_uio_ivshmem_driver()` | `ivshmem_uio_register()` |
   
     Registration is now driven by `ivshmem_register_drivers()`, called from
     `drivers_initialize()` next to the PCI registration instead of inside
     `pci_register_drivers()`.
   - No behaviour change: the same drivers register for the same devices, and 
the
     device names (`/dev/uioX`, the ramdisk names, the rptun names) are 
unchanged.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64; arm-none-eabi-gcc 10.3-2021.10.
   
   **Builds**, 0 warnings each: `qemu-armv7a:rpserver` and
   `qemu-armv7a:rpproxy`, which enable `CONFIG_PCI_IVSHMEM` and
   `CONFIG_RPTUN_IVSHMEM` - the configurations the split touches.
   
   **Baseline**: `sim:rpserver`/`rpproxy` and
   `qemu-armv8a:rpserver`/`rpproxy` boot and pass the rpmsg cases (dump, ping,
   rpmsgfs).  The qemu-armv8a pair is the runtime check for this change: those
   images enable `PCI_IVSHMEM` and `RPTUN_IVSHMEM`, so they create the bus,
   register the PCI backend device on it and bind the rptun driver through the
   new path.
   
   The `qemu-armv7a` pair cannot be used as a runtime check: with this QEMU
   setup both master and this branch data-abort during boot (`arm_dataabort`,
   `AppBring`), before reaching the shell, so there is nothing to compare.
   
   checkpatch passes on all four commits.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to