From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Naw9i-0002sD-87 for qemu-devel@nongnu.org; Fri, 29 Jan 2010 14:05:22 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Naw9d-0002pQ-Gh for qemu-devel@nongnu.org; Fri, 29 Jan 2010 14:05:21 -0500 Received: from [199.232.76.173] (port=41734 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Naw9d-0002pH-4G for qemu-devel@nongnu.org; Fri, 29 Jan 2010 14:05:17 -0500 Received: from verein.lst.de ([213.95.11.210]:49403) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1Naw9c-0004H2-6h for qemu-devel@nongnu.org; Fri, 29 Jan 2010 14:05:16 -0500 Date: Fri, 29 Jan 2010 20:05:14 +0100 From: Christoph Hellwig Message-ID: <20100129190514.GC25287@lst.de> References: <20100129190417.GA25237@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100129190417.GA25237@lst.de> Subject: [Qemu-devel] [PATCH 4/5] ide: add topology support List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Martin K. Petersen" Export the physical block size in the ATA IDENTIFY command. The other topology values are not supported in ATA so skip them. Add a new field to the savevm information which is initialized to zero if migrating from an older qemu version. Signed-off-by: Christoph Hellwig Index: qemu/hw/ide/core.c =================================================================== --- qemu.orig/hw/ide/core.c 2010-01-29 11:07:50.103003910 +0100 +++ qemu/hw/ide/core.c 2010-01-29 11:08:32.943004637 +0100 @@ -164,6 +164,8 @@ static void ide_identify(IDEState *s) put_le16(p + 101, s->nb_sectors >> 16); put_le16(p + 102, s->nb_sectors >> 32); put_le16(p + 103, s->nb_sectors >> 48); + if (s->physical_block_exp) + put_le16(p + 106, 0x6000 | s->physical_block_exp); memcpy(s->identify_data, p, sizeof(s->identify_data)); s->identify_set = 1; @@ -2615,6 +2617,7 @@ void ide_init_drive(IDEState *s, DriveIn } strncpy(s->drive_serial_str, drive_get_serial(s->bs), sizeof(s->drive_serial_str)); + s->physical_block_exp = bdrv_get_physical_block_exp(s->bs); } if (strlen(s->drive_serial_str) == 0) snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), @@ -2684,12 +2687,17 @@ static int ide_drive_post_load(void *opa s->cdrom_changed = 1; } } + + if (version_id < 4) { + s->physical_block_exp = 0; + } + return 0; } const VMStateDescription vmstate_ide_drive = { .name = "ide_drive", - .version_id = 3, + .version_id = 4, .minimum_version_id = 0, .minimum_version_id_old = 0, .post_load = ide_drive_post_load, @@ -2714,6 +2722,7 @@ const VMStateDescription vmstate_ide_dri VMSTATE_UINT8(sense_key, IDEState), VMSTATE_UINT8(asc, IDEState), VMSTATE_UINT8_V(cdrom_changed, IDEState, 3), + VMSTATE_UINT8_V(physical_block_exp, IDEState, 4), /* XXX: if a transfer is pending, we do not save it yet */ VMSTATE_END_OF_LIST() } Index: qemu/hw/ide/internal.h =================================================================== --- qemu.orig/hw/ide/internal.h 2010-01-29 11:07:50.116004031 +0100 +++ qemu/hw/ide/internal.h 2010-01-29 11:08:32.948011699 +0100 @@ -433,6 +433,8 @@ struct IDEState { int smart_errors; uint8_t smart_selftest_count; uint8_t *smart_selftest_data; + /* topology information */ + uint8_t physical_block_exp; }; struct IDEBus {