linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Brown <davidb@codeaurora.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: Jeff Ohlstein <johlstei@codeaurora.org>,
	Daniel Walker <dwalker@codeaurora.org>,
	linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Stephen Boyd <sboyd@codeaurora.org>,
	Abhijeet Dharmapurikar <adharmap@codeaurora.org>,
	David Brown <davidb@codeaurora.org>,
	Bryan Huntsman <bryanh@codeaurora.org>,
	Russell King <linux@arm.linux.org.uk>
Subject: Re: [PATCH 1/5] msm: Secure Channel Manager (SCM) support
Date: Wed, 15 Dec 2010 06:05:58 -0800	[thread overview]
Message-ID: <20101215140558.GA9736@huya.qualcomm.com> (raw)
In-Reply-To: <20101215074811.GA2483@ucw.cz>

On Wed, Dec 15, 2010 at 08:48:11AM +0100, Pavel Machek wrote:

> > +static u32 smc(dma_addr_t cmd_addr)
> > +{
> > +	int context_id;
> > +	register u32 r0 asm("r0") = 1;
> > +	register u32 r1 asm("r1") = (u32)&context_id;
> > +	register u32 r2 asm("r2") = (u32)cmd_addr;
> 
> Are these neccessary?

The values have to be in specific registers.  Without them it doesn't
generate the right code.

> > +	asm(
> > +		__asmeq("%0", "r0")
> > +		__asmeq("%1", "r0")
> > +		__asmeq("%2", "r1")
> > +		__asmeq("%3", "r2")
> > +		"smc	#0	@ switch to secure world\n"
> > +		: "=r" (r0)
> > +		: "r" (r0), "r" (r1), "r" (r2)
> > +		: "r3");
> > +	return r0;
> > +}
> 
> > +u32 scm_get_version(void)
> > +{
> > +	int context_id;
> > +	static u32 version = -1;
> > +	register u32 r0 asm("r0") = 0x1 << 8;
> > +	register u32 r1 asm("r1") = (u32)&context_id;
> 
> And does this even work?

In what sense?  It generates the desired code.

> > +	if (version != -1)
> > +		return version;
> > +
> > +	mutex_lock(&scm_lock);
> > +	asm(
> > +		__asmeq("%0", "r1")
> > +		__asmeq("%1", "r0")
> > +		__asmeq("%2", "r1")
> > +		"smc	#0	@ switch to secure world\n"
> > +		: "=r" (r1)
> > +		: "r" (r0), "r" (r1)
> > +		: "r2", "r3");
> > +	version = r1;
> > +	mutex_unlock(&scm_lock);
> > +
> > +	return version;
> > +}

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  reply	other threads:[~2010-12-15 14:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06  7:16 [PATCH 0/5] SMP support for msm Jeff Ohlstein
2010-12-06  7:16 ` [PATCH 1/5] msm: Secure Channel Manager (SCM) support Jeff Ohlstein
2010-12-06 20:00   ` Valdis.Kletnieks
2010-12-06 20:52     ` Russell King - ARM Linux
2010-12-15  7:48   ` Pavel Machek
2010-12-15 14:05     ` David Brown [this message]
2010-12-15 16:07       ` Russell King - ARM Linux
2010-12-06  7:16 ` [PATCH 2/5] msm: scm-boot: Support for setting cold/warm boot addresses Jeff Ohlstein
2010-12-06  7:16 ` [PATCH 3/5] msm: timer: SMP timer support for msm Jeff Ohlstein
2010-12-06  9:56   ` Thomas Gleixner
2010-12-06 10:20     ` Russell King - ARM Linux
2010-12-06 11:11       ` Thomas Gleixner
2010-12-07  4:49     ` Jeff Ohlstein
2010-12-07  8:17     ` Russell King - ARM Linux
2010-12-20 12:21       ` Russell King - ARM Linux
2010-12-06  7:16 ` [PATCH 4/5] msm: hotplug: support cpu hotplug on msm Jeff Ohlstein
2010-12-06  7:16 ` [PATCH 5/5] msm: add SMP support for msm Jeff Ohlstein

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=20101215140558.GA9736@huya.qualcomm.com \
    --to=davidb@codeaurora.org \
    --cc=adharmap@codeaurora.org \
    --cc=bryanh@codeaurora.org \
    --cc=dwalker@codeaurora.org \
    --cc=johlstei@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=pavel@ucw.cz \
    --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).