Re: [PATCH v3 5/7] vfio: move barmap to a separate function and export
From: Alex Williamson
Date: Fri Nov 21 2025 - 16:08:47 EST
On Fri, 21 Nov 2025 15:58:19 -0500
Donald Dutile <ddutile@xxxxxxxxxx> wrote:
> On 11/21/25 11:39 AM, Alex Williamson wrote:
> > On Fri, 21 Nov 2025 14:11:39 +0000
> > <ankita@xxxxxxxxxx> wrote:
> >> +
> >> int vfio_pci_core_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma)
> >> {
> >> struct vfio_pci_core_device *vdev =
> >> @@ -1761,18 +1784,9 @@ int vfio_pci_core_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma
> >> * Even though we don't make use of the barmap for the mmap,
> >> * we need to request the region and the barmap tracks that.
> >> */
> >> - if (!vdev->barmap[index]) {
> >> - ret = pci_request_selected_regions(pdev,
> >> - 1 << index, "vfio-pci");
> >> - if (ret)
> >> - return ret;
> >> -
> >> - vdev->barmap[index] = pci_iomap(pdev, index, 0);
> >> - if (!vdev->barmap[index]) {
> >> - pci_release_selected_regions(pdev, 1 << index);
> >> - return -ENOMEM;
> >> - }
> >> - }
> >> + ret = vfio_pci_core_barmap(vdev, index);
> >> + if (ret)
> >> + return ret;
> >>
> so, vfio_pci_core_mmap() should be calling vfio_pci_core_setup_barmap() vs. what it does above currently?
Yeah, it probably should have happened in 8bccc5b80678 ("vfio/pci:
Expose vfio_pci_core_setup_barmap()") when the static function in
vfio_pci_rdwr.c was exported. Better late than never. Thanks,
Alex