From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Juan Quintela" <quintela@redhat.com>,
mjt@tls.msk.ru, "Alexander Graf" <agraf@suse.de>,
brogers@suse.com, "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [RFC 1/2] ahci: Refactor ports as a fixed-size array for VMState
Date: Fri, 23 Dec 2011 15:55:50 +0100 [thread overview]
Message-ID: <1324652151-4299-2-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1324652151-4299-1-git-send-email-afaerber@suse.de>
It seems, VMState cannot handle a dynamically allocated array of
structs at this time.
Change AHCIState to use an AHCIDevice array of size AHCI_MAX_PORTS.
Of those 32, only 6 are being used for ich9.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Juan Quintela <quintela@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Alexander Graf <agraf@suse.de>
---
hw/ide/ahci.c | 3 +--
hw/ide/ahci.h | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 0af201d..51cb48b 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1168,7 +1168,7 @@ void ahci_init(AHCIState *s, DeviceState *qdev, int ports)
int i;
s->ports = ports;
- s->dev = g_malloc0(sizeof(AHCIDevice) * ports);
+ memset(s->dev, 0, sizeof(AHCIDevice) * ports);
ahci_reg_init(s);
/* XXX BAR size should be 1k, but that breaks, so bump it to 4k for now */
memory_region_init_io(&s->mem, &ahci_mem_ops, s, "ahci", AHCI_MEM_BAR_SIZE);
@@ -1194,7 +1194,6 @@ void ahci_uninit(AHCIState *s)
{
memory_region_destroy(&s->mem);
memory_region_destroy(&s->idp);
- g_free(s->dev);
}
void ahci_reset(void *opaque)
diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h
index b223d2c..4df7c2b 100644
--- a/hw/ide/ahci.h
+++ b/hw/ide/ahci.h
@@ -291,7 +291,7 @@ struct AHCIDevice {
};
typedef struct AHCIState {
- AHCIDevice *dev;
+ AHCIDevice dev[AHCI_MAX_PORTS];
AHCIControlRegs control_regs;
MemoryRegion mem;
MemoryRegion idp; /* Index-Data Pair I/O port space */
--
1.7.7
next prev parent reply other threads:[~2011-12-23 14:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-23 14:55 [Qemu-devel] [RFC 0/2] ahci: Make ich9-ahci migratable Andreas Färber
2011-12-23 14:55 ` Andreas Färber [this message]
2011-12-23 14:55 ` [Qemu-devel] [RFC 2/2] ahci: Add migration support for ICH9 Andreas Färber
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=1324652151-4299-2-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=brogers@suse.com \
--cc=kwolf@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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 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).