From 50bf4158d9ecc933088e8e57436a6727393bfb8a Mon Sep 17 00:00:00 2001 Message-Id: <50bf4158d9ecc933088e8e57436a6727393bfb8a.1350314947.git.minovotn@redhat.com> In-Reply-To: References: From: Pavel Hrdina Date: Mon, 15 Oct 2012 15:00:51 +0200 Subject: [PATCH 2/4] fdc: introduce new property "migrate_dir" RH-Author: Pavel Hrdina Message-id: Patchwork-id: 43177 O-Subject: [RHEL-6.4 qemu-kvm PATCH v5 2/2] fdc: introduce new property "migrate_dir" Bugzilla: 854474 RH-Acked-by: Paolo Bonzini RH-Acked-by: Michal Novotny The floppy DIR register will be migrated if needed if we set this property to 1. As migration of DIR register is supported on machine type rhel6.4.0 or newer we set this property for older machine types to 0. Signed-off-by: Pavel Hrdina --- hw/fdc.c | 11 ++++++++++- hw/pc.c | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) Signed-off-by: Michal Novotny --- hw/fdc.c | 11 ++++++++++- hw/pc.c | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/hw/fdc.c b/hw/fdc.c index 4e8c9f5..0b39932 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -34,6 +34,7 @@ #include "sysbus.h" #include "qdev-addr.h" #include "sysemu.h" +#include "block_int.h" /********************************************************/ /* debug Floppy devices */ @@ -82,6 +83,7 @@ typedef enum fdisk_flags_t { typedef struct fdrive_t { BlockDriverState *bs; + fdctrl_t *fdctrl; /* Drive status */ fdrive_type_t drive; uint8_t perpendicular; /* 2.88 MB access mode */ @@ -503,6 +505,7 @@ struct fdctrl_t { uint8_t status0; uint8_t status1; uint8_t status2; + uint8_t migrate_dir; /* Command FIFO */ uint8_t *fifo; int32_t fifo_size; @@ -651,7 +654,11 @@ static bool fdrive_media_changed_needed(void *opaque) { fdrive_t *drive = opaque; - return (drive->bs != NULL && drive->media_changed != 1); + if (drive->fdctrl->migrate_dir) { + return (drive->bs != NULL && drive->media_changed != 1); + } + + return 0; } static const VMStateDescription vmstate_fdrive_media_changed = { @@ -1922,6 +1929,7 @@ static void fdctrl_connect_drives(fdctrl_t *fdctrl) for (i = 0; i < MAX_FD; i++) { drive = &fdctrl->drives[i]; + drive->fdctrl = fdctrl; fd_init(drive); fdctrl_change_cb(drive, 0); @@ -2104,6 +2112,7 @@ static ISADeviceInfo isa_fdc_info = { DEFINE_PROP_DRIVE("driveB", fdctrl_isabus_t, state.drives[1].bs), DEFINE_PROP_INT32("bootindexA", fdctrl_isabus_t, bootindexA, -1), DEFINE_PROP_INT32("bootindexB", fdctrl_isabus_t, bootindexB, -1), + DEFINE_PROP_UINT8("migrate_dir", fdctrl_isabus_t, state.migrate_dir, 1), DEFINE_PROP_END_OF_LIST(), }, }; diff --git a/hw/pc.c b/hw/pc.c index 7d73146..0868e35 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1582,6 +1582,10 @@ static void rhel_common_init(const char *type1_version, .driver = "qxl",\ .property = "revision",\ .value = stringify(3),\ + },{\ + .driver = "isa-fdc",\ + .property = "migrate_dir",\ + .value = "0",\ } #define PC_RHEL6_2_COMPAT \ -- 1.7.11.7