linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <leonard.crestez@nxp.com>
To: Paul Walmsley <paul@pwsan.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	 "sboyd@kernel.org" <sboyd@kernel.org>
Cc: "kstewart@linuxfoundation.org" <kstewart@linuxfoundation.org>,
	"pgaikwad@nvidia.com" <pgaikwad@nvidia.com>,
	"heiko@sntech.de" <heiko@sntech.de>,
	"geert+renesas@glider.be" <geert+renesas@glider.be>,
	"chunhui.dai@mediatek.com" <chunhui.dai@mediatek.com>,
	Yangtao Li <tiny.windzz@gmail.com>,
	"mturquette@baylibre.com" <mturquette@baylibre.com>,
	"palmer@sifive.com" <palmer@sifive.com>,
	"nsekhar@ti.com" <nsekhar@ti.com>,
	"tomasz.figa@gmail.com" <tomasz.figa@gmail.com>,
	"rfontana@redhat.com" <rfontana@redhat.com>,
	"weiyongjun1@huawei.com" <weiyongjun1@huawei.com>,
	"s.nawrocki@samsung.com" <s.nawrocki@samsung.com>,
	"manivannan.sadhasivam@linaro.org"
	<manivannan.sadhasivam@linaro.org>,
	"linux-riscv@lists.infradead.org"
	<linux-riscv@lists.infradead.org>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"emilio@elopez.com.ar" <emilio@elopez.com.ar>,
	"allison@lohutok.net" <allison@lohutok.net>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"jonathanh@nvidia.com" <jonathanh@nvidia.com>,
	"cw00.choi@samsung.com" <cw00.choi@samsung.com>,
	"wens@csie.org" <wens@csie.org>,
	"agross@kernel.org" <agross@kernel.org>,
	"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	dl-linux-imx <linux-imx@nxp.com>,
	"Eugeniy.Paltsev@synopsys.com" <Eugeniy.Paltsev@synopsys.com>,
	"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"swinslow@gmail.com" <swinslow@gmail.com>,
	"paul.walmsley@sifive.com" <paul.walmsley@sifive.com>,
	"john@phrozen.org" <john@phrozen.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	Daniel Baluta <daniel.baluta@nxp.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Aisheng Dong <aisheng.dong@nxp.com>,
	"jcmvbkbc@gmail.com" <jcmvbkbc@gmail.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"pdeschrijver@nvidia.com" <pdeschrijver@nvidia.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"t-kristo@ti.com" <t-kristo@ti.com>,
	"dinguyen@kernel.org" <dinguyen@kernel.org>,
	"kgene@kernel.org" <kgene@kernel.org>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"wangyan.wang@mediatek.com" <wangyan.wang@mediatek.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"afaerber@suse.de" <afaerber@suse.de>
Subject: Re: [PATCH 08/17] clk: imx: convert to devm_platform_ioremap_resource
Date: Wed, 11 Dec 2019 18:38:11 +0000	[thread overview]
Message-ID: <VI1PR04MB7023943556EB5E6967AE3E0CEE5A0@VI1PR04MB7023.eurprd04.prod.outlook.com> (raw)
In-Reply-To: alpine.DEB.2.21.999.1912111743560.32095@utopia.booyaka.com

On 11.12.2019 19:51, Paul Walmsley wrote:
> On Tue, 10 Dec 2019, Thierry Reding wrote:
>> On Mon, Dec 09, 2019 at 08:44:39PM +0000, Leonard Crestez wrote:
>>
>>> This breaks imx8qxp-mek boot by causing most peripherals (like uart) to
>>> fail to probe.
>>>
>>> The old and new paths are not equivalent: devm_platform_ioremap_resource
>>> calls devm_ioremap_resource which differs from devm_ioremap by also
>>> calling devm_request_mem_region.
>>>
>>> This prevents other mappings in the area and imx8qxp-lpcg nodes map
>>> whole hardware "subsystems" and overlap most peripherals. For example:
>>>
>>>                    adma_lpcg: clock-controller@59000000 {
>>>                            compatible = "fsl,imx8qxp-lpcg-adma";
>>>                            reg = <0x59000000 0x2000000>;
>>>                            #clock-cells = <1>;
>>> 		};
>>>
>>>                   adma_lpuart0: serial@5a060000 {
>>> 			reg = <0x5a060000 0x1000>;
>>> 			...
>>> 		};
>>
>> The whole point of doing a request_mem_region() is to avoid having
>> multiple drivers trample on each others' mappings. What you do above
>> doesn't look right. Why does that clock controller need access to 32
>> MiB of I/O memory space?
> 
> Thierry's right; your DT data looks broken.  Unfortunately the IMX8M TRM
> requires some sort of signup to download, so I can't easily read it, but
> based on files like this:
> 
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Ftree%2Fdrivers%2Fclk%2Fimx%2Fclk-imx8qxp-lpcg.h&amp;data=02%7C01%7Cleonard.crestez%40nxp.com%7Cf0e68024888e4aed777e08d77e62c5df%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C1%7C637116835018036168&amp;sdata=z70QUYwknXfvc4zhyOrT7dcLPq5eryv4U7HoGMzI4ZE%3D&amp;reserved=0
> 
> it looks like what should be in the DT instead is either a large set of
> smaller register ranges, or a set of separate DT nodes/drivers: one per
> peripheral LPCG instance.  That should avoid the overlapping memory range
> issue.

Yes, current imx8 clock DT bindings are definitely odd. I only objected 
to the cleanup because it breaks boot.

This series converts imx8 LPCG to use separate DT nodes for each 
peripheral LPCG instance and makes other improvements, it's just been 
stuck in review:

https://patchwork.kernel.org/cover/11248249/

Having a large number of clock-providing DT nodes is also odd but it 
closely aligns with SOC hardware architecture. The clock gating bits 
were deliberately split into many 64k areas so that access can be 
controlled for each peripheral using very coarse-grained access control 
methods.

For example hypervisors can control guest access on page boundaries but 
not to individual bits in a byte.

This design makes it easy to securely grant control for a peripheral and 
all of its clock bits to an M4 core or virtualization guest without 
additional layers of software indirection.

--
Regards,
Leonard


  reply	other threads:[~2019-12-11 18:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 19:57 [PATCH 01/17] clk: sunxi: sunxi-ng: convert to devm_platform_ioremap_resource Yangtao Li
2019-12-09 19:57 ` [PATCH 02/17] clk: qcom: " Yangtao Li
2019-12-09 19:57 ` [PATCH 03/17] clk: samsung: " Yangtao Li
2019-12-10  2:10   ` Chanwoo Choi
2019-12-09 19:57 ` [PATCH 04/17] clk: mediatek: " Yangtao Li
2019-12-09 19:57 ` [PATCH 05/17] clk: hisilicon: " Yangtao Li
2019-12-09 19:57 ` [PATCH 06/17] clk: tegra: " Yangtao Li
2019-12-11  9:49   ` Peter De Schrijver
2019-12-09 19:57 ` [PATCH 07/17] clk: mvebu: " Yangtao Li
2019-12-09 19:57 ` [PATCH 08/17] clk: imx: " Yangtao Li
2019-12-09 20:44   ` Leonard Crestez
2019-12-10 13:21     ` Thierry Reding
2019-12-10 14:57       ` Andreas Färber
2019-12-10 15:10         ` mripard
2019-12-11 17:57         ` Paul Walmsley
2019-12-11 19:54           ` Andreas Färber
2019-12-11 22:49             ` Paul Walmsley
2019-12-12  5:38               ` Andreas Färber
2019-12-12  6:40                 ` Thierry Reding
2019-12-11 17:51       ` Paul Walmsley
2019-12-11 18:38         ` Leonard Crestez [this message]
2019-12-10 20:37     ` Frank Lee
2019-12-09 19:57 ` [PATCH 09/17] clk: sifive: " Yangtao Li
2019-12-09 19:57 ` [PATCH 10/17] clk: axi-clkgen: " Yangtao Li
2019-12-09 19:57 ` [PATCH 11/17] clk: milbeaut: " Yangtao Li
2019-12-09 19:57 ` [PATCH 12/17] clk: socfpga: " Yangtao Li
2019-12-16 20:20   ` Dinh Nguyen
2019-12-09 19:57 ` [PATCH 13/17] clk: gemini: " Yangtao Li
2019-12-09 19:57 ` [PATCH 14/17] clk: axm5516: " Yangtao Li
2019-12-09 19:57 ` [PATCH 15/17] clk: bm1880: " Yangtao Li
2019-12-09 19:57 ` [PATCH 16/17] clk: actions: " Yangtao Li
2019-12-09 19:57 ` [PATCH 17/17] ARC: clk: " Yangtao Li
2019-12-13  8:05 ` [PATCH 01/17] clk: sunxi: sunxi-ng: " Chen-Yu Tsai
2020-01-31  1:06 ` Stephen Boyd

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=VI1PR04MB7023943556EB5E6967AE3E0CEE5A0@VI1PR04MB7023.eurprd04.prod.outlook.com \
    --to=leonard.crestez@nxp.com \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=afaerber@suse.de \
    --cc=agross@kernel.org \
    --cc=aisheng.dong@nxp.com \
    --cc=allison@lohutok.net \
    --cc=chunhui.dai@mediatek.com \
    --cc=cw00.choi@samsung.com \
    --cc=daniel.baluta@nxp.com \
    --cc=dinguyen@kernel.org \
    --cc=emilio@elopez.com.ar \
    --cc=festevam@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=jcmvbkbc@gmail.com \
    --cc=john@phrozen.org \
    --cc=jonathanh@nvidia.com \
    --cc=kernel@pengutronix.de \
    --cc=kgene@kernel.org \
    --cc=krzk@kernel.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=matthias.bgg@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=nsekhar@ti.com \
    --cc=palmer@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --cc=paul@pwsan.com \
    --cc=pdeschrijver@nvidia.com \
    --cc=pgaikwad@nvidia.com \
    --cc=rfontana@redhat.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=swinslow@gmail.com \
    --cc=t-kristo@ti.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=tiny.windzz@gmail.com \
    --cc=tomasz.figa@gmail.com \
    --cc=wangyan.wang@mediatek.com \
    --cc=weiyongjun1@huawei.com \
    --cc=wens@csie.org \
    /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;
as well as URLs for NNTP newsgroup(s).