From: Liviu Dudau <liviu@dudau.co.uk>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Yong <yong.deng@magewell.com>, kbuild test robot <lkp@intel.com>,
kbuild-all@01.org, Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>, Chen-Yu Tsai <wens@csie.org>,
"David S. Miller" <davem@davemloft.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Hans Verkuil <hans.verkuil@cisco.com>,
Linus Walleij <linus.walleij@linaro.org>,
Randy Dunlap <rdunlap@infradead.org>,
Stanimir Varbanov <stanimir.varbanov@linaro.org>,
Hugues Fruchet <hugues.fruchet@st.com>,
Yannick Fertre <yannick.fertre@st.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Arnd Bergmann <arnd@arndb.de>,
Benjamin Gaignard <benjamin.gaignard@linaro.org>,
Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>,
Rick Chang <rick.chang@mediatek.com>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
megous@megous.com
Subject: Re: [linux-sunxi] Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI.
Date: Wed, 31 Jan 2018 14:47:53 +0000 [thread overview]
Message-ID: <20180131144753.GB19945@bart.dudau.co.uk> (raw)
In-Reply-To: <20180131074212.7hvb3nqkt22h2chg@flea.lan>
On Wed, Jan 31, 2018 at 08:42:12AM +0100, Maxime Ripard wrote:
> Hi Liviu,
Hi Maxime,
>
> On Wed, Jan 31, 2018 at 03:08:08AM +0000, Liviu Dudau wrote:
> > On Fri, Jan 26, 2018 at 11:00:41AM +0800, Yong wrote:
> > > Hi Maxime,
> > >
> > > On Fri, 26 Jan 2018 09:46:58 +0800
> > > Yong <yong.deng@magewell.com> wrote:
> > >
> > > > Hi Maxime,
> > > >
> > > > Do you have any experience in solving this problem?
> > > > It seems the PHYS_OFFSET maybe undeclared when the ARCH is not arm.
> > >
> > > Got it.
> > > Should I add 'depends on ARM' in Kconfig?
> >
> > No, I don't think you should do that, you should fix the code.
> >
> > The dma_addr_t addr that you've got is ideally coming from dma_alloc_coherent(),
> > in which case the addr is already "suitable" for use by the device (because the
> > bus where the device is attached to does all the address translations).
>
> Like we're discussing in that other part of the thread with Thierry
> and Arnd, things are slightly more complicated than that :)
Yeah, sorry, my threading of the discussion was broken and I've seen the rest of the
thread after I have replied. My bad!
>
> In our case, the bus where the device is attached will not do the
> address translations, and shouldn't.
In my view, the bus is already doing address translation at physical level, AFAIU it
remaps the memory to zero. What you (we?) need is a simple bus driver that registers
the correct virt_to_bus()/bus_to_virt() hooks for the device that do this translation
at the DMA API level as well.
>
> > If you apply PHYS_OFFSET forcefully to it you might get unexpected
> > results.
>
> Out of curiosity, what would be these unexpected results?
If in the future (or a parallel world setup) the device is sitting behind an IOMMU, the
addr value might well be smaller than PHYS_OFFSET and you will under-wrap, possibly
starting to hit kernel physical addresses (or anything sitting at the top of the physical
memory).
>From my time playing with IOMMUs and PCI domains, I've learned to treat the dma_addr_t as
a cookie value and never try to do arithmetics with it.
Best regards,
Liviu
>
> Thanks!
> Maxime
>
> --
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
>
> --
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
next prev parent reply other threads:[~2018-01-31 14:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 8:18 [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI Yong Deng
2018-01-26 0:04 ` kbuild test robot
2018-01-26 1:46 ` Yong
2018-01-26 3:00 ` Yong
2018-01-26 8:10 ` Maxime Ripard
2018-01-28 2:19 ` [linux-sunxi] " Yong
2018-01-29 8:16 ` Maxime Ripard
2018-01-31 3:08 ` Liviu Dudau
2018-01-31 3:24 ` Chen-Yu Tsai
2018-01-31 7:42 ` Maxime Ripard
2018-01-31 14:47 ` Liviu Dudau [this message]
2018-02-01 8:32 ` Maxime Ripard
2018-02-01 9:20 ` Arnd Bergmann
2018-02-01 11:34 ` Liviu Dudau
2018-02-01 15:54 ` Maxime Ripard
2018-01-27 15:51 ` kbuild test robot
2018-01-27 16:14 ` Linus Walleij
2018-01-28 2:39 ` Yong
2018-01-29 8:25 ` Maxime Ripard
2018-01-29 9:25 ` Linus Walleij
2018-01-29 14:34 ` Arnd Bergmann
2018-01-30 7:54 ` Maxime Ripard
2018-01-30 9:24 ` Arnd Bergmann
2018-01-30 9:59 ` Thierry Reding
2018-01-30 10:01 ` Thierry Reding
2018-01-31 7:29 ` Maxime Ripard
2018-01-31 9:37 ` Arnd Bergmann
2018-02-01 15:29 ` Maxime Ripard
2018-02-01 15:36 ` Arnd Bergmann
2018-02-01 16:31 ` Robin Murphy
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=20180131144753.GB19945@bart.dudau.co.uk \
--to=liviu@dudau.co.uk \
--cc=arnd@arndb.de \
--cc=benjamin.gaignard@linaro.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hans.verkuil@cisco.com \
--cc=hugues.fruchet@st.com \
--cc=kbuild-all@01.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=lkp@intel.com \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@free-electrons.com \
--cc=mchehab@kernel.org \
--cc=megous@megous.com \
--cc=p.zabel@pengutronix.de \
--cc=ramesh.shanmugasundaram@bp.renesas.com \
--cc=rdunlap@infradead.org \
--cc=rick.chang@mediatek.com \
--cc=robh+dt@kernel.org \
--cc=sakari.ailus@linux.intel.com \
--cc=stanimir.varbanov@linaro.org \
--cc=wens@csie.org \
--cc=yannick.fertre@st.com \
--cc=yong.deng@magewell.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