Blame SOURCES/kvm-pflash_cfi01-Do-not-exit-on-guest-aborting-write-to-.patch

383d26
From f72f8a75f6b29f02a2226324901e35dbb07ae932 Mon Sep 17 00:00:00 2001
383d26
From: Markus Armbruster <armbru@redhat.com>
383d26
Date: Fri, 17 May 2019 06:50:53 +0200
383d26
Subject: [PATCH 26/53] pflash_cfi01: Do not exit() on guest aborting "write to
383d26
 buffer"
383d26
MIME-Version: 1.0
383d26
Content-Type: text/plain; charset=UTF-8
383d26
Content-Transfer-Encoding: 8bit
383d26
383d26
RH-Author: Markus Armbruster <armbru@redhat.com>
383d26
Message-id: <20190517065120.12028-5-armbru@redhat.com>
383d26
Patchwork-id: 87986
383d26
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v3 04/31] pflash_cfi01: Do not exit() on guest aborting "write to buffer"
383d26
Bugzilla: 1624009
383d26
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
383d26
RH-Acked-by: Thomas Huth <thuth@redhat.com>
383d26
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
383d26
When a guest tries to abort "write to buffer" (command 0xE8), we print
383d26
"PFLASH: Possible BUG - Write block confirm", then exit(1).  Letting
383d26
the guest terminate QEMU is not a good idea.  Instead, LOG_UNIMP we
383d26
screwed up, then reset the device.
383d26
383d26
Macro PFLASH_BUG() is now unused; delete it.
383d26
383d26
Suggested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
383d26
Signed-off-by: Markus Armbruster <armbru@redhat.com>
383d26
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
383d26
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
383d26
Message-Id: <20190308094610.21210-3-armbru@redhat.com>
383d26
(cherry picked from commit 2d93bebf81520ccebeb9a3ea9bd051ce088854ea)
383d26
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
383d26
---
383d26
 hw/block/pflash_cfi01.c | 13 +++++--------
383d26
 1 file changed, 5 insertions(+), 8 deletions(-)
383d26
383d26
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
383d26
index 389bc60..c565db1 100644
383d26
--- a/hw/block/pflash_cfi01.c
383d26
+++ b/hw/block/pflash_cfi01.c
383d26
@@ -49,12 +49,6 @@
383d26
 #include "hw/sysbus.h"
383d26
 #include "sysemu/sysemu.h"
383d26
 
383d26
-#define PFLASH_BUG(fmt, ...) \
383d26
-do { \
383d26
-    fprintf(stderr, "PFLASH: Possible BUG - " fmt, ## __VA_ARGS__); \
383d26
-    exit(1); \
383d26
-} while(0)
383d26
-
383d26
 /* #define PFLASH_DEBUG */
383d26
 #ifdef PFLASH_DEBUG
383d26
 #define DPRINTF(fmt, ...)                                   \
383d26
@@ -636,8 +630,11 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
383d26
                 pfl->wcycle = 0;
383d26
                 pfl->status |= 0x80;
383d26
             } else {
383d26
-                DPRINTF("%s: unknown command for \"write block\"\n", __func__);
383d26
-                PFLASH_BUG("Write block confirm");
383d26
+                qemu_log_mask(LOG_UNIMP,
383d26
+                    "%s: Aborting write to buffer not implemented,"
383d26
+                    " the data is already written to storage!\n"
383d26
+                    "Flash device reset into READ mode.\n",
383d26
+                    __func__);
383d26
                 goto reset_flash;
383d26
             }
383d26
             break;
383d26
-- 
383d26
1.8.3.1
383d26