[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2] xen: Stop abusing DT of_dma_configure API


  • To: Rob Herring <robh@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Wed, 9 Oct 2019 11:42:16 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hOxJMxNkqREYsxq4TXAsCDRwvBimIbgUBGUqXZC8pV0=; b=eH9ccoEmce1agir4ZVMM+yysHLBmSninv701saTj13/ytGYWf14MkCf48YIRdkfAwvCZcVsEsBauhpm9H3OEAgBYSbCh9NVxNMK1BI2lVlDWdLx7CyhxEP2P3k324dWMw6xO15K4g7HR3MjzApU6VR/j4Y/uaQIU5dhpYAJ0Ki9QB1oodsHVtaR7DNAcwXr7xagEMno9+nVX/fjP0LiqqtClKSfmM92I23+jKTp5H4Ta6945jgxkLBzOyQy+mjvAQmMg/z1YUjIJImx8gPXw3DLi1gG5pCLQ/HAcejGJ58QfyqSkabyJWaqdy9YhsCjFKMQXhlfxnd5tGde93HLLWQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JpYb7kHJXP8aiXT4f4/coF5Qp0YG9HhbbqpgzG8ON0I3d31FcHa1BIEFBNLgCBdaXCTIpx4ytaHvq9STpVpfsi4ykP/LOaBhDMY7LsMyc6gz2zAsakpvjRgLBUEkZjVf6u/imy4N2yz0HQZUUEoq808I2N36jsRK0mEe5jLI4XQQ5cGUtwdZbNgqdVWozdCyguZQtDNT49vguGQEFMNLsOonZpi92oJI+ZxzzHEEFFbcmwrEGX0wmkXq8YGZzQLnq2gCSecaQXRZlI9JsctAW4lILVfp1mDymZZZ8Z7M/cWDT+5DKs2XsKOVuNsxmoStxxRbynNoz65Dt50PsYABKg==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Oleksandr_Andrushchenko@xxxxxxxx;
  • Cc: Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, Julien Grall <julien.grall@xxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Robin Murphy <robin.murphy@xxxxxxx>, Christoph Hellwig <hch@xxxxxx>, Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
  • Delivery-date: Wed, 09 Oct 2019 11:42:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVfhBzhlN6OkxJQ0qTWpE9XJwQU6dSMRCA
  • Thread-topic: [PATCH v2] xen: Stop abusing DT of_dma_configure API

On 10/8/19 10:41 PM, Rob Herring wrote:
> 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@xxxxxxx>
> Cc: Julien Grall <julien.grall@xxxxxxx>
> Cc: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
> Cc: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>
> Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
> Cc: Juergen Gross <jgross@xxxxxxxx>
> Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
> Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
Acked-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@xxxxxxxx>

Unfortunately I cannot test this patch with real HW running Xen:
I am still on 4.14 kernel which is dictated by the board's BSP and
it is not possible to have more recent one at the moment.
So, I hope the patch will work as intended.

Thank you,
Oleksandr
> ---
> v2:
>   - Setup dma masks
>   - Also fix xen_drm_front.c
>   
> This can now be applied to the Xen tree independent of the coming
> of_dma_configure() changes.
>
> Rob
>
>   drivers/gpu/drm/xen/xen_drm_front.c | 12 ++----------
>   drivers/xen/gntdev.c                | 13 ++-----------
>   2 files changed, 4 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c 
> b/drivers/gpu/drm/xen/xen_drm_front.c
> index ba1828acd8c9..4be49c1aef51 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> @@ -718,17 +718,9 @@ static int xen_drv_probe(struct xenbus_device *xb_dev,
>       struct device *dev = &xb_dev->dev;
>       int ret;
>   
> -     /*
> -      * The device is not spawn from a device tree, so arch_setup_dma_ops
> -      * is not called, thus leaving the device with dummy DMA ops.
> -      * This makes the device return error on PRIME buffer import, which
> -      * is not correct: to fix this call of_dma_configure() with a NULL
> -      * node to set default DMA ops.
> -      */
> -     dev->coherent_dma_mask = DMA_BIT_MASK(32);
> -     ret = of_dma_configure(dev, NULL, true);
> +     ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
>       if (ret < 0) {
> -             DRM_ERROR("Cannot setup DMA ops, ret %d", ret);
> +             DRM_ERROR("Cannot setup DMA mask, ret %d", ret);
>               return ret;
>       }
>   
> diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
> index a446a7221e13..81401f386c9c 100644
> --- a/drivers/xen/gntdev.c
> +++ b/drivers/xen/gntdev.c
> @@ -22,6 +22,7 @@
>   
>   #define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
>   
> +#include <linux/dma-mapping.h>
>   #include <linux/module.h>
>   #include <linux/kernel.h>
>   #include <linux/init.h>
> @@ -34,9 +35,6 @@
>   #include <linux/slab.h>
>   #include <linux/highmem.h>
>   #include <linux/refcount.h>
> -#ifdef CONFIG_XEN_GRANT_DMA_ALLOC
> -#include <linux/of_device.h>
> -#endif
>   
>   #include <xen/xen.h>
>   #include <xen/grant_table.h>
> @@ -625,14 +623,7 @@ static int gntdev_open(struct inode *inode, struct file 
> *flip)
>       flip->private_data = priv;
>   #ifdef CONFIG_XEN_GRANT_DMA_ALLOC
>       priv->dma_dev = gntdev_miscdev.this_device;
> -
> -     /*
> -      * The device is not spawn from a device tree, so arch_setup_dma_ops
> -      * is not called, thus leaving the device with dummy DMA ops.
> -      * Fix this by calling of_dma_configure() with a NULL node to set
> -      * default DMA ops.
> -      */
> -     of_dma_configure(priv->dma_dev, NULL, true);
> +     dma_coerce_mask_and_coherent(priv->dma_dev, DMA_BIT_MASK(64));
>   #endif
>       pr_debug("priv %p\n", priv);
>   
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.