|
|
9ae3a8 |
From bc5ebe6df8479b32dbf46f75f32cfad7008a14f0 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 13 Dec 2017 13:38:32 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 01/41] fw_cfg: remove support for guest-side data writes
|
|
|
9ae3a8 |
MIME-Version: 1.0
|
|
|
9ae3a8 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9ae3a8 |
Content-Transfer-Encoding: 8bit
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Message-id: <20171213133912.26176-2-marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 78353
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.5 qemu-kvm PATCH v3 01/41] fw_cfg: remove support for guest-side data writes
|
|
|
9ae3a8 |
Bugzilla: 1411490
|
|
|
9ae3a8 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: "Gabriel L. Somlo" <somlo@cmu.edu>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
>From this point forward, any guest-side writes to the fw_cfg
|
|
|
9ae3a8 |
data register will be treated as no-ops. This patch also removes
|
|
|
9ae3a8 |
the unused host-side API function fw_cfg_add_callback(), which
|
|
|
9ae3a8 |
allowed the registration of a callback to be executed each time
|
|
|
9ae3a8 |
the guest completed a full overwrite of a given fw_cfg data item.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
|
|
|
9ae3a8 |
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
(cherry picked from commit 023e3148567ac898c7258138f8e86c3c2bb40d07)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RHEL: Fix conflicts, due to fw_cfg_modify_bytes_read() introduction in
|
|
|
9ae3a8 |
upstream commit bdbb5b1706d165e8d4222121f1e9b59b6b4359ce.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/nvram/fw_cfg.c | 35 +----------------------------------
|
|
|
9ae3a8 |
include/hw/nvram/fw_cfg.h | 2 --
|
|
|
9ae3a8 |
trace-events | 1 -
|
|
|
9ae3a8 |
3 files changed, 1 insertion(+), 37 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
index fcb3146..9d7b99e 100644
|
|
|
9ae3a8 |
--- a/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
+++ b/hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
@@ -40,7 +40,6 @@ typedef struct FWCfgEntry {
|
|
|
9ae3a8 |
uint32_t len;
|
|
|
9ae3a8 |
uint8_t *data;
|
|
|
9ae3a8 |
void *callback_opaque;
|
|
|
9ae3a8 |
- FWCfgCallback callback;
|
|
|
9ae3a8 |
FWCfgReadCallback read_callback;
|
|
|
9ae3a8 |
} FWCfgEntry;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
@@ -206,22 +205,7 @@ static void fw_cfg_reboot(FWCfgState *s)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static void fw_cfg_write(FWCfgState *s, uint8_t value)
|
|
|
9ae3a8 |
{
|
|
|
9ae3a8 |
- int arch = !!(s->cur_entry & FW_CFG_ARCH_LOCAL);
|
|
|
9ae3a8 |
- FWCfgEntry *e = (s->cur_entry == FW_CFG_INVALID) ? NULL :
|
|
|
9ae3a8 |
- &s->entries[arch][s->cur_entry & FW_CFG_ENTRY_MASK];
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- trace_fw_cfg_write(s, value);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- if (s->cur_entry & FW_CFG_WRITE_CHANNEL
|
|
|
9ae3a8 |
- && e != NULL
|
|
|
9ae3a8 |
- && e->callback
|
|
|
9ae3a8 |
- && s->cur_offset < e->len) {
|
|
|
9ae3a8 |
- e->data[s->cur_offset++] = value;
|
|
|
9ae3a8 |
- if (s->cur_offset == e->len) {
|
|
|
9ae3a8 |
- e->callback(e->callback_opaque, e->data);
|
|
|
9ae3a8 |
- s->cur_offset = 0;
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
- }
|
|
|
9ae3a8 |
+ /* nothing, write support removed in QEMU v2.4+ */
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static int fw_cfg_select(FWCfgState *s, uint16_t key)
|
|
|
9ae3a8 |
@@ -442,23 +426,6 @@ void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value)
|
|
|
9ae3a8 |
fw_cfg_add_bytes(s, key, copy, sizeof(value));
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-void fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
|
|
|
9ae3a8 |
- void *callback_opaque, void *data, size_t len)
|
|
|
9ae3a8 |
-{
|
|
|
9ae3a8 |
- int arch = !!(key & FW_CFG_ARCH_LOCAL);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- assert(key & FW_CFG_WRITE_CHANNEL);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- key &= FW_CFG_ENTRY_MASK;
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- assert(key < FW_CFG_MAX_ENTRY && len <= UINT32_MAX);
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
- s->entries[arch][key].data = data;
|
|
|
9ae3a8 |
- s->entries[arch][key].len = (uint32_t)len;
|
|
|
9ae3a8 |
- s->entries[arch][key].callback_opaque = callback_opaque;
|
|
|
9ae3a8 |
- s->entries[arch][key].callback = callback;
|
|
|
9ae3a8 |
-}
|
|
|
9ae3a8 |
-
|
|
|
9ae3a8 |
void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
|
|
|
9ae3a8 |
FWCfgReadCallback callback, void *callback_opaque,
|
|
|
9ae3a8 |
void *data, size_t len)
|
|
|
9ae3a8 |
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
|
|
|
9ae3a8 |
index 72b1549..aa5f351 100644
|
|
|
9ae3a8 |
--- a/include/hw/nvram/fw_cfg.h
|
|
|
9ae3a8 |
+++ b/include/hw/nvram/fw_cfg.h
|
|
|
9ae3a8 |
@@ -69,8 +69,6 @@ void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value);
|
|
|
9ae3a8 |
void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value);
|
|
|
9ae3a8 |
void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value);
|
|
|
9ae3a8 |
void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value);
|
|
|
9ae3a8 |
-void fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
|
|
|
9ae3a8 |
- void *callback_opaque, void *data, size_t len);
|
|
|
9ae3a8 |
void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data,
|
|
|
9ae3a8 |
size_t len);
|
|
|
9ae3a8 |
void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
|
|
|
9ae3a8 |
diff --git a/trace-events b/trace-events
|
|
|
9ae3a8 |
index fa2618d..a987dfa 100644
|
|
|
9ae3a8 |
--- a/trace-events
|
|
|
9ae3a8 |
+++ b/trace-events
|
|
|
9ae3a8 |
@@ -176,7 +176,6 @@ ecc_diag_mem_writeb(uint64_t addr, uint32_t val) "Write diagnostic %"PRId64" = %
|
|
|
9ae3a8 |
ecc_diag_mem_readb(uint64_t addr, uint32_t ret) "Read diagnostic %"PRId64"= %02x"
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
# hw/nvram/fw_cfg.c
|
|
|
9ae3a8 |
-fw_cfg_write(void *s, uint8_t value) "%p %d"
|
|
|
9ae3a8 |
fw_cfg_select(void *s, uint16_t key, int ret) "%p key %d = %d"
|
|
|
9ae3a8 |
fw_cfg_read(void *s, uint8_t ret) "%p = %d"
|
|
|
9ae3a8 |
fw_cfg_add_file_dupe(void *s, char *name) "%p %s"
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|