Skip to content

Add PCI Ivshmem support: rptun_ivshmem and uio_ivshmem#12766

Closed
CV-Bowen wants to merge 19 commits intoapache:masterfrom
CV-Bowen:pci-ivshmem
Closed

Add PCI Ivshmem support: rptun_ivshmem and uio_ivshmem#12766
CV-Bowen wants to merge 19 commits intoapache:masterfrom
CV-Bowen:pci-ivshmem

Conversation

@CV-Bowen
Copy link
Copy Markdown
Contributor

Summary

  1. Optimize the PCI frameworks and add pci_ecam for arm archtecture;
  2. Implement the rptun_ivshmem.c driver for rpmsg communication in QEMU;
  3. Implement the uio_ivshmem.c driver for application to access the memory provided by ivshmem device;
  4. Enable above features in ARM64 QEMU platfrom;

Impact

PCI

Testing

arm64 nsh

yangshuyong and others added 19 commits July 25, 2024 23:13
Now the pci framework can be used in arm archtecture

Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
Some bugs fix for the pci framework

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Add rptun ivshmem driver support, ivshmem is a pci device provided
by QEMU to make two virtual machines can access the same share memory.
Base on the ivshmem, we implement the rptun_ivshmem driver to make
rptun work in the QEMU platform.

Now two nuttxs in QEMU can communicate with each other through Rpmsg.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
In file included from pci/pci.c:30:
pci/pci.c: In function 'pci_setup_device':
pci/pci.c:449:66: warning: right shift count >= width of type [-Wshift-count-overflow]
  449 |           pci_write_config_dword(dev, base_address_1, res->start >> 32);
      |                                                                  ^~
pci/pci.c: In function 'pci_presetup_bridge':
pci/pci.c:541:51: warning: right shift count >= width of type [-Wshift-count-overflow]
  541 |                              ctrl->mem_pref.start >> 32);
      |                                                   ^~
pci/pci.c: In function 'pci_postsetup_bridge':
pci/pci.c:604:57: warning: right shift count >= width of type [-Wshift-count-overflow]
  604 |                              (ctrl->mem_pref.start - 1) >> 32);
      |                                                         ^~
CC:  pthread/pthread_release.c pci/pci_ecam.c:71:12: warning: initialization of 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  uint32_t *)' {aka 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  long unsigned int *)'} from incompatible pointer type 'int (*)(struct pci_bus_s *, uint32_t,  int,  int,  uint32_t *)' {aka 'int (*)(struct pci_bus_s *, long unsigned int,  int,  int,  long unsigned int *)'} [-Wincompatible-pointer-types]
   71 |   .read  = pci_ecam_read_config,
      |            ^~~~~~~~~~~~~~~~~~~~
pci/pci_ecam.c:71:12: note: (near initialization for 'g_pci_ecam_ops.read')
pci/pci_ecam.c:72:12: warning: initialization of 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  uint32_t)' {aka 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  long unsigned int)'} from incompatible pointer type 'int (*)(struct pci_bus_s *, uint32_t,  int,  int,  uint32_t)' {aka 'int (*)(struct pci_bus_s *, long unsigned int,  int,  int,  long unsigned int)'} [-Wincompatible-pointer-types]
   72 |   .write = pci_ecam_write_config,

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Now all the type of devfn in pci framework are unsigned int

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Update x86_64 pci controller driver

Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
pci/pci.c:415:34: warning: variable ‘res’ set but not used [-Wunused-but-set-variable]
  415 |       FAR struct pci_resource_s *res;
      |                                  ^~~
pci/pci.c: In function ‘pci_scan_bus’:
pci/pci.c:663:32: warning: unused variable ‘ctrl’ [-Wunused-variable]
  663 |   FAR struct pci_controller_s *ctrl = bus->ctrl;

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Change the qmeu pci test code for new pci driver framework

Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Change the qemu pci edu driver code for new pci driver framework

Signed-off-by: yangshuyong <yangshuyong@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Application can open "/dev/uioX" and use `mmap()` to get the
memory provided by ivshmem device.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
@CV-Bowen
Copy link
Copy Markdown
Contributor Author

This PR is a bit messy, I need some time to organize it. Please not review, thanks.

@xiaoxiang781216 xiaoxiang781216 marked this pull request as draft July 26, 2024 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants