Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@sonymobile.com>
To: Andy Gross <agross@codeaurora.org>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-soc@vger.kernel.org
Subject: Re: [PATCH v2] firmware: qcom: scm: Peripheral Authentication Service
Date: Wed, 15 Jul 2015 17:39:56 -0700	[thread overview]
Message-ID: <20150716003955.GI32767@usrtlx11787.corpusers.net> (raw)
In-Reply-To: <20150715213323.GA12399@qualcomm.com>

On Wed 15 Jul 14:33 PDT 2015, Andy Gross wrote:

> On Wed, Jul 15, 2015 at 11:58:06AM -0700, Bjorn Andersson wrote:
> 
> <snip>
> 
> > +int __qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size)
> > +{
> > +	dma_addr_t mdata_phys;
> > +	void *mdata_buf;
> > +	__le32 scm_ret;
> > +	int ret;
> > +	struct pas_init_image_req {
> > +		__le32 proc;
> > +		__le32 image_addr;
> > +	} request;
> > +
> > +	/*
> > +	 * During the scm call memory protection will be enabled for the meta
> > +	 * data blob, so make sure it's physically contiguous, 4K aligned and
> > +	 * non-cachable to avoid XPU violations.
> > +	 */
> > +	mdata_buf = dma_alloc_coherent(NULL, size, &mdata_phys, GFP_KERNEL);
> 
> It'd be nice to send in the dev so we can attribute the allocation correctly.
> For 64 bit, we actually have to do this because NULL is not allowed right now.
> 

As per Stephen's answer I need to respin this anyways, but I think I
need to read up a little bit more on the implications of passing e.g.
the PIL dev* down here.

> > +	if (!mdata_buf) {
> > +		pr_err("Allocation of metadata buffer failed.\n");
> > +		return -ENOMEM;
> > +	}
> > +	memcpy(mdata_buf, metadata, size);
> > +
> > +	request.proc = cpu_to_le32(peripheral);
> > +	request.image_addr = cpu_to_le32(mdata_phys);
> > +
> > +	ret = qcom_scm_call(QCOM_SCM_SVC_PIL, QCOM_SCM_PAS_INIT_IMAGE_CMD,
> > +			    &request, sizeof(request),
> > +			    &scm_ret, sizeof(scm_ret));
> > +
> > +	dma_free_coherent(NULL, size, mdata_buf, mdata_phys);
> > +
> > +	return ret ? : le32_to_cpu(scm_ret);
> > +}
> > +
> 
> Otherwise, looks good.  Let me know if you plan to modify for the device above.
> If you want me to do it later, thats fine.  But it means API change.
> 

I'll respin this in a bit, need to read up a little bit more on the dma
allocation. But most likely I'll just move the allocation to the common
code, pass the physical address here and expect a dev* in the public
api.

Regards,
Bjorn

  reply	other threads:[~2015-07-16  0:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 19:46 [PATCH] firmware: qcom: scm: Peripheral Authentication Service Bjorn Andersson
2015-06-30 23:22 ` Andy Gross
2015-07-02 16:19 ` Stephen Boyd
2015-07-02 17:37   ` Bjorn Andersson
2015-07-02 18:37     ` Stephen Boyd
2015-07-15 18:58 ` [PATCH v2] " Bjorn Andersson
2015-07-15 21:33   ` Andy Gross
2015-07-16  0:39     ` Bjorn Andersson [this message]
2015-07-15 23:43   ` Stephen Boyd
2015-07-16  0:35     ` Bjorn Andersson
2015-07-16  0:55       ` Stephen Boyd
2015-07-16  1:22         ` 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=20150716003955.GI32767@usrtlx11787.corpusers.net \
    --to=bjorn.andersson@sonymobile.com \
    --cc=agross@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-soc@vger.kernel.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