public inbox for iommu@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: dri-devel@lists.freedesktop.org,
	iommu@lists.linux-foundation.org,
	Robin Murphy <robin.murphy@arm.com>,
	Christoph Hellwig <hch@lst.de>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH] of/platform: Initialise AMBA default DMA masks
Date: Tue, 28 Aug 2018 11:23:38 +0200	[thread overview]
Message-ID: <20180828092338.GA12488@lst.de> (raw)
In-Reply-To: <20180828084442.30176-1-linus.walleij@linaro.org>

>  	/* setup generic device info */
> +	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> +	if (!dev->dev.dma_mask)
> +		dev->dev.dma_mask = &dev->dev.coherent_dma_mask;

We should never set dma_mask to point to the coherent_dma_mask,
as that will cause problems with devices that have different
mask for the two.

How about something like this?

---
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 7ba90c290a42..c04ed124305c 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -242,6 +242,9 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 		goto err_clear_flag;
 
 	/* setup generic device info */
+	dev->dma_mask = DMA_BIT_MASK(32);
+	dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+	dev->dev.dma_mask = &dev->dma_mask;
 	dev->dev.of_node = of_node_get(node);
 	dev->dev.fwnode = &node->fwnode;
 	dev->dev.parent = parent ? : &platform_bus;
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index d143c13bed26..fbc7adf3ca54 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -34,6 +34,7 @@ struct amba_device {
 	unsigned int		periphid;
 	unsigned int		irq[AMBA_NR_IRQS];
 	char			*driver_override;
+	u64			dma_mask;
 };
 
 struct amba_driver {
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-08-28  9:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28  8:44 [PATCH] of/platform: Initialise AMBA default DMA masks Linus Walleij
2018-08-28  9:23 ` Christoph Hellwig [this message]
2018-08-28 13:25   ` Linus Walleij
2018-08-28 14:14     ` Russell King - ARM Linux
     [not found]       ` <20180828141413.GH30658-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2018-08-29  5:55         ` Christoph Hellwig
     [not found]           ` <20180829055521.GA28958-jcswGhMUV9g@public.gmane.org>
2018-08-30  8:40             ` Russell King - ARM Linux
     [not found]               ` <20180830084014.GJ30658-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org>
2018-08-30  8:45                 ` Linus Walleij
     [not found]                   ` <CACRpkdYbaZj4z_RYST2+HuA9A1YQZ3-xM0J0xBdFLWzZ_0=u4w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-08-30 17:01                     ` Russell King - ARM Linux
2018-08-29  5:55     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180828092338.GA12488@lst.de \
    --to=hch@lst.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox