Displaying 20 results from an estimated 219 matches for "dma_bit_mask".
2017 Jan 10
5
[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));
+ if (rc)
+ dev_warn(&pdev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to co...
2017 Jan 10
5
[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));
+ if (rc)
+ dev_warn(&pdev->dev, "Failed to enable 64-bit or 32-bit DMA. Trying to co...
2015 Sep 04
4
[PATCH 0/4] tegra: DMA mask and IOMMU bit fixes
These 4 patches fix two issues that existed on Tegra regarding DMA:
1) The bit indicating whether to use an IOMMU or not was hardcoded ; make this
a platform property and use it in instmem
2) The DMA mask was not set for platform devices. Fix this by converting
more pci_dma* to the DMA API, and use that more generic code to set the
DMA mask properly for all platforms.
Tested on both x86
2023 May 03
1
[PATCH v5 virtio 02/11] virtio: allow caller to override device DMA mask in vp_modern
...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 files changed, 5 insertions(+), 1 deletion(-)...
2017 Jan 10
4
[PATCH v2 1/2] virtio_mmio: Set DMA masks appropriately
...mmio_probe(struct platform_device *pdev)
}
vm_dev->vdev.id.vendor = readl(vm_dev->base + VIRTIO_MMIO_VENDOR_ID);
- if (vm_dev->version == 1)
+ if (vm_dev->version == 1) {
writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
+ rc = dma_set_mask(&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(&pd...
2017 Jan 10
4
[PATCH v2 1/2] virtio_mmio: Set DMA masks appropriately
...mmio_probe(struct platform_device *pdev)
}
vm_dev->vdev.id.vendor = readl(vm_dev->base + VIRTIO_MMIO_VENDOR_ID);
- if (vm_dev->version == 1)
+ if (vm_dev->version == 1) {
writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
+ rc = dma_set_mask(&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(&pd...
2017 Jan 10
1
[PATCH] virtio_mmio: Set DMA masks appropriately
...> @@ -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
> here...
2017 Jan 10
1
[PATCH] virtio_mmio: Set DMA masks appropriately
...> @@ -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
> here...
2017 Jan 10
1
[PATCH] virtio_mmio: Set DMA masks appropriately
...>> 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, for ver...
2017 Jan 10
1
[PATCH] virtio_mmio: Set DMA masks appropriately
...>> 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, for ver...
2017 Jan 10
0
[PATCH] virtio_mmio: Set DMA masks appropriately
...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 abo...
2017 Jan 10
0
[PATCH] virtio_mmio: Set DMA masks appropriately
...ev, 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, for version 1 you
set coherent ma...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...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, "virtio-pci");
> if (err)
>...
2014 Aug 27
2
[PATCH 3/3] virtio_pci: Use the DMA API for virtqueues
...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, "virtio-pci");
> if (err)
>...
2014 Feb 01
0
[RFC 02/16] drm/nouveau: basic support for platform devices
...ouveau_ttm_init(struct nouveau_drm *drm)
{
struct drm_device *dev = drm->dev;
+ struct nouveau_device *device = nv_device(drm->device);
u32 bits;
int ret;
bits = nouveau_vmmgr(drm->device)->dma_bits;
- if ( drm->agp.stat == ENABLED ||
- !pci_dma_supported(dev->pdev, DMA_BIT_MASK(bits)))
- bits = 32;
-
- ret = pci_set_dma_mask(dev->pdev, DMA_BIT_MASK(bits));
- if (ret)
- return ret;
-
- ret = pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(bits));
- if (ret)
- pci_set_consistent_dma_mask(dev->pdev, DMA_BIT_MASK(32));
+ if (nv_device_is_pci(device)) {
+ if (...
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 use of kernel buffers that are above the first 4G
here?
> + else if (vm_...
2023 Mar 23
0
[PATCH v3 virtio 1/8] virtio: allow caller to override device id and DMA mask
...}
> }
> 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_mask_and_coherent(&pci_dev->dev...
2019 Jun 03
2
[PATCH v3 2/8] s390/cio: introduce DMA pools to cio
...ere...
>
> @Halil, please let me know what comment you prefere here...
>
How about?
/*
* The physical addresses of some the dma structures that
* can belong to a subchannel need to fit 31 bit width (examples ccw,).
*/
> >
> >> + sch->dev.coherent_dma_mask = DMA_BIT_MASK(31);
> >> + sch->dev.dma_mask = &sch->dev.coherent_dma_mask;
> >> return sch;
> >>
> >> err:
> >> @@ -899,6 +903,8 @@ static int __init setup_css(int nr)
> >> dev_set_name(&css->device, "css%x", nr);
> &g...
2019 Jun 03
2
[PATCH v3 2/8] s390/cio: introduce DMA pools to cio
...ere...
>
> @Halil, please let me know what comment you prefere here...
>
How about?
/*
* The physical addresses of some the dma structures that
* can belong to a subchannel need to fit 31 bit width (examples ccw,).
*/
> >
> >> + sch->dev.coherent_dma_mask = DMA_BIT_MASK(31);
> >> + sch->dev.dma_mask = &sch->dev.coherent_dma_mask;
> >> return sch;
> >>
> >> err:
> >> @@ -899,6 +903,8 @@ static int __init setup_css(int nr)
> >> dev_set_name(&css->device, "css%x", nr);
> &g...
2019 Jun 03
5
[PATCH v3 2/8] s390/cio: introduce DMA pools to cio
...bchannel(struct subchannel_id schid,
> INIT_WORK(&sch->todo_work, css_sch_todo);
> sch->dev.release = &css_subchannel_release;
> device_initialize(&sch->dev);
It might be helpful to add a comment why you use 31 bit here...
> + sch->dev.coherent_dma_mask = DMA_BIT_MASK(31);
> + sch->dev.dma_mask = &sch->dev.coherent_dma_mask;
> return sch;
>
> err:
> @@ -899,6 +903,8 @@ static int __init setup_css(int nr)
> dev_set_name(&css->device, "css%x", nr);
> css->device.groups = cssdev_attr_groups;
> css->...