* [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12
2010-01-08 14:25 [Qemu-devel] [PATCH 0/6] rom loading saga continued Gerd Hoffmann
@ 2010-01-08 14:25 ` Gerd Hoffmann
2010-01-11 19:50 ` Anthony Liguori
2010-01-08 14:25 ` [Qemu-devel] [PATCH 2/6] roms: minor fixes and cleanups Gerd Hoffmann
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Gerd Hoffmann @ 2010-01-08 14:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Add a new machine type for qemu 0.12.
Also fixup the 0.11 machine type: msi for virtio-blk-pci was enabled
after the 0.11 release, so turn it off in the 0.11 machine type.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pc.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 83f8dd0..ea5ac8e 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1298,7 +1298,7 @@ void cmos_set_s3_resume(void)
}
static QEMUMachine pc_machine = {
- .name = "pc-0.11",
+ .name = "pc-0.12",
.alias = "pc",
.desc = "Standard PC",
.init = pc_init_pci,
@@ -1306,6 +1306,21 @@ static QEMUMachine pc_machine = {
.is_default = 1,
};
+static QEMUMachine pc_machine_v0_11 = {
+ .name = "pc-0.11",
+ .desc = "Standard PC, qemu 0.11",
+ .init = pc_init_pci,
+ .max_cpus = 255,
+ .compat_props = (GlobalProperty[]) {
+ {
+ .driver = "virtio-blk-pci",
+ .property = "vectors",
+ .value = stringify(0),
+ },
+ { /* end of list */ }
+ }
+};
+
static QEMUMachine pc_machine_v0_10 = {
.name = "pc-0.10",
.desc = "Standard PC, qemu 0.10",
@@ -1343,6 +1358,7 @@ static QEMUMachine isapc_machine = {
static void pc_machine_init(void)
{
qemu_register_machine(&pc_machine);
+ qemu_register_machine(&pc_machine_v0_11);
qemu_register_machine(&pc_machine_v0_10);
qemu_register_machine(&isapc_machine);
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12
2010-01-08 14:25 ` [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12 Gerd Hoffmann
@ 2010-01-11 19:50 ` Anthony Liguori
2010-01-12 17:10 ` Gerd Hoffmann
0 siblings, 1 reply; 12+ messages in thread
From: Anthony Liguori @ 2010-01-11 19:50 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On 01/08/2010 08:25 AM, Gerd Hoffmann wrote:
> Add a new machine type for qemu 0.12.
>
> Also fixup the 0.11 machine type: msi for virtio-blk-pci was enabled
> after the 0.11 release, so turn it off in the 0.11 machine type.
>
> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>
Applied all. Thanks.
Regards,
Anthony Liguori
> ---
> hw/pc.c | 18 +++++++++++++++++-
> 1 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index 83f8dd0..ea5ac8e 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -1298,7 +1298,7 @@ void cmos_set_s3_resume(void)
> }
>
> static QEMUMachine pc_machine = {
> - .name = "pc-0.11",
> + .name = "pc-0.12",
> .alias = "pc",
> .desc = "Standard PC",
> .init = pc_init_pci,
> @@ -1306,6 +1306,21 @@ static QEMUMachine pc_machine = {
> .is_default = 1,
> };
>
> +static QEMUMachine pc_machine_v0_11 = {
> + .name = "pc-0.11",
> + .desc = "Standard PC, qemu 0.11",
> + .init = pc_init_pci,
> + .max_cpus = 255,
> + .compat_props = (GlobalProperty[]) {
> + {
> + .driver = "virtio-blk-pci",
> + .property = "vectors",
> + .value = stringify(0),
> + },
> + { /* end of list */ }
> + }
> +};
> +
> static QEMUMachine pc_machine_v0_10 = {
> .name = "pc-0.10",
> .desc = "Standard PC, qemu 0.10",
> @@ -1343,6 +1358,7 @@ static QEMUMachine isapc_machine = {
> static void pc_machine_init(void)
> {
> qemu_register_machine(&pc_machine);
> + qemu_register_machine(&pc_machine_v0_11);
> qemu_register_machine(&pc_machine_v0_10);
> qemu_register_machine(&isapc_machine);
> }
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12
2010-01-11 19:50 ` Anthony Liguori
@ 2010-01-12 17:10 ` Gerd Hoffmann
2010-01-12 19:18 ` Anthony Liguori
2010-01-12 19:36 ` Anthony Liguori
0 siblings, 2 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-01-12 17:10 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
On 01/11/10 20:50, Anthony Liguori wrote:
> On 01/08/2010 08:25 AM, Gerd Hoffmann wrote:
>> Add a new machine type for qemu 0.12.
>>
>> Also fixup the 0.11 machine type: msi for virtio-blk-pci was enabled
>> after the 0.11 release, so turn it off in the 0.11 machine type.
>>
>> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>
> Applied all. Thanks.
Note: this is intented to be applied to 0.12 too. Forgot to mention in
$subject. The series description should have made that clear though.
On a related note: Tried to check staging for stable. anthony-queue.git
seems to be unused now though (last update a few weeks ago) Can you
post a summary of which git trees are where right now and what is
planned (transition to git.qemu.org?).
thanks,
Gerd
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12
2010-01-12 17:10 ` Gerd Hoffmann
@ 2010-01-12 19:18 ` Anthony Liguori
2010-01-12 19:36 ` Anthony Liguori
1 sibling, 0 replies; 12+ messages in thread
From: Anthony Liguori @ 2010-01-12 19:18 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On 01/12/2010 11:10 AM, Gerd Hoffmann wrote:
> On 01/11/10 20:50, Anthony Liguori wrote:
>> On 01/08/2010 08:25 AM, Gerd Hoffmann wrote:
>>> Add a new machine type for qemu 0.12.
>>>
>>> Also fixup the 0.11 machine type: msi for virtio-blk-pci was enabled
>>> after the 0.11 release, so turn it off in the 0.11 machine type.
>>>
>>> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>>
>> Applied all. Thanks.
>
> Note: this is intented to be applied to 0.12 too. Forgot to mention
> in $subject. The series description should have made that clear though.
Thanks, I'll make sure to pull those in to stable.
> On a related note: Tried to check staging for stable.
> anthony-queue.git seems to be unused now though (last update a few
> weeks ago) Can you post a summary of which git trees are where right
> now and what is planned (transition to git.qemu.org?).
I'm trying something a little different. I'm using a different
mechanism to track patches and trying to make sure to always push
patches on a daily basis. If this works out, a staging tree won't make
sense anymore. Give me a week or two to see how this works and I'll
make sure to explain my new process.
Regards,
Anthony Liguori
> thanks,
> Gerd
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12
2010-01-12 17:10 ` Gerd Hoffmann
2010-01-12 19:18 ` Anthony Liguori
@ 2010-01-12 19:36 ` Anthony Liguori
2010-01-12 20:43 ` Gerd Hoffmann
1 sibling, 1 reply; 12+ messages in thread
From: Anthony Liguori @ 2010-01-12 19:36 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: qemu-devel
On 01/12/2010 11:10 AM, Gerd Hoffmann wrote:
> On 01/11/10 20:50, Anthony Liguori wrote:
>> On 01/08/2010 08:25 AM, Gerd Hoffmann wrote:
>>> Add a new machine type for qemu 0.12.
>>>
>>> Also fixup the 0.11 machine type: msi for virtio-blk-pci was enabled
>>> after the 0.11 release, so turn it off in the 0.11 machine type.
>>>
>>> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>>
>> Applied all. Thanks.
>
> Note: this is intented to be applied to 0.12 too. Forgot to mention
> in $subject. The series description should have made that clear though.
Can you rebase this series to stable and submit? I rebased myself but
one of the rom loader patches didn't apply and I'm concerned we're
missing a previous patch here. If you can take a look, I'd appreciate it.
Regards,
Anthony Liguori
> On a related note: Tried to check staging for stable.
> anthony-queue.git seems to be unused now though (last update a few
> weeks ago) Can you post a summary of which git trees are where right
> now and what is planned (transition to git.qemu.org?).
>
> thanks,
> Gerd
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12
2010-01-12 19:36 ` Anthony Liguori
@ 2010-01-12 20:43 ` Gerd Hoffmann
0 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-01-12 20:43 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
On 01/12/10 20:36, Anthony Liguori wrote:
> Can you rebase this series to stable and submit? I rebased myself but
> one of the rom loader patches didn't apply and I'm concerned we're
> missing a previous patch here. If you can take a look, I'd appreciate it.
It is a missing patch indeed. After cherry-picking commit
f21a59c224a6fdf7b30c3fe551fd93043e537f6c ("loader: more ignores for rom
intended to be loaded by the bios" by Aurelien Jarno) the series cleanly
applies to stable as-is.
cheers,
Gerd
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 2/6] roms: minor fixes and cleanups.
2010-01-08 14:25 [Qemu-devel] [PATCH 0/6] rom loading saga continued Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12 Gerd Hoffmann
@ 2010-01-08 14:25 ` Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 3/6] fw_cfg: rom loader tweaks Gerd Hoffmann
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-01-08 14:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Changes:
- Drop extra file argument from rom_add_file().
- Drop fw_dir check in do_info_roms, we allways have a dir name.
- code style fixes.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/loader.c | 38 +++++++++++++++++++++++---------------
hw/loader.h | 5 +++--
2 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/hw/loader.c b/hw/loader.c
index 3aba47c..38ee2da 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -556,7 +556,7 @@ static void rom_insert(Rom *rom)
QTAILQ_INSERT_TAIL(&roms, rom, next);
}
-int rom_add_file(const char *file, const char *fw_dir, const char *fw_file,
+int rom_add_file(const char *file, const char *fw_dir,
target_phys_addr_t addr)
{
Rom *rom;
@@ -576,8 +576,10 @@ int rom_add_file(const char *file, const char *fw_dir, const char *fw_file,
goto err;
}
- rom->fw_dir = fw_dir ? qemu_strdup(fw_dir) : NULL;
- rom->fw_file = fw_file ? qemu_strdup(fw_file) : NULL;
+ if (fw_dir) {
+ rom->fw_dir = qemu_strdup(fw_dir);
+ rom->fw_file = qemu_strdup(file);
+ }
rom->addr = addr;
rom->romsize = lseek(fd, 0, SEEK_END);
rom->data = qemu_mallocz(rom->romsize);
@@ -621,14 +623,14 @@ int rom_add_vga(const char *file)
{
if (!rom_enable_driver_roms)
return 0;
- return rom_add_file(file, "vgaroms", file, 0);
+ return rom_add_file(file, "vgaroms", 0);
}
int rom_add_option(const char *file)
{
if (!rom_enable_driver_roms)
return 0;
- return rom_add_file(file, "genroms", file, 0);
+ return rom_add_file(file, "genroms", 0);
}
static void rom_reset(void *unused)
@@ -639,8 +641,9 @@ static void rom_reset(void *unused)
if (rom->fw_file) {
continue;
}
- if (rom->data == NULL)
+ if (rom->data == NULL) {
continue;
+ }
cpu_physical_memory_write_rom(rom->addr, rom->data, rom->romsize);
if (rom->isrom) {
/* rom needs to be written only once */
@@ -683,8 +686,9 @@ int rom_load_fw(void *fw_cfg)
Rom *rom;
QTAILQ_FOREACH(rom, &roms, next) {
- if (!rom->fw_file)
+ if (!rom->fw_file) {
continue;
+ }
fw_cfg_add_file(fw_cfg, rom->fw_dir, rom->fw_file, rom->data, rom->romsize);
}
return 0;
@@ -698,10 +702,12 @@ static Rom *find_rom(target_phys_addr_t addr)
if (rom->fw_file) {
continue;
}
- if (rom->addr > addr)
+ if (rom->addr > addr) {
continue;
- if (rom->addr + rom->romsize < addr)
+ }
+ if (rom->addr + rom->romsize < addr) {
continue;
+ }
return rom;
}
return NULL;
@@ -723,12 +729,15 @@ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size)
if (rom->fw_file) {
continue;
}
- if (rom->addr + rom->romsize < addr)
+ if (rom->addr + rom->romsize < addr) {
continue;
- if (rom->addr > end)
+ }
+ if (rom->addr > end) {
break;
- if (!rom->data)
+ }
+ if (!rom->data) {
continue;
+ }
d = dest + (rom->addr - addr);
s = rom->data;
@@ -771,10 +780,9 @@ void do_info_roms(Monitor *mon)
rom->isrom ? "rom" : "ram",
rom->name);
} else {
- monitor_printf(mon, "fw=%s%s%s"
+ monitor_printf(mon, "fw=%s/%s"
" size=0x%06zx name=\"%s\" \n",
- rom->fw_dir ? rom->fw_dir : "",
- rom->fw_dir ? "/" : "",
+ rom->fw_dir,
rom->fw_file,
rom->romsize,
rom->name);
diff --git a/hw/loader.h b/hw/loader.h
index 77beb0e..698160b 100644
--- a/hw/loader.h
+++ b/hw/loader.h
@@ -19,7 +19,8 @@ void pstrcpy_targphys(const char *name,
target_phys_addr_t dest, int buf_size,
const char *source);
-int rom_add_file(const char *file, const char *fw_dir, const char *fw_file,
+
+int rom_add_file(const char *file, const char *fw_dir,
target_phys_addr_t addr);
int rom_add_blob(const char *name, const void *blob, size_t len,
target_phys_addr_t addr);
@@ -30,7 +31,7 @@ void *rom_ptr(target_phys_addr_t addr);
void do_info_roms(Monitor *mon);
#define rom_add_file_fixed(_f, _a) \
- rom_add_file(_f, NULL, NULL, _a)
+ rom_add_file(_f, NULL, _a)
#define rom_add_blob_fixed(_f, _b, _l, _a) \
rom_add_blob(_f, _b, _l, _a)
--
1.6.5.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 3/6] fw_cfg: rom loader tweaks.
2010-01-08 14:25 [Qemu-devel] [PATCH 0/6] rom loading saga continued Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 1/6] pc: add machine type for 0.12 Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 2/6] roms: minor fixes and cleanups Gerd Hoffmann
@ 2010-01-08 14:25 ` Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 4/6] roms: rework rom loading via fw Gerd Hoffmann
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-01-08 14:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Changes:
- make dir argument mandatory, we allways have one anyway
(vgaroms or genroms).
- check for duplicates, skip loading if found.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/fw_cfg.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index fe9c527..ea120ba 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -278,7 +278,7 @@ int fw_cfg_add_file(FWCfgState *s, const char *dir, const char *filename,
uint8_t *data, uint32_t len)
{
const char *basename;
- int index;
+ int i, index;
if (!s->files) {
int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS;
@@ -300,13 +300,17 @@ int fw_cfg_add_file(FWCfgState *s, const char *dir, const char *filename,
} else {
basename = filename;
}
- if (dir) {
- snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
- "%s/%s", dir, basename);
- } else {
- snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
- "%s", basename);
+
+ snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
+ "%s/%s", dir, basename);
+ for (i = 0; i < index; i++) {
+ if (strcmp(s->files->f[index].name, s->files->f[i].name) == 0) {
+ FW_CFG_DPRINTF("%s: skip duplicate: %s\n", __FUNCTION__,
+ s->files->f[index].name);
+ return 1;
+ }
}
+
s->files->f[index].size = cpu_to_be32(len);
s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index);
FW_CFG_DPRINTF("%s: #%d: %s (%d bytes)\n", __FUNCTION__,
--
1.6.5.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 4/6] roms: rework rom loading via fw
2010-01-08 14:25 [Qemu-devel] [PATCH 0/6] rom loading saga continued Gerd Hoffmann
` (2 preceding siblings ...)
2010-01-08 14:25 ` [Qemu-devel] [PATCH 3/6] fw_cfg: rom loader tweaks Gerd Hoffmann
@ 2010-01-08 14:25 ` Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 5/6] pci: allow loading roms via fw_cfg Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 6/6] pc: add rombar to compat properties for pc-0.10 and pc-0.11 Gerd Hoffmann
5 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-01-08 14:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
This patch changes the way rom loading via fw_cfg is handled.
Instead of having pc_init1() call a function which passed all
roms to the firmware config we simply pass a pointer to fw_cfg
to the rom loader.
Advantage: loading roms via firmware works also for devices which
are initialized after pc_init1(), i.e. everyting added via -device.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/loader.c | 15 +++++----------
hw/loader.h | 2 +-
hw/pc.c | 3 +--
3 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/hw/loader.c b/hw/loader.c
index 38ee2da..b3bbd77 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -535,6 +535,7 @@ struct Rom {
QTAILQ_ENTRY(Rom) next;
};
+static FWCfgState *fw_cfg;
static QTAILQ_HEAD(, Rom) roms = QTAILQ_HEAD_INITIALIZER(roms);
int rom_enable_driver_roms;
@@ -592,6 +593,8 @@ int rom_add_file(const char *file, const char *fw_dir,
}
close(fd);
rom_insert(rom);
+ if (rom->fw_file && fw_cfg)
+ fw_cfg_add_file(fw_cfg, rom->fw_dir, rom->fw_file, rom->data, rom->romsize);
return 0;
err:
@@ -681,17 +684,9 @@ int rom_load_all(void)
return 0;
}
-int rom_load_fw(void *fw_cfg)
+void rom_set_fw(void *f)
{
- Rom *rom;
-
- QTAILQ_FOREACH(rom, &roms, next) {
- if (!rom->fw_file) {
- continue;
- }
- fw_cfg_add_file(fw_cfg, rom->fw_dir, rom->fw_file, rom->data, rom->romsize);
- }
- return 0;
+ fw_cfg = f;
}
static Rom *find_rom(target_phys_addr_t addr)
diff --git a/hw/loader.h b/hw/loader.h
index 698160b..8ff3c94 100644
--- a/hw/loader.h
+++ b/hw/loader.h
@@ -25,7 +25,7 @@ int rom_add_file(const char *file, const char *fw_dir,
int rom_add_blob(const char *name, const void *blob, size_t len,
target_phys_addr_t addr);
int rom_load_all(void);
-int rom_load_fw(void *fw_cfg);
+void rom_set_fw(void *f);
int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size);
void *rom_ptr(target_phys_addr_t addr);
void do_info_roms(Monitor *mon);
diff --git a/hw/pc.c b/hw/pc.c
index ea5ac8e..3ed43f5 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1099,6 +1099,7 @@ static void pc_init1(ram_addr_t ram_size,
bios_size, bios_offset | IO_MEM_ROM);
fw_cfg = bochs_bios_init();
+ rom_set_fw(fw_cfg);
if (linux_boot) {
load_linux(fw_cfg, kernel_filename, initrd_filename, kernel_cmdline, below_4g_mem_size);
@@ -1259,8 +1260,6 @@ static void pc_init1(ram_addr_t ram_size,
}
}
}
-
- rom_load_fw(fw_cfg);
}
static void pc_init_pci(ram_addr_t ram_size,
--
1.6.5.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 5/6] pci: allow loading roms via fw_cfg.
2010-01-08 14:25 [Qemu-devel] [PATCH 0/6] rom loading saga continued Gerd Hoffmann
` (3 preceding siblings ...)
2010-01-08 14:25 ` [Qemu-devel] [PATCH 4/6] roms: rework rom loading via fw Gerd Hoffmann
@ 2010-01-08 14:25 ` Gerd Hoffmann
2010-01-08 14:25 ` [Qemu-devel] [PATCH 6/6] pc: add rombar to compat properties for pc-0.10 and pc-0.11 Gerd Hoffmann
5 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-01-08 14:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
This patch adds a pci bus property 'rombar' which specifies whenever
the pci rom should be loaded via pci rom bar (default) or via fw_cfg.
The later can be used for compatibility with older qemu versions where
no pci rom bar is present.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pci.c | 15 +++++++++++++++
hw/pci.h | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 0814383..c584dba 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -65,6 +65,7 @@ static struct BusInfo pci_bus_info = {
.props = (Property[]) {
DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1),
DEFINE_PROP_STRING("romfile", PCIDevice, romfile),
+ DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1),
DEFINE_PROP_END_OF_LIST()
}
};
@@ -1477,6 +1478,20 @@ static int pci_add_option_rom(PCIDevice *pdev)
if (strlen(pdev->romfile) == 0)
return 0;
+ if (!pdev->rom_bar) {
+ /*
+ * Load rom via fw_cfg instead of creating a rom bar,
+ * for 0.11 compatibility.
+ */
+ int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
+ if (class == 0x0300) {
+ rom_add_vga(pdev->romfile);
+ } else {
+ rom_add_option(pdev->romfile);
+ }
+ return 0;
+ }
+
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile);
if (path == NULL) {
path = qemu_strdup(pdev->romfile);
diff --git a/hw/pci.h b/hw/pci.h
index fd16460..5d8bf97 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -244,6 +244,7 @@ struct PCIDevice {
/* Location of option rom */
char *romfile;
ram_addr_t rom_offset;
+ uint32_t rom_bar;
};
PCIDevice *pci_register_device(PCIBus *bus, const char *name,
--
1.6.5.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 6/6] pc: add rombar to compat properties for pc-0.10 and pc-0.11
2010-01-08 14:25 [Qemu-devel] [PATCH 0/6] rom loading saga continued Gerd Hoffmann
` (4 preceding siblings ...)
2010-01-08 14:25 ` [Qemu-devel] [PATCH 5/6] pci: allow loading roms via fw_cfg Gerd Hoffmann
@ 2010-01-08 14:25 ` Gerd Hoffmann
5 siblings, 0 replies; 12+ messages in thread
From: Gerd Hoffmann @ 2010-01-08 14:25 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
So '-M pc-0.10' and '-M pc-0.11' will use the fw_cfg rom load method
by default.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/pc.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 3ed43f5..825501c 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1315,6 +1315,10 @@ static QEMUMachine pc_machine_v0_11 = {
.driver = "virtio-blk-pci",
.property = "vectors",
.value = stringify(0),
+ },{
+ .driver = "PCI",
+ .property = "rombar",
+ .value = stringify(0),
},
{ /* end of list */ }
}
@@ -1342,6 +1346,10 @@ static QEMUMachine pc_machine_v0_10 = {
.driver = "virtio-blk-pci",
.property = "vectors",
.value = stringify(0),
+ },{
+ .driver = "PCI",
+ .property = "rombar",
+ .value = stringify(0),
},
{ /* end of list */ }
},
--
1.6.5.2
^ permalink raw reply related [flat|nested] 12+ messages in thread