All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Subject: [Qemu-devel] [PATCH 4/5] ide: add topology support
Date: Fri, 29 Jan 2010 20:05:14 +0100	[thread overview]
Message-ID: <20100129190514.GC25287@lst.de> (raw)
In-Reply-To: <20100129190417.GA25237@lst.de>

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>

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 {

  parent reply	other threads:[~2010-01-29 19:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-29 19:04 [Qemu-devel] [PATCH 1/4] virtio-blk: revert serial number support Christoph Hellwig
2010-01-29 19:04 ` [Qemu-devel] [PATCH 2/4] block: add block topology options Christoph Hellwig
2010-02-03 19:00   ` Anthony Liguori
2010-02-05 13:09     ` Christoph Hellwig
2010-02-05 16:16       ` Jamie Lokier
2010-02-05 16:22         ` Christoph Hellwig
2010-02-05 17:16           ` Jamie Lokier
2010-02-05 17:33       ` Anthony Liguori
2010-02-09 15:26         ` Markus Armbruster
2010-01-29 19:05 ` [Qemu-devel] [PATCH 3/5] scsi: add topology support Christoph Hellwig
2010-01-29 19:05 ` Christoph Hellwig [this message]
2010-01-29 19:05 ` [Qemu-devel] [PATCH 5/5] virtio-blk: " Christoph Hellwig
2010-02-01  9:09   ` [Qemu-devel] [PATCH v2 " Christoph Hellwig

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=20100129190514.GC25287@lst.de \
    --to=hch@lst.de \
    --cc=martin.petersen@oracle.com \
    --cc=qemu-devel@nongnu.org \
    /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.