If I have only the physical address of device buffer (PCIe), how can I map this buffer to user-space?

前端 未结 2 1365
[愿得一人]
[愿得一人] 2021-01-27 08:10

If I have only the physical address of the memory buffer to which is mapped the device buffer via the PCI-Express BAR (Base Address Register), how can I map thi

2条回答
  •  灰色年华
    2021-01-27 09:04

    Mapping PCI resource is dependent on the architecture.

    BARs are already available to userspace with the sysfs files /sys/bus/pci/devices/*/resource*, which support mmap.

    This is implemented by the function pci_mmap_resource in drivers/pci/pci-sysfs.c, which ends up calling pci_mmap_page_range.

提交回复
热议问题