All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>,
	Jeffy Chen <jeffy.chen@rock-chips.com>,
	open list <linux-kernel@vger.kernel.org>,
	jcliang@chromium.org, simon xue <xxm@rock-chips.com>,
	tfiga@chromium.org, Romain Perier <romain.perier@collabora.com>,
	Yakir Yang <kuankuan.y@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	Liang Chen <cl@rock-chips.com>, Rob Herring <robh+dt@kernel.org>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	David Wu <david.wu@rock-chips.com>,
	Finley Xiao <finley.xiao@rock-chips.com>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Jacob Chen <jacob-chen@iotwrt.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Brian Norris <briannorris@chromium.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.or>
Subject: Re: [PATCH v8 07/14] ARM: dts: rockchip: add clocks in iommu nodes
Date: Tue, 10 Apr 2018 12:54:17 +0200	[thread overview]
Message-ID: <1720770.fWGWCFZ36p@phil> (raw)
In-Reply-To: <5686492.Vgpi8vPSL1@diego>

Am Montag, 9. April 2018, 23:49:58 CEST schrieb Heiko Stübner:
> Am Montag, 9. April 2018, 17:55:40 CEST schrieb Heiko Stübner:
> > Am Montag, 9. April 2018, 17:53:01 CEST schrieb Robin Murphy:
> > > On 09/04/18 16:44, Heiko Stübner wrote:
> > > > Hi Tomeu,
> > > > 
> > > > Am Montag, 9. April 2018, 16:41:56 CEST schrieb Tomeu Vizoso:
> > > >> in today's linux-next, the DRM driver fails to probe because the iommu
> > > >> driver fails to find the aclk. I need to apply this patch for things
> > > >> to work again.
> > > > 
> > > > Thanks for catching that issue.
> > > > 
> > > > This seems to expose a backwards-compatibility issue, as this breaks
> > > > all old devicetrees, so should get a proper fix, apart from me applying
> > > > the dt-patch I missed.
> > > > 
> > > > Looking at the iommu-clock-handling patch, I imagine this part as
> > > > the culprit:
> > > > 
> > > > +	iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks);
> > > > +	iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks,
> > > > +				     sizeof(*iommu->clocks), GFP_KERNEL);
> > > > +	if (!iommu->clocks)
> > > > +		return -ENOMEM;
> > > > 
> > > > The clk-bulk functions seem to work with simple for loops and
> > > > should (as the other standard clock functions) just work fine with
> > > > an empty struct, so I guess a simple
> > > > 
> > > > 	if (!iommu->clocks && iommu->num_clocks > 0)
> > > > 	
> > > > 		return -ENOMEM;
> > > > 
> > > > should hopefully be enough. I'll try to give this a test later on
> > > > if nobody beats me to it :-)
> > > 
> > > But iommu->num_clocks is clearly set to a nonzero compile-time constant
> > > at this point ;)
> > > 
> > > I'd assume it's the return from devm_clk_bulk_get() which needs to
> > > special-case the "no clocks found" case from any other error, and *then*
> > > blat num_clocks to 0 if so.
> > 
> > you're right of course. Looking at it again, I now clearly see the
> > ARRAY_SIZE and am wondering what made me think num_clocks would be
> > runtime-read.
> > 
> > Must be those 25°C today ;-)
> 
> In any case, this does not seem to fully fix the issue ... or be more exact 
> seems to be the only issue.
> 
> - With 4.16 both pinky and kevin have working displays.
> - When I was merging display patches to drm-misc, I did boot-tests on
>   both pinky and kevin, keeping their displays in a working state.
> 
> - With current torvalds head (iommu not merged yet)
> e9092d0d9796 ("Fix subtle macro variable shadowing in min_not_zero()")
> 
> I get display output on rk3399-kevin (edp), but not on
> rk3288-pinky (edp + hdmi). [components + hdmi device+modes get
> recognized correctly though]
> 
> - With iommu changes merged I end up with the failing clock issue
>   which can be countered by making the iommu-clocks optional.
> 
> - After that I get working display output again on kevin but not pinky.
> 
> Looks like this needs bisecting.

And it seems the dwc2 vbus thingy was responsible for the other issue I saw.
With Tomeus fixup patch applied and the series I sent an hour ago, I now
get display output again on both kevin (rk3399) and pinky (rk3288).

Heiko

WARNING: multiple messages have this Message-ID (diff)
From: heiko@sntech.de (Heiko Stuebner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v8 07/14] ARM: dts: rockchip: add clocks in iommu nodes
Date: Tue, 10 Apr 2018 12:54:17 +0200	[thread overview]
Message-ID: <1720770.fWGWCFZ36p@phil> (raw)
In-Reply-To: <5686492.Vgpi8vPSL1@diego>

Am Montag, 9. April 2018, 23:49:58 CEST schrieb Heiko St?bner:
> Am Montag, 9. April 2018, 17:55:40 CEST schrieb Heiko St?bner:
> > Am Montag, 9. April 2018, 17:53:01 CEST schrieb Robin Murphy:
> > > On 09/04/18 16:44, Heiko St?bner wrote:
> > > > Hi Tomeu,
> > > > 
> > > > Am Montag, 9. April 2018, 16:41:56 CEST schrieb Tomeu Vizoso:
> > > >> in today's linux-next, the DRM driver fails to probe because the iommu
> > > >> driver fails to find the aclk. I need to apply this patch for things
> > > >> to work again.
> > > > 
> > > > Thanks for catching that issue.
> > > > 
> > > > This seems to expose a backwards-compatibility issue, as this breaks
> > > > all old devicetrees, so should get a proper fix, apart from me applying
> > > > the dt-patch I missed.
> > > > 
> > > > Looking at the iommu-clock-handling patch, I imagine this part as
> > > > the culprit:
> > > > 
> > > > +	iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks);
> > > > +	iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks,
> > > > +				     sizeof(*iommu->clocks), GFP_KERNEL);
> > > > +	if (!iommu->clocks)
> > > > +		return -ENOMEM;
> > > > 
> > > > The clk-bulk functions seem to work with simple for loops and
> > > > should (as the other standard clock functions) just work fine with
> > > > an empty struct, so I guess a simple
> > > > 
> > > > 	if (!iommu->clocks && iommu->num_clocks > 0)
> > > > 	
> > > > 		return -ENOMEM;
> > > > 
> > > > should hopefully be enough. I'll try to give this a test later on
> > > > if nobody beats me to it :-)
> > > 
> > > But iommu->num_clocks is clearly set to a nonzero compile-time constant
> > > at this point ;)
> > > 
> > > I'd assume it's the return from devm_clk_bulk_get() which needs to
> > > special-case the "no clocks found" case from any other error, and *then*
> > > blat num_clocks to 0 if so.
> > 
> > you're right of course. Looking at it again, I now clearly see the
> > ARRAY_SIZE and am wondering what made me think num_clocks would be
> > runtime-read.
> > 
> > Must be those 25?C today ;-)
> 
> In any case, this does not seem to fully fix the issue ... or be more exact 
> seems to be the only issue.
> 
> - With 4.16 both pinky and kevin have working displays.
> - When I was merging display patches to drm-misc, I did boot-tests on
>   both pinky and kevin, keeping their displays in a working state.
> 
> - With current torvalds head (iommu not merged yet)
> e9092d0d9796 ("Fix subtle macro variable shadowing in min_not_zero()")
> 
> I get display output on rk3399-kevin (edp), but not on
> rk3288-pinky (edp + hdmi). [components + hdmi device+modes get
> recognized correctly though]
> 
> - With iommu changes merged I end up with the failing clock issue
>   which can be countered by making the iommu-clocks optional.
> 
> - After that I get working display output again on kevin but not pinky.
> 
> Looks like this needs bisecting.

And it seems the dwc2 vbus thingy was responsible for the other issue I saw.
With Tomeus fixup patch applied and the series I sent an hour ago, I now
get display output again on both kevin (rk3399) and pinky (rk3288).

Heiko

WARNING: multiple messages have this Message-ID (diff)
From: Heiko Stuebner <heiko@sntech.de>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Tomeu Vizoso <tomeu@tomeuvizoso.net>,
	Jeffy Chen <jeffy.chen@rock-chips.com>,
	open list <linux-kernel@vger.kernel.org>,
	jcliang@chromium.org, simon xue <xxm@rock-chips.com>,
	tfiga@chromium.org, Romain Perier <romain.perier@collabora.com>,
	Yakir Yang <kuankuan.y@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	Liang Chen <cl@rock-chips.com>, Rob Herring <robh+dt@kernel.org>,
	Shawn Lin <shawn.lin@rock-chips.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	David Wu <david.wu@rock-chips.com>,
	Finley Xiao <finley.xiao@rock-chips.com>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Jacob Chen <jacob-chen@iotwrt.com>,
	Kever Yang <kever.yang@rock-chips.com>,
	Brian Norris <briannorris@chromium.org>,
	"open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	Rocky Hao <rocky.hao@rock-chips.com>,
	Will Deacon <will.deacon@arm.com>,
	Nickey Yang <nickey.yang@rock-chips.com>,
	devicetree@vger.kernel.org, Mark Yao <markyao0591@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	linux-arm-kernel@lists.infradead.org,
	Sugar Zhang <sugar.zhang@rock-chips.com>,
	Caesar Wang <wxt@rock-chips.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH v8 07/14] ARM: dts: rockchip: add clocks in iommu nodes
Date: Tue, 10 Apr 2018 12:54:17 +0200	[thread overview]
Message-ID: <1720770.fWGWCFZ36p@phil> (raw)
In-Reply-To: <5686492.Vgpi8vPSL1@diego>

Am Montag, 9. April 2018, 23:49:58 CEST schrieb Heiko Stübner:
> Am Montag, 9. April 2018, 17:55:40 CEST schrieb Heiko Stübner:
> > Am Montag, 9. April 2018, 17:53:01 CEST schrieb Robin Murphy:
> > > On 09/04/18 16:44, Heiko Stübner wrote:
> > > > Hi Tomeu,
> > > > 
> > > > Am Montag, 9. April 2018, 16:41:56 CEST schrieb Tomeu Vizoso:
> > > >> in today's linux-next, the DRM driver fails to probe because the iommu
> > > >> driver fails to find the aclk. I need to apply this patch for things
> > > >> to work again.
> > > > 
> > > > Thanks for catching that issue.
> > > > 
> > > > This seems to expose a backwards-compatibility issue, as this breaks
> > > > all old devicetrees, so should get a proper fix, apart from me applying
> > > > the dt-patch I missed.
> > > > 
> > > > Looking at the iommu-clock-handling patch, I imagine this part as
> > > > the culprit:
> > > > 
> > > > +	iommu->num_clocks = ARRAY_SIZE(rk_iommu_clocks);
> > > > +	iommu->clocks = devm_kcalloc(iommu->dev, iommu->num_clocks,
> > > > +				     sizeof(*iommu->clocks), GFP_KERNEL);
> > > > +	if (!iommu->clocks)
> > > > +		return -ENOMEM;
> > > > 
> > > > The clk-bulk functions seem to work with simple for loops and
> > > > should (as the other standard clock functions) just work fine with
> > > > an empty struct, so I guess a simple
> > > > 
> > > > 	if (!iommu->clocks && iommu->num_clocks > 0)
> > > > 	
> > > > 		return -ENOMEM;
> > > > 
> > > > should hopefully be enough. I'll try to give this a test later on
> > > > if nobody beats me to it :-)
> > > 
> > > But iommu->num_clocks is clearly set to a nonzero compile-time constant
> > > at this point ;)
> > > 
> > > I'd assume it's the return from devm_clk_bulk_get() which needs to
> > > special-case the "no clocks found" case from any other error, and *then*
> > > blat num_clocks to 0 if so.
> > 
> > you're right of course. Looking at it again, I now clearly see the
> > ARRAY_SIZE and am wondering what made me think num_clocks would be
> > runtime-read.
> > 
> > Must be those 25°C today ;-)
> 
> In any case, this does not seem to fully fix the issue ... or be more exact 
> seems to be the only issue.
> 
> - With 4.16 both pinky and kevin have working displays.
> - When I was merging display patches to drm-misc, I did boot-tests on
>   both pinky and kevin, keeping their displays in a working state.
> 
> - With current torvalds head (iommu not merged yet)
> e9092d0d9796 ("Fix subtle macro variable shadowing in min_not_zero()")
> 
> I get display output on rk3399-kevin (edp), but not on
> rk3288-pinky (edp + hdmi). [components + hdmi device+modes get
> recognized correctly though]
> 
> - With iommu changes merged I end up with the failing clock issue
>   which can be countered by making the iommu-clocks optional.
> 
> - After that I get working display output again on kevin but not pinky.
> 
> Looks like this needs bisecting.

And it seems the dwc2 vbus thingy was responsible for the other issue I saw.
With Tomeus fixup patch applied and the series I sent an hour ago, I now
get display output again on both kevin (rk3399) and pinky (rk3288).

Heiko

  reply	other threads:[~2018-04-10 10:54 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-23  7:38 [PATCH v8 00/14] iommu/rockchip: Use OF_IOMMU Jeffy Chen
2018-03-23  7:38 ` Jeffy Chen
2018-03-23  7:38 ` Jeffy Chen
2018-03-23  7:38 ` [PATCH v8 02/14] iommu/rockchip: Fix error handling in probe Jeffy Chen
2018-03-23  7:38   ` Jeffy Chen
     [not found] ` <20180323073814.5802-1-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-03-23  7:38   ` [PATCH v8 01/14] iommu/rockchip: Prohibit unbind and remove Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38   ` [PATCH v8 03/14] iommu/rockchip: Request irqs in rk_iommu_probe() Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38   ` [PATCH v8 05/14] iommu/rockchip: Use iopoll helpers to wait for hardware Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38   ` [PATCH v8 06/14] iommu/rockchip: Fix TLB flush of secondary IOMMUs Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38   ` [PATCH v8 09/14] dt-bindings: iommu/rockchip: Add clock property Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
     [not found]     ` <20180323073814.5802-10-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-03-25 23:52       ` Rob Herring
2018-03-25 23:52         ` Rob Herring
2018-03-25 23:52         ` Rob Herring
2018-03-23  7:38   ` [PATCH v8 10/14] iommu/rockchip: Use IOMMU device for dma mapping operations Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38   ` [PATCH v8 11/14] iommu/rockchip: Use OF_IOMMU to attach devices automatically Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
     [not found]     ` <20180323073814.5802-12-jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-03-26  6:31       ` Daniel Kurtz
2018-03-26  6:31         ` Daniel Kurtz
2018-03-26  6:31         ` Daniel Kurtz
     [not found]         ` <CAGS+omDUve9DTMJY8FdWBBxQgCOACLYLsRuzmQzd3Fh7TeekDw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-03-26  7:57           ` JeffyChen
2018-04-03 16:11             ` Daniel Kurtz
2018-04-03 16:11               ` Daniel Kurtz
2018-04-04 11:10               ` JeffyChen
2018-04-04 11:10                 ` JeffyChen
2018-03-23  7:38   ` [PATCH v8 12/14] iommu/rockchip: Fix error handling in init Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38   ` [PATCH v8 14/14] iommu/rockchip: Support sharing IOMMU between masters Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-23  7:38     ` Jeffy Chen
2018-03-29 10:24   ` [PATCH v8 00/14] iommu/rockchip: Use OF_IOMMU Joerg Roedel
2018-03-29 10:24     ` Joerg Roedel
2018-03-29 10:24     ` Joerg Roedel
2018-03-23  7:38 ` [PATCH v8 04/14] iommu/rockchip: Fix error handling in attach Jeffy Chen
2018-03-23  7:38   ` Jeffy Chen
2018-03-23  7:38 ` [PATCH v8 07/14] ARM: dts: rockchip: add clocks in iommu nodes Jeffy Chen
2018-03-23  7:38   ` Jeffy Chen
2018-03-23  7:38   ` Jeffy Chen
2018-04-09 14:41   ` Tomeu Vizoso
2018-04-09 14:41     ` Tomeu Vizoso
2018-04-09 14:41     ` Tomeu Vizoso
2018-04-09 15:44     ` Heiko Stübner
2018-04-09 15:44       ` Heiko Stübner
2018-04-09 15:44       ` Heiko Stübner
2018-04-09 15:53       ` Robin Murphy
2018-04-09 15:53         ` Robin Murphy
2018-04-09 15:53         ` Robin Murphy
2018-04-09 15:55         ` Heiko Stübner
2018-04-09 15:55           ` Heiko Stübner
2018-04-09 15:55           ` Heiko Stübner
2018-04-09 21:49           ` Heiko Stübner
2018-04-09 21:49             ` Heiko Stübner
2018-04-09 21:49             ` Heiko Stübner
2018-04-10 10:54             ` Heiko Stuebner [this message]
2018-04-10 10:54               ` Heiko Stuebner
2018-04-10 10:54               ` Heiko Stuebner
2018-04-10 11:46   ` Heiko Stuebner
2018-04-10 11:46     ` Heiko Stuebner
2018-04-10 11:46     ` Heiko Stuebner
2018-03-23  7:38 ` [PATCH v8 08/14] iommu/rockchip: Control clocks needed to access the IOMMU Jeffy Chen
2018-03-23  7:38   ` Jeffy Chen
2018-03-23  7:38 ` [PATCH v8 13/14] iommu/rockchip: Add runtime PM support Jeffy Chen
2018-03-23  7:38   ` Jeffy Chen

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=1720770.fWGWCFZ36p@phil \
    --to=heiko@sntech.de \
    --cc=arnd@arndb.de \
    --cc=briannorris@chromium.org \
    --cc=catalin.marinas@arm.com \
    --cc=cl@rock-chips.com \
    --cc=david.wu@rock-chips.com \
    --cc=enric.balletbo@collabora.com \
    --cc=finley.xiao@rock-chips.com \
    --cc=jacob-chen@iotwrt.com \
    --cc=jcliang@chromium.org \
    --cc=jeffy.chen@rock-chips.com \
    --cc=kever.yang@rock-chips.com \
    --cc=kuankuan.y@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.or \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=romain.perier@collabora.com \
    --cc=shawn.lin@rock-chips.com \
    --cc=tfiga@chromium.org \
    --cc=tomeu@tomeuvizoso.net \
    --cc=xxm@rock-chips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.