linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: EXYNOS: Add smc call to support trustzone feature
Date: Mon, 11 Jun 2012 10:44:23 +0100	[thread overview]
Message-ID: <20120611094423.GC11168@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20120611090440.GA27207@july>

On Mon, Jun 11, 2012 at 06:04:40PM +0900, Kyungmin Park wrote:
> +/*
> + * Read registers
> + * Function signature: u32 exynos_smc_readsfr(u32 addr, u32 *val)

What address space is 'addr' in?

> + */
> +ENTRY(exynos_smc_readsfr)
> +	stmfd	sp!, {r4-r11, lr}
> +	mov	r2, #0
> +	lsr	r0, r0, #2
> +	mov	ip, r1
> +	mov	r3, r2
> +	orr	r1, r0, #0xC0000000

I assume this is not PAGE_OFFSET.

> +	mvn	r0, #100

Hmm.  The compiler will automatically use mvn instead of a normal mov with
negative numbers.  It may be clearer to write:

	mov	r0, #-101

> +	dsb
> +	smc	#0
> +	cmn	r0, #101

Same here:
	cmp	r0, #-101

Notice that writing it this way means it's obvious that you're checking
for -101, the original value passed in.

> +	beq	1f
> +	cmp	r0, #0
> +	streq	r2, [ip]
> +	ldmfd	sp!, {r4-r11, pc}
> +1:	subs	r0, r1, #0

Isn't this just a normal:
	movs	r0, r1

?

> +	streq	r2, [ip]
> +	ldmfd	sp!, {r4-r11, pc}
> +ENDPROC(exynos_smc_readsfr)

In any case, can't this end part be written:

	cmp	r0, #-101
	moveq	r0, r1
	teq	r0, #0		@ I prefer teq over cmp to test equality
	streq	r2, [ip]
	ldmfd	sp!, {r4 - r11, pc}

  reply	other threads:[~2012-06-11  9:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-11  9:04 [PATCH] ARM: EXYNOS: Add smc call to support trustzone feature Kyungmin Park
2012-06-11  9:44 ` Russell King - ARM Linux [this message]
2012-06-11 10:19   ` Marek Szyprowski
2012-06-20 10:59 ` Dave Martin

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=20120611094423.GC11168@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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).