diff options
author | Shannon Nelson <shannon.nelson@amd.com> | 2023-05-19 14:56:23 -0700 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2023-06-27 10:47:08 -0400 |
commit | 5d7d82d39eb4cab2c7d0d85baaee0fc45d2c7900 (patch) | |
tree | 21db1e3ed4af7b2fd26730a9f899ba67628c294f /drivers/virtio | |
parent | a37c0191acbd58efab4da43372585207f30e3102 (diff) |
virtio: allow caller to override device DMA mask in vp_modern
To add a bit of vendor flexibility with various virtio based devices,
allow the caller to specify a different DMA mask. This adds a dma_mask
field to struct virtio_pci_modern_device. If defined by the driver,
this mask will be used in a call to dma_set_mask_and_coherent() instead
of the traditional DMA_BIT_MASK(64). This allows limiting the DMA space
on vendor devices with address limitations.
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Message-Id: <20230519215632.12343-3-shannon.nelson@amd.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_pci_modern_dev.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c index 9b2d6614de67..aad7d9296e77 100644 --- a/drivers/virtio/virtio_pci_modern_dev.c +++ b/drivers/virtio/virtio_pci_modern_dev.c @@ -268,7 +268,8 @@ int vp_modern_probe(struct virtio_pci_modern_device *mdev) return -EINVAL; } - err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); + err = dma_set_mask_and_coherent(&pci_dev->dev, + mdev->dma_mask ? : DMA_BIT_MASK(64)); if (err) err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32)); |