search for: dma_set_mask_and_coherent

Displaying 20 results from an estimated 106 matches for "dma_set_mask_and_coherent".

2017 Jan 10
5
[PATCH] virtio_mmio: Set DMA masks appropriately
...e *mem; unsigned long magic; + int rc; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) if (vm_dev->version == 1) writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); + if (rc) + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + else if (vm_dev->version == 1) + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32 + PAGE_SHIFT)); + if (rc) + dev_warn(&pdev->dev, "Failed to enable 64-...
2017 Jan 10
5
[PATCH] virtio_mmio: Set DMA masks appropriately
...e *mem; unsigned long magic; + int rc; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) if (vm_dev->version == 1) writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); + if (rc) + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + else if (vm_dev->version == 1) + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32 + PAGE_SHIFT)); + if (rc) + dev_warn(&pdev->dev, "Failed to enable 64-...
2023 May 03
1
[PATCH v5 virtio 02/11] 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 at amd.com> --- drivers/virtio/virtio_pci_modern_dev.c | 3 ++- include/linux/virtio_pci_modern.h | 3 +++ 2 file...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...* We support 64-bit DMA. If this fails (e.g. some bridge > + * or PV code doesn't or DAC is disabled), then we're okay > + * with 32-bit DMA. <scratches his head> I am having a hard time parsing that. Could you expand a bit the faulting use-case please? > + */ > + dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); The usual process is: ret = dma_set_mask_and_coherent(..) if (ret) ret = dma_set_mask_and_coherent(.., DMA_BIT_MASK(32)) if (ret) pr_warn("We are truly screwed. Good luck!\n"); > + > err = pci_request_regions(pci_dev, "virti...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...* We support 64-bit DMA. If this fails (e.g. some bridge > + * or PV code doesn't or DAC is disabled), then we're okay > + * with 32-bit DMA. <scratches his head> I am having a hard time parsing that. Could you expand a bit the faulting use-case please? > + */ > + dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); The usual process is: ret = dma_set_mask_and_coherent(..) if (ret) ret = dma_set_mask_and_coherent(.., DMA_BIT_MASK(32)) if (ret) pr_warn("We are truly screwed. Good luck!\n"); > + > err = pci_request_regions(pci_dev, "virti...
2017 Jan 10
1
[PATCH] virtio_mmio: Set DMA masks appropriately
...tform_get_resource(pdev, IORESOURCE_MEM, 0); >> if (!mem) >> @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) >> if (vm_dev->version == 1) >> writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); >> >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); >> + if (rc) >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); >> + else if (vm_dev->version == 1) >> + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32 + PAGE_SHIFT)); > > That's a very co...
2017 Jan 10
1
[PATCH] virtio_mmio: Set DMA masks appropriately
...tform_get_resource(pdev, IORESOURCE_MEM, 0); >> if (!mem) >> @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) >> if (vm_dev->version == 1) >> writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); >> >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); >> + if (rc) >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); >> + else if (vm_dev->version == 1) >> + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32 + PAGE_SHIFT)); > > That's a very co...
2017 Jan 10
0
[PATCH] virtio_mmio: Set DMA masks appropriately
...> > mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (!mem) > @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) > if (vm_dev->version == 1) > writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); > > + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); > + if (rc) > + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > + else if (vm_dev->version == 1) > + dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32 + PAGE_SHIFT)); That's a very convoluted way to do this, f...
2014 Aug 27
0
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...>> + * or PV code doesn't or DAC is disabled), then we're okay >> + * with 32-bit DMA. > > <scratches his head> > > I am having a hard time parsing that. Could you expand a bit the > faulting use-case please? > >> + */ >> + dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); > > The usual process is: > > ret = dma_set_mask_and_coherent(..) > if (ret) > ret = dma_set_mask_and_coherent(.., DMA_BIT_MASK(32)) > > if (ret) > pr_warn("We are truly...
2023 Mar 23
0
[PATCH v3 virtio 1/8] virtio: allow caller to override device id and DMA mask
...= pci_dev->device - 0x1040; > + } > } > mdev->id.vendor = pci_dev->subsystem_vendor; > > @@ -260,7 +267,12 @@ 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)); > + if (mdev->dma_mask_override) > + err = dma_set_mask_and_coherent(&pci_dev->dev, > + mdev->dma_mask_override); > + else > + err = dma_set_mas...
2017 Jan 10
1
[PATCH] virtio_mmio: Set DMA masks appropriately
...2017 12:26:01 PM CET Robin Murphy wrote: >> @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) >> if (vm_dev->version == 1) >> writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); >> >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); >> + if (rc) >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > > You don't seem to do anything different when 64-bit DMA is unsupported. > How do you prevent the use of kernel buffers that...
2017 Jan 10
1
[PATCH] virtio_mmio: Set DMA masks appropriately
...2017 12:26:01 PM CET Robin Murphy wrote: >> @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) >> if (vm_dev->version == 1) >> writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); >> >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); >> + if (rc) >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > > You don't seem to do anything different when 64-bit DMA is unsupported. > How do you prevent the use of kernel buffers that...
2017 Jan 10
4
[PATCH v2 1/2] virtio_mmio: Set DMA masks appropriately
...k(&pdev->dev, DMA_BIT_MASK(64)); + /* + * In the legacy case, ensure our coherently-allocated virtio + * ring will be at an address expressable as a 32-bit PFN. + */ + if (!rc) + dma_set_coherent_mask(&pdev->dev, + DMA_BIT_MASK(32 + PAGE_SHIFT)); + } else { + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); + } + if (rc) + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (rc) + dev_warn(&pdev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n"); + platform_set_drvdata(pdev, vm...
2017 Jan 10
4
[PATCH v2 1/2] virtio_mmio: Set DMA masks appropriately
...k(&pdev->dev, DMA_BIT_MASK(64)); + /* + * In the legacy case, ensure our coherently-allocated virtio + * ring will be at an address expressable as a 32-bit PFN. + */ + if (!rc) + dma_set_coherent_mask(&pdev->dev, + DMA_BIT_MASK(32 + PAGE_SHIFT)); + } else { + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); + } + if (rc) + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); + if (rc) + dev_warn(&pdev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n"); + platform_set_drvdata(pdev, vm...
2014 Sep 17
4
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...info->queue, info->queue_dma_addr); > + } else { > + free_pages_exact(info->queue, PAGE_ALIGN(size)); > + } > kfree(info); > } > > @@ -713,6 +778,13 @@ static int virtio_pci_probe(struct pci_dev *pci_dev, > if (err) > goto out; > > + err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); > + if (err) > + err = dma_set_mask_and_coherent(&pci_dev->dev, > + DMA_BIT_MASK(32)); > + if (err) > + dev_warn(&pci_dev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n&q...
2014 Sep 17
4
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...info->queue, info->queue_dma_addr); > + } else { > + free_pages_exact(info->queue, PAGE_ALIGN(size)); > + } > kfree(info); > } > > @@ -713,6 +778,13 @@ static int virtio_pci_probe(struct pci_dev *pci_dev, > if (err) > goto out; > > + err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); > + if (err) > + err = dma_set_mask_and_coherent(&pci_dev->dev, > + DMA_BIT_MASK(32)); > + if (err) > + dev_warn(&pci_dev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n&q...
2014 Sep 17
1
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...info->queue, info->queue_dma_addr); > + } else { > + free_pages_exact(info->queue, PAGE_ALIGN(size)); > + } > kfree(info); > } > > @@ -713,6 +778,13 @@ static int virtio_pci_probe(struct pci_dev *pci_dev, > if (err) > goto out; > > + err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); > + if (err) > + err = dma_set_mask_and_coherent(&pci_dev->dev, > + DMA_BIT_MASK(32)); > + if (err) > + dev_warn(&pci_dev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n&q...
2014 Sep 17
1
[PATCH v5 2/3] virtio_pci: Use the DMA API for virtqueues when possible
...info->queue, info->queue_dma_addr); > + } else { > + free_pages_exact(info->queue, PAGE_ALIGN(size)); > + } > kfree(info); > } > > @@ -713,6 +778,13 @@ static int virtio_pci_probe(struct pci_dev *pci_dev, > if (err) > goto out; > > + err = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(64)); > + if (err) > + err = dma_set_mask_and_coherent(&pci_dev->dev, > + DMA_BIT_MASK(32)); > + if (err) > + dev_warn(&pci_dev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to continue, but this might not work.\n&q...
2017 Jan 10
0
[PATCH] virtio_mmio: Set DMA masks appropriately
...uesday, January 10, 2017 12:26:01 PM CET Robin Murphy wrote: > @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) > if (vm_dev->version == 1) > writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); > > + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); > + if (rc) > + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); You don't seem to do anything different when 64-bit DMA is unsupported. How do you prevent the use of kernel buffers that are above the first 4G...
2017 Jan 10
0
[PATCH] virtio_mmio: Set DMA masks appropriately
...n Murphy wrote: > >> @@ -548,6 +550,14 @@ static int virtio_mmio_probe(struct platform_device *pdev) > >> if (vm_dev->version == 1) > >> writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE); > >> > >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); > >> + if (rc) > >> + rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > > > > You don't seem to do anything different when 64-bit DMA is unsupported. > > How do you prevent the us...