From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: agraf@suse.de, serge.fdrv@gmail.com, alex.bennee@linaro.org,
qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH 08/14] target-arm: Allow cp access functions to indicate traps to EL2 or EL3
Date: Thu, 21 May 2015 15:47:12 +1000 [thread overview]
Message-ID: <20150521054712.GU30952@toto> (raw)
In-Reply-To: <1432060414-5195-9-git-send-email-peter.maydell@linaro.org>
On Tue, May 19, 2015 at 07:33:28PM +0100, Peter Maydell wrote:
> Some coprocessor access functions will need to indicate that the
> instruction should trap to EL2 or EL3 rather than the default
> target exception level; add corresponding CPAccessResult enum
> entries and handling code.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> target-arm/cpu.h | 6 +++++-
> target-arm/op_helper.c | 14 +++++++++++++-
> 2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> index 9119a94..e431372 100644
> --- a/target-arm/cpu.h
> +++ b/target-arm/cpu.h
> @@ -1252,7 +1252,8 @@ typedef enum CPAccessResult {
> /* Access fails due to a configurable trap or enable which would
> * result in a categorized exception syndrome giving information about
> * the failing instruction (ie syndrome category 0x3, 0x4, 0x5, 0x6,
> - * 0xc or 0x18).
> + * 0xc or 0x18). The exception is taken to the usual target EL (EL1 or
> + * PL1 if in EL0, otherwise to the current EL).
> */
> CP_ACCESS_TRAP = 1,
> /* Access fails and results in an exception syndrome 0x0 ("uncategorized").
> @@ -1260,6 +1261,9 @@ typedef enum CPAccessResult {
> * result in this failure is specifically defined by the architecture.
> */
> CP_ACCESS_TRAP_UNCATEGORIZED = 2,
> + /* As CP_ACCESS_TRAP, but for traps directly to EL2 or EL3 */
> + CP_ACCESS_TRAP_EL2 = 3,
> + CP_ACCESS_TRAP_EL3 = 4,
> } CPAccessResult;
>
> /* Access functions for coprocessor registers. These cannot fail and
> diff --git a/target-arm/op_helper.c b/target-arm/op_helper.c
> index d693b01..5963f3b 100644
> --- a/target-arm/op_helper.c
> +++ b/target-arm/op_helper.c
> @@ -335,6 +335,7 @@ void HELPER(set_user_reg)(CPUARMState *env, uint32_t regno, uint32_t val)
> void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome)
> {
> const ARMCPRegInfo *ri = rip;
> + int target_el;
>
> if (arm_feature(env, ARM_FEATURE_XSCALE) && ri->cp < 14
> && extract32(env->cp15.c15_cpar, ri->cp, 1) == 0) {
> @@ -349,6 +350,17 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome)
> case CP_ACCESS_OK:
> return;
> case CP_ACCESS_TRAP:
> + target_el = exception_target_el(env);
> + break;
> + case CP_ACCESS_TRAP_EL2:
> + /* Requesting a trap to EL2 when we're in EL3 or S-EL0/1 is
> + * a bug in the access function.
> + */
> + assert(!arm_is_secure(env) && !arm_current_el(env) == 3);
> + target_el = 2;
> + break;
> + case CP_ACCESS_TRAP_EL3:
> + target_el = 3;
> break;
> case CP_ACCESS_TRAP_UNCATEGORIZED:
> syndrome = syn_uncategorized();
It looks like you need a:
target_el = exception_target_el(env);
here, no?
> @@ -357,7 +369,7 @@ void HELPER(access_check_cp_reg)(CPUARMState *env, void *rip, uint32_t syndrome)
> g_assert_not_reached();
> }
>
> - raise_exception(env, EXCP_UDEF, syndrome, exception_target_el(env));
> + raise_exception(env, EXCP_UDEF, syndrome, target_el);
> }
>
> void HELPER(set_cp_reg)(CPUARMState *env, void *rip, uint32_t value)
> --
> 1.9.1
>
next prev parent reply other threads:[~2015-05-21 5:50 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 18:33 [Qemu-devel] [PATCH 00/14] Various EL3 support/cleanup patches Peter Maydell
2015-05-19 18:33 ` [Qemu-devel] [PATCH 01/14] target-arm: Add exception target el infrastructure Peter Maydell
2015-05-19 18:33 ` [Qemu-devel] [PATCH 02/14] target-arm: Extend helpers to route exceptions Peter Maydell
2015-05-19 18:33 ` [Qemu-devel] [PATCH 03/14] target-arm: Set correct syndrome for faults on MSR DAIF*, imm Peter Maydell
2015-05-28 5:30 ` Edgar E. Iglesias
2015-05-28 8:30 ` Peter Maydell
2015-05-28 11:40 ` Peter Maydell
2015-05-28 11:44 ` Edgar E. Iglesias
2015-05-28 11:54 ` Peter Maydell
2015-05-19 18:33 ` [Qemu-devel] [PATCH 04/14] target-arm: Move setting of exception info into tlb_fill Peter Maydell
2015-05-28 5:32 ` Edgar E. Iglesias
2015-05-19 18:33 ` [Qemu-devel] [PATCH 05/14] target-arm: Set exception target EL in tlb_fill Peter Maydell
2015-05-28 5:39 ` Edgar E. Iglesias
2015-05-19 18:33 ` [Qemu-devel] [PATCH 06/14] target-arm: Make raise_exception() take syndrome and target EL Peter Maydell
2015-05-28 5:42 ` Edgar E. Iglesias
2015-05-19 18:33 ` [Qemu-devel] [PATCH 07/14] target-arm: Update interrupt handling to use " Peter Maydell
2015-05-19 18:33 ` [Qemu-devel] [PATCH 08/14] target-arm: Allow cp access functions to indicate traps to EL2 or EL3 Peter Maydell
2015-05-21 5:47 ` Edgar E. Iglesias [this message]
2015-05-21 7:04 ` Peter Maydell
2015-05-28 11:48 ` Edgar E. Iglesias
2015-05-28 11:56 ` Peter Maydell
2015-05-19 18:33 ` [Qemu-devel] [PATCH 09/14] target-arm: Add AArch64 CPTR registers Peter Maydell
2015-05-28 12:12 ` Edgar E. Iglesias
2015-05-19 18:33 ` [Qemu-devel] [PATCH 10/14] target-arm: Make singlestate TB flags common between AArch32/64 Peter Maydell
2015-05-28 5:51 ` Edgar E. Iglesias
2015-05-19 18:33 ` [Qemu-devel] [PATCH 11/14] target-arm: Extend FP checks to use an EL Peter Maydell
2015-05-28 12:50 ` Edgar E. Iglesias
2015-05-28 13:19 ` Peter Maydell
2015-05-28 13:27 ` Edgar E. Iglesias
2015-05-28 14:48 ` Peter Maydell
2015-05-19 18:33 ` [Qemu-devel] [PATCH 12/14] target-arm: Move TB flags down to fill gap Peter Maydell
2015-05-28 5:53 ` Edgar E. Iglesias
2015-05-19 18:33 ` [Qemu-devel] [PATCH 13/14] target-arm: Don't halt on WFI unless we don't have any work Peter Maydell
2015-05-28 5:55 ` Edgar E. Iglesias
2015-05-19 18:33 ` [Qemu-devel] [PATCH 14/14] target-arm: Add WFx instruction trap support Peter Maydell
2015-05-28 5:59 ` Edgar E. Iglesias
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=20150521054712.GU30952@toto \
--to=edgar.iglesias@xilinx.com \
--cc=agraf@suse.de \
--cc=alex.bennee@linaro.org \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=serge.fdrv@gmail.com \
/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).