qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-arm/helper.c: fix access rights of SP_ELs
@ 2016-05-14  5:07 Tsung-Han Lin
  2016-05-14 10:08 ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Tsung-Han Lin @ 2016-05-14  5:07 UTC (permalink / raw)
  To: peter.maydell, qemu-arm; +Cc: qemu-devel

Fix the access rights of SP_EL2 and SP_EL1, which should be able to be
accessed from EL2 and EL1 respectively.

Signed-off-by: Tsung-Han Lin <tsunghan.tw@gmail.com>
---
 target-arm/helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-arm/helper.c b/target-arm/helper.c
index a2ab701ca5c2..8d4b03b5141b 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -3326,7 +3326,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
       .fieldoffset = offsetof(CPUARMState, sp_el[0]) },
     { .name = "SP_EL1", .state = ARM_CP_STATE_AA64,
       .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 1, .opc2 = 0,
-      .access = PL2_RW, .type = ARM_CP_ALIAS,
+      .access = PL1_RW, .type = ARM_CP_ALIAS,
       .fieldoffset = offsetof(CPUARMState, sp_el[1]) },
     { .name = "SPSel", .state = ARM_CP_STATE_AA64,
       .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0,
@@ -3526,7 +3526,7 @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
       .resetvalue = 0 },
     { .name = "SP_EL2", .state = ARM_CP_STATE_AA64,
       .opc0 = 3, .opc1 = 6, .crn = 4, .crm = 1, .opc2 = 0,
-      .access = PL3_RW, .type = ARM_CP_ALIAS,
+      .access = PL2_RW, .type = ARM_CP_ALIAS,
       .fieldoffset = offsetof(CPUARMState, sp_el[2]) },
     { .name = "CPTR_EL2", .state = ARM_CP_STATE_BOTH,
       .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 2,
-- 
2.7.4

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

* Re: [Qemu-devel] [PATCH] target-arm/helper.c: fix access rights of SP_ELs
  2016-05-14  5:07 [Qemu-devel] [PATCH] target-arm/helper.c: fix access rights of SP_ELs Tsung-Han Lin
@ 2016-05-14 10:08 ` Peter Maydell
  2016-05-14 11:43   ` Tsung-Han Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2016-05-14 10:08 UTC (permalink / raw)
  To: Tsung-Han Lin; +Cc: qemu-arm, QEMU Developers

On 14 May 2016 at 06:07, Tsung-Han Lin <tsunghan.tw@gmail.com> wrote:
> Fix the access rights of SP_EL2 and SP_EL1, which should be able to be
> accessed from EL2 and EL1 respectively.
>
> Signed-off-by: Tsung-Han Lin <tsunghan.tw@gmail.com>
> ---
>  target-arm/helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index a2ab701ca5c2..8d4b03b5141b 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -3326,7 +3326,7 @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
>        .fieldoffset = offsetof(CPUARMState, sp_el[0]) },
>      { .name = "SP_EL1", .state = ARM_CP_STATE_AA64,
>        .opc0 = 3, .opc1 = 4, .crn = 4, .crm = 1, .opc2 = 0,
> -      .access = PL2_RW, .type = ARM_CP_ALIAS,
> +      .access = PL1_RW, .type = ARM_CP_ALIAS,
>        .fieldoffset = offsetof(CPUARMState, sp_el[1]) },
>      { .name = "SPSel", .state = ARM_CP_STATE_AA64,
>        .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 2, .opc2 = 0,
> @@ -3526,7 +3526,7 @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
>        .resetvalue = 0 },
>      { .name = "SP_EL2", .state = ARM_CP_STATE_AA64,
>        .opc0 = 3, .opc1 = 6, .crn = 4, .crm = 1, .opc2 = 0,
> -      .access = PL3_RW, .type = ARM_CP_ALIAS,
> +      .access = PL2_RW, .type = ARM_CP_ALIAS,
>        .fieldoffset = offsetof(CPUARMState, sp_el[2]) },
>      { .name = "CPTR_EL2", .state = ARM_CP_STATE_BOTH,
>        .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 2,

The ARM ARM defines that SP_EL1 is accessible only from
EL2 or higher via the system-register instructions, and
SP_EL2 only from EL3 or higher (see table C5-7 on page
C5-288 of the v8 ARM ARM DDI0487A.h, or the register description
pages for the two registers). Why do you think this is a correct
change?

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH] target-arm/helper.c: fix access rights of SP_ELs
  2016-05-14 10:08 ` Peter Maydell
@ 2016-05-14 11:43   ` Tsung-Han Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Tsung-Han Lin @ 2016-05-14 11:43 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-arm, QEMU Developers

2016-05-14 19:08 GMT+09:00 Peter Maydell <peter.maydell@linaro.org>:

>
>
> The ARM ARM defines that SP_EL1 is accessible only from
> EL2 or higher via the system-register instructions, and
> SP_EL2 only from EL3 or higher (see table C5-7 on page
> C5-288 of the v8 ARM ARM DDI0487A.h, or the register description
> pages for the two registers). Why do you think this is a correct
> change?
>
> Thanks for the correction. Seems like I misunderstood the spec.


> thanks
> -- PMM
>

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

end of thread, other threads:[~2016-05-14 11:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-14  5:07 [Qemu-devel] [PATCH] target-arm/helper.c: fix access rights of SP_ELs Tsung-Han Lin
2016-05-14 10:08 ` Peter Maydell
2016-05-14 11:43   ` Tsung-Han Lin

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