diff mbox series

[RFC,v5,07/16] Add ultra call support for skiboot

Message ID 20200227204023.22125-8-grimm@linux.ibm.com
State New
Headers show
Series Ultravisor support in skiboot | expand

Checks

Context Check Description
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (82aed17a5468aff6b600ee1694a10a60f942c018)

Commit Message

Ryan Grimm Feb. 27, 2020, 8:40 p.m. UTC
From: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>

A new type of system call called the ultra call is used to get the
services of the ultravisor. This ultracall support is needed in skiboot
to access the xscoms which are in the secure memory area.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[ andmike: ABI change to switch from r0 to r3 ]
Signed-off-by: Michael Anderson <andmike@linux.ibm.com>
---
 asm/misc.S           | 27 +++++++++++++++++++++++++++
 include/ultravisor.h |  1 +
 2 files changed, 28 insertions(+)
diff mbox series

Patch

diff --git a/asm/misc.S b/asm/misc.S
index 9d2f3b6e..8dca77b0 100644
--- a/asm/misc.S
+++ b/asm/misc.S
@@ -316,3 +316,30 @@  exit_uv_mode:
         mflr    %r4
         mtspr   SPR_USRR0,%r4
         urfid
+
+.global ucall
+ucall:
+        mflr    %r0
+        stdu    %r1,-STACK_FRAMESIZE(%r1)
+        std     %r0,STACK_LR(%r1)
+        mfcr    %r0
+        stw     %r0,STACK_CR(%r1)
+        std     %r4,STACK_GPR4(%r1)     /* Save ret buffer */
+        mr      %r4,%r5
+        mr      %r5,%r6
+        mr      %r6,%r7
+        mr      %r7,%r8
+        mr      %r8,%r9
+        mr      %r9,%r10
+        sc      2                       /* invoke the ultravisor */
+        ld      %r12,STACK_GPR4(%r1)
+        std     %r4,  0(%r12)
+        std     %r5,  8(%r12)
+        std     %r6, 16(%r12)
+        std     %r7, 24(%r12)
+        lwz     %r0,STACK_CR(%r1)
+        mtcrf   0xff,%r0
+        ld      %r0,STACK_LR(%r1)
+        mtlr    %r0
+        addi    %r1,%r1,STACK_FRAMESIZE
+        blr                             /* return r3 = status */
diff --git a/include/ultravisor.h b/include/ultravisor.h
index 44cf36bf..148041a0 100644
--- a/include/ultravisor.h
+++ b/include/ultravisor.h
@@ -9,6 +9,7 @@ 
 
 #define UV_LOAD_MAX_SIZE        0x200000
 
+extern long ucall(unsigned long opcode, unsigned long *retbuf, ...);
 extern int start_uv(uint64_t entry, void *fdt);
 
 int start_ultravisor(void *fdt);