* [PATCH] of: set dma_mask to point to coherent_dma_mask @ 2013-10-30 5:05 Rob Herring 2013-11-02 18:07 ` Grant Likely 0 siblings, 1 reply; 7+ messages in thread From: Rob Herring @ 2013-10-30 5:05 UTC (permalink / raw) To: Russell King, linux-kernel, devicetree Cc: stefano.stabellini, Grant Likely, Rob Herring From: Rob Herring <rob.herring@calxeda.com> Platform devices created by DT code don't initialize dma_mask pointer to anything. Set it to coherent_dma_mask by default if the architecture code has not set it. Signed-off-by: Rob Herring <rob.herring@calxeda.com> --- I think this is at least part of what is needed to fix dma_mask issue raised by Stefano [1]. Things should work AFAICT with just this, but I suppose the xgmac driver needs to set the mask as well (not relying on the default), but some pointing the dma_mask to a valid value is needed first. Rob [1] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg528236.html drivers/of/platform.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index f6dcde2..fce088e 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -215,6 +215,8 @@ static struct platform_device *of_platform_device_create_pdata( dev->archdata.dma_mask = 0xffffffffUL; #endif dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + if (!dev->dev.dma_mask) + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data; -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] of: set dma_mask to point to coherent_dma_mask 2013-10-30 5:05 [PATCH] of: set dma_mask to point to coherent_dma_mask Rob Herring @ 2013-11-02 18:07 ` Grant Likely [not found] ` <20131102180724.D8FC5C40F02-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Grant Likely @ 2013-11-02 18:07 UTC (permalink / raw) To: Rob Herring, Russell King, linux-kernel, devicetree Cc: stefano.stabellini, Rob Herring On Wed, 30 Oct 2013 00:05:22 -0500, Rob Herring <robherring2@gmail.com> wrote: > From: Rob Herring <rob.herring@calxeda.com> > > Platform devices created by DT code don't initialize dma_mask pointer to > anything. Set it to coherent_dma_mask by default if the architecture > code has not set it. > > Signed-off-by: Rob Herring <rob.herring@calxeda.com> I believe this is okay. I haven't done any testing to back up that opinion though. g. > --- > I think this is at least part of what is needed to fix dma_mask issue > raised by Stefano [1]. Things should work AFAICT with just this, but > I suppose the xgmac driver needs to set the mask as well (not relying > on the default), but some pointing the dma_mask to a valid value is > needed first. > > Rob > > [1] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg528236.html > > drivers/of/platform.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > index f6dcde2..fce088e 100644 > --- a/drivers/of/platform.c > +++ b/drivers/of/platform.c > @@ -215,6 +215,8 @@ static struct platform_device *of_platform_device_create_pdata( > dev->archdata.dma_mask = 0xffffffffUL; > #endif > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > + if (!dev->dev.dma_mask) > + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > dev->dev.bus = &platform_bus_type; > dev->dev.platform_data = platform_data; > > -- > 1.8.1.2 > ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20131102180724.D8FC5C40F02-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>]
* Re: [PATCH] of: set dma_mask to point to coherent_dma_mask [not found] ` <20131102180724.D8FC5C40F02-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> @ 2013-11-06 16:46 ` Stefano Stabellini [not found] ` <alpine.DEB.2.02.1311061642270.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Stefano Stabellini @ 2013-11-06 16:46 UTC (permalink / raw) To: Grant Likely Cc: Rob Herring, Russell King, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ, Rob Herring On Sat, 2 Nov 2013, Grant Likely wrote: > On Wed, 30 Oct 2013 00:05:22 -0500, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > Platform devices created by DT code don't initialize dma_mask pointer to > > anything. Set it to coherent_dma_mask by default if the architecture > > code has not set it. > > > > Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > I believe this is okay. I haven't done any testing to back up that > opinion though. Tested-by: Stefano Stabellini <stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org> > > I think this is at least part of what is needed to fix dma_mask issue > > raised by Stefano [1]. Things should work AFAICT with just this, but > > I suppose the xgmac driver needs to set the mask as well (not relying > > on the default), but some pointing the dma_mask to a valid value is > > needed first. > > > > Rob > > > > [1] http://www.mail-archive.com/linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg528236.html > > > > drivers/of/platform.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > > index f6dcde2..fce088e 100644 > > --- a/drivers/of/platform.c > > +++ b/drivers/of/platform.c > > @@ -215,6 +215,8 @@ static struct platform_device *of_platform_device_create_pdata( > > dev->archdata.dma_mask = 0xffffffffUL; > > #endif > > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > > + if (!dev->dev.dma_mask) > > + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > dev->dev.bus = &platform_bus_type; > > dev->dev.platform_data = platform_data; > > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <alpine.DEB.2.02.1311061642270.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org>]
* Re: [PATCH] of: set dma_mask to point to coherent_dma_mask [not found] ` <alpine.DEB.2.02.1311061642270.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org> @ 2013-11-11 16:59 ` Stefano Stabellini [not found] ` <alpine.DEB.2.02.1311111658100.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Stefano Stabellini @ 2013-11-11 16:59 UTC (permalink / raw) To: Stefano Stabellini Cc: Grant Likely, Rob Herring, Russell King, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring On Wed, 6 Nov 2013, Stefano Stabellini wrote: > On Sat, 2 Nov 2013, Grant Likely wrote: > > On Wed, 30 Oct 2013 00:05:22 -0500, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > > > Platform devices created by DT code don't initialize dma_mask pointer to > > > anything. Set it to coherent_dma_mask by default if the architecture > > > code has not set it. > > > > > > Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > I believe this is okay. I haven't done any testing to back up that > > opinion though. > > Tested-by: Stefano Stabellini <stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org> BTW I hope you are planning on sending this upstream soon, because without it I can very easily corrupt my root fs by simply booting the system. > > > I think this is at least part of what is needed to fix dma_mask issue > > > raised by Stefano [1]. Things should work AFAICT with just this, but > > > I suppose the xgmac driver needs to set the mask as well (not relying > > > on the default), but some pointing the dma_mask to a valid value is > > > needed first. > > > > > > Rob > > > > > > [1] http://www.mail-archive.com/linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg528236.html > > > > > > drivers/of/platform.c | 2 ++ > > > 1 file changed, 2 insertions(+) > > > > > > diff --git a/drivers/of/platform.c b/drivers/of/platform.c > > > index f6dcde2..fce088e 100644 > > > --- a/drivers/of/platform.c > > > +++ b/drivers/of/platform.c > > > @@ -215,6 +215,8 @@ static struct platform_device *of_platform_device_create_pdata( > > > dev->archdata.dma_mask = 0xffffffffUL; > > > #endif > > > dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); > > > + if (!dev->dev.dma_mask) > > > + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; > > > dev->dev.bus = &platform_bus_type; > > > dev->dev.platform_data = platform_data; > > > > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <alpine.DEB.2.02.1311111658100.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org>]
* Re: [PATCH] of: set dma_mask to point to coherent_dma_mask [not found] ` <alpine.DEB.2.02.1311111658100.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org> @ 2013-11-12 7:01 ` Grant Likely 2013-11-12 10:19 ` Russell King - ARM Linux 1 sibling, 0 replies; 7+ messages in thread From: Grant Likely @ 2013-11-12 7:01 UTC (permalink / raw) To: Stefano Stabellini Cc: Rob Herring, Russell King, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring On Mon, 11 Nov 2013 16:59:14 +0000, Stefano Stabellini <stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org> wrote: > On Wed, 6 Nov 2013, Stefano Stabellini wrote: > > On Sat, 2 Nov 2013, Grant Likely wrote: > > > On Wed, 30 Oct 2013 00:05:22 -0500, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > > > > > Platform devices created by DT code don't initialize dma_mask pointer to > > > > anything. Set it to coherent_dma_mask by default if the architecture > > > > code has not set it. > > > > > > > > Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > > > I believe this is okay. I haven't done any testing to back up that > > > opinion though. > > > > Tested-by: Stefano Stabellini <stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org> > > BTW I hope you are planning on sending this upstream soon, because > without it I can very easily corrupt my root fs by simply booting the system. Gah! That's pretty nasty. It is in Rob's for-next branch, but it hasn't been marked for backporting to stable. Best thing to do here is for either you or Rob to repost the patch to stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org and include the commit id from Rob's tree. It's not upstream yet, but it will be soon. How far back in kernel releases do you want the patch backported to? g. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] of: set dma_mask to point to coherent_dma_mask [not found] ` <alpine.DEB.2.02.1311111658100.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org> 2013-11-12 7:01 ` Grant Likely @ 2013-11-12 10:19 ` Russell King - ARM Linux [not found] ` <20131112101955.GF16735-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org> 1 sibling, 1 reply; 7+ messages in thread From: Russell King - ARM Linux @ 2013-11-12 10:19 UTC (permalink / raw) To: Stefano Stabellini Cc: Grant Likely, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring On Mon, Nov 11, 2013 at 04:59:14PM +0000, Stefano Stabellini wrote: > On Wed, 6 Nov 2013, Stefano Stabellini wrote: > > On Sat, 2 Nov 2013, Grant Likely wrote: > > > On Wed, 30 Oct 2013 00:05:22 -0500, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > > > > > Platform devices created by DT code don't initialize dma_mask pointer to > > > > anything. Set it to coherent_dma_mask by default if the architecture > > > > code has not set it. > > > > > > > > Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > > > I believe this is okay. I haven't done any testing to back up that > > > opinion though. > > > > Tested-by: Stefano Stabellini <stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org> > > BTW I hope you are planning on sending this upstream soon, because > without it I can very easily corrupt my root fs by simply booting the system. What's the mechanism for that corruption? Having the DMA mask not set should not cause DMA corruption - that hints at something else being wrong, and that needs to be investigated. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20131112101955.GF16735-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>]
* Re: [PATCH] of: set dma_mask to point to coherent_dma_mask [not found] ` <20131112101955.GF16735-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org> @ 2013-11-12 13:21 ` Stefano Stabellini 0 siblings, 0 replies; 7+ messages in thread From: Stefano Stabellini @ 2013-11-12 13:21 UTC (permalink / raw) To: Russell King - ARM Linux Cc: Stefano Stabellini, Grant Likely, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring On Tue, 12 Nov 2013, Russell King - ARM Linux wrote: > On Mon, Nov 11, 2013 at 04:59:14PM +0000, Stefano Stabellini wrote: > > On Wed, 6 Nov 2013, Stefano Stabellini wrote: > > > On Sat, 2 Nov 2013, Grant Likely wrote: > > > > On Wed, 30 Oct 2013 00:05:22 -0500, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > From: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > > > > > > > Platform devices created by DT code don't initialize dma_mask pointer to > > > > > anything. Set it to coherent_dma_mask by default if the architecture > > > > > code has not set it. > > > > > > > > > > Signed-off-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > > > > > > > I believe this is okay. I haven't done any testing to back up that > > > > opinion though. > > > > > > Tested-by: Stefano Stabellini <stefano.stabellini-mvvWK6WmYclDPfheJLI6IQ@public.gmane.org> > > > > BTW I hope you are planning on sending this upstream soon, because > > without it I can very easily corrupt my root fs by simply booting the system. > > What's the mechanism for that corruption? Having the DMA mask not set > should not cause DMA corruption - that hints at something else being > wrong, and that needs to be investigated. Russell, you are right. I went through the swiotlb-xen code and I realized that I missed a map_page call on one of the (usually unused) fallback paths. Thanks!! -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-11-12 13:21 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-30 5:05 [PATCH] of: set dma_mask to point to coherent_dma_mask Rob Herring 2013-11-02 18:07 ` Grant Likely [not found] ` <20131102180724.D8FC5C40F02-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> 2013-11-06 16:46 ` Stefano Stabellini [not found] ` <alpine.DEB.2.02.1311061642270.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org> 2013-11-11 16:59 ` Stefano Stabellini [not found] ` <alpine.DEB.2.02.1311111658100.26077-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org> 2013-11-12 7:01 ` Grant Likely 2013-11-12 10:19 ` Russell King - ARM Linux [not found] ` <20131112101955.GF16735-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org> 2013-11-12 13:21 ` Stefano Stabellini
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).