Skip to contentSkip to conversation

ARM: OMAP: Add secure function omap_smc3() which calling instruction smc #1

PATCH Dave Martin 3 participants 4 messages Sep 16, 2013 – Sep 17, 2013

lore
Share & tools
lore

Dave Martin

author Acked-by
#0 lore raw
Quoted 60 lines · Pali Rohár
Quoted 59 lines · On Sunday 08 September 2013 09:43:29 Pali Rohár wrote:

Here is new version (v4) of omap secure part patch:

Other secure functions omap_smc1() and omap_smc2() calling instruction smc #0 but Nokia RX-51 board needs to call smc #1 for PPA access.

---

(quoted diff) +0 -0

b/arch/arm/mach-omap2/omap-secure.h index 0e72917..c4586f4 100644

arch/arm/mach-omap2/omap-secure.h +1 -0
@@ -51,6 +51,7 @@
 extern u32 omap_secure_dispatcher(u32 idx, u32 flag, u32
 nargs, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
 extern u32 omap_smc2(u32 id, u32 falg, u32 pargs);
+extern u32 omap_smc3(u32 id, u32 process, u32 flag, u32

pargs); extern phys_addr_t
omap_secure_ram_mempool_base(void); extern int
omap_secure_ram_reserve_memblock(void);

(quoted diff) +0 -0

b/arch/arm/mach-omap2/omap-smc.S index f6441c1..fd90125 100644

arch/arm/mach-omap2/omap-smc.S +3 -1
@@ -1,9 +1,11 @@
 /*
- * OMAP44xx secure APIs file.
+ * OMAP34xx and OMAP44xx secure APIs file.
  *
  * Copyright (C) 2010 Texas Instruments, Inc.
  * Written by Santosh Shilimkar <[email protected]>
  *
+ * Copyright (C) 2012 Ivaylo Dimitrov <[email protected]>
+ * Copyright (C) 2013 Pali Rohár <[email protected]>
  *
  * This program is free software,you can redistribute it

and/or modify * it under the terms of the GNU General Public License version 2 as @@ -54,6 +56,23 @@ ENTRY(omap_smc2)

arch/arm/mach-omap2/omap-smc.S +2 -0
 	ldmfd   sp!, {r4-r12, pc}
 ENDPROC(omap_smc2)
 
+/**
+ * u32 omap_smc3(u32 service_id, u32 process_id, u32 flag,

u32 pargs) + * Low level common routine for secure HAL and PPA APIs via smc #1 + * r0 - @service_id: Secure Service ID
+ * r1 - @process_id: Process ID
+ * r2 - @flag: Flag to indicate the criticality of operation
+ * r3 - @pargs: Physical address of parameter list
+ */

arch/arm/mach-omap2/omap-smc.S +5 -0
+ENTRY(omap_smc3)
+	stmfd	sp!, {r4-r11, lr}
+	mov	r12, r0		@ Copy the secure service ID
+	mov	r6, #0xff	@ Indicate new Task call
+	dsb			@ Memory Barrier (not sure if needed, copied from

omap_smc2) + smc #1 @ Call PPA service

Quoted 8 lines

arch/arm/mach-omap2/omap-smc.S

Quoted 6 lines
arch/arm/mach-omap2/omap-smc.S +3 -0
+	ldmfd	sp!, {r4-r11, pc}
+ENDPROC(omap_smc3)
+
 ENTRY(omap_modify_auxcoreboot0)
 	stmfd   sp!, {r1-r12, lr}
 	ldr	r12, =0x104

Dave, it is ok now?

Yes, that's sufficient to warn people to stop and think (at least, if someone copy-pastes it, they will likely highlight the possible error by copy-pasting the comment too). Thanks.

#1 lore raw
Quoted 18 lines · Dave Martin
Quoted 16 lines · Pali Roh?r

Review

Quoted 13 lines · On Sunday 08 September 2013 09:43:29 Pali Roh?r wrote:

+ */

(quoted diff) +5 -0
+ENTRY(omap_smc3)
+	stmfd	sp!, {r4-r11, lr}
+	mov	r12, r0		@ Copy the secure service ID
+	mov	r6, #0xff	@ Indicate new Task call
+	dsb			@ Memory Barrier (not sure if needed, copied from

omap_smc2) + smc #1 @ Call PPA service

(quoted diff) +3 -0
+	ldmfd	sp!, {r4-r11, pc}
+ENDPROC(omap_smc3)
+
 ENTRY(omap_modify_auxcoreboot0)
 	stmfd   sp!, {r1-r12, lr}
 	ldr	r12, =0x104

Dave, it is ok now?

Quoted 5 lines

Yes, that's sufficient to warn people to stop and think (at least, if someone copy-pastes it, they will likely highlight the possible error by copy-pasting the comment too). Thanks.

Have you guys checked how this works with the recently posted "[PATCH v6 0/5] ARM: support for Trusted Foundations secure monitor" series?

Regards,

Tony

#2 lore raw
Quoted 28 lines · On Tuesday 17 September 2013 17:43:31 Tony Lindgren wrote:
Quoted 20 lines · Dave Martin
Quoted 12 lines · Pali Roh?r
Quoted 11 lines · On Sunday 08 September 2013 09:43:29 Pali Roh?r wrote:

+ */

(quoted diff) +5 -0
+ENTRY(omap_smc3)
+	stmfd	sp!, {r4-r11, lr}
+	mov	r12, r0		@ Copy the secure service ID
+	mov	r6, #0xff	@ Indicate new Task call
+	dsb			@ Memory Barrier (not sure if needed, copied

from omap_smc2) + smc #1 @ Call PPA service

(quoted diff) +3 -0
+	ldmfd	sp!, {r4-r11, pc}
+ENDPROC(omap_smc3)
+
Quoted 6 lines

Review

Quoted 4 lines

ENTRY(omap_modify_auxcoreboot0)

(quoted diff) +0 -0
 	stmfd   sp!, {r1-r12, lr}
 	ldr	r12, =0x104

Dave, it is ok now?

Quoted 6 lines

Yes, that's sufficient to warn people to stop and think (at least, if someone copy-pastes it, they will likely highlight the possible error by copy-pasting the comment too). Thanks.

Quoted 7 lines

Have you guys checked how this works with the recently posted "[PATCH v6 0/5] ARM: support for Trusted Foundations secure monitor" series?

Regards,

Tony

Hello,

this code looks like some Tegra and "Trusted Foundations" specific. There is Note: The API followed by Trusted Foundations does *not* follow the SMC calling conventions. Also code calling smc #0 instruction, so in my opinion for rx51 it is useless.

Tony, can you include this two rx51 secure patches (patch v4 1/2 and patch v2 2/2)? Or is there some any other problem?

Signature · 9 lines
Pali Roh?r
pali.rohar at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130917/9e7d55e4/attachment.sig>
#3 lore raw
Quoted 9 lines · Pali Roh?r
Quoted 3 lines · On Tuesday 17 September 2013 17:43:31 Tony Lindgren wrote:

Have you guys checked how this works with the recently posted "[PATCH v6 0/5] ARM: support for Trusted Foundations secure monitor" series?

this code looks like some Tegra and "Trusted Foundations" specific. There is Note: The API followed by Trusted Foundations does *not* follow the SMC calling conventions. Also code calling smc #0 instruction, so in my opinion for rx51 it is useless.

OK, so still no generic SMC code then :( This patch is fine with me.

Quoted 2 lines

Tony, can you include this two rx51 secure patches (patch v4 1/2 and patch v2 2/2)? Or is there some any other problem?

No other comments on this patch, I'll post some comments on the v2 2/2 patch considering we're moving to device tree based booting.

Regards,

Tony