From: Jan Kiszka <jan.kiszka@siemens.com>
To: Avi Kivity <avi@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm <kvm@vger.kernel.org>
Subject: [PATCH] qemu-kvm: Prepare IOAPIC for upstream merge
Date: Mon, 07 Feb 2011 12:59:34 +0100 [thread overview]
Message-ID: <4D4FDEA6.1010101@siemens.com> (raw)
Drop base_address from the vmstate, upstream decided against managing it
at device level. Instead, fetch it from the sysbus device state when
setting the in-kernel state. Moreover, merge ioapic_pre_load into
ioapic_post_load as upstream does.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
hw/ioapic.c | 26 +++++++-------------------
1 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/hw/ioapic.c b/hw/ioapic.c
index aeb3653..bbc0488 100644
--- a/hw/ioapic.c
+++ b/hw/ioapic.c
@@ -40,7 +40,6 @@
#define DPRINTF(fmt, ...)
#endif
-#define IOAPIC_DEFAULT_BASE_ADDRESS 0xfec00000
#define IOAPIC_LVT_MASKED (1<<16)
#define IOAPIC_TRIGGER_EDGE 0
@@ -61,8 +60,6 @@ struct IOAPICState {
SysBusDevice busdev;
uint8_t id;
uint8_t ioregsel;
- uint64_t base_address;
-
uint32_t irr;
uint64_t ioredtbl[IOAPIC_NUM_PINS];
};
@@ -219,7 +216,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;
@@ -239,7 +235,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];
@@ -258,16 +254,6 @@ static void ioapic_pre_save(void *opaque)
}
}
-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;
@@ -275,21 +261,24 @@ static int ioapic_post_load(void *opaque, int version_id)
if (kvm_enabled() && kvm_irqchip_in_kernel()) {
kvm_kernel_ioapic_load_from_user(s);
}
+ if (version_id == 1) {
+ /* set sane value */
+ s->irr = 0;
+ }
return 0;
}
static const VMStateDescription vmstate_ioapic = {
.name = "ioapic",
- .version_id = 2,
+ .version_id = 3,
.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()
@@ -301,7 +290,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;
--
1.7.1
next reply other threads:[~2011-02-07 11:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-07 11:59 Jan Kiszka [this message]
2011-02-14 15:43 ` [PATCH] qemu-kvm: Prepare IOAPIC for upstream merge Marcelo Tosatti
2011-02-14 15:53 ` Jan Kiszka
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=4D4FDEA6.1010101@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
/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 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.