All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Michael Tretter <m.tretter@pengutronix.de>
Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	kernel@pengutronix.de,
	Michael Turquette <mturquette@baylibre.com>,
	Michal Simek <michal.simek@xilinx.com>,
	Jolly Shah <jolly.shah@xilinx.com>
Subject: Re: [PATCH 1/5] clk: zynqmp: fix check for fractional clock
Date: Wed, 13 Mar 2019 09:24:04 -0700	[thread overview]
Message-ID: <155249424471.20095.16028115604342624987@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <20190312182546.24e46c5c@litschi.hi.pengutronix.de>

Quoting Michael Tretter (2019-03-12 10:25:46)
> On Tue, 12 Mar 2019 09:49:21 -0700, Stephen Boyd wrote:
> > Quoting Michael Tretter (2019-03-12 04:00:12)
> > > CLK_FRAC is not set in the divider->flags, but in the hw->flags.
> > > 
> > > The firmware sets CLK_FRAC for fractional clocks in the clkflag field.
> > > When registering the devider, these clkflags are copied to hw->flags.
> > > 
> > > Moreover, divider->flags field is a u8 type, but CLK_FRAG is BIT(13). So
> > > this check would never work.
> > > 
> > > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> > > ---
> > >  drivers/clk/zynqmp/divider.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
> > > index a371c66e72ef..fc70950c1e24 100644
> > > --- a/drivers/clk/zynqmp/divider.c
> > > +++ b/drivers/clk/zynqmp/divider.c
> > > @@ -117,7 +117,7 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw,
> > >         bestdiv = zynqmp_divider_get_val(*prate, rate);
> > >  
> > >         if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) &&
> > > -           (divider->flags & CLK_FRAC))
> > > +           (clk_hw_get_flags(hw) & CLK_FRAC))  
> > 
> > CLK_FRAC shouldn't be set in the struct clk_hw::core::flags field. It's
> > not a clk framework flag so it shouldn't go there. Please fix the user
> > of this flag to place the CLK_FRAC flag somewhere else. Even adding it
> > into divider::flags is not a good idea because that numberspace is for
> > dividers, and this flag seems to be zynqmp driver specific, so maybe
> > just add a bool to the zynqmp_clk_divider?
> > 
> 
> Thanks. The driver sets the clk_hw::core::flags based on a response
> from the ATF and this response includes this flag with other clk
> frameworks flags. I can test for the flag when registering the clock
> and set another flag or a bool for the zynqmp_clk_divider and will do
> so in v2.

Cool. Thanks!

> 
> However, this merely sounds like a workaround for an issue in the ATF,
> which should not define and use this flag in the first place. 
> 

What is ATF doing with these flags? Hopefully ATF and the Linux kernel
aren't using the same numberspace to describe these things. For example,
I would be concerned if ATF was looking at the CLK_SET_RATE_PARENT flag
and passing that value from firmware to the kernel, blindly assuming
that the kernel wouldn't change those numbers to be something else.
Obviously that type of kernel change would be invasive but it's not an
ABI that we've ever published so we're free to do these sorts of things.


WARNING: multiple messages have this Message-ID (diff)
From: Stephen Boyd <sboyd@kernel.org>
To: Michael Tretter <m.tretter@pengutronix.de>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Michal Simek <michal.simek@xilinx.com>,
	kernel@pengutronix.de, Jolly Shah <jolly.shah@xilinx.com>,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/5] clk: zynqmp: fix check for fractional clock
Date: Wed, 13 Mar 2019 09:24:04 -0700	[thread overview]
Message-ID: <155249424471.20095.16028115604342624987@swboyd.mtv.corp.google.com> (raw)
In-Reply-To: <20190312182546.24e46c5c@litschi.hi.pengutronix.de>

Quoting Michael Tretter (2019-03-12 10:25:46)
> On Tue, 12 Mar 2019 09:49:21 -0700, Stephen Boyd wrote:
> > Quoting Michael Tretter (2019-03-12 04:00:12)
> > > CLK_FRAC is not set in the divider->flags, but in the hw->flags.
> > > 
> > > The firmware sets CLK_FRAC for fractional clocks in the clkflag field.
> > > When registering the devider, these clkflags are copied to hw->flags.
> > > 
> > > Moreover, divider->flags field is a u8 type, but CLK_FRAG is BIT(13). So
> > > this check would never work.
> > > 
> > > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> > > ---
> > >  drivers/clk/zynqmp/divider.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/clk/zynqmp/divider.c b/drivers/clk/zynqmp/divider.c
> > > index a371c66e72ef..fc70950c1e24 100644
> > > --- a/drivers/clk/zynqmp/divider.c
> > > +++ b/drivers/clk/zynqmp/divider.c
> > > @@ -117,7 +117,7 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw,
> > >         bestdiv = zynqmp_divider_get_val(*prate, rate);
> > >  
> > >         if ((clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) &&
> > > -           (divider->flags & CLK_FRAC))
> > > +           (clk_hw_get_flags(hw) & CLK_FRAC))  
> > 
> > CLK_FRAC shouldn't be set in the struct clk_hw::core::flags field. It's
> > not a clk framework flag so it shouldn't go there. Please fix the user
> > of this flag to place the CLK_FRAC flag somewhere else. Even adding it
> > into divider::flags is not a good idea because that numberspace is for
> > dividers, and this flag seems to be zynqmp driver specific, so maybe
> > just add a bool to the zynqmp_clk_divider?
> > 
> 
> Thanks. The driver sets the clk_hw::core::flags based on a response
> from the ATF and this response includes this flag with other clk
> frameworks flags. I can test for the flag when registering the clock
> and set another flag or a bool for the zynqmp_clk_divider and will do
> so in v2.

Cool. Thanks!

> 
> However, this merely sounds like a workaround for an issue in the ATF,
> which should not define and use this flag in the first place. 
> 

What is ATF doing with these flags? Hopefully ATF and the Linux kernel
aren't using the same numberspace to describe these things. For example,
I would be concerned if ATF was looking at the CLK_SET_RATE_PARENT flag
and passing that value from firmware to the kernel, blindly assuming
that the kernel wouldn't change those numbers to be something else.
Obviously that type of kernel change would be invasive but it's not an
ABI that we've ever published so we're free to do these sorts of things.


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-03-13 16:24 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 11:00 [PATCH 0/5] clk: zynqmp: fix CLK_FRAC and various cleanups Michael Tretter
2019-03-12 11:00 ` Michael Tretter
2019-03-12 11:00 ` [PATCH 1/5] clk: zynqmp: fix check for fractional clock Michael Tretter
2019-03-12 11:00   ` Michael Tretter
2019-03-12 16:49   ` Stephen Boyd
2019-03-12 16:49     ` Stephen Boyd
2019-03-12 17:25     ` Michael Tretter
2019-03-12 17:25       ` Michael Tretter
2019-03-13 16:24       ` Stephen Boyd [this message]
2019-03-13 16:24         ` Stephen Boyd
2019-03-14  8:38         ` Michael Tretter
2019-03-14  8:38           ` Michael Tretter
2019-03-14 15:45           ` Stephen Boyd
2019-03-14 15:45             ` Stephen Boyd
2019-03-19  0:56           ` Jolly Shah
2019-03-19  0:56             ` Jolly Shah
2019-03-19 10:19             ` Michael Tretter
2019-03-19 10:19               ` Michael Tretter
2019-03-12 11:00 ` [PATCH 2/5] clk: zynqmp: fix doc of __zynqmp_clock_get_parents Michael Tretter
2019-03-12 11:00   ` Michael Tretter
2019-03-13 14:48   ` Michal Simek
2019-03-13 14:48     ` Michal Simek
2019-03-12 11:00 ` [PATCH 3/5] clk: zynqmp: do not export zynqmp_clk_register_mux Michael Tretter
2019-03-12 11:00   ` Michael Tretter
2019-03-12 16:52   ` Stephen Boyd
2019-03-12 16:52     ` Stephen Boyd
2019-03-12 17:26     ` Michael Tretter
2019-03-12 17:26       ` Michael Tretter
2019-03-12 11:00 ` [PATCH 4/5] clk: zynqmp: cleanup sizes of firmware responses Michael Tretter
2019-03-12 11:00   ` Michael Tretter
2019-03-13 16:37   ` Stephen Boyd
2019-03-13 16:37     ` Stephen Boyd
2019-03-12 11:00 ` [PATCH 5/5] clk: zynqmp: make field definitions of query responses consistent Michael Tretter
2019-03-12 11:00   ` Michael Tretter
2019-03-12 11:19   ` Michael Tretter
2019-03-12 11:19     ` Michael Tretter
2019-03-19  0:47   ` Jolly Shah
2019-03-19  0:47     ` Jolly Shah
2019-03-13 14:49 ` [PATCH 0/5] clk: zynqmp: fix CLK_FRAC and various cleanups Michal Simek
2019-03-13 14:49   ` Michal Simek

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=155249424471.20095.16028115604342624987@swboyd.mtv.corp.google.com \
    --to=sboyd@kernel.org \
    --cc=jolly.shah@xilinx.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=m.tretter@pengutronix.de \
    --cc=michal.simek@xilinx.com \
    --cc=mturquette@baylibre.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.