linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Lina Iyer <ilina@codeaurora.org>
Cc: andy.gross@linaro.org, david.brown@linaro.org,
	sboyd@codeaurora.org, rnayak@codeaurora.org,
	linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org,
	msivasub@codeaurora.org
Subject: Re: [PATCH 1/2] drivers: qcom: add command DB driver
Date: Wed, 7 Feb 2018 14:15:05 -0800	[thread overview]
Message-ID: <20180207221505.GS9465@builder> (raw)
In-Reply-To: <20180207214302.GA18993@codeaurora.org>

On Wed 07 Feb 13:43 PST 2018, Lina Iyer wrote:

> On Wed, Feb 07 2018 at 21:06 +0000, Bjorn Andersson wrote:
> > On Wed 07 Feb 10:29 PST 2018, Lina Iyer wrote:
> > > On Mon, Feb 05 2018 at 23:18 +0000, Bjorn Andersson wrote:
> > > > On Thu 18 Jan 14:08 PST 2018, Lina Iyer wrote:
> > [..]
> > > > > +static u64 cmd_db_get_u64_id(const char *id)
> > > > > +{
> > > > > +	uint64_t rsc_id = 0;
> > > > > +	uint8_t *ch  = (uint8_t *)&rsc_id;
> > > > > +	int i;
> > > > > +
> > > > > +	for (i = 0; ((i < sizeof(rsc_id)) && id[i]); i++)
> > > > > +		ch[i] = id[i];
> > > > > +
> > > > > +	return rsc_id;
> > > > > +}
> > > >
> > > > So this "casts" a 8 byte string to a u64. Why not just use u64 constants
> > > > to represent the resources, as we've done in the past?
> > > >
> > > This matches the resource specification on the remote end for this new
> > > architecture.
> > > 
> > 
> > But are these resource constants going to be used in the Linux kernel?
> > 
> > In previous variants of the RPM we had these too and in some places they
> > where described in their string variant and some in integer constants.
> > Upstream they all became integer constants, typically with a comment.
> > 
> > Unless there's some code sharing here I think we should do the
> > translation offline and encode them as hexadecimal constants.
> > 
> While I agree with the suggestion. I doubt this is making it any easier.
> The general identifier of a resource is a human readadble stringified
> name. It makes understanding the information regarding the resource -
> like the rail name, clock etc much more user friendly. I would like to
> keep it that way. I am quite sure, the driver authors would prefer to,
> as well. This makes it easier when reading through DT.
> 
> Ex: gfx.lvl, ddr.lvl, ddr.tmr as opposed to -
> 0x6c766c2e786667, 0x6c766c2e726464, 0x726d742e726464  respectively.
> 

The way that upstream regulator, clock and the current direction
interconnect is taken these constants are not visible in DT.

The way we have dealt with these constants previously (it's pretty much
the same with previous RPM versions) is to used defines in those
drivers.  E.g. RPM_KEY_{SWEN,UV,MA} in qcom_smd-regulator.c


That said, I don't have a strong opinion about this so feel free to
retain this model if you think it helps those drivers.

[..]
> > > > > +int cmd_db_get_slave_id(const char *resource_id)
> > > > > +{
> > > > > +	int ret;
> > > > > +	struct entry_header ent;
> > > > > +	struct rsc_hdr rsc_hdr;
> > > > > +
> > > > > +	ret = cmd_db_get_header_by_rsc_id(resource_id, &ent, &rsc_hdr);
> > > > > +	return ret < 0 ? 0 : (ent.addr >> SLAVE_ID_SHIFT) & SLAVE_ID_MASK;
> > > >
> > > > Why is this bit 16-19 of the address? What is ent.addr?! Why isn't this
> > > > rsc_hdr.slv_id?
> > > >
> > > BITS 16:18 indicate what type of slave it is - ARC, BCM, VRM. This
> > > information is part of each entry.
> > > 
> > 
> > Okay, that sounds reasonable.
> > 
> > But what's the value in rsc_hdr.slv_id representing? The "id" of the
> > resource? Why is that a "slave id"?
> > 
> The master is the client that runs on Linux and other processors like
> GPU, Modem etc. The slave is the actual resource like the clock,
> regulator, etc. Hence the name 'slave id'.
> 

Okay, that does make sense.

But if a "slave" is a "resource" it would be convenient if the driver
picked one of the names and stuck with that.

And it sounds like this function should be named get_slave_type() (or
get_resource_type()).


Thanks,
Bjorn

  reply	other threads:[~2018-02-07 22:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 22:08 [PATCH 0/2] drivers/qcom: add Command DB support Lina Iyer
2018-01-18 22:08 ` [PATCH 1/2] drivers: qcom: add command DB driver Lina Iyer
2018-01-25 20:46   ` Stephen Boyd
2018-02-07 16:47     ` Lina Iyer
2018-02-07 17:00       ` Bjorn Andersson
2018-02-05 23:18   ` Bjorn Andersson
2018-02-07 18:29     ` Lina Iyer
2018-02-07 21:06       ` Bjorn Andersson
2018-02-07 21:43         ` Lina Iyer
2018-02-07 22:15           ` Bjorn Andersson [this message]
2018-01-18 22:08 ` [PATCH 2/2] dt-bindings: introduce Command DB for QCOM SoCs Lina Iyer
2018-01-18 22:28   ` Lina Iyer
2018-01-29 19:08     ` Rob Herring
2018-01-30 16:17       ` Lina Iyer
2018-02-05 22:11         ` Bjorn Andersson
2018-02-06 20:05           ` Lina Iyer
     [not found]             ` <20180206200507.GA13360-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-02-06 20:15               ` Bjorn Andersson

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=20180207221505.GS9465@builder \
    --to=bjorn.andersson@linaro.org \
    --cc=andy.gross@linaro.org \
    --cc=david.brown@linaro.org \
    --cc=ilina@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-soc@vger.kernel.org \
    --cc=msivasub@codeaurora.org \
    --cc=rnayak@codeaurora.org \
    --cc=sboyd@codeaurora.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).