[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1] arm/optee: Use only least 32 bits for SMC type arg according to SMCCC


  • To: Julien Grall <julien@xxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Wed, 6 Jan 2021 23:22:16 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fL2ohcFdgPSgn2pwufUN3MhTkdpWj+aMh8mtGZX6ubk=; b=OWsoTvyUr9lSwd6tfaRgJMulBg797YI1KNP+ZzCjIIM7gLWEhfQHmN14lo9ch6lWxrOxap9mzZ7lV1PIEl2Qh6lRAS3hAdyL9V8iGc9aPP2JIrG2daMuZIR+jqlbdp9E0mMUydwS2buqi30wsp0kZyRROh/FmWH5iLhgoYeBl//dsYODS0DG84PDNnzQVikA/gcQBXgDpaP9gCxMnsImzX00oaOsMeKeE0FUDnNVKhVS19kNEt5yK0qyw2ZSHTVDBnAxJU9/wt+HT2ic8cncUt/PUMx8S7yo7PQv2HguspCdF5BlH9nKqWsNApq7A40ByFd1HH79Ve8rBsE9ZeuYlw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cd4BTj2ykeXeQtqjUYHH0xC6DhN4nvL+JAIH5FcPfiTWlWJPRtmCzYvaliFRJcNrONF2WMDZdhH5ynNLMJETs0r6IkrfbmIOTZ1/ZiYkOFqe9+vqT8wpKMlihqAbeP1YSu24irN5KdR9zYOERG0gYvCxTI1ALsSnkFWdtHP+/8priF628VoKKbjikiPIiIBpr4Pk5dOWwMyB0s7t9gMI2EaToa6izAtG4Kms7X1ncyMN8Dt0lP6bxJR40LqhQ8CE9/VkhmnbRouqktpYMuqQKGqHr+AwrTsfTsL9lvSMxqBXqGaxeidlbe9y4NqhyIlizowhFs9PFKXrJxgm14zC6g==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=epam.com;
  • Cc: Roman Skakun <Roman_Skakun@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Wed, 06 Jan 2021 23:22:35 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHW5FYo0uebW+fa3kaV4/YUoyuEvKobPNyA
  • Thread-topic: [PATCH v1] arm/optee: Use only least 32 bits for SMC type arg according to SMCCC

Hi Julien,

Julien Grall writes:

> Hi Roman,
>
> On 06/01/2021 11:26, Roman Skakun wrote:
>> This patch added additional sanity and increases an understanding for
>> getting proper value from the first argument for SMC call on aarch64
>> according to SMCC Convention.
>
> I would suggest the following commit message:
>
> "xen/arm: optee: The function identifier is always 32-bit
>
> Per the SMCCC specification (see section 3.1 in ARM DEN 0028D), the
> function identifier is only stored in the least significant
> 32-bits. The most significant 32-bits should be ignored.
>
> The function optee_handle_call() is now updated to ignore the most
> significant 32-bits.
>
> "
>
> Note that I used the version D rather than B because the latter has
> buggy wording (it seems to suggest that the least significants bits 
> should be ignored).
>
> Furthermore, I checked vsmc.c (the layer that dispatch the SMC) and it
> was already handled properly thanks to commit 7f4217cc6057 "xen/arm: 
> vsmc: The function identifier is always 32-bit".
>
>> [0] ARM DEN0028B, page 12
>> Signed-off-by: Roman Skakun <roman_skakun@xxxxxxxx>
>> ---
>>   xen/arch/arm/tee/optee.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>> diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
>> index ee85359742..87060b52b8 100644
>> --- a/xen/arch/arm/tee/optee.c
>> +++ b/xen/arch/arm/tee/optee.c
>> @@ -1643,7 +1643,8 @@ static bool optee_handle_call(struct cpu_user_regs 
>> *regs)
>>       if ( !ctx )
>>           return false;
>>   -    switch ( get_user_reg(regs, 0) )
>> +    /* Only least 32 bits are significant (see ARM DEN 0028B, page 12) */
>
> I would suggest:
>
> /* The function identifier is always stored in the least significant
> 32-bit (see section ARM DEN 0028D) */
>
> I can update it while committing, if both Volodymyr and you are happy
> with changes.

I'm totally fine with the proposed changes. Thank you for tidying this up.

-- 
Volodymyr Babchuk at EPAM


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.