Re: [PATCH] virtio_mmio: Set DMA masks appropriately

From
Arnd Bergmann <arnd@arndb.de>
Date
2017-01-10 13:15:57
Also in
linux-arm-kernel
On Tuesday, January 10, 2017 12:26:01 PM CET Robin Murphy wrote:
quoted hunk
@@ -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_dev->version == 1)
+               dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32 + PAGE_SHIFT));
Why is this limitation only for the coherent mask?

	Arnd
Thread (3 messages) 3 messages, 3 authors, last reply 2017-01-10
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help