From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:46690) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Re6YZ-0002zR-44 for qemu-devel@nongnu.org; Fri, 23 Dec 2011 09:57:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Re6YU-0007Y3-Ug for qemu-devel@nongnu.org; Fri, 23 Dec 2011 09:57:11 -0500 Received: from cantor2.suse.de ([195.135.220.15]:50662 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Re6YU-0007Xq-Oh for qemu-devel@nongnu.org; Fri, 23 Dec 2011 09:57:06 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 23 Dec 2011 15:55:50 +0100 Message-Id: <1324652151-4299-2-git-send-email-afaerber@suse.de> In-Reply-To: <1324652151-4299-1-git-send-email-afaerber@suse.de> References: <1324652151-4299-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [RFC 1/2] ahci: Refactor ports as a fixed-size array for VMState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Juan Quintela , mjt@tls.msk.ru, Alexander Graf , brogers@suse.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= 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=C3=A4rber Cc: Juan Quintela Cc: Kevin Wolf Cc: Alexander Graf --- 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; =20 s->ports =3D ports; - s->dev =3D 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_BA= R_SIZE); @@ -1194,7 +1194,6 @@ void ahci_uninit(AHCIState *s) { memory_region_destroy(&s->mem); memory_region_destroy(&s->idp); - g_free(s->dev); } =20 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 { }; =20 typedef struct AHCIState { - AHCIDevice *dev; + AHCIDevice dev[AHCI_MAX_PORTS]; AHCIControlRegs control_regs; MemoryRegion mem; MemoryRegion idp; /* Index-Data Pair I/O port space */ --=20 1.7.7