All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Andersson <andersson@kernel.org>
To: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Robert Marko <robimarko@gmail.com>,
	agross@kernel.org, ilia.lin@kernel.org, rafael@kernel.org,
	viresh.kumar@linaro.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
	ansuelsmth@gmail.com
Subject: Re: [PATCH v4 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id()
Date: Thu, 25 May 2023 19:33:25 -0700	[thread overview]
Message-ID: <20230526023325.y7iqygmbtjmbf4zo@ripper> (raw)
In-Reply-To: <a196330e-9d70-1bbd-6fae-7d60eb06e478@linaro.org>

On Fri, May 26, 2023 at 01:18:17AM +0200, Konrad Dybcio wrote:
> 
> 
> On 25.05.2023 23:02, Robert Marko wrote:
> > Introduce a helper to return the SoC SMEM ID, which is used to identify the
> > exact SoC model as there may be differences in the same SoC family.
> > 
> > Currently, cpufreq-nvmem does this completely in the driver and there has
> > been more interest expresed for other drivers to use this information so
> > lets expose a common helper to prevent redoing it in individual drivers
> > since this field is present on every SMEM table version.
> > 
> > Signed-off-by: Robert Marko <robimarko@gmail.com>
> > ---
> > Changes in v4:
> > * Change helper name to qcom_smem_get_soc_id()
> > * Remove len and just pass NULL, that is sufficient here
> > 
> > Changes in v3:
> > * Change export to EXPORT_SYMBOL_GPL
> > * Use an argument for returning SoC ID
> > * Update kerneldoc
> > ---
> >  drivers/soc/qcom/smem.c       | 23 +++++++++++++++++++++++
> >  include/linux/soc/qcom/smem.h |  2 ++
> >  2 files changed, 25 insertions(+)
> > 
> > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> > index bc98520c4969..78cf79ea4924 100644
> > --- a/drivers/soc/qcom/smem.c
> > +++ b/drivers/soc/qcom/smem.c
> > @@ -14,6 +14,7 @@
> >  #include <linux/sizes.h>
> >  #include <linux/slab.h>
> >  #include <linux/soc/qcom/smem.h>
> > +#include <linux/soc/qcom/socinfo.h>
> >  
> >  /*
> >   * The Qualcomm shared memory system is a allocate only heap structure that
> > @@ -772,6 +773,28 @@ phys_addr_t qcom_smem_virt_to_phys(void *p)
> >  }
> >  EXPORT_SYMBOL_GPL(qcom_smem_virt_to_phys);
> >  
> > +/**
> > + * qcom_smem_get_soc_id() - return the SoC ID
> > + * @id:	On success, we return the SoC ID here.
> > + *
> > + * Look up SoC ID from HW/SW build ID and return it.
> > + *
> > + * Return: 0 on success, negative errno on failure.
> > + */
> > +int qcom_smem_get_soc_id(u32 *id)
> __le32 *id
> 

Why do you want this passed back to the user in little endian? When is
it not going to be compared to a cpu-endian constant?

> LGTM otherwise!
> 
> Konrad
> > +{
> > +	struct socinfo *info;
> > +
> > +	info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_HW_SW_BUILD_ID, NULL);
> > +	if (IS_ERR(info))
> > +		return PTR_ERR(info);
> > +
> > +	*id = info->id;

This should be __le32_to_cpu() though...

Regards,
Bjorn

> > +
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(qcom_smem_get_soc_id);
> > +
> >  static int qcom_smem_get_sbl_version(struct qcom_smem *smem)
> >  {
> >  	struct smem_header *header;
> > diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h
> > index 86e1b358688a..223db6a9c733 100644
> > --- a/include/linux/soc/qcom/smem.h
> > +++ b/include/linux/soc/qcom/smem.h
> > @@ -11,4 +11,6 @@ int qcom_smem_get_free_space(unsigned host);
> >  
> >  phys_addr_t qcom_smem_virt_to_phys(void *p);
> >  
> > +int qcom_smem_get_soc_id(u32 *id);
> > +
> >  #endif

  reply	other threads:[~2023-05-26  2:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25 21:02 [PATCH v4 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Robert Marko
2023-05-25 21:02 ` [PATCH v4 2/5] soc: qcom: smem: Switch to EXPORT_SYMBOL_GPL() Robert Marko
2023-05-25 21:02 ` [PATCH v4 3/5] soc: qcom: smem: introduce qcom_smem_get_soc_id() Robert Marko
2023-05-25 23:18   ` Konrad Dybcio
2023-05-26  2:33     ` Bjorn Andersson [this message]
2023-05-26  8:42       ` Konrad Dybcio
2023-05-26 19:04   ` Bjorn Andersson
2023-05-25 21:02 ` [PATCH v4 4/5] cpufreq: qcom-nvmem: use SoC ID-s from bindings Robert Marko
2023-05-25 21:02 ` [PATCH v4 5/5] cpufreq: qcom-nvmem: use helper to get SMEM SoC ID Robert Marko
2023-05-25 23:18   ` Konrad Dybcio
2023-05-26  2:43     ` Bjorn Andersson
2023-05-26  8:44       ` Konrad Dybcio
2023-05-25 23:13 ` [PATCH v4 1/5] soc: qcom: socinfo: move SMEM item struct and defines to a header Konrad Dybcio

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=20230526023325.y7iqygmbtjmbf4zo@ripper \
    --to=andersson@kernel.org \
    --cc=agross@kernel.org \
    --cc=ansuelsmth@gmail.com \
    --cc=ilia.lin@kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robimarko@gmail.com \
    --cc=viresh.kumar@linaro.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 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.