xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] xen: arm: traps: check hsr.ec for ARM32
@ 2015-09-21  7:07 Peng Fan
  2015-09-21  9:47 ` Julien Grall
  0 siblings, 1 reply; 3+ messages in thread
From: Peng Fan @ 2015-09-21  7:07 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, Peng.Fan, Stefano Stabellini, Ian Campbell

To ARM64, "if ( hsr.ec >= 0x10 ) return 1;" is ok for unconditional
check, but to ARM32, we need to use 'hsr.ec >> 30' to check.

Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
Cc: Julien Grall <julien.grall@citrix.com>
---
 xen/arch/arm/traps.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 9d2bd6a..2e2b1f2 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1531,8 +1531,13 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
     int cond;
 
     /* Unconditional Exception classes */
+#ifdef CONFIG_ARM_64
     if ( hsr.ec >= 0x10 )
         return 1;
+#else
+    if ( hsr.ec >> 30 )
+        return 1;
+#endif
 
     /* Check for valid condition in hsr */
     cond = hsr.cond.ccvalid ? hsr.cond.cc : -1;
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] xen: arm: traps: check hsr.ec for ARM32
  2015-09-21  9:47 ` Julien Grall
@ 2015-09-21  8:41   ` Peng Fan
  0 siblings, 0 replies; 3+ messages in thread
From: Peng Fan @ 2015-09-21  8:41 UTC (permalink / raw)
  To: Julien Grall; +Cc: Peng Fan, Stefano Stabellini, Ian Campbell, xen-devel

Hi Julien,
On Mon, Sep 21, 2015 at 10:47:23AM +0100, Julien Grall wrote:
>Hi Peng,
>
>On 21/09/15 08:07, Peng Fan wrote:
>> To ARM64, "if ( hsr.ec >= 0x10 ) return 1;" is ok for unconditional
>> check, but to ARM32, we need to use 'hsr.ec >> 30' to check.
>
>hsr.ec is encoded on 5 bits, therefore the shift you suggest is wrong.
>Maybe you wanted to use (hsr.ec >> 4)?
Thanks for correcting me. 0x10 can handle hsr.ec >> 4.
My bad, this patch is wrong. 

Regards,
Peng.
>
>Although, can you explain why you need a different check for ARM32?
>
>Regards,
>
>> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
>> Cc: Ian Campbell <ian.campbell@citrix.com>
>> Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
>> Cc: Julien Grall <julien.grall@citrix.com>
>> ---
>>  xen/arch/arm/traps.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>> 
>> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
>> index 9d2bd6a..2e2b1f2 100644
>> --- a/xen/arch/arm/traps.c
>> +++ b/xen/arch/arm/traps.c
>> @@ -1531,8 +1531,13 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
>>      int cond;
>>  
>>      /* Unconditional Exception classes */
>> +#ifdef CONFIG_ARM_64
>>      if ( hsr.ec >= 0x10 )
>>          return 1;
>> +#else
>> +    if ( hsr.ec >> 30 )
>> +        return 1;
>> +#endif
>>  
>>      /* Check for valid condition in hsr */
>>      cond = hsr.cond.ccvalid ? hsr.cond.cc : -1;
>> 
>
>
>-- 
>Julien Grall

-- 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] xen: arm: traps: check hsr.ec for ARM32
  2015-09-21  7:07 [PATCH 1/2] xen: arm: traps: check hsr.ec for ARM32 Peng Fan
@ 2015-09-21  9:47 ` Julien Grall
  2015-09-21  8:41   ` Peng Fan
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Grall @ 2015-09-21  9:47 UTC (permalink / raw)
  To: Peng Fan, xen-devel; +Cc: Stefano Stabellini, Ian Campbell

Hi Peng,

On 21/09/15 08:07, Peng Fan wrote:
> To ARM64, "if ( hsr.ec >= 0x10 ) return 1;" is ok for unconditional
> check, but to ARM32, we need to use 'hsr.ec >> 30' to check.

hsr.ec is encoded on 5 bits, therefore the shift you suggest is wrong.
Maybe you wanted to use (hsr.ec >> 4)?

Although, can you explain why you need a different check for ARM32?

Regards,

> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Ian Campbell <ian.campbell@citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@citrix.com>
> Cc: Julien Grall <julien.grall@citrix.com>
> ---
>  xen/arch/arm/traps.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
> index 9d2bd6a..2e2b1f2 100644
> --- a/xen/arch/arm/traps.c
> +++ b/xen/arch/arm/traps.c
> @@ -1531,8 +1531,13 @@ static int check_conditional_instr(struct cpu_user_regs *regs,
>      int cond;
>  
>      /* Unconditional Exception classes */
> +#ifdef CONFIG_ARM_64
>      if ( hsr.ec >= 0x10 )
>          return 1;
> +#else
> +    if ( hsr.ec >> 30 )
> +        return 1;
> +#endif
>  
>      /* Check for valid condition in hsr */
>      cond = hsr.cond.ccvalid ? hsr.cond.cc : -1;
> 


-- 
Julien Grall

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-21  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21  7:07 [PATCH 1/2] xen: arm: traps: check hsr.ec for ARM32 Peng Fan
2015-09-21  9:47 ` Julien Grall
2015-09-21  8:41   ` Peng Fan

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).