linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] arm/arm64: KVM: vgic: move reset initialization into vgic_init_maps()
Date: Thu, 11 Dec 2014 12:48:10 +0100	[thread overview]
Message-ID: <20141211114810.GC28388@cbox> (raw)
In-Reply-To: <54881C5D.7060203@linaro.org>

On Wed, Dec 10, 2014 at 11:11:41AM +0100, Eric Auger wrote:
> Hi Christoffer,
> Reviewed-by: Eric Auger <eric.auger@linaro.org>
> see few comments below.
> On 12/09/2014 04:44 PM, Christoffer Dall wrote:
> > From: Peter Maydell <peter.maydell@linaro.org>
> > 
> > VGIC initialization currently happens in three phases:
> >  (1) kvm_vgic_create() (triggered by userspace GIC creation)
> >  (2) vgic_init_maps() (triggered by userspace GIC register read/write
> >      requests, or from kvm_vgic_init() if not already run)
> >  (3) kvm_vgic_init() (triggered by first VM run)
> > 
> > We were doing initialization of some state to correspond with the
> > state of a freshly-reset GIC in kvm_vgic_init(); this is too late,
> > since it will overwrite changes made by userspace using the
> > register access APIs before the VM is run. Move this initialization
> > earlier, into the vgic_init_maps() phase.
> > 
> > This fixes a bug where QEMU could successfully restore a saved
> > VM state snapshot into a VM that had already been run, but could
> > not restore it "from cold" using the -loadvm command line option
> > (the symptoms being that the restored VM would run but interrupts
> > were ignored).
> > 
> > Finally rename vgic_init_maps to vgic_init and renamed kvm_vgic_init to
> > kvm_vgic_map_resources.
> > 
> >   [ This patch is originally written by Peter Maydell, but I have
> >     modified it somewhat heavily, renaming various bits and moving code
> >     around.  If something is broken, I am to be blamed. - Christoffer ]
> > 
> > Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
> > ---
> > This patch was originally named "vgic: move reset initialization into
> > vgic_init_maps()" but I renamed it slightly to match the other vgic
> > patches in the kernel.  I also did the additional changes since the
> > original patch:
> >  - Renamed kvm_vgic_init to kvm_vgic_map_resources
> >  - Renamed vgic_init_maps to vgic_init
> >  - Moved vgic_enable call into existing vcpu loop in vgic_init
> >  - Moved ITARGETSRn initializtion above vcpu loop in vgic_init (the idea
> typo
> >    is to init global state first, then vcpu state).
> 
> kvm_vgic_vcpu_init also has disappeared and PPI settings of
> dist->irq_enabled and dist->irq_cfg now are in former vgic_init_maps.
> 
> Maybe it would be simpler to review if there were 2 patches: one for
> init redistribution from kvm_vgic_init to vgic_init_maps and one for the
> renaming.

Maybe, but if you apply this patch and review it that way, it becomes
much easier.  I'd really like to get this in soon, so given you already
gave me your reviewed-by, I'm going to wait and see what Marc says and
only respin if he finds it necessary.

> 
> kvm_vgic_map_resources: difficult to understand it also inits the
> internal states. Wouldn't kvm_vgic_set_ready be aligned with ready
> terminology?
> 
So I thought about that, but really, the fact that we now call
vgic_init() from all sorts of places shouldn't require us to rename all
those functions, just because they call init.  So I ended up naming this
function for what it really does, and then just added a comment about
the on-demand approach.

I think that's cleanest.

Thanks,
-Christoffer

  reply	other threads:[~2014-12-11 11:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09 15:43 [PATCH 0/5] Fix vgic initialization problems Christoffer Dall
2014-12-09 15:44 ` [PATCH 1/5] arm/arm64: KVM: vgic: move reset initialization into vgic_init_maps() Christoffer Dall
2014-12-10 10:11   ` Eric Auger
2014-12-11 11:48     ` Christoffer Dall [this message]
2014-12-11 18:25       ` Marc Zyngier
2014-12-09 15:44 ` [PATCH 2/5] arm/arm64: KVM: Rename vgic_initialized to vgic_ready Christoffer Dall
2014-12-11 18:26   ` Marc Zyngier
2014-12-09 15:44 ` [PATCH 3/5] arm/arm64: KVM: Add (new) vgic_initialized macro Christoffer Dall
2014-12-10 10:27   ` Eric Auger
2014-12-11 11:48     ` Christoffer Dall
2014-12-11 18:28   ` Marc Zyngier
2014-12-09 15:44 ` [PATCH 4/5] arm/arm64: KVM: Don't allow creating VCPUs after vgic_initialized Christoffer Dall
2014-12-10 12:35   ` Eric Auger
2014-12-11 11:55     ` Christoffer Dall
2014-12-11 18:30   ` Marc Zyngier
2014-12-09 15:44 ` [PATCH 5/5] arm/arm64: KVM: Initialize the vgic on-demand when injecting IRQs Christoffer Dall
2014-12-10 12:45   ` Eric Auger
2014-12-11 12:01     ` Christoffer Dall
2014-12-11 12:38       ` Eric Auger
2014-12-12 11:06         ` Christoffer Dall
2014-12-15 10:43           ` Eric Auger
2014-12-11 18:35   ` Marc Zyngier
2014-12-12 11:14     ` Christoffer Dall
2014-12-12 11:23       ` Marc Zyngier
2014-12-12 11:37         ` Christoffer Dall
2014-12-12 20:24           ` Christoffer Dall

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=20141211114810.GC28388@cbox \
    --to=christoffer.dall@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).