All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-kvm: Clean up IOAPIC after upstream merge
@ 2011-02-14  9:35 Jan Kiszka
  2011-02-15 19:10 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2011-02-14  9:35 UTC (permalink / raw)
  To: Avi Kivity, Marcelo Tosatti; +Cc: kvm

Drop base_address from the vmstate, upstream decided against managing it
at device level. Continuing to interpret the vmstate field would break
compatibility with upstream. Instead, fetch the base addres from the
sysbus device state when setting the in-kernel state.

Moreover, drop redundant ioapic_post_load and apply some tiny cleanups.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/ioapic.c |   24 ++++--------------------
 1 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/hw/ioapic.c b/hw/ioapic.c
index 8fab34f..e806822 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -22,7 +22,6 @@
 
 #include "hw.h"
 #include "pc.h"
-#include "apic.h"
 #include "sysemu.h"
 #include "apic.h"
 #include "ioapic.h"
@@ -41,7 +40,6 @@
 #define DPRINTF(fmt, ...)
 #endif
 
-#define IOAPIC_DEFAULT_BASE_ADDRESS  0xfec00000
 #define MAX_IOAPICS                     1
 
 #define IOAPIC_VERSION                  0x11
@@ -93,7 +91,6 @@ struct IOAPICState {
     SysBusDevice busdev;
     uint8_t id;
     uint8_t ioregsel;
-    uint64_t base_address;
     uint32_t irr;
     uint64_t ioredtbl[IOAPIC_NUM_PINS];
 };
@@ -286,7 +283,6 @@ static void kvm_kernel_ioapic_save_to_user(IOAPICState *s)
 
     s->id = kioapic->id;
     s->ioregsel = kioapic->ioregsel;
-    s->base_address = kioapic->base_address;
     s->irr = kioapic->irr;
     for (i = 0; i < IOAPIC_NUM_PINS; i++) {
         s->ioredtbl[i] = kioapic->redirtbl[i].bits;
@@ -306,7 +302,7 @@ static void kvm_kernel_ioapic_load_from_user(IOAPICState *s)
 
     kioapic->id = s->id;
     kioapic->ioregsel = s->ioregsel;
-    kioapic->base_address = s->base_address;
+    kioapic->base_address = s->busdev.mmio[0].addr;
     kioapic->irr = s->irr;
     for (i = 0; i < IOAPIC_NUM_PINS; i++) {
         kioapic->redirtbl[i].bits = s->ioredtbl[i];
@@ -319,22 +315,12 @@ static void kvm_kernel_ioapic_load_from_user(IOAPICState *s)
 static void ioapic_pre_save(void *opaque)
 {
     IOAPICState *s = (void *)opaque;
- 
+
     if (kvm_enabled() && kvm_irqchip_in_kernel()) {
         kvm_kernel_ioapic_save_to_user(s);
     }
 }
 
-static int ioapic_pre_load(void *opaque)
-{
-    IOAPICState *s = opaque;
-
-    /* in case we are doing version 1, we just set these to sane values */
-    s->base_address = IOAPIC_DEFAULT_BASE_ADDRESS;
-    s->irr = 0;
-    return 0;
-}
-
 static int ioapic_post_load(void *opaque, int version_id)
 {
     IOAPICState *s = opaque;
@@ -354,15 +340,14 @@ static int ioapic_post_load(void *opaque, int version_id)
 static const VMStateDescription vmstate_ioapic = {
     .name = "ioapic",
     .version_id = 3,
-    .post_load = ioapic_post_load,
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
-    .pre_load = ioapic_pre_load,
+    .post_load = ioapic_post_load,
     .pre_save = ioapic_pre_save,
     .fields = (VMStateField[]) {
         VMSTATE_UINT8(id, IOAPICState),
         VMSTATE_UINT8(ioregsel, IOAPICState),
-        VMSTATE_UINT64_V(base_address, IOAPICState, 2),
+        VMSTATE_UNUSED_V(2, 8), /* to account for qemu-kvm's v2 format */
         VMSTATE_UINT32_V(irr, IOAPICState, 2),
         VMSTATE_UINT64_ARRAY(ioredtbl, IOAPICState, IOAPIC_NUM_PINS),
         VMSTATE_END_OF_LIST()
@@ -374,7 +359,6 @@ static void ioapic_reset(DeviceState *d)
     IOAPICState *s = DO_UPCAST(IOAPICState, busdev.qdev, d);
     int i;
 
-    s->base_address = IOAPIC_DEFAULT_BASE_ADDRESS;
     s->id = 0;
     s->ioregsel = 0;
     s->irr = 0;


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] qemu-kvm: Clean up IOAPIC after upstream merge
  2011-02-14  9:35 [PATCH] qemu-kvm: Clean up IOAPIC after upstream merge Jan Kiszka
@ 2011-02-15 19:10 ` Marcelo Tosatti
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2011-02-15 19:10 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Avi Kivity, kvm

On Mon, Feb 14, 2011 at 10:35:54AM +0100, Jan Kiszka wrote:
> Drop base_address from the vmstate, upstream decided against managing it
> at device level. Continuing to interpret the vmstate field would break
> compatibility with upstream. Instead, fetch the base addres from the
> sysbus device state when setting the in-kernel state.
> 
> Moreover, drop redundant ioapic_post_load and apply some tiny cleanups.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  hw/ioapic.c |   24 ++++--------------------
>  1 files changed, 4 insertions(+), 20 deletions(-)

Applied, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-15 19:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14  9:35 [PATCH] qemu-kvm: Clean up IOAPIC after upstream merge Jan Kiszka
2011-02-15 19:10 ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.