Comments
Patch
===================================================================
@@ -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()
}
===================================================================
@@ -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 {
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 <hch@lst.de>