[Skiboot] [RFC PATCH v2 4/8] pef: ultra-call support for skiboot

Oliver O'Halloran oohall at gmail.com
Mon Nov 18 10:51:54 AEDT 2019


On Sat, Sep 21, 2019 at 12:01 AM Ryan Grimm <grimm at linux.ibm.com> wrote:
>
> From: Madhavan Srinivasan <maddy at 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 at linux.vnet.ibm.com>
> Signed-off-by: Santosh Sivaraj <santosh at fossix.org>
> [ andmike: ABI hange to switch from r0 to r3 ]
> Signed-off-by: Michael Anderson <andmike at linux.ibm.com>
> [ grimm: Comments to start_uv for register usage ]
> Signed-off-by: Ryan Grimm <grimm at linux.ibm.com>
> ---
>  asm/head.S           | 34 +++++++++++++++++++++++++++++++++-
>  include/ultravisor.h |  1 +
>  2 files changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/asm/head.S b/asm/head.S
> index 18ce3044..f8808b08 100644
> --- a/asm/head.S
> +++ b/asm/head.S
> @@ -1066,6 +1066,11 @@ start_kernel_secondary:
>         mfspr   %r3,SPR_PIR
>         bctr
>
> +/* start_uv register usage:
> + *
> + *  r3 is base address of UV
> + *  r4 is ptr to struct uv_opal
> + */
>  .global start_uv
>  start_uv:
>         mflr    %r0
> @@ -1083,7 +1088,34 @@ start_uv:
>         addi    %r7,%r5,1
>         li      %r4,0
>         li      %r5,0
> -       bctrl
> +       bctrl   /* branch to UV here */
>         ld      %r0,16(%r1)
>         mtlr    %r0
>         blr

The comments should go into the patch that adds start_uv.

> +.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 b49121ce..67be743f 100644
> --- a/include/ultravisor.h
> +++ b/include/ultravisor.h
> @@ -23,5 +23,6 @@ extern void uv_preload_image(void);
>  extern void uv_decompress_image(void);
>  extern void init_uv(void);
>  extern int start_ultravisor(void);
> +extern long ucall(unsigned long opcode, unsigned long *retbuf, ...);
>
>  #endif /* __ULTRAVISOR_H */
> --
> 2.21.0
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot


More information about the Skiboot mailing list