|
|
357786 |
From 81b63caf259fac3ec0906f6d7712a831206d0dd5 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
9bac43 |
Date: Fri, 26 Jun 2015 16:19:47 +0200
|
|
|
9bac43 |
Subject: Migration compat for fdc
|
|
|
9bac43 |
|
|
|
9bac43 |
Patchwork-id: 66534
|
|
|
9bac43 |
O-Subject: [RHEL-7.2 qemu-kvm-rhev PATCH 1/1] Migration compat for fdc
|
|
|
9bac43 |
Bugzilla: 1215091
|
|
|
9bac43 |
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Juan Quintela <quintela@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
2.2 added some sections into the fdc and floppy drive, this patch
|
|
|
9bac43 |
disables those new sections for reverse migration compatibility.
|
|
|
9bac43 |
|
|
|
9bac43 |
There are three pieces of data added to the migration:
|
|
|
9bac43 |
1) 'perpendicular mode' on the drive - i.e. 2.88MB mode, that
|
|
|
9bac43 |
was rare as hens teeth and the flag isn't actually used anywhere.
|
|
|
9bac43 |
|
|
|
9bac43 |
2) fdc_reset_sensei
|
|
|
9bac43 |
This relates to the state of the fdc just after a reset command;
|
|
|
9bac43 |
the fdc produces four 'sense' states internally (corresponding to
|
|
|
9bac43 |
one external interrupt) that is there for backwards compatibility
|
|
|
9bac43 |
to an older fdc (and to 8" drives!!). This compatibility code
|
|
|
9bac43 |
was added to qemu to fix SCO Openserver floppy problems, ~2009.
|
|
|
9bac43 |
Migration just after an fdc-reset would get the initial interrupt
|
|
|
9bac43 |
but lose the extra 3 sense states. Print a log message since
|
|
|
9bac43 |
that's guest visible, but it's not knowingly caused us a problem
|
|
|
9bac43 |
so don't fail migration.
|
|
|
9bac43 |
|
|
|
9bac43 |
3) result-timer
|
|
|
9bac43 |
The emulation models a delay after the 'read id' command which
|
|
|
9bac43 |
is handled by a timer; if we migrate before the timer goes off
|
|
|
9bac43 |
we probably wont complete the command.
|
|
|
9bac43 |
I'm worried that the most likely time that a 'read id' would be
|
|
|
9bac43 |
used would be in a background probe to see if there's a floppy
|
|
|
9bac43 |
present, so again, don't fail the migrate, but do print a log
|
|
|
9bac43 |
message. With any luck any sane floppy driver will have a
|
|
|
9bac43 |
timeout; if we hit problems then a work around would be to
|
|
|
9bac43 |
make the pre-save mark the command as finished with error.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit b18d89c56aa26e86fb6194f77a15a72244d5ff88)
|
|
|
357786 |
(cherry picked from commit 50613448205a2e85e90a488be1c83d0f2b5f2d52)
|
|
|
357786 |
(cherry picked from commit 5bdbc1fe6b4574c78c80e664c539c51d7719f84d)
|
|
|
357786 |
(cherry picked from commit 069889e404721c5439ee7d69aa90f9d4580f4f21)
|
|
|
357786 |
(cherry picked from commit fd31805201e8da37645c5a34f7990a281afce10f)
|
|
|
9bac43 |
---
|
|
|
9bac43 |
hw/block/fdc.c | 39 +++++++++++++++++++++++++++++++++++++--
|
|
|
9bac43 |
1 file changed, 37 insertions(+), 2 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
|
|
|
357786 |
index 3964096..6943263 100644
|
|
|
9bac43 |
--- a/hw/block/fdc.c
|
|
|
9bac43 |
+++ b/hw/block/fdc.c
|
|
|
9bac43 |
@@ -36,6 +36,7 @@
|
|
|
9bac43 |
#include "hw/isa/isa.h"
|
|
|
9bac43 |
#include "hw/sysbus.h"
|
|
|
9bac43 |
#include "hw/block/block.h"
|
|
|
9bac43 |
+#include "migration/migration.h"
|
|
|
9bac43 |
#include "sysemu/block-backend.h"
|
|
|
9bac43 |
#include "sysemu/blockdev.h"
|
|
|
9bac43 |
#include "sysemu/sysemu.h"
|
|
|
357786 |
@@ -1036,6 +1037,10 @@ static bool fdrive_perpendicular_needed(void *opaque)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
FDrive *drive = opaque;
|
|
|
9bac43 |
|
|
|
9bac43 |
+ if (migrate_pre_2_2) {
|
|
|
9bac43 |
+ return false;
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+
|
|
|
9bac43 |
return drive->perpendicular != 0;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
357786 |
@@ -1130,8 +1135,20 @@ static int fdc_post_load(void *opaque, int version_id)
|
|
|
9bac43 |
static bool fdc_reset_sensei_needed(void *opaque)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
FDCtrl *s = opaque;
|
|
|
9bac43 |
+ bool needed = s->reset_sensei != 0;
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ if (migrate_pre_2_2) {
|
|
|
9bac43 |
+ /*
|
|
|
9bac43 |
+ * This probably wont matter for most OSs, but it's good to log
|
|
|
9bac43 |
+ * it just incase we find it causes problems.
|
|
|
9bac43 |
+ */
|
|
|
9bac43 |
+ if (needed) {
|
|
|
9bac43 |
+ error_report("INFO: fdc migration just after reset (sensei!=0)");
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ return false;
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
|
|
|
9bac43 |
- return s->reset_sensei != 0;
|
|
|
9bac43 |
+ return needed;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
static const VMStateDescription vmstate_fdc_reset_sensei = {
|
|
|
357786 |
@@ -1148,8 +1165,26 @@ static const VMStateDescription vmstate_fdc_reset_sensei = {
|
|
|
9bac43 |
static bool fdc_result_timer_needed(void *opaque)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
FDCtrl *s = opaque;
|
|
|
9bac43 |
+ bool needed = timer_pending(s->result_timer);
|
|
|
9bac43 |
+
|
|
|
9bac43 |
+ if (migrate_pre_2_2) {
|
|
|
9bac43 |
+ /*
|
|
|
9bac43 |
+ * This could upset some OSs if their read-id command doesn't
|
|
|
9bac43 |
+ * complete, so lets log something.
|
|
|
9bac43 |
+ */
|
|
|
9bac43 |
+ if (needed) {
|
|
|
9bac43 |
+ error_report("INFO: fdc migration just after read-id (timer!=0)");
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
+ /*
|
|
|
9bac43 |
+ * However, since it's not apparently caused us problems for many
|
|
|
9bac43 |
+ * years, don't fail the migration, especially as this could
|
|
|
9bac43 |
+ * happen as part of a background drive-probe which if it fails
|
|
|
9bac43 |
+ * won't be a problem.
|
|
|
9bac43 |
+ */
|
|
|
9bac43 |
+ return false;
|
|
|
9bac43 |
+ }
|
|
|
9bac43 |
|
|
|
9bac43 |
- return timer_pending(s->result_timer);
|
|
|
9bac43 |
+ return needed;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
static const VMStateDescription vmstate_fdc_result_timer = {
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|