|
|
0a122b |
From 5f8e45393355671d8793e4bb37c07c95c609fdcd Mon Sep 17 00:00:00 2001
|
|
|
0a122b |
From: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
Date: Sun, 9 Mar 2014 18:48:58 +0100
|
|
|
0a122b |
Subject: [PATCH 10/16] pc: avoid duplicate names for ROM MRs
|
|
|
0a122b |
|
|
|
0a122b |
RH-Author: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
Message-id: <1394390868-24135-2-git-send-email-mst@redhat.com>
|
|
|
0a122b |
Patchwork-id: 58054
|
|
|
0a122b |
O-Subject: [PATCH qemu-kvm RHEL7.0 v3 2/2] pc: avoid duplicate names for ROM MRs
|
|
|
0a122b |
Bugzilla: 1064018
|
|
|
0a122b |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
0a122b |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
Since
|
|
|
0a122b |
commit 04920fc0faa4760f9c4fc0e73b992b768099be70
|
|
|
0a122b |
loader: store FW CFG ROM files in RAM
|
|
|
0a122b |
RAM MRs including ROM files in FW CFGs are created
|
|
|
0a122b |
and named using the file basename.
|
|
|
0a122b |
|
|
|
0a122b |
This becomes problematic if these names are
|
|
|
0a122b |
supplied by user, since the basename might not
|
|
|
0a122b |
be unique.
|
|
|
0a122b |
|
|
|
0a122b |
There are two cases we care about:
|
|
|
0a122b |
- option-rom flag.
|
|
|
0a122b |
- option ROM for devices. This triggers e.g. when
|
|
|
0a122b |
using rombar=0.
|
|
|
0a122b |
|
|
|
0a122b |
At the moment we get an assert. E.g
|
|
|
0a122b |
qemu -option-rom /usr/share/ipxe/8086100e.rom -option-rom
|
|
|
0a122b |
/usr/share/ipxe.efi/8086100e.rom
|
|
|
0a122b |
RAMBlock "/rom@genroms/8086100e.rom" already registered, abort!
|
|
|
0a122b |
|
|
|
0a122b |
This is a regression from 1.7.
|
|
|
0a122b |
|
|
|
0a122b |
For now let's keep it simple and just avoid creating the
|
|
|
0a122b |
MRs in case of option ROMs.
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
0a122b |
|
|
|
0a122b |
Upstream: posted
|
|
|
0a122b |
Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7173355
|
|
|
0a122b |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1064018#c6
|
|
|
0a122b |
Tested: by developer
|
|
|
0a122b |
---
|
|
|
0a122b |
include/hw/loader.h | 6 ++++--
|
|
|
0a122b |
hw/core/loader.c | 10 ++++++----
|
|
|
0a122b |
2 files changed, 10 insertions(+), 6 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
0a122b |
---
|
|
|
0a122b |
hw/core/loader.c | 10 ++++++----
|
|
|
0a122b |
include/hw/loader.h | 6 ++++--
|
|
|
0a122b |
2 files changed, 10 insertions(+), 6 deletions(-)
|
|
|
0a122b |
|
|
|
0a122b |
diff --git a/hw/core/loader.c b/hw/core/loader.c
|
|
|
0a122b |
index c363aef..9309b8c 100644
|
|
|
0a122b |
--- a/hw/core/loader.c
|
|
|
0a122b |
+++ b/hw/core/loader.c
|
|
|
0a122b |
@@ -54,6 +54,7 @@
|
|
|
0a122b |
|
|
|
0a122b |
#include <zlib.h>
|
|
|
0a122b |
|
|
|
0a122b |
+bool option_rom_has_mr = false;
|
|
|
0a122b |
bool rom_file_has_mr = true;
|
|
|
0a122b |
|
|
|
0a122b |
static int roms_loaded;
|
|
|
0a122b |
@@ -590,7 +591,8 @@ static void *rom_set_mr(Rom *rom, const char *name)
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
int rom_add_file(const char *file, const char *fw_dir,
|
|
|
0a122b |
- hwaddr addr, int32_t bootindex)
|
|
|
0a122b |
+ hwaddr addr, int32_t bootindex,
|
|
|
0a122b |
+ bool option_rom)
|
|
|
0a122b |
{
|
|
|
0a122b |
Rom *rom;
|
|
|
0a122b |
int rc, fd = -1;
|
|
|
0a122b |
@@ -642,7 +644,7 @@ int rom_add_file(const char *file, const char *fw_dir,
|
|
|
0a122b |
basename);
|
|
|
0a122b |
snprintf(devpath, sizeof(devpath), "/rom@%s", fw_file_name);
|
|
|
0a122b |
|
|
|
0a122b |
- if (rom_file_has_mr) {
|
|
|
0a122b |
+ if ((!option_rom || option_rom_has_mr) && rom_file_has_mr) {
|
|
|
0a122b |
data = rom_set_mr(rom, devpath);
|
|
|
0a122b |
} else {
|
|
|
0a122b |
data = rom->data;
|
|
|
0a122b |
@@ -721,12 +723,12 @@ int rom_add_elf_program(const char *name, void *data, size_t datasize,
|
|
|
0a122b |
|
|
|
0a122b |
int rom_add_vga(const char *file)
|
|
|
0a122b |
{
|
|
|
0a122b |
- return rom_add_file(file, "vgaroms", 0, -1);
|
|
|
0a122b |
+ return rom_add_file(file, "vgaroms", 0, -1, true);
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
int rom_add_option(const char *file, int32_t bootindex)
|
|
|
0a122b |
{
|
|
|
0a122b |
- return rom_add_file(file, "genroms", 0, bootindex);
|
|
|
0a122b |
+ return rom_add_file(file, "genroms", 0, bootindex, true);
|
|
|
0a122b |
}
|
|
|
0a122b |
|
|
|
0a122b |
static void rom_reset(void *unused)
|
|
|
0a122b |
diff --git a/include/hw/loader.h b/include/hw/loader.h
|
|
|
0a122b |
index 7ceccce..a5e02ce 100644
|
|
|
0a122b |
--- a/include/hw/loader.h
|
|
|
0a122b |
+++ b/include/hw/loader.h
|
|
|
0a122b |
@@ -23,10 +23,12 @@ void pstrcpy_targphys(const char *name,
|
|
|
0a122b |
hwaddr dest, int buf_size,
|
|
|
0a122b |
const char *source);
|
|
|
0a122b |
|
|
|
0a122b |
+extern bool option_rom_has_mr;
|
|
|
0a122b |
extern bool rom_file_has_mr;
|
|
|
0a122b |
|
|
|
0a122b |
int rom_add_file(const char *file, const char *fw_dir,
|
|
|
0a122b |
- hwaddr addr, int32_t bootindex);
|
|
|
0a122b |
+ hwaddr addr, int32_t bootindex,
|
|
|
0a122b |
+ bool option_rom);
|
|
|
0a122b |
void *rom_add_blob(const char *name, const void *blob, size_t len,
|
|
|
0a122b |
hwaddr addr, const char *fw_file_name,
|
|
|
0a122b |
FWCfgReadCallback fw_callback, void *callback_opaque);
|
|
|
0a122b |
@@ -40,7 +42,7 @@ void *rom_ptr(hwaddr addr);
|
|
|
0a122b |
void do_info_roms(Monitor *mon, const QDict *qdict);
|
|
|
0a122b |
|
|
|
0a122b |
#define rom_add_file_fixed(_f, _a, _i) \
|
|
|
0a122b |
- rom_add_file(_f, NULL, _a, _i)
|
|
|
0a122b |
+ rom_add_file(_f, NULL, _a, _i, false)
|
|
|
0a122b |
#define rom_add_blob_fixed(_f, _b, _l, _a) \
|
|
|
0a122b |
(rom_add_blob(_f, _b, _l, _a, NULL, NULL, NULL) ? 0 : -1)
|
|
|
0a122b |
|
|
|
0a122b |
--
|
|
|
0a122b |
1.7.1
|
|
|
0a122b |
|