Skip to content

Commit ee7f522

Browse files
robherringbostrovs
authored andcommitted
xen: Stop abusing DT of_dma_configure API
As the removed comments say, these aren't DT based devices. of_dma_configure() is going to stop allowing a NULL DT node and calling it will no longer work. The comment is also now out of date as of commit 9ab91e7 ("arm64: default to the direct mapping in get_arch_dma_ops"). Direct mapping is now the default rather than dma_dummy_ops. According to Stefano and Oleksandr, the only other part needed is setting the DMA masks and there's no reason to restrict the masks to 32-bits. So set the masks to 64 bits. Cc: Robin Murphy <[email protected]> Cc: Julien Grall <[email protected]> Cc: Nicolas Saenz Julienne <[email protected]> Cc: Oleksandr Andrushchenko <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Stefano Stabellini <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: [email protected] Signed-off-by: Rob Herring <[email protected]> Acked-by: Oleksandr Andrushchenko <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent 574878f commit ee7f522

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

drivers/gpu/drm/xen/xen_drm_front.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -716,17 +716,9 @@ static int xen_drv_probe(struct xenbus_device *xb_dev,
716716
struct device *dev = &xb_dev->dev;
717717
int ret;
718718

719-
/*
720-
* The device is not spawn from a device tree, so arch_setup_dma_ops
721-
* is not called, thus leaving the device with dummy DMA ops.
722-
* This makes the device return error on PRIME buffer import, which
723-
* is not correct: to fix this call of_dma_configure() with a NULL
724-
* node to set default DMA ops.
725-
*/
726-
dev->coherent_dma_mask = DMA_BIT_MASK(32);
727-
ret = of_dma_configure(dev, NULL, true);
719+
ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
728720
if (ret < 0) {
729-
DRM_ERROR("Cannot setup DMA ops, ret %d", ret);
721+
DRM_ERROR("Cannot setup DMA mask, ret %d", ret);
730722
return ret;
731723
}
732724

drivers/xen/gntdev.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
2424

25+
#include <linux/dma-mapping.h>
2526
#include <linux/module.h>
2627
#include <linux/kernel.h>
2728
#include <linux/init.h>
@@ -34,9 +35,6 @@
3435
#include <linux/slab.h>
3536
#include <linux/highmem.h>
3637
#include <linux/refcount.h>
37-
#ifdef CONFIG_XEN_GRANT_DMA_ALLOC
38-
#include <linux/of_device.h>
39-
#endif
4038

4139
#include <xen/xen.h>
4240
#include <xen/grant_table.h>
@@ -625,14 +623,7 @@ static int gntdev_open(struct inode *inode, struct file *flip)
625623
flip->private_data = priv;
626624
#ifdef CONFIG_XEN_GRANT_DMA_ALLOC
627625
priv->dma_dev = gntdev_miscdev.this_device;
628-
629-
/*
630-
* The device is not spawn from a device tree, so arch_setup_dma_ops
631-
* is not called, thus leaving the device with dummy DMA ops.
632-
* Fix this by calling of_dma_configure() with a NULL node to set
633-
* default DMA ops.
634-
*/
635-
of_dma_configure(priv->dma_dev, NULL, true);
626+
dma_coerce_mask_and_coherent(priv->dma_dev, DMA_BIT_MASK(64));
636627
#endif
637628
pr_debug("priv %p\n", priv);
638629

0 commit comments

Comments
 (0)