Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210432

Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32

From Jens Wiklander <jens.wiklander@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32
Date 2015-08-20 13:40 +0200
Message-ID <pZwml-3AQ-5@gated-at.bofh.it> (permalink)
References <pZ7eh-Nx-1@gated-at.bofh.it> <pZ7ei-Nx-21@gated-at.bofh.it> <pZeSt-3lt-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Aug 19, 2015 at 05:50:09PM +0100, Will Deacon wrote:
> On Wed, Aug 19, 2015 at 09:40:25AM +0100, Jens Wiklander wrote:
> > Adds helpers to do SMC based on ARM SMC Calling Convention.
> > CONFIG_HAVE_SMCCC is enabled for architectures that may support
> > the SMC instruction. It's the responsibility of the caller to
> > know if the SMC instruction is supported by the platform.
> 
> [...]
> > diff --git a/arch/arm64/kernel/smccc-call.S b/arch/arm64/kernel/smccc-call.S
> > new file mode 100644
> > index 0000000..3ce7fe8
> > --- /dev/null
> > +++ b/arch/arm64/kernel/smccc-call.S
> > @@ -0,0 +1,34 @@
> > +/*
> > + * Copyright (c) 2015, Linaro Limited
> > + *
> > + * 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
> > + * published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + * GNU General Public License for more details.
> > + *
> > + */
> > +#include <linux/linkage.h>
> > +
> > +#define SMC_PARAM_W0_OFFS      0
> > +#define SMC_PARAM_W2_OFFS      8
> > +#define SMC_PARAM_W4_OFFS      16
> > +#define SMC_PARAM_W6_OFFS      24
> > +
> > +/* void smccc_call32(struct smccc_param32 *param) */
> > +ENTRY(smccc_call32)
> > +       stp     x28, x30, [sp, #-16]!
> 
> Why are you saving lr?

Agree, no point in saving lr, but I still need to decrease sp with 16 to
maintain correct alignment. I'll do it with an str instruction instead.

> 
> > +       mov     x28, x0
> > +       ldp     w0, w1, [x28, #SMC_PARAM_W0_OFFS]
> > +       ldp     w2, w3, [x28, #SMC_PARAM_W2_OFFS]
> > +       ldp     w4, w5, [x28, #SMC_PARAM_W4_OFFS]
> > +       ldp     w6, w7, [x28, #SMC_PARAM_W6_OFFS]
> > +       smc     #0
> > +       stp     w0, w1, [x28, #SMC_PARAM_W0_OFFS]
> > +       stp     w2, w3, [x28, #SMC_PARAM_W2_OFFS]
> > +       ldp     x28, x30, [sp], #16
> > +       ret
> > +ENDPROC(smccc_call32)
> 
> Could we deal with this like we do for PSCI instead? (see
> __invoke_psci_fn_smc). We could also then rename psci-call.S to fw-call.S
> and stick this in there too.

I assume you're referring to when to use "hvc" and "smc".

I would rather consider smccc_call32() a primitive function that a
driver may use if it's configured to do so, for instance via DT. When an
"hvc" should be used instead of an "smc" up to the driver to decide
based how it's configured.

When merging psci-call.S and smccc-call.S into fw-call.S, what should I
do about smccc.c? I need to export the smccc_call32 function somewhere
as it could be used from a loadable module.

--
Thanks,
Jens
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 0/5] generic TEE subsystem Jens Wiklander <jens.wiklander@linaro.org> - 2015-08-19 10:50 +0200
  [PATCH v5 5/5] Documentation: tee subsystem and op-tee driver Jens Wiklander <jens.wiklander@linaro.org> - 2015-08-19 10:50 +0200
  [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Jens Wiklander <jens.wiklander@linaro.org> - 2015-08-19 10:50 +0200
    Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Yury <yury.norov@gmail.com> - 2015-08-19 13:00 +0200
      Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Jens Wiklander <jens.wiklander@linaro.org> - 2015-08-20 09:30 +0200
    Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Will Deacon <will.deacon@arm.com> - 2015-08-19 19:00 +0200
      Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Jens Wiklander <jens.wiklander@linaro.org> - 2015-08-20 13:40 +0200
        Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Mark Rutland <mark.rutland@arm.com> - 2015-08-20 23:40 +0200
        Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Will Deacon <will.deacon@arm.com> - 2015-08-21 11:30 +0200
          Re: [PATCH v5 1/5] arm/arm64: add smccc ARCH32 Jens Wiklander <jens.wiklander@linaro.org> - 2015-08-21 13:50 +0200
  [PATCH v5 2/5] dt/bindings: add bindings for optee Jens Wiklander <jens.wiklander@linaro.org> - 2015-08-19 10:50 +0200

csiph-web