All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Volodymyr Babchuk <volodymyr_babchuk@epam.com>,
	xen-devel@lists.xen.org,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Jan Beulich <jbeulich@suse.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Tim Deegan <tim@xen.org>, Wei Liu <wei.liu2@citrix.com>
Cc: tee-dev@lists.linaro.org,
	"Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Subject: Re: [PATCH v1 1/6] arm: add SMC wrapper that is compatible with SMCCC
Date: Thu, 23 Aug 2018 16:31:57 +0100	[thread overview]
Message-ID: <c3f3d61b-1c70-9a47-ce94-178dbb9068a4@arm.com> (raw)
In-Reply-To: <e5f75995-2ae2-e7d4-9771-aa68c1f05435@epam.com>

Hi,

On 08/23/2018 04:16 PM, Volodymyr Babchuk wrote:
> Hi,
> 
> On 23.08.18 17:45, Julien Grall wrote:
>>
>>
>> On 08/23/2018 03:35 PM, Volodymyr Babchuk wrote:
>>> Hi,
>>
>> Hi Volodymyr,
>>
>>
>>> On 22.08.18 19:46, Julien Grall wrote:
>>>> Hi Volodymyr,
>>>>
>>>> On 22/08/18 15:11, Volodymyr Babchuk wrote:
>>>>> Existing SMC wrapper call_smc() allows only 4 parameters and
>>>>> returns only one value. This is enough for existing
>>>>> use in PSCI code, but TEE mediator will need a call that is
>>>>> fully compatible with ARM SMCCC.
>>>>> This patch adds this call for both arm32 and arm64.
>>>>>
>>>>> There was similar patch by Edgar E. Iglesias ([1]), but looks
>>>>> like it is abandoned.
>>>>>
>>>>> [1] 
>>>>> https://lists.xenproject.org/archives/html/xen-devel/2017-02/msg00636.html 
>>>>>
>>>>>
>>>>> CC: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>>>>>
>>>>> Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
>>>>> ---
>>>>>
>>>>> changes from "RFC":
>>>>>    - response now stored in structure instead of array
>>>>>    - added comments for arm32 assembly code
>>>>>    - added offset (instead of magic values) for arm32 asm code
>>>>
>>>> Did you mean arm64?
>>>
>>> Yes, you are right.
>>>
>>>>>
>>>>>   xen/arch/arm/arm32/Makefile      |  1 +
>>>>>   xen/arch/arm/arm32/smc.S         | 39 
>>>>> +++++++++++++++++++++++++++++++++++++++
>>>>>   xen/arch/arm/arm64/Makefile      |  1 +
>>>>>   xen/arch/arm/arm64/asm-offsets.c |  4 ++++
>>>>>   xen/arch/arm/arm64/smc.S         | 30 ++++++++++++++++++++++++++++++
>>>>>   xen/include/asm-arm/processor.h  | 11 +++++++++++
>>>>>   6 files changed, 86 insertions(+)
>>>>>   create mode 100644 xen/arch/arm/arm32/smc.S
>>>>>   create mode 100644 xen/arch/arm/arm64/smc.S
>>>>>
>>>>> diff --git a/xen/arch/arm/arm32/Makefile b/xen/arch/arm/arm32/Makefile
>>>>> index 0ac254f..c69f35e 100644
>>>>> --- a/xen/arch/arm/arm32/Makefile
>>>>> +++ b/xen/arch/arm/arm32/Makefile
>>>>> @@ -10,4 +10,5 @@ obj-y += proc-v7.o proc-caxx.o
>>>>>   obj-y += smpboot.o
>>>>>   obj-y += traps.o
>>>>>   obj-y += vfp.o
>>>>> +obj-y += smc.o
>>>>> diff --git a/xen/arch/arm/arm32/smc.S b/xen/arch/arm/arm32/smc.S
>>>>> new file mode 100644
>>>>> index 0000000..56f7982
>>>>> --- /dev/null
>>>>> +++ b/xen/arch/arm/arm32/smc.S
>>>>> @@ -0,0 +1,39 @@
>>>>> +/*
>>>>> + * xen/arch/arm/arm32/smc.S
>>>>> + *
>>>>> + * Wrapper for Secure Monitors Calls
>>>>> + *
>>>>> + * This program is free software; you can redistribute it and/or 
>>>>> modify
>>>>> + * it under the terms of the GNU General Public License as 
>>>>> published by
>>>>> + * the Free Software Foundation; either version 2 of the License, or
>>>>> + * (at your option) any later version.
>>>>
>>>> Xen is GPLv2 only. Can you please update the copyright accordingly?
>>>>
>>>> Also, the code is pretty much a copy of the Linux part. So it is 
>>>> probably worth to keep the copy-right around.
>>>>> + *
>>>>> + * 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 <asm/macros.h>
>>>>> +
>>>>> +/*
>>>>> + * void call_smccc_smc(register_t a0, register_t a1, register_t a2,
>>>>> + *                     register_t a3, register_t a4, register_t a5,
>>>>> + *                     register_t a6, register_t a7, struct 
>>>>> smccc_res *res)
>>>>> + */
>>>>> +ENTRY(call_smccc_smc)
>>>>
>>>> I would rather avoid to have 2 function to handle the same 
>>>> convention. Can you please either drop call_smc or rework it to 
>>>> handle more parameters?
>>>>
>>>> But it looks like you could re-use arm_smccc_1_1 as it follows the 
>>>> 1.0 convention for 32-bits.
>>> Oops, I missed introduction of arm_smccc_1_1. I think, it will be 
>>> sufficient for my tasks. Looks like, I'll drop this patch at all.
>>
>> Are you suggesting that OP-TEE will always use SMCCC 1.1 calling 
>> convention?
> 
> It depends on ARM-TF, I think. At least, on ARMv8 platforms. But you are 
> right. I can't be sure that SMCCC 1.1 is supported.
> Looks like XEN should determine at boot time which calling convention is 
> supported and then use appropriate function in all places where SMCCC 
> calls are made. What do you think?

This may not be entirely trivial to do it as arm_smccc_1_1 is based on 
macros to limit the number of parameters saved. But I would welcome such 
patch.

> 
>> I would be quite surprised given that you seem to have platform with 
>> ancient firmware.
> It is not so ancient :) At least it have ARM-TF.

Well, SMCCC 1.1 has been introduced last January for Meltdown/Spectre 
mitigations. I consider anything before that ancient :).

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-08-23 15:31 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 14:11 [PATCH v1 0/6] TEE mediator (and OP-TEE) support in XEN Volodymyr Babchuk
2018-08-22 14:11 ` [PATCH v1 1/6] arm: add SMC wrapper that is compatible with SMCCC Volodymyr Babchuk
2018-08-22 16:46   ` Julien Grall
2018-08-23 14:35     ` Volodymyr Babchuk
2018-08-23 14:45       ` Julien Grall
2018-08-23 15:16         ` Volodymyr Babchuk
2018-08-23 15:31           ` Julien Grall [this message]
2018-08-30 14:48     ` Volodymyr Babchuk
2018-08-30 16:43       ` Julien Grall
2018-08-27  6:44   ` Jan Beulich
2018-08-27 19:24     ` Volodymyr Babchuk
2018-08-27 20:19       ` Julien Grall
2018-08-28  6:09       ` Jan Beulich
2018-08-22 14:11 ` [PATCH v1 2/6] arm: add generic TEE mediator framework Volodymyr Babchuk
2018-08-22 17:03   ` Julien Grall
2018-08-27 19:09     ` Volodymyr Babchuk
2018-08-28 11:14       ` Julien Grall
2018-08-22 14:11 ` [PATCH v1 3/6] arm: tee: add OP-TEE header files Volodymyr Babchuk
2018-08-22 14:11 ` [PATCH v1 4/6] optee: add OP-TEE mediator Volodymyr Babchuk
2018-08-22 17:28   ` Julien Grall
2018-08-23 14:27     ` Volodymyr Babchuk
2018-08-23 15:28       ` Julien Grall
2018-08-22 14:11 ` [PATCH v1 5/6] libxl: create DTS node for OP-TEE if it is enabled Volodymyr Babchuk
2018-08-22 17:03   ` Wei Liu
2018-08-22 17:32   ` Julien Grall
2018-08-23 14:03     ` Volodymyr Babchuk
2018-08-23 14:11       ` Julien Grall
2018-08-23 14:16         ` Volodymyr Babchuk
2018-08-22 14:11 ` [PATCH v1 6/6] xsm: add tee access policy support Volodymyr Babchuk
2018-08-23 13:43   ` Julien Grall
2018-08-23 13:57     ` Volodymyr Babchuk
2018-08-23 14:08       ` Julien Grall

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=c3f3d61b-1c70-9a47-ce94-178dbb9068a4@arm.com \
    --to=julien.grall@arm.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=tee-dev@lists.linaro.org \
    --cc=tim@xen.org \
    --cc=volodymyr_babchuk@epam.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.