Re: [RFC PATCH] drm/komeda: fixing of DMA mapping sg segment warning

From: Ayan Halder
Date: Fri Mar 29 2019 - 12:26:49 EST


On Thu, Mar 28, 2019 at 07:25:00AM +0000, Lowry Li (Arm Technology China) wrote:
> Fixing the DMA mapping sg segment warning, which shows "DMA-API: mapping
> sg segment longer than device claims to support [len=921600] [max=65536]".
> Fixed by setting the max segment size at Komeda driver.
>
> Signed-off-by: Lowry Li <lowry.li@xxxxxxx>
> ---
> drivers/gpu/drm/arm/display/komeda/komeda_dev.c | 4 ++++
> drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 1 +
> 2 files changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> index 7f25e6a..b4902ae 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.c
> @@ -8,6 +8,7 @@
> #include <linux/of_device.h>
> #include <linux/of_graph.h>
> #include <linux/platform_device.h>
> +#include <linux/dma-iommu.h>
> #ifdef CONFIG_DEBUG_FS
> #include <linux/debugfs.h>
> #include <linux/seq_file.h>
> @@ -245,6 +246,9 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
> goto err_cleanup;
> }
>
> + dev->dma_parms = &mdev->dma_parms;
> + dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
> +
> err = sysfs_create_group(&dev->kobj, &komeda_sysfs_attr_group);
> if (err) {
> DRM_ERROR("create sysfs group failed.\n");
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> index 0c3e32b..d8cfa92 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h
> @@ -146,6 +146,7 @@ enum {
> */
> struct komeda_dev {
> struct device *dev;
> + struct device_dma_parameters dma_parms;
> u32 __iomem *reg_base;
>
> struct komeda_chip_info chip;
> --
Please rebase and test your patches on drm-misc-next.
https://drm.pages.freedesktop.org/maintainer-tools/repositories.html
> 1.9.1