From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Rob Herring" <rob.herring@linaro.org>,
"Peter Crosthwaite" <peter.crosthwaite@xilinx.com>,
"Fabian Aggeler" <aggelerf@ethz.ch>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Alexander Graf" <agraf@suse.de>,
"Blue Swirl" <blauwirbel@gmail.com>,
"John Williams" <john.williams@xilinx.com>,
"Greg Bellows" <greg.bellows@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Christoffer Dall" <christoffer.dall@linaro.org>,
"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v3 16/16] target-arm: Add support for VIRQ and VFIQ
Date: Mon, 4 Aug 2014 15:00:34 +1000 [thread overview]
Message-ID: <20140804050034.GY13735@toto> (raw)
In-Reply-To: <CAFEAcA_WcMkM1BhJo5v2TTepuqHEKtTf7ti1s_kwVOZvA4_hLw@mail.gmail.com>
On Fri, Aug 01, 2014 at 03:32:59PM +0100, Peter Maydell wrote:
> On 17 June 2014 09:45, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> >
> > Acked-by: Greg Bellows <greg.bellows@linaro.org>
> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > ---
> > cpu-exec.c | 12 ++++++++++++
> > target-arm/cpu.c | 20 ++++++++++++++++++--
> > target-arm/cpu.h | 24 ++++++++++++++++++++++--
> > target-arm/helper-a64.c | 2 ++
> > target-arm/helper.c | 4 ++++
> > target-arm/internals.h | 2 ++
> > 6 files changed, 60 insertions(+), 4 deletions(-)
> >
> > diff --git a/cpu-exec.c b/cpu-exec.c
> > index a579ffc..baf5643 100644
> > --- a/cpu-exec.c
> > +++ b/cpu-exec.c
> > @@ -498,6 +498,18 @@ int cpu_exec(CPUArchState *env)
> > cc->do_interrupt(cpu);
> > next_tb = 0;
> > }
> > + if (interrupt_request & CPU_INTERRUPT_VIRQ
> > + && arm_excp_unmasked(cpu, EXCP_VIRQ)) {
> > + cpu->exception_index = EXCP_VIRQ;
> > + cc->do_interrupt(cpu);
> > + next_tb = 0;
> > + }
> > + if (interrupt_request & CPU_INTERRUPT_VFIQ
> > + && arm_excp_unmasked(cpu, EXCP_VFIQ)) {
> > + cpu->exception_index = EXCP_VFIQ;
> > + cc->do_interrupt(cpu);
> > + next_tb = 0;
> > + }
> > #elif defined(TARGET_UNICORE32)
> > if (interrupt_request & CPU_INTERRUPT_HARD
> > && !(env->uncached_asr & ASR_I)) {
> > diff --git a/target-arm/cpu.c b/target-arm/cpu.c
> > index 8e64c5a..cd7a5df 100644
> > --- a/target-arm/cpu.c
> > +++ b/target-arm/cpu.c
> > @@ -195,6 +195,20 @@ static void arm_cpu_set_irq(void *opaque, int irq, int level)
> > cpu_reset_interrupt(cs, CPU_INTERRUPT_FIQ);
> > }
> > break;
> > + case ARM_CPU_VIRQ:
> > + if (level) {
> > + cpu_interrupt(cs, CPU_INTERRUPT_VIRQ);
> > + } else {
> > + cpu_reset_interrupt(cs, CPU_INTERRUPT_VIRQ);
> > + }
> > + break;
> > + case ARM_CPU_VFIQ:
> > + if (level) {
> > + cpu_interrupt(cs, CPU_INTERRUPT_VFIQ);
> > + } else {
> > + cpu_reset_interrupt(cs, CPU_INTERRUPT_VFIQ);
> > + }
> > + break;
>
> With four cases this kind of wants a lookup of irq to CPU_INTERRUPT_
> value I think, rather than the code duplication.
Added a table lookup, thanks.
>
> > default:
> > hw_error("arm_cpu_set_irq: Bad interrupt line %d\n", irq);
> > }
> > @@ -242,9 +256,11 @@ static void arm_cpu_initfn(Object *obj)
> > #ifndef CONFIG_USER_ONLY
> > /* Our inbound IRQ and FIQ lines */
> > if (kvm_enabled()) {
> > - qdev_init_gpio_in(DEVICE(cpu), arm_cpu_kvm_set_irq, 2);
> > + /* VIRQ and VFIQ are unused with KVM but we add them to maintain
> > + the same interface as non-KVM CPUs. */
>
> /* Multiline comments
> * should look like this.
> */
Fixed
>
> > + qdev_init_gpio_in(DEVICE(cpu), arm_cpu_kvm_set_irq, 4);
> > } else {
> > - qdev_init_gpio_in(DEVICE(cpu), arm_cpu_set_irq, 2);
> > + qdev_init_gpio_in(DEVICE(cpu), arm_cpu_set_irq, 4);
> > }
> >
> > cpu->gt_timer[GTIMER_PHYS] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE,
> > diff --git a/target-arm/cpu.h b/target-arm/cpu.h
> > index bb123bd..df61bbd 100644
> > --- a/target-arm/cpu.h
> > +++ b/target-arm/cpu.h
> > @@ -53,6 +53,8 @@
> > #define EXCP_STREX 10
> > #define EXCP_HVC 11 /* HyperVisor Call */
> > #define EXCP_SMC 12 /* Secure Monitor Call */
> > +#define EXCP_VIRQ 13
> > +#define EXCP_VFIQ 14
> >
> > #define ARMV7M_EXCP_RESET 1
> > #define ARMV7M_EXCP_NMI 2
> > @@ -67,6 +69,8 @@
> >
> > /* ARM-specific interrupt pending bits. */
> > #define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1
> > +#define CPU_INTERRUPT_VIRQ CPU_INTERRUPT_TGT_EXT_2
> > +#define CPU_INTERRUPT_VFIQ CPU_INTERRUPT_TGT_EXT_3
> >
> > /* The usual mapping for an AArch64 system register to its AArch32
> > * counterpart is for the 32 bit world to have access to the lower
> > @@ -85,6 +89,9 @@
> > /* Meanings of the ARMCPU object's two inbound GPIO lines */
>
> You forgot to update this comment ^^^
Done
>
> > #define ARM_CPU_IRQ 0
> > #define ARM_CPU_FIQ 1
> > +#define ARM_CPU_VIRQ 2
> > +#define ARM_CPU_VFIQ 3
>
> >
> > typedef void ARMWriteCPFunc(void *opaque, int cp_info,
> > int srcreg, int operand, uint32_t value);
> > @@ -1142,6 +1149,8 @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx)
> > * EL2 if we are in NS EL0/1.
> > */
> > bool irq_can_hyp = !secure && cur_el < 2 && target_el == 2;
> > + bool irq_unmasked = ((IS_M(env) && env->regs[15] < 0xfffffff0)
> > + || !(env->daif & PSTATE_I));
>
> The M profile stuff is starting to look increasingly weird here.
Yes, not sure what to do about it though. I forgot to move the
comment in cpu-exec to here, will do that.
Cheers,
Edgar
next prev parent reply other threads:[~2014-08-04 5:03 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-17 8:45 [Qemu-devel] [PATCH v3 00/16] target-arm: Parts of the AArch64 EL2/3 exception model Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 01/16] target-arm: A64: Break out aarch64_save/restore_sp Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 02/16] target-arm: A64: Respect SPSEL in ERET SP restore Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 03/16] target-arm: A64: Respect SPSEL when taking exceptions Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 04/16] target-arm: Make far_el1 an array Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 05/16] target-arm: Add ESR_EL2 and 3 Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 06/16] target-arm: Add FAR_EL2 " Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 07/16] target-arm: Add HCR_EL2 Edgar E. Iglesias
2014-06-23 14:03 ` Greg Bellows
2014-08-01 13:29 ` Peter Maydell
2014-08-04 3:48 ` Edgar E. Iglesias
2014-08-04 4:00 ` Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 08/16] target-arm: Add SCR_EL3 Edgar E. Iglesias
2014-06-23 14:15 ` Greg Bellows
2014-08-01 13:34 ` Peter Maydell
2014-08-04 15:19 ` Edgar E. Iglesias
2014-08-13 14:48 ` Greg Bellows
2014-08-18 3:24 ` Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 09/16] target-arm: A64: Refactor aarch64_cpu_do_interrupt Edgar E. Iglesias
2014-08-01 14:33 ` Peter Maydell
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 10/16] target-arm: Break out exception masking to a separate func Edgar E. Iglesias
2014-08-01 13:51 ` Peter Maydell
2014-08-04 1:57 ` Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 11/16] target-arm: Don't take interrupts targeting lower ELs Edgar E. Iglesias
2014-08-01 14:33 ` Peter Maydell
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 12/16] target-arm: A64: Correct updates to FAR and ESR on exceptions Edgar E. Iglesias
2014-08-01 13:56 ` Peter Maydell
2014-08-04 4:02 ` Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 13/16] target-arm: A64: Emulate the HVC insn Edgar E. Iglesias
2014-08-01 14:21 ` Peter Maydell
2014-08-04 4:12 ` Edgar E. Iglesias
2014-08-04 14:24 ` Peter Maydell
2014-08-04 15:15 ` Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 14/16] target-arm: A64: Emulate the SMC insn Edgar E. Iglesias
2014-06-23 14:29 ` Greg Bellows
2014-08-01 14:23 ` Peter Maydell
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 15/16] target-arm: Add IRQ and FIQ routing to EL2 and 3 Edgar E. Iglesias
2014-08-01 14:27 ` Peter Maydell
2014-08-04 4:13 ` Edgar E. Iglesias
2014-06-17 8:45 ` [Qemu-devel] [PATCH v3 16/16] target-arm: Add support for VIRQ and VFIQ Edgar E. Iglesias
2014-08-01 14:32 ` Peter Maydell
2014-08-04 5:00 ` Edgar E. Iglesias [this message]
2014-06-23 16:12 ` [Qemu-devel] [PATCH v3 00/16] target-arm: Parts of the AArch64 EL2/3 exception model Greg Bellows
2014-07-10 23:17 ` Edgar E. Iglesias
2014-07-11 9:00 ` Peter Maydell
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=20140804050034.GY13735@toto \
--to=edgar.iglesias@gmail.com \
--cc=aggelerf@ethz.ch \
--cc=agraf@suse.de \
--cc=alex.bennee@linaro.org \
--cc=blauwirbel@gmail.com \
--cc=christoffer.dall@linaro.org \
--cc=greg.bellows@linaro.org \
--cc=john.williams@xilinx.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rob.herring@linaro.org \
--cc=rth@twiddle.net \
/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).