On 10.12.2018 18:12, Vivek Goyal wrote: > From: Stefan Hajnoczi <stefanha@xxxxxxxxxx> > +static int virtio_fs_setup_dax(struct virtio_device *vdev, struct virtio_fs *fs) > +{ > + struct virtio_fs_memremap_info *mi; > + struct dev_pagemap *pgmap; > + struct pci_dev *pci_dev; > + phys_addr_t phys_addr; > + size_t len; > + int ret; > + > + if (!IS_ENABLED(CONFIG_DAX_DRIVER)) > + return 0; > + > + /* HACK implement VIRTIO shared memory regions instead of > + * directly accessing the PCI BAR from a virtio device driver. > + */ > + pci_dev = container_of(vdev->dev.parent, struct pci_dev, dev); > + > + /* TODO Is this safe - the virtio_pci_* driver doesn't use managed > + * device APIs? */ > + ret = pcim_enable_device(pci_dev); > + if (ret < 0) > + return ret; > + > + /* TODO handle case where device doesn't expose BAR? */ > + ret = pci_request_region(pci_dev, VIRTIO_FS_WINDOW_BAR, > + "virtio-fs-window"); > + if (ret < 0) { > + dev_err(&vdev->dev, "%s: failed to request window BAR\n", > + __func__); > + return ret; > + } Can we please have a generic virtio interface to map the address (the default can then fall back to PCI) instead of mapping a PCI bar? This would make it easier to implement virtio-ccw or virtio-mmio.