xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Volodymyr Babchuk <volodymyr_babchuk@epam.com>,
	xen-devel@lists.xen.org
Cc: "Edgar E . Iglesias" <edgar.iglesias@xilinx.com>,
	Volodymyr Babchuk <vlad.babchuk@gmail.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH 1/7] arm: traps: psci: use generic register accessors
Date: Wed, 9 Aug 2017 10:52:14 +0100	[thread overview]
Message-ID: <e7deaf30-ff86-cbe1-f2e2-e7226fd87509@arm.com> (raw)
In-Reply-To: <34d92fcc-6954-ce2f-a9a9-731b7cc2793d@citrix.com>



On 08/08/17 21:37, Andrew Cooper wrote:
> On 08/08/2017 21:08, Volodymyr Babchuk wrote:
>> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
>> index 6cf9ee7..ed78b36 100644
>> --- a/xen/arch/arm/traps.c
>> +++ b/xen/arch/arm/traps.c
>> @@ -1449,13 +1449,12 @@ static void do_debug_trap(struct cpu_user_regs *regs, unsigned int code)
>>  }
>>  #endif
>>
>> +#define PSCI_SET_RESULT(reg, val) set_user_reg(reg, 0, val)
>> +#define PSCI_ARG(reg,n) get_user_reg(reg, n)
>> +
>>  #ifdef CONFIG_ARM_64
>> -#define PSCI_RESULT_REG(reg) (reg)->x0
>> -#define PSCI_ARG(reg,n) (reg)->x##n
>> -#define PSCI_ARG32(reg,n) (uint32_t)( (reg)->x##n & 0x00000000FFFFFFFF )
>> +#define PSCI_ARG32(reg,n) (uint32_t)(get_user_reg(reg, n) & 0x00000000FFFFFFFF)
>
> There is no need for the mask as well as the explicit (uint32_t) cast.
> I'd recommend dropping the mask entirely.

I want to avoid the implicit cast from 64-bit register to 32-bit that 
Volodymyr introduced in his series.

uint32_t pstate = get_user_reg(regs, 1);

IHMO this is a call to mistake. Another solution is to provide 3 helpers
	- get_user_reg32(...)
	- get_user_reg64(...)
	- get_user_reg(...) -> Return the full register (32-bit on ARM32, 
64-bit on ARM64).

This would at least document the return value of get_user_reg*.

Cheers,

-- 
Julien Grall

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

  parent reply	other threads:[~2017-08-09  9:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08 20:08 [PATCH v3 0/7] Handle SMCs and HVCs in conformance with SMCCC Volodymyr Babchuk
2017-08-08 20:08 ` [PATCH 1/7] arm: traps: psci: use generic register accessors Volodymyr Babchuk
2017-08-08 20:37   ` Andrew Cooper
2017-08-08 20:46     ` Volodymyr Babchuk
2017-08-09  9:52     ` Julien Grall [this message]
2017-08-09 11:12       ` Andrew Cooper
2017-08-09 11:43         ` Julien Grall
2017-08-08 20:08 ` [PATCH 2/7] arm: make processor-specific functions from traps.c globaly visible Volodymyr Babchuk
2017-08-09  9:53   ` Julien Grall
2017-08-09 19:26     ` Volodymyr Babchuk
2017-08-09 20:13       ` Julien Grall
2017-08-08 20:08 ` [PATCH 3/7] arm: traps: check if SMC was conditional before handling it Volodymyr Babchuk
2017-08-09  9:56   ` Julien Grall
2017-08-08 20:08 ` [PATCH 4/7] arm: smccc: handle SMCs according to SMCCC Volodymyr Babchuk
2017-08-09 10:10   ` Julien Grall
2017-08-09 11:58     ` Jan Beulich
2017-08-09 21:39       ` Volodymyr Babchuk
2017-08-10  7:30         ` Jan Beulich
2017-08-10 10:48           ` Julien Grall
2017-08-16 21:41       ` Volodymyr Babchuk
2017-08-17  7:45         ` Jan Beulich
2017-08-17 12:35           ` Volodymyr Babchuk
2017-08-17 12:52             ` Julien Grall
2017-08-17 12:56             ` Jan Beulich
2017-08-10 15:33     ` Volodymyr Babchuk
2017-08-10 16:11       ` Julien Grall
2017-08-10 17:40         ` Volodymyr Babchuk
2017-08-10 18:18           ` Julien Grall
2017-08-10 20:09             ` Volodymyr Babchuk
2017-08-10 21:09               ` Julien Grall
2017-08-11 10:47                 ` Julien Grall
2017-08-11 13:08                 ` Volodymyr Babchuk
2017-08-08 20:08 ` [PATCH 5/7] arm: traps: handle PSCI calls inside `smccc.c` Volodymyr Babchuk
2017-08-09 11:02   ` Julien Grall
2017-08-08 20:08 ` [PATCH 6/7] arm: psci: use definitions provided by vsmc.h Volodymyr Babchuk
2017-08-09 11:36   ` Julien Grall
2017-08-08 20:08 ` [PATCH 7/7] arm: vsmc: remove 64 bit mode check in psci handler Volodymyr Babchuk
2017-08-09 11:38   ` 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=e7deaf30-ff86-cbe1-f2e2-e7226fd87509@arm.com \
    --to=julien.grall@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=sstabellini@kernel.org \
    --cc=vlad.babchuk@gmail.com \
    --cc=volodymyr_babchuk@epam.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).