qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Patch Tracking <patches@linaro.org>,
	"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>
Subject: Re: [Qemu-devel] [PATCH 5/5] hw: arm_gic_kvm: Add KVM VGIC save/restore logic
Date: Mon, 23 Sep 2013 03:14:46 +0100	[thread overview]
Message-ID: <20130923021446.GB19043@lvm> (raw)
In-Reply-To: <CAFEAcA-k9fzQ9i+mtD-g2qV+xXFnnjRHKGNaNH08qCc1wEzFQA@mail.gmail.com>

On Sat, Sep 21, 2013 at 06:38:19PM +0900, Peter Maydell wrote:
> On 21 September 2013 06:46, Christoffer Dall
> <christoffer.dall@linaro.org> wrote:
> > On Sat, Sep 21, 2013 at 06:22:23AM +0900, Peter Maydell wrote:
> >>  *) for getting TCG<->KVM and KVM-with-non-host-CPU cases
> >> right we need to do translation anyway, or at least think about it.
> >
> > Why? Wouldn't we always only support the case where QEMU emulates the
> > same model as KVM in the first case, and the kernel should behave the
> > same and export the same state if you ask for a specific target no
> > matter what the underlying hardware is, no?
> 
> If the kernel has to be able to do translation of the state, why
> not make its life easier by having it only need to do one thing
> (host h/w format -> whatever standard format we pick)
> rather than lots and lots of things
> (host CPU X h/w format -> format for supported guest CPU A,
>  host CPU X h/w format -> format for supported guest CPU B,
>  host CPU Y h/w format -> format for guest CPU A,
>  host CPU Y h/w format -> format for guest CPU B,
>  etc etc etc)
> 
> ? That's basically a cross product over every CPU we
> support.
> 
Good point.

So after reading the GIC specs again, the way I understand it is that
the APR regs have a bit set, if that group priority (a.k.a. preemption
level) has an active interrupt.  Further, multiple set bits would would
only happen if software acknowledges an interrupt and before EOIing it,
the GIC gets preempted by an interrupt with a higher group priority
(lower number).  Correct?

Further, and again, I don't think the spec is particularly clear on this
point, but I think it suggests that if bit[0] is set, then there's an
interrupt from interrupt priority group 0 (the group with the highest
priority) in the active state, if bit[1] is set, one from group 1 is
active, and so on.

That would be a perfectly fine format for the APR in the GICstate
structure, and the only remaining questions would be:

 (1) How many preemption levels should be supported, which would be most
     easily solved by just defining GICC_APR0-GICC_APR3 for all cpu
     interfaces.
 (2) How does the arm_gic_kvm.c code detect the underlying host CPU that
     the kernel read the register from when it returned the value of the
     register to do the proper translation?  I don't even want to think
     about how this will work on Big.Little...

-Christoffer

  reply	other threads:[~2013-09-23  2:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-23 20:10 [Qemu-devel] [PATCH 0/5] Support arm-gic-kvm save/restore Christoffer Dall
2013-08-23 20:10 ` [Qemu-devel] [PATCH 1/5] hw: arm_gic: Fix gic_set_irq handling Christoffer Dall
2013-09-06 13:59   ` Peter Maydell
2013-09-13  6:38     ` Christoffer Dall
2013-08-23 20:10 ` [Qemu-devel] [PATCH 2/5] hw: arm_gic: Introduce GIC_SET_PRIORITY macro Christoffer Dall
2013-08-25 15:37   ` Alexander Graf
2013-09-13  6:47     ` Christoffer Dall
2013-08-23 20:10 ` [Qemu-devel] [PATCH 3/5] hw: arm_gic: Keep track of SGI sources Christoffer Dall
2013-09-06 14:08   ` Peter Maydell
2013-09-13 19:29     ` Christoffer Dall
2013-08-23 20:10 ` [Qemu-devel] [PATCH 4/5] hw: arm_gic: Support setting/getting binary point reg Christoffer Dall
2013-08-23 21:57   ` Andreas Färber
2013-09-06 14:41   ` Peter Maydell
2013-09-14  1:52     ` Christoffer Dall
2013-09-14  9:46       ` Peter Maydell
2013-09-19 19:48         ` Christoffer Dall
2013-09-19 20:03           ` Christoffer Dall
2013-08-23 20:10 ` [Qemu-devel] [PATCH 5/5] hw: arm_gic_kvm: Add KVM VGIC save/restore logic Christoffer Dall
2013-08-25 15:47   ` Alexander Graf
2013-09-06 14:57     ` Paolo Bonzini
2013-09-20 20:41       ` Christoffer Dall
2013-09-20 21:09         ` Paolo Bonzini
2013-09-20 21:23           ` Christoffer Dall
2013-09-20 20:39     ` Christoffer Dall
2013-09-06 15:13   ` Peter Maydell
2013-09-20 19:50     ` Christoffer Dall
2013-09-20 21:22       ` Peter Maydell
2013-09-20 21:46         ` Christoffer Dall
2013-09-21  9:38           ` Peter Maydell
2013-09-23  2:14             ` Christoffer Dall [this message]
2013-09-23 12:02               ` Peter Maydell
2013-09-23 15:30                 ` Christoffer Dall
2013-08-25 15:48 ` [Qemu-devel] [PATCH 0/5] Support arm-gic-kvm save/restore Alexander Graf

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=20130923021446.GB19043@lvm \
    --to=christoffer.dall@linaro.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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).