Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 9ab91e7c5c51 ("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 <robin.murphy@arm.com>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: xen-devel@lists.xenproject.org
Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>

authored by

Rob Herring and committed by
Boris Ostrovsky
ee7f5225 574878f9

+4 -21
+2 -10
drivers/gpu/drm/xen/xen_drm_front.c
··· 716 716 struct device *dev = &xb_dev->dev; 717 717 int ret; 718 718 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)); 728 720 if (ret < 0) { 729 - DRM_ERROR("Cannot setup DMA ops, ret %d", ret); 721 + DRM_ERROR("Cannot setup DMA mask, ret %d", ret); 730 722 return ret; 731 723 } 732 724
+2 -11
drivers/xen/gntdev.c
··· 22 22 23 23 #define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt 24 24 25 + #include <linux/dma-mapping.h> 25 26 #include <linux/module.h> 26 27 #include <linux/kernel.h> 27 28 #include <linux/init.h> ··· 35 34 #include <linux/slab.h> 36 35 #include <linux/highmem.h> 37 36 #include <linux/refcount.h> 38 - #ifdef CONFIG_XEN_GRANT_DMA_ALLOC 39 - #include <linux/of_device.h> 40 - #endif 41 37 42 38 #include <xen/xen.h> 43 39 #include <xen/grant_table.h> ··· 623 625 flip->private_data = priv; 624 626 #ifdef CONFIG_XEN_GRANT_DMA_ALLOC 625 627 priv->dma_dev = gntdev_miscdev.this_device; 626 - 627 - /* 628 - * The device is not spawn from a device tree, so arch_setup_dma_ops 629 - * is not called, thus leaving the device with dummy DMA ops. 630 - * Fix this by calling of_dma_configure() with a NULL node to set 631 - * default DMA ops. 632 - */ 633 - of_dma_configure(priv->dma_dev, NULL, true); 628 + dma_coerce_mask_and_coherent(priv->dma_dev, DMA_BIT_MASK(64)); 634 629 #endif 635 630 pr_debug("priv %p\n", priv); 636 631