diff mbox

sparc: allow CASA with ASI 0xa from user space

Message ID 1449241262-3002-1-git-send-email-azu@sysgo.de
State New
Headers show

Commit Message

Alex Zuepke Dec. 4, 2015, 3:01 p.m. UTC
LEON3 allows the CASA instruction to be used from user space
if the ASI is set to 0xa (user data).

Signed-off-by: Alex Zuepke <azu@sysgo.de>
---
 target-sparc/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Richard Henderson Dec. 8, 2015, 7:59 p.m. UTC | #1
On 12/04/2015 07:01 AM, Alex Zuepke wrote:
> LEON3 allows the CASA instruction to be used from user space
> if the ASI is set to 0xa (user data).
> 
> Signed-off-by: Alex Zuepke <azu@sysgo.de>
> ---
>  target-sparc/translate.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target-sparc/translate.c b/target-sparc/translate.c
> index 41a3319..63440dd 100644
> --- a/target-sparc/translate.c
> +++ b/target-sparc/translate.c
> @@ -5097,7 +5097,8 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
>                      if (IS_IMM) {
>                          goto illegal_insn;
>                      }
> -                    if (!supervisor(dc)) {
> +                    /* LEON3 allows CASA from user space with ASI 0xa */
> +                    if ((GET_FIELD(insn, 19, 26) != 0xa) && !supervisor(dc)) {
>                          goto priv_insn;
>                      }
>  #endif
> 

Reviewed-by: Richard Henderson <rth@twiddle.net>

This should probably be merged for 2.5.

For 2.6, I have a branch with substantial changes for the sparc backend.  Part
of which totally revamps the way ASIs are handled.  I believe it gets this
right.  See

  git://github.com/rth7680/qemu.git tgt-sparc


r~
Peter Maydell Dec. 8, 2015, 9:28 p.m. UTC | #2
On 8 December 2015 at 19:59, Richard Henderson <rth@twiddle.net> wrote:
> On 12/04/2015 07:01 AM, Alex Zuepke wrote:
>> LEON3 allows the CASA instruction to be used from user space
>> if the ASI is set to 0xa (user data).
>>
>> Signed-off-by: Alex Zuepke <azu@sysgo.de>
>> ---
>>  target-sparc/translate.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/target-sparc/translate.c b/target-sparc/translate.c
>> index 41a3319..63440dd 100644
>> --- a/target-sparc/translate.c
>> +++ b/target-sparc/translate.c
>> @@ -5097,7 +5097,8 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
>>                      if (IS_IMM) {
>>                          goto illegal_insn;
>>                      }
>> -                    if (!supervisor(dc)) {
>> +                    /* LEON3 allows CASA from user space with ASI 0xa */
>> +                    if ((GET_FIELD(insn, 19, 26) != 0xa) && !supervisor(dc)) {
>>                          goto priv_insn;
>>                      }
>>  #endif
>>
>
> Reviewed-by: Richard Henderson <rth@twiddle.net>
>
> This should probably be merged for 2.5.

Very late, but a very small patch which only affects TCG SPARC,
so I'm OK with applying it to master. (Mark, did you want to ack/review?)

thanks
-- PMM
Mark Cave-Ayland Dec. 9, 2015, 11:24 p.m. UTC | #3
On 08/12/15 21:28, Peter Maydell wrote:

> On 8 December 2015 at 19:59, Richard Henderson <rth@twiddle.net> wrote:
>> On 12/04/2015 07:01 AM, Alex Zuepke wrote:
>>> LEON3 allows the CASA instruction to be used from user space
>>> if the ASI is set to 0xa (user data).
>>>
>>> Signed-off-by: Alex Zuepke <azu@sysgo.de>
>>> ---
>>>  target-sparc/translate.c | 3 ++-
>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/target-sparc/translate.c b/target-sparc/translate.c
>>> index 41a3319..63440dd 100644
>>> --- a/target-sparc/translate.c
>>> +++ b/target-sparc/translate.c
>>> @@ -5097,7 +5097,8 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
>>>                      if (IS_IMM) {
>>>                          goto illegal_insn;
>>>                      }
>>> -                    if (!supervisor(dc)) {
>>> +                    /* LEON3 allows CASA from user space with ASI 0xa */
>>> +                    if ((GET_FIELD(insn, 19, 26) != 0xa) && !supervisor(dc)) {
>>>                          goto priv_insn;
>>>                      }
>>>  #endif
>>>
>>
>> Reviewed-by: Richard Henderson <rth@twiddle.net>
>>
>> This should probably be merged for 2.5.
> 
> Very late, but a very small patch which only affects TCG SPARC,
> so I'm OK with applying it to master. (Mark, did you want to ack/review?)

My understanding from this thread is that it only affects LEON3 - while
I don't have any such images to test with, given that it's restricted to
LEON3 then I'd be fine if you were to apply this to master with an R-B
from Richard and Fabien (I'll do another OpenBIOS test suite run over
the weekend just to be sure).


ATB,

Mark.
Peter Maydell Dec. 10, 2015, 11:43 a.m. UTC | #4
On 9 December 2015 at 23:24, Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
> On 08/12/15 21:28, Peter Maydell wrote:
>
>> On 8 December 2015 at 19:59, Richard Henderson <rth@twiddle.net> wrote:
>>> On 12/04/2015 07:01 AM, Alex Zuepke wrote:
>>>> LEON3 allows the CASA instruction to be used from user space
>>>> if the ASI is set to 0xa (user data).
>>>>
>>>> Signed-off-by: Alex Zuepke <azu@sysgo.de>
>>>> ---
>>>>  target-sparc/translate.c | 3 ++-
>>>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/target-sparc/translate.c b/target-sparc/translate.c
>>>> index 41a3319..63440dd 100644
>>>> --- a/target-sparc/translate.c
>>>> +++ b/target-sparc/translate.c
>>>> @@ -5097,7 +5097,8 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
>>>>                      if (IS_IMM) {
>>>>                          goto illegal_insn;
>>>>                      }
>>>> -                    if (!supervisor(dc)) {
>>>> +                    /* LEON3 allows CASA from user space with ASI 0xa */
>>>> +                    if ((GET_FIELD(insn, 19, 26) != 0xa) && !supervisor(dc)) {
>>>>                          goto priv_insn;
>>>>                      }
>>>>  #endif
>>>>
>>>
>>> Reviewed-by: Richard Henderson <rth@twiddle.net>
>>>
>>> This should probably be merged for 2.5.
>>
>> Very late, but a very small patch which only affects TCG SPARC,
>> so I'm OK with applying it to master. (Mark, did you want to ack/review?)
>
> My understanding from this thread is that it only affects LEON3 - while
> I don't have any such images to test with, given that it's restricted to
> LEON3 then I'd be fine if you were to apply this to master with an R-B
> from Richard and Fabien (I'll do another OpenBIOS test suite run over
> the weekend just to be sure).

OK. I have applied this patch to master.

thanks
-- PMM
diff mbox

Patch

diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 41a3319..63440dd 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -5097,7 +5097,8 @@  static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
                     if (IS_IMM) {
                         goto illegal_insn;
                     }
-                    if (!supervisor(dc)) {
+                    /* LEON3 allows CASA from user space with ASI 0xa */
+                    if ((GET_FIELD(insn, 19, 26) != 0xa) && !supervisor(dc)) {
                         goto priv_insn;
                     }
 #endif