From: icenowy@aosc.io
To: maxime.ripard@free-electrons.com,Maxime Ripard
<maxime.ripard@free-electrons.com>,Arnd Bergmann
<arnd@arndb.de>,Linus Walleij <linus.walleij@linaro.org>
Cc: Yong Deng <yong.deng@magewell.com>,
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>,
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>,
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,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
Linux ARM <linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
linux-sunxi@mailchannels.net
Subject: Re: [linux-sunxi] Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI.
Date: Mon, 29 Jan 2018 16:28:06 +0800 [thread overview]
Message-ID: <20180129082850.CAAF25C1783@relay.mailchannels.net> (raw)
In-Reply-To: <20180129082533.6edmqgbauo6q5dgz@flea.lan>
<linux-sunxi@googlegroups.com>,megous@megous.com,Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
From: Icenowy Zheng <icenowy@aosc.io>
Message-ID: <B1E70BBD-8C1C-4381-8280-E7A368AE3DE6@aosc.io>
于 2018年1月29日 GMT+08:00 下午4:25:33, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
>Hi Linus,
>
>On Sat, Jan 27, 2018 at 05:14:26PM +0100, Linus Walleij wrote:
>> > +void sun6i_csi_update_buf_addr(struct sun6i_csi *csi, dma_addr_t
>addr)
>> > +{
>> > + struct sun6i_csi_dev *sdev = sun6i_csi_to_dev(csi);
>> > + /* transform physical address to bus address */
>> > + dma_addr_t bus_addr = addr - PHYS_OFFSET;
>>
>> I am sorry if this is an unjustified drive-by comment. Maybe you
>> have already investigate other ways to do this.
>
>It's definitely not unjustified :)
>
>> Accessing PHYS_OFFSET directly seems unintuitive and not good
>> practice.
>>
>> But normally an dma_addr_t only comes from some function inside
>> <linux/dma-mapping.h> such as: dma_alloc_coherent() for a contigous
>> buffer which is coherent in physical memory, or from some buffer <=
>> 64KB that is switching ownership between device and CPU explicitly
>> with dma_map* or so. Did you check with Documentation/DMA-API.txt?
>
>So, I've discussed this with Arnd a month ago or so, because I'm not
>really fond of the current approach but we haven't found better way to
>do it yet.
>
>The issue is that all the DMA accesses are done not through the main
>AXI bus, but through a separate bus dedicated for memory accesses,
>where the RAM is mapped at the address 0. So the CPU and DMA devices
>have a different mapping for the RAM.
Maybe we can specify the offset in the DT as it's about how
the IP block is integrated to the SoC.
>
>I guess we could address this by using the field dma_pfn_offset that
>seems to be used in similar situations. However, in DT systems, that
>field is filled only with the parent's node dma-ranges property. In
>our case, and since the DT parenthood is based on the "control" bus,
>and not the "data" bus, our parent node would be the AXI bus, and not
>the memory bus that enforce those constraints.
>
>And other devices doing DMA through regular DMA accesses won't have
>that mapping, so we definitely shouldn't enforce it for all the
>devices there, but only the one connected to the separate memory bus.
>
>tl; dr: the DT is not really an option to store that info.
>
>I suggested setting dma_pfn_offset at probe, but Arnd didn't seem too
>fond of that approach either at the time.
>
>So, well, I guess we could do better. We just have no idea how :)
>
>Maxime
next prev parent reply other threads:[~2018-01-29 8:28 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 8:18 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
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 8:28 ` icenowy [this message]
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=20180129082850.CAAF25C1783@relay.mailchannels.net \
--to=icenowy@aosc.io \
--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=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@mailchannels.net \
--cc=mark.rutland@arm.com \
--cc=maxime.ripard@free-electrons.com \
--cc=mchehab@kernel.org \
--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
all inboxes | Powered by JetHome®