qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: imammedo@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] kvm/apic: fix 2.2->2.1 migration
Date: Fri, 12 Dec 2014 17:30:45 +0000	[thread overview]
Message-ID: <20141212173044.GD2328@work-vm> (raw)
In-Reply-To: <1418227041-28151-1-git-send-email-pbonzini@redhat.com>

* Paolo Bonzini (pbonzini@redhat.com) wrote:
> The wait_for_sipi field is set back to 1 after an INIT, so it was not
> effective to reset it in kvm_apic_realize.  Introduce a reset callback
> and reset wait_for_sipi there.


> Reported-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

OK, let me just check that I get this....

It gets reset to 0 already in kvm_apic_realize
then we do the common init that sets it to !bsp - so 1 for most CPUs
then you're adding this so that a specific APIC implementation (kvm)
can nobble it back to 0 again?

and on the load side it's forced to zero by apic_pre_load.


Dave

> ---
>  hw/i386/kvm/apic.c              | 10 +++++++---
>  hw/intc/apic_common.c           |  5 +++++
>  include/hw/i386/apic_internal.h |  1 +
>  3 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i386/kvm/apic.c b/hw/i386/kvm/apic.c
> index 271e97f..5b47056 100644
> --- a/hw/i386/kvm/apic.c
> +++ b/hw/i386/kvm/apic.c
> @@ -171,12 +171,15 @@ static const MemoryRegionOps kvm_apic_io_ops = {
>      .endianness = DEVICE_NATIVE_ENDIAN,
>  };
>  
> -static void kvm_apic_realize(DeviceState *dev, Error **errp)
> +static void kvm_apic_reset(APICCommonState *s)
>  {
> -    APICCommonState *s = APIC_COMMON(dev);
> -
>      /* Not used by KVM, which uses the CPU mp_state instead.  */
>      s->wait_for_sipi = 0;
> +}
> +
> +static void kvm_apic_realize(DeviceState *dev, Error **errp)
> +{
> +    APICCommonState *s = APIC_COMMON(dev);
>  
>      memory_region_init_io(&s->io_memory, NULL, &kvm_apic_io_ops, s, "kvm-apic-msi",
>                            APIC_SPACE_SIZE);
> @@ -191,6 +194,7 @@ static void kvm_apic_class_init(ObjectClass *klass, void *data)
>      APICCommonClass *k = APIC_COMMON_CLASS(klass);
>  
>      k->realize = kvm_apic_realize;
> +    k->reset = kvm_apic_reset;
>      k->set_base = kvm_apic_set_base;
>      k->set_tpr = kvm_apic_set_tpr;
>      k->get_tpr = kvm_apic_get_tpr;
> diff --git a/hw/intc/apic_common.c b/hw/intc/apic_common.c
> index 4e62f25..d9bb188 100644
> --- a/hw/intc/apic_common.c
> +++ b/hw/intc/apic_common.c
> @@ -178,6 +178,7 @@ bool apic_next_timer(APICCommonState *s, int64_t current_time)
>  void apic_init_reset(DeviceState *dev)
>  {
>      APICCommonState *s = APIC_COMMON(dev);
> +    APICCommonClass *info = APIC_COMMON_GET_CLASS(s);
>      int i;
>  
>      if (!s) {
> @@ -206,6 +207,10 @@ void apic_init_reset(DeviceState *dev)
>          timer_del(s->timer);
>      }
>      s->timer_expiry = -1;
> +
> +    if (info->reset) {
> +        info->reset(s);
> +    }
>  }
>  
>  void apic_designate_bsp(DeviceState *dev)
> diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h
> index 83e2a42..dc7a89d 100644
> --- a/include/hw/i386/apic_internal.h
> +++ b/include/hw/i386/apic_internal.h
> @@ -89,6 +89,7 @@ typedef struct APICCommonClass
>      void (*external_nmi)(APICCommonState *s);
>      void (*pre_save)(APICCommonState *s);
>      void (*post_load)(APICCommonState *s);
> +    void (*reset)(APICCommonState *s);
>  } APICCommonClass;
>  
>  struct APICCommonState {
> -- 
> 2.1.0
> 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2014-12-12 17:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-10 15:57 [Qemu-devel] [PATCH] kvm/apic: fix 2.2->2.1 migration Paolo Bonzini
2014-12-12 17:30 ` Dr. David Alan Gilbert [this message]
2014-12-12 18:42   ` Paolo Bonzini
2014-12-12 19:32     ` Dr. David Alan Gilbert
2015-01-20  9:53 ` Markus Armbruster

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=20141212173044.GD2328@work-vm \
    --to=dgilbert@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).