Skip to contentSkip to conversation

hw/misc/blob-loader: add a generic blob loader

PATCH Superseded Li Guang 4 participants 22 messages Jan 2, 2014 – Jan 8, 2014

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Li Guang

author
#0 lore raw

PATCH 1/1 hw/misc/blob-loader: add a generic blob loader

this blob loader will be used to load a specified
blob into a specified RAM address.

---
it can be used now for allwinner-a10, like:
"-device blob-loader,addr=0x43000000,file=/path/script.bin"

reference:
http://linux-sunxi.org/Sunxi-tools

script file address:
http://dl.dbank.com/c00aonvlmw

Thanks to Peter Crosthwaite for the idea!

---
 default-configs/arm-softmmu.mak |    2 +
 hw/misc/Makefile.objs           |    2 +
 hw/misc/blob-loader.c           |   75 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 hw/misc/blob-loader.c
default-configs/arm-softmmu.mak +2 -0
index ce1d620..50c71a6 100644
@@ -87,3 +87,5 @@ CONFIG_INTEGRATOR_DEBUG=y
 CONFIG_ALLWINNER_A10_PIT=y
 CONFIG_ALLWINNER_A10_PIC=y
 CONFIG_ALLWINNER_A10=y
+
+CONFIG_BLOB_LOADER=y
hw/misc/Makefile.objs +2 -0
index f674365..df28288 100644
@@ -42,3 +42,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_BLOB_LOADER) += blob-loader.o
hw/misc/blob-loader.c new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 3 lines · Li Guang

this blob loader will be used to load a specified
blob into a specified RAM address.

Quoted 24 lines

---
it can be used now for allwinner-a10, like:
"-device blob-loader,addr=0x43000000,file=/path/script.bin"

reference:
http://linux-sunxi.org/Sunxi-tools

script file address:
http://dl.dbank.com/c00aonvlmw

Thanks to Peter Crosthwaite for the idea!

---
 default-configs/arm-softmmu.mak |    2 +
 hw/misc/Makefile.objs           |    2 +
 hw/misc/blob-loader.c           |   75 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 hw/misc/blob-loader.c
default-configs/arm-softmmu.mak +0 -0
index ce1d620..50c71a6 100644

default-configs/arm-softmmu.mak CONFIG_INTEGRATOR_DEBUG=y · line 91

Quoted 5 lines
default-configs/arm-softmmu.mak +2 -0
@@ -87,3 +87,5 @@ CONFIG_INTEGRATOR_DEBUG=y
 CONFIG_ALLWINNER_A10_PIT=y
 CONFIG_ALLWINNER_A10_PIC=y
 CONFIG_ALLWINNER_A10=y
+
+CONFIG_BLOB_LOADER=y

This shouldn't be arm specific. I would make the argument that the blob loader has global validity.

Quoted 16 lines
hw/misc/Makefile.objs +2 -0
index f674365..df28288 100644
@@ -42,3 +42,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_BLOB_LOADER) += blob-loader.o
hw/misc/blob-loader.c new file +0 -0
new file mode 100644
index 0000000..d7f1408

hw/misc/blob-loader.c line 6

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
@@ -0,0 +1,75 @@
+#include "hw/sysbus.h"
+#include "hw/devices.h"
+#include "hw/loader.h"
+#include "qemu/error-report.h"
+
+typedef struct BlobLoaderState {

/*< private >/*

hw/misc/blob-loader.c line 7

Quoted 1 line
hw/misc/blob-loader.c new file +1 -0
+    DeviceState qdev;

parent_obj;

/*< public >/*

hw/misc/blob-loader.c line 8

Quoted 1 line
hw/misc/blob-loader.c new file +1 -0
+    uint32_t addr;

uint64_t or hwaddr. Blob loading shouldn't be limited to 32 bit.

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+    char *file;
+} BlobLoaderState;
+
+#define TYPE_BLOB_LOADER "blob-loader"
+#define BLOB_LOADER(obj) OBJECT_CHECK(BlobLoaderState, (obj), TYPE_BLOB_LOADER)
+
+static Property blob_loader_props[] = {
+    DEFINE_PROP_UINT32("addr", BlobLoaderState, addr, 0),
+    DEFINE_PROP_STRING("file", BlobLoaderState, file),
+    DEFINE_PROP_END_OF_LIST(),

hw/misc/blob-loader.c line 28

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+};
+
+static void do_blob_load(BlobLoaderState *s)
+{
+    char *file_name;
+    int file_size;
+
+    if  (s->file == NULL) {
+        error_report("please spicify a file for blob loader\n");
+        return;

Should you exit(1)? Better yet, return true for error and ..

Quoted 12 lines
hw/misc/blob-loader.c new file +12 -0
+    }
+    file_name = qemu_find_file(QEMU_FILE_TYPE_BIOS, s->file);
+    if (file_name == NULL) {
+        error_report("can't find %s\n", s->file);
+        return;
+    }
+    file_size = get_image_size(file_name);
+    if (file_size < 0) {
+        error_report("can't get file size of %s\n", file_name);
+        return;
+    }
+    if (load_image_targphys(file_name, s->addr, file_size) < 0) {

hw/misc/blob-loader.c line 50

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+        error_report("can't load %s\n", file_name);
+        return;
+    }
+}
+
+static int blob_loader_init(DeviceState *dev)
+{
+    BlobLoaderState *s = BLOB_LOADER(dev);
+
+    do_blob_load(s);

exit(1) here.

hw/misc/blob-loader.c line 54

Quoted 4 lines
hw/misc/blob-loader.c new file +4 -0
+    return 0;
+}
+
+static void blob_loader_class_init(ObjectClass *klass, void *data)

s/klass/oc.

hw/misc/blob-loader.c line 60

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->props = blob_loader_props;
+    dc->desc = "blob loader";
+    dc->init = blob_loader_init;

I'm wondering whether blob loading is actually a reset step not an init. Will doing it at init will play foul with VMSD, as your blob loader will trample non-reset state on machine restore?

Regards,
Peter

Quoted 19 lines
hw/misc/blob-loader.c new file +15 -1
+}
+
+static TypeInfo blob_loader_info = {
+    .name                  = TYPE_BLOB_LOADER,
+    .parent                = TYPE_DEVICE,
+    .instance_size         = sizeof(BlobLoaderState),
+    .class_init            = blob_loader_class_init,
+};
+
+static void blob_loader_register_type(void)
+{
+    type_register_static(&blob_loader_info);
+}
+
+type_init(blob_loader_register_type)
--

1.7.2.5

author
#2 lore raw
Quoted 131 lines · Peter Crosthwaite
Quoted 4 lines · Li Guang

this blob loader will be used to load a specified
blob into a specified RAM address.

Quoted 25 lines

---
it can be used now for allwinner-a10, like:
"-device blob-loader,addr=0x43000000,file=/path/script.bin"

reference:
http://linux-sunxi.org/Sunxi-tools

script file address:
http://dl.dbank.com/c00aonvlmw

Thanks to Peter Crosthwaite for the idea!

---
  default-configs/arm-softmmu.mak |    2 +
  hw/misc/Makefile.objs           |    2 +
  hw/misc/blob-loader.c           |   75 +++++++++++++++++++++++++++++++++++++++
  3 files changed, 79 insertions(+), 0 deletions(-)

create mode 100644 hw/misc/blob-loader.c

default-configs/arm-softmmu.mak +0 -0
index ce1d620..50c71a6 100644

default-configs/arm-softmmu.mak CONFIG_INTEGRATOR_DEBUG=y · line 91

Quoted 5 lines
default-configs/arm-softmmu.mak +2 -0
@@ -87,3 +87,5 @@ CONFIG_INTEGRATOR_DEBUG=y
  CONFIG_ALLWINNER_A10_PIT=y
  CONFIG_ALLWINNER_A10_PIC=y
  CONFIG_ALLWINNER_A10=y
+
+CONFIG_BLOB_LOADER=y

This shouldn't be arm specific. I would make the argument that the blob loader has global validity.

Quoted 17 lines
hw/misc/Makefile.objs +2 -0
index f674365..df28288 100644
@@ -42,3 +42,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
  obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
  obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_BLOB_LOADER) += blob-loader.o
hw/misc/blob-loader.c new file +0 -0
new file mode 100644
index 0000000..d7f1408

hw/misc/blob-loader.c line 6

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
@@ -0,0 +1,75 @@
+#include "hw/sysbus.h"
+#include "hw/devices.h"
+#include "hw/loader.h"
+#include "qemu/error-report.h"
+
+typedef struct BlobLoaderState {

/*< private>/*

hw/misc/blob-loader.c line 7

Quoted 2 lines
hw/misc/blob-loader.c new file +1 -0
+    DeviceState qdev;

parent_obj;

/*< public>/*

hw/misc/blob-loader.c line 8

Quoted 2 lines
hw/misc/blob-loader.c new file +1 -0
+    uint32_t addr;

uint64_t or hwaddr. Blob loading shouldn't be limited to 32 bit.

Quoted 11 lines
hw/misc/blob-loader.c new file +10 -0
+    char *file;
+} BlobLoaderState;
+
+#define TYPE_BLOB_LOADER "blob-loader"
+#define BLOB_LOADER(obj) OBJECT_CHECK(BlobLoaderState, (obj), TYPE_BLOB_LOADER)
+
+static Property blob_loader_props[] = {
+    DEFINE_PROP_UINT32("addr", BlobLoaderState, addr, 0),
+    DEFINE_PROP_STRING("file", BlobLoaderState, file),
+    DEFINE_PROP_END_OF_LIST(),

hw/misc/blob-loader.c line 28

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+};
+
+static void do_blob_load(BlobLoaderState *s)
+{
+    char *file_name;
+    int file_size;
+
+    if  (s->file == NULL) {
+        error_report("please spicify a file for blob loader\n");
+        return;

Should you exit(1)? Better yet, return true for error and ..

Quoted 13 lines
hw/misc/blob-loader.c new file +12 -0
+    }
+    file_name = qemu_find_file(QEMU_FILE_TYPE_BIOS, s->file);
+    if (file_name == NULL) {
+        error_report("can't find %s\n", s->file);
+        return;
+    }
+    file_size = get_image_size(file_name);
+    if (file_size<  0) {
+        error_report("can't get file size of %s\n", file_name);
+        return;
+    }
+    if (load_image_targphys(file_name, s->addr, file_size)<  0) {

hw/misc/blob-loader.c line 50

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+        error_report("can't load %s\n", file_name);
+        return;
+    }
+}
+
+static int blob_loader_init(DeviceState *dev)
+{
+    BlobLoaderState *s = BLOB_LOADER(dev);
+
+    do_blob_load(s);

exit(1) here.

Quoted 8 lines

hw/misc/blob-loader.c line 54

Quoted 5 lines
hw/misc/blob-loader.c new file +4 -0
+    return 0;
+}
+
+static void blob_loader_class_init(ObjectClass *klass, void *data)

s/klass/oc.

will fix all above,

Quoted 13 lines

hw/misc/blob-loader.c line 60

Quoted 7 lines
hw/misc/blob-loader.c new file +6 -0
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->props = blob_loader_props;
+    dc->desc = "blob loader";
+    dc->init = blob_loader_init;

I'm wondering whether blob loading is actually a reset step not an init. Will doing it at init will play foul with VMSD, as your blob loader will trample non-reset state on machine restore?

why will trample non-reset state on machine restore?

Thanks!

Quoted 22 lines
Quoted 20 lines
hw/misc/blob-loader.c new file +15 -1
+}
+
+static TypeInfo blob_loader_info = {
+    .name                  = TYPE_BLOB_LOADER,
+    .parent                = TYPE_DEVICE,
+    .instance_size         = sizeof(BlobLoaderState),
+    .class_init            = blob_loader_class_init,
+};
+
+static void blob_loader_register_type(void)
+{
+    type_register_static(&blob_loader_info);
+}
+
+type_init(blob_loader_register_type)
--

1.7.2.5

#3 lore raw
In reply to Peter Crosthwaite

Il 02/01/2014 06:50, Peter Crosthwaite ha scritto:

Quoted 114 lines · Li Guang
Quoted 3 lines

this blob loader will be used to load a specified
blob into a specified RAM address.

Quoted 24 lines

---
it can be used now for allwinner-a10, like:
"-device blob-loader,addr=0x43000000,file=/path/script.bin"

reference:
http://linux-sunxi.org/Sunxi-tools

script file address:
http://dl.dbank.com/c00aonvlmw

Thanks to Peter Crosthwaite for the idea!

---
 default-configs/arm-softmmu.mak |    2 +
 hw/misc/Makefile.objs           |    2 +
 hw/misc/blob-loader.c           |   75 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 hw/misc/blob-loader.c
default-configs/arm-softmmu.mak +0 -0
index ce1d620..50c71a6 100644

default-configs/arm-softmmu.mak CONFIG_INTEGRATOR_DEBUG=y · line 91

Quoted 5 lines
default-configs/arm-softmmu.mak +2 -0
@@ -87,3 +87,5 @@ CONFIG_INTEGRATOR_DEBUG=y
 CONFIG_ALLWINNER_A10_PIT=y
 CONFIG_ALLWINNER_A10_PIC=y
 CONFIG_ALLWINNER_A10=y
+
+CONFIG_BLOB_LOADER=y

This shouldn't be arm specific. I would make the argument that the blob loader has global validity.

Quoted 16 lines
hw/misc/Makefile.objs +2 -0
index f674365..df28288 100644
@@ -42,3 +42,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_BLOB_LOADER) += blob-loader.o
hw/misc/blob-loader.c new file +0 -0
new file mode 100644
index 0000000..d7f1408

hw/misc/blob-loader.c line 6

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
@@ -0,0 +1,75 @@
+#include "hw/sysbus.h"
+#include "hw/devices.h"
+#include "hw/loader.h"
+#include "qemu/error-report.h"
+
+typedef struct BlobLoaderState {

/*< private >/*

hw/misc/blob-loader.c line 7

Quoted 1 line
hw/misc/blob-loader.c new file +1 -0
+    DeviceState qdev;

parent_obj;

/*< public >/*

hw/misc/blob-loader.c line 8

Quoted 1 line
hw/misc/blob-loader.c new file +1 -0
+    uint32_t addr;

uint64_t or hwaddr. Blob loading shouldn't be limited to 32 bit.

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+    char *file;
+} BlobLoaderState;
+
+#define TYPE_BLOB_LOADER "blob-loader"
+#define BLOB_LOADER(obj) OBJECT_CHECK(BlobLoaderState, (obj), TYPE_BLOB_LOADER)
+
+static Property blob_loader_props[] = {
+    DEFINE_PROP_UINT32("addr", BlobLoaderState, addr, 0),
+    DEFINE_PROP_STRING("file", BlobLoaderState, file),
+    DEFINE_PROP_END_OF_LIST(),

hw/misc/blob-loader.c line 28

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+};
+
+static void do_blob_load(BlobLoaderState *s)
+{
+    char *file_name;
+    int file_size;
+
+    if  (s->file == NULL) {
+        error_report("please spicify a file for blob loader\n");
+        return;

Should you exit(1)? Better yet, return true for error and ..

Quoted 16 lines
hw/misc/blob-loader.c new file +16 -0
+    }
+    file_name = qemu_find_file(QEMU_FILE_TYPE_BIOS, s->file);
+    if (file_name == NULL) {
+        error_report("can't find %s\n", s->file);
+        return;
+    }
+    file_size = get_image_size(file_name);
+    if (file_size < 0) {
+        error_report("can't get file size of %s\n", file_name);
+        return;
+    }
+    if (load_image_targphys(file_name, s->addr, file_size) < 0) {
+        error_report("can't load %s\n", file_name);
+        return;
+    }
+}
Quoted 8 lines

hw/misc/blob-loader.c line 50

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
+
+static int blob_loader_init(DeviceState *dev)
+{
+    BlobLoaderState *s = BLOB_LOADER(dev);
+
+    do_blob_load(s);

exit(1) here.

No, please use "realize" and avoid init. This way you can use an Error* to report the error.

Also, the actual load_image_targphys call probably should be done in a reset handler, not at realize time.

Paolo

Quoted 6 lines

hw/misc/blob-loader.c line 54

Quoted 4 lines
hw/misc/blob-loader.c new file +4 -0
+    return 0;
+}
+
+static void blob_loader_class_init(ObjectClass *klass, void *data)

s/klass/oc.

Actually klass is quite commonly used.

Paolo

Quoted 35 lines

hw/misc/blob-loader.c line 60

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->props = blob_loader_props;
+    dc->desc = "blob loader";
+    dc->init = blob_loader_init;

I'm wondering whether blob loading is actually a reset step not an init. Will doing it at init will play foul with VMSD, as your blob loader will trample non-reset state on machine restore?

Regards,
Peter

Quoted 19 lines
hw/misc/blob-loader.c new file +15 -1
+}
+
+static TypeInfo blob_loader_info = {
+    .name                  = TYPE_BLOB_LOADER,
+    .parent                = TYPE_DEVICE,
+    .instance_size         = sizeof(BlobLoaderState),
+    .class_init            = blob_loader_class_init,
+};
+
+static void blob_loader_register_type(void)
+{
+    type_register_static(&blob_loader_info);
+}
+
+type_init(blob_loader_register_type)
--

1.7.2.5

#4 lore raw
Quoted 124 lines · Paolo Bonzini

Il 02/01/2014 06:50, Peter Crosthwaite ha scritto:

Quoted 114 lines · Li Guang
Quoted 3 lines

this blob loader will be used to load a specified
blob into a specified RAM address.

Quoted 24 lines

---
it can be used now for allwinner-a10, like:
"-device blob-loader,addr=0x43000000,file=/path/script.bin"

reference:
http://linux-sunxi.org/Sunxi-tools

script file address:
http://dl.dbank.com/c00aonvlmw

Thanks to Peter Crosthwaite for the idea!

---
 default-configs/arm-softmmu.mak |    2 +
 hw/misc/Makefile.objs           |    2 +
 hw/misc/blob-loader.c           |   75 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 0 deletions(-)
 create mode 100644 hw/misc/blob-loader.c
default-configs/arm-softmmu.mak +0 -0
index ce1d620..50c71a6 100644

default-configs/arm-softmmu.mak CONFIG_INTEGRATOR_DEBUG=y · line 91

Quoted 5 lines
default-configs/arm-softmmu.mak +2 -0
@@ -87,3 +87,5 @@ CONFIG_INTEGRATOR_DEBUG=y
 CONFIG_ALLWINNER_A10_PIT=y
 CONFIG_ALLWINNER_A10_PIC=y
 CONFIG_ALLWINNER_A10=y
+
+CONFIG_BLOB_LOADER=y

This shouldn't be arm specific. I would make the argument that the blob loader has global validity.

Quoted 16 lines
hw/misc/Makefile.objs +2 -0
index f674365..df28288 100644
@@ -42,3 +42,5 @@ obj-$(CONFIG_SLAVIO) += slavio_misc.o
 obj-$(CONFIG_ZYNQ) += zynq_slcr.o
 
 obj-$(CONFIG_PVPANIC) += pvpanic.o
+
+obj-$(CONFIG_BLOB_LOADER) += blob-loader.o
hw/misc/blob-loader.c new file +0 -0
new file mode 100644
index 0000000..d7f1408

hw/misc/blob-loader.c line 6

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
@@ -0,0 +1,75 @@
+#include "hw/sysbus.h"
+#include "hw/devices.h"
+#include "hw/loader.h"
+#include "qemu/error-report.h"
+
+typedef struct BlobLoaderState {

/*< private >/*

hw/misc/blob-loader.c line 7

Quoted 1 line
hw/misc/blob-loader.c new file +1 -0
+    DeviceState qdev;

parent_obj;

/*< public >/*

hw/misc/blob-loader.c line 8

Quoted 1 line
hw/misc/blob-loader.c new file +1 -0
+    uint32_t addr;

uint64_t or hwaddr. Blob loading shouldn't be limited to 32 bit.

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+    char *file;
+} BlobLoaderState;
+
+#define TYPE_BLOB_LOADER "blob-loader"
+#define BLOB_LOADER(obj) OBJECT_CHECK(BlobLoaderState, (obj), TYPE_BLOB_LOADER)
+
+static Property blob_loader_props[] = {
+    DEFINE_PROP_UINT32("addr", BlobLoaderState, addr, 0),
+    DEFINE_PROP_STRING("file", BlobLoaderState, file),
+    DEFINE_PROP_END_OF_LIST(),

hw/misc/blob-loader.c line 28

Quoted 10 lines
hw/misc/blob-loader.c new file +10 -0
+};
+
+static void do_blob_load(BlobLoaderState *s)
+{
+    char *file_name;
+    int file_size;
+
+    if  (s->file == NULL) {
+        error_report("please spicify a file for blob loader\n");
+        return;

Should you exit(1)? Better yet, return true for error and ..

Quoted 16 lines
hw/misc/blob-loader.c new file +16 -0
+    }
+    file_name = qemu_find_file(QEMU_FILE_TYPE_BIOS, s->file);
+    if (file_name == NULL) {
+        error_report("can't find %s\n", s->file);
+        return;
+    }
+    file_size = get_image_size(file_name);
+    if (file_size < 0) {
+        error_report("can't get file size of %s\n", file_name);
+        return;
+    }
+    if (load_image_targphys(file_name, s->addr, file_size) < 0) {
+        error_report("can't load %s\n", file_name);
+        return;
+    }
+}
Quoted 8 lines

hw/misc/blob-loader.c line 50

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
+
+static int blob_loader_init(DeviceState *dev)
+{
+    BlobLoaderState *s = BLOB_LOADER(dev);
+
+    do_blob_load(s);

exit(1) here.

Quoted 6 lines

No, please use "realize" and avoid init. This way you can use an Error* to report the error.

Also, the actual load_image_targphys call probably should be done in a reset handler, not at realize time.

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Quoted 11 lines

Paolo

Quoted 6 lines

hw/misc/blob-loader.c line 54

Quoted 4 lines
hw/misc/blob-loader.c new file +4 -0
+    return 0;
+}
+
+static void blob_loader_class_init(ObjectClass *klass, void *data)

s/klass/oc.

Actually klass is quite commonly used.

Yeh, I remember being told off for that one though :)

Regards,
Peter

Quoted 39 lines

Paolo

Quoted 35 lines

hw/misc/blob-loader.c line 60

Quoted 6 lines
hw/misc/blob-loader.c new file +6 -0
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->props = blob_loader_props;
+    dc->desc = "blob loader";
+    dc->init = blob_loader_init;

I'm wondering whether blob loading is actually a reset step not an init. Will doing it at init will play foul with VMSD, as your blob loader will trample non-reset state on machine restore?

Regards,
Peter

Quoted 19 lines
hw/misc/blob-loader.c new file +15 -1
+}
+
+static TypeInfo blob_loader_info = {
+    .name                  = TYPE_BLOB_LOADER,
+    .parent                = TYPE_DEVICE,
+    .instance_size         = sizeof(BlobLoaderState),
+    .class_init            = blob_loader_class_init,
+};
+
+static void blob_loader_register_type(void)
+{
+    type_register_static(&blob_loader_info);
+}
+
+type_init(blob_loader_register_type)
--

1.7.2.5

#5 lore raw

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 11 lines
Quoted 6 lines
Quoted 6 lines

No, please use "realize" and avoid init. This way you can use an Error* to report the error.

Also, the actual load_image_targphys call probably should be done in a reset handler, not at realize time.

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Yeah, also because init is in fact a legacy interface to realize.

Paolo

author
#6 lore raw
Quoted 15 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

No, please use "realize" and avoid init. This way you can use an Error* to report the error.

Also, the actual load_image_targphys call probably should be done in a reset handler, not at realize time.

Quoted 6 lines

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Quoted 5 lines

Yeah, also because init is in fact a legacy interface to realize.

Paolo

Ok, thanks!

author
#7 lore raw
Quoted 13 lines · Li Guang
Quoted 12 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 11 lines
Quoted 6 lines
Quoted 6 lines

No, please use "realize" and avoid init. This way you can use an Error* to report the error.

Also, the actual load_image_targphys call probably should be done in a reset handler, not at realize time.

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Quoted 7 lines
Quoted 4 lines

Yeah, also because init is in fact a legacy interface to realize.

Paolo

Ok, thanks!

Sorry, seems load blob at reset handler can't do the right job, while the same action can play very well at init or realize. any suggestion to figure out this problem?

Thanks!

#8 lore raw
Quoted 21 lines · Li Guang
Quoted 20 lines · Li Guang
Quoted 18 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

No, please use "realize" and avoid init. This way you can use an Error*
to report the error.

Quoted 8 lines
Quoted 3 lines
Quoted 3 lines

Also, the actual load_image_targphys call probably should be done in a reset handler, not at realize time.

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Yeah, also because init is in fact a legacy interface to realize.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Paolo

Ok, thanks!

Sorry, seems load blob at reset handler can't do the right job, while the same action can play very well at init or realize.

What's the exact problem with the reset idea?

Regards,
Peter

Quoted 6 lines

any suggestion to figure out this problem?

Thanks!

author
#9 lore raw
Quoted 27 lines · Peter Crosthwaite
Quoted 25 lines · Li Guang
Quoted 23 lines · Li Guang
Quoted 21 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

No, please use "realize" and avoid init. This way you can use an Error*
to report the error.

Also, the actual load_image_targphys call probably should be done in a reset handler, not at realize time.

Quoted 6 lines

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Yeah, also because init is in fact a legacy interface to realize.

Paolo

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Ok, thanks!

Sorry, seems load blob at reset handler can't do the right job, while the same action can play very well at init or realize.

What's the exact problem with the reset idea?

code snippet:
static void blob_loader_reset(DeviceState *dev)

{
    BlobLoaderState *s = BLOB_LOADER(dev);

    if (load_image_targphys(s->file, s->hwaddr, MAX_BLOB_SIZE) < 0) {
        error_report("can't load %s\n", s->file);
        exit(1);
    }
}

if it is device reset handler, no result,
kernel doesn't find and parse blob,
if it is called at device realize phase,
it works.

Thanks!

Quoted 9 lines
Quoted 7 lines

any suggestion to figure out this problem?

Thanks!

#10 lore raw
Quoted 62 lines · Li Guang
Quoted 41 lines · Peter Crosthwaite
Quoted 38 lines · Li Guang
Quoted 34 lines · Li Guang
Quoted 21 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 11 lines
Quoted 10 lines
Quoted 10 lines

No, please use "realize" and avoid init. This way you can use an Error*
to report the error.

Also, the actual load_image_targphys call probably should be done in a
reset handler, not at realize time.

Quoted 6 lines

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Quoted 5 lines

Yeah, also because init is in fact a legacy interface to realize.

Paolo

Ok, thanks!

Quoted 8 lines
Quoted 3 lines

Sorry, seems load blob at reset handler can't do the right job, while the same action can play very well at init or realize.

What's the exact problem with the reset idea?

code snippet:
static void blob_loader_reset(DeviceState *dev)

{
    BlobLoaderState *s = BLOB_LOADER(dev);

    if (load_image_targphys(s->file, s->hwaddr, MAX_BLOB_SIZE) < 0) {
        error_report("can't load %s\n", s->file);
        exit(1);
    }
}
Quoted 5 lines

if it is device reset handler, no result,
kernel doesn't find and parse blob,
if it is called at device realize phase,
it works.

Need to figure out why I think. There's no fundamental problem here AFAIK. It must be a bug somewhere.

Quoted 4 lines

Thanks!

Quoted 1 line
Quoted 1 line

any suggestion to figure out this problem?

Run QEMU in GDB and break on your new reset function to see if it is ever called. If not have a look into QOM/qdev to see how resets work and how that plays with -device args. If yes, have a look into load_image_targphys and see why that's not working.

Regards,
Peter

Quoted 12 lines
Quoted 9 lines
Quoted 6 lines

Thanks!

author
#11 lore raw
Quoted 78 lines · Peter Crosthwaite
Quoted 62 lines · Li Guang
Quoted 40 lines · Peter Crosthwaite
Quoted 37 lines · Li Guang
Quoted 34 lines · Li Guang
Quoted 20 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

No, please use "realize" and avoid init. This way you can use an Error*
to report the error.

Also, the actual load_image_targphys call probably should be done in a
reset handler, not at realize time.

Quoted 7 lines

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Quoted 6 lines

Yeah, also because init is in fact a legacy interface to realize.

Paolo

Ok, thanks!

Quoted 9 lines
Quoted 4 lines

Sorry, seems load blob at reset handler can't do the right job, while the same action can play very well at init or realize.

What's the exact problem with the reset idea?

code snippet:
static void blob_loader_reset(DeviceState *dev)

{
     BlobLoaderState *s = BLOB_LOADER(dev);

     if (load_image_targphys(s->file, s->hwaddr, MAX_BLOB_SIZE)<  0) {
         error_report("can't load %s\n", s->file);
         exit(1);
     }
}
Quoted 6 lines

if it is device reset handler, no result,
kernel doesn't find and parse blob,
if it is called at device realize phase,
it works.

Need to figure out why I think. There's no fundamental problem here AFAIK. It must be a bug somewhere.

Quoted 4 lines

Thanks!

Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

any suggestion to figure out this problem?

Run QEMU in GDB and break on your new reset function to see if it is ever called. If not have a look into QOM/qdev to see how resets work and how that plays with -device args. If yes, have a look into load_image_targphys and see why that's not working.

reset handler definitely be called, and load_image_targphys has no problem,
I guess it may be impacted by other RAM related codes, just can't figure out it quickly.

Thanks!

Quoted 14 lines
Quoted 12 lines
Quoted 9 lines
Quoted 6 lines

Thanks!

author
#12 lore raw
Quoted 72 lines · Li Guang
Quoted 60 lines · Peter Crosthwaite
Quoted 51 lines · Li Guang
Quoted 28 lines · Peter Crosthwaite
Quoted 26 lines · Li Guang
Quoted 24 lines · Li Guang
Quoted 22 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

No, please use "realize" and avoid init. This way you can use an Error*
to report the error.

Also, the actual load_image_targphys call probably should be done in a
reset handler, not at realize time.

Quoted 6 lines

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible (file-path / address sanitsation etc) at realize time, then only the actual blob load happens at reset. Going on what Paolo said, I think for this device ::init is actually a nop.

Yeah, also because init is in fact a legacy interface to realize.

Paolo

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Ok, thanks!

Sorry, seems load blob at reset handler can't do the right job, while the same action can play very well at init or realize.

What's the exact problem with the reset idea?

code snippet:
static void blob_loader_reset(DeviceState *dev)

{
     BlobLoaderState *s = BLOB_LOADER(dev);

     if (load_image_targphys(s->file, s->hwaddr, MAX_BLOB_SIZE)<  0) {
         error_report("can't load %s\n", s->file);
         exit(1);
     }
}
Quoted 5 lines

if it is device reset handler, no result,
kernel doesn't find and parse blob,
if it is called at device realize phase,
it works.

Need to figure out why I think. There's no fundamental problem here AFAIK. It must be a bug somewhere.

Quoted 10 lines
Quoted 4 lines

Thanks!

Quoted 1 line
Quoted 1 line

any suggestion to figure out this problem?

Run QEMU in GDB and break on your new reset function to see if it is ever called. If not have a look into QOM/qdev to see how resets work and how that plays with -device args. If yes, have a look into load_image_targphys and see why that's not working.

Quoted 5 lines

reset handler definitely be called, and load_image_targphys has no problem,
I guess it may be impacted by other RAM related codes, just can't figure out it quickly.

Ok, I found the problem finally,
load_image_targphys depends on rom_reset to take effect, if it's located at reset handler, rom_reset is called before it, it surely failed to do the right job.

so, I have to write my own code to load blob into RAM.

Thanks!

#13 lore raw
Quoted 89 lines · Li Guang
Quoted 82 lines · Li Guang
Quoted 71 lines · Peter Crosthwaite
Quoted 58 lines · Li Guang
Quoted 34 lines · Peter Crosthwaite
Quoted 30 lines · Li Guang
Quoted 28 lines · Li Guang
Quoted 26 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

No, please use "realize" and avoid init. This way you can use an Error*
to report the error.

Also, the actual load_image_targphys call probably should be done in
a
reset handler, not at realize time.

Quoted 9 lines

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible
(file-path / address sanitsation etc) at realize time, then only the
actual blob load happens at reset. Going on what Paolo said, I think
for this device ::init is actually a nop.

Yeah, also because init is in fact a legacy interface to realize.

Paolo

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

Ok, thanks!

Sorry, seems load blob at reset handler can't do the right job, while the same action can play very well at init or realize.

What's the exact problem with the reset idea?

code snippet:
static void blob_loader_reset(DeviceState *dev)

{
     BlobLoaderState *s = BLOB_LOADER(dev);

     if (load_image_targphys(s->file, s->hwaddr, MAX_BLOB_SIZE)<  0) {
         error_report("can't load %s\n", s->file);
         exit(1);
     }
}
Quoted 5 lines

if it is device reset handler, no result,
kernel doesn't find and parse blob,
if it is called at device realize phase,
it works.

Need to figure out why I think. There's no fundamental problem here AFAIK. It must be a bug somewhere.

Quoted 3 lines

Thanks!

Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line

any suggestion to figure out this problem?

Run QEMU in GDB and break on your new reset function to see if it is ever called. If not have a look into QOM/qdev to see how resets work and how that plays with -device args. If yes, have a look into load_image_targphys and see why that's not working.

Quoted 5 lines

reset handler definitely be called, and load_image_targphys has no problem,
I guess it may be impacted by other RAM related codes, just can't figure out it quickly.

Quoted 7 lines

Ok, I found the problem finally,
load_image_targphys depends on rom_reset to take effect, if it's located at reset handler, rom_reset is called before it, it surely failed to do the right job.

so, I have to write my own code to load blob into RAM.

dma_memory_write() work?

Regards,
Peter

Quoted 3 lines

Thanks!

author
#14 lore raw
Quoted 109 lines · Peter Crosthwaite
Quoted 107 lines · Li Guang
Quoted 94 lines · Li Guang
Quoted 83 lines · Peter Crosthwaite
Quoted 67 lines · Li Guang
Quoted 45 lines · Peter Crosthwaite
Quoted 41 lines · Li Guang
Quoted 38 lines · Li Guang
Quoted 24 lines · Paolo Bonzini

Il 02/01/2014 11:51, Peter Crosthwaite ha scritto:

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

No, please use "realize" and avoid init. This way you can use an Error*
to report the error.

Also, the actual load_image_targphys call probably should be done in
a
reset handler, not at realize time.

Quoted 10 lines

Ok I think that settles it. The actual blobbing needs to happen at reset time. Perhaps the correct approach is to do as much as possible
(file-path / address sanitsation etc) at realize time, then only the
actual blob load happens at reset. Going on what Paolo said, I think
for this device ::init is actually a nop.

Quoted 6 lines

Yeah, also because init is in fact a legacy interface to realize.

Paolo

Ok, thanks!

Quoted 9 lines
Quoted 4 lines

Sorry, seems load blob at reset handler can't do the right job, while the same action can play very well at init or realize.

What's the exact problem with the reset idea?

code snippet:
static void blob_loader_reset(DeviceState *dev)

{
      BlobLoaderState *s = BLOB_LOADER(dev);

      if (load_image_targphys(s->file, s->hwaddr, MAX_BLOB_SIZE)<   0) {
          error_report("can't load %s\n", s->file);
          exit(1);
      }
}
Quoted 6 lines

if it is device reset handler, no result,
kernel doesn't find and parse blob,
if it is called at device realize phase,
it works.

Need to figure out why I think. There's no fundamental problem here AFAIK. It must be a bug somewhere.

Quoted 4 lines

Thanks!

Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

any suggestion to figure out this problem?

Run QEMU in GDB and break on your new reset function to see if it is ever called. If not have a look into QOM/qdev to see how resets work and how that plays with -device args. If yes, have a look into load_image_targphys and see why that's not working.

Quoted 6 lines

reset handler definitely be called, and load_image_targphys has no problem,
I guess it may be impacted by other RAM related codes, just can't figure out it quickly.

Ok, I found the problem finally,
load_image_targphys depends on rom_reset to take effect, if it's located at reset handler, rom_reset is called before it, it surely failed to do the right job.

Quoted 7 lines
Quoted 3 lines

so, I have to write my own code to load blob into RAM.

dma_memory_write() work?

what about cpu_physical_memory_write_rom ?

Quoted 6 lines
Quoted 4 lines

Thanks!

#15 lore raw

Il 06/01/2014 06:36, Li Guang ha scritto:

Quoted 3 lines
Quoted 1 line

dma_memory_write() work?

what about cpu_physical_memory_write_rom ?

Sorry, I missed that load_image_targphys is already doing the right thing on reset.

Paolo

#16 lore raw
In reply to Peter Crosthwaite
Quoted 2 lines · Peter Crosthwaite

I'm wondering whether blob loading is actually a reset step not an init.

load_image_targphys() uses the rom blob loader code from hw/core/loader.c, which already supports reloading the blob on machine reset if necessary.

That raises some more general design questions:
* how is this expected to interact with rom blob loading, -machine firmware=, etc? What are the guidelines for when to use one or the other? Should this be rolled into the rom blob code rather than being a bolt-on extra?
* I'm unconvinced by the general approach of having a device with an address property
* would it be useful if the rom blob loading was extended/reworked so that you could load a rom blob into a MemoryRegion? We want that for the SPARC TCX ROM blobs as well; maybe it would help here too, though I haven't thought much about it.

thanks
-- PMM

#17 lore raw
Quoted 10 lines · Peter Maydell
Quoted 2 lines · Peter Crosthwaite

I'm wondering whether blob loading is actually a reset step not an init.

load_image_targphys() uses the rom blob loader code from hw/core/loader.c, which already supports reloading the blob on machine reset if necessary.

That raises some more general design questions:
* how is this expected to interact with rom blob loading, -machine firmware=, etc?

I guess it's not. The behavior of "-machine firmware=" is machine specific, so a machine specific undefined behavior will occur if you have overlap issues. The two should not in any way inhibit each other. They are independent mechanisms.

Quoted 1 line

What are the guidelines for when to use one or the other?

"-machine firmware=" if you want to load a firmware blob in a board specific way. This if you want to place a blob in memory at an arbitrary location on reset.

Quoted 1 line

Should this be rolled into the rom blob code rather than being a bolt-on extra?

The QOMification is nice. And bolt-on'ness makes it repeatable so you can do whatever and as many blobs as you want.

Quoted 2 lines

* I'm unconvinced by the general approach of having a device with an address property

That is what makes it generically reusable.

Quoted 2 lines

* would it be useful if the rom blob loading was extended/reworked so that you could load a rom blob into a MemoryRegion?

Yes. Edgar's work on per-master AS may be related and applicable.

Regards,
Peter

Quoted 7 lines

We want that for
the SPARC TCX ROM blobs as well; maybe it would help here too, though I haven't thought much about it.

thanks
-- PMM

#18 lore raw
Quoted 10 lines · Peter Crosthwaite
Quoted 3 lines · Peter Maydell

That raises some more general design questions:
* how is this expected to interact with rom blob loading, -machine firmware=, etc?

I guess it's not. The behavior of "-machine firmware=" is machine specific, so a machine specific undefined behavior will occur if you have overlap issues. The two should not in any way inhibit each other. They are independent mechanisms.

Quoted 5 lines
Quoted 1 line

What are the guidelines for when to use one or the other?

"-machine firmware=" if you want to load a firmware blob in a board specific way. This if you want to place a blob in memory at an arbitrary location on reset.

I guess I don't much like the way we're solving a problem by adding yet another mechanism here rather than trying to produce a design for blob loading that works for all the use cases we have.

thanks
-- PMM

#19 lore raw
In reply to Peter Crosthwaite

Il 06/01/2014 08:56, Peter Crosthwaite ha scritto:

Quoted 5 lines
Quoted 1 line

What are the guidelines for when to use one or the other?

"-machine firmware=" if you want to load a firmware blob in a board specific way. This if you want to place a blob in memory at an arbitrary location on reset.

"-machine firmware=" is also a pretty bad design because it's not extensible and doesn't apply to most boards. We really should get per-board -machine options, so that you can have a less generic name than "firmware".

Paolo

#20 lore raw
Quoted 12 lines · Paolo Bonzini

Il 06/01/2014 08:56, Peter Crosthwaite ha scritto:

Quoted 5 lines
Quoted 1 line

What are the guidelines for when to use one or the other?

"-machine firmware=" if you want to load a firmware blob in a board specific way. This if you want to place a blob in memory at an arbitrary location on reset.

"-machine firmware=" is also a pretty bad design because it's not extensible and doesn't apply to most boards. We really should get per-board -machine options, so that you can have a less generic name than "firmware".

Then we have even more divergence in boot flow between boards. It's already a bit of a Zoo out there when it comes to bootloaders.

We expressed dislike for the Allwinner/FEX board specific bootloader due it its mainline Linux non-acceptance. This generic solution facilitates this case among many others and the reason its able to achieve that goal is it has no reliance on software policy. OTOH if we need to do everything board specific then we need to start deciding software policy for each and every board. For allwinner, FEX was a nack, which pretty much hangs out users of that linux kernel to dry.

Looking at QEMU ARM, we are in a position now where you can only boot systems two ways:

1: Exactly as real HW (have to use your boards bootrom, BIOS, storage media etc).
2. ARM Linux exactly to the letter of the mainline boot process.

With generic tools like this device, you at least let the users do a few flexible things for boots that do not fit these two limited use cases. And the device is completely unobtrusive on existing code. If developers in the future come along with their weird and wonderful board specific bootflows that we don't like we can now tell them to use the generic blob loader for their bits and pieces and everybody wins.

If anything, the boards implementing -machine firware="" should implement it by layer ontop of this device.

Regards,
Peter

Quoted 2 lines

Paolo

author
#21 lore raw
Quoted 42 lines · Peter Crosthwaite
Quoted 4 lines · Paolo Bonzini

Il 06/01/2014 08:56, Peter Crosthwaite ha scritto:

Quoted 2 lines
Quoted 2 lines

What are the guidelines for when to use one or the other?

Quoted 10 lines
Quoted 4 lines

"-machine firmware=" if you want to load a firmware blob in a board specific way. This if you want to place a blob in memory at an arbitrary location on reset.

"-machine firmware=" is also a pretty bad design because it's not extensible and doesn't apply to most boards. We really should get per-board -machine options, so that you can have a less generic name than "firmware".

Then we have even more divergence in boot flow between boards. It's already a bit of a Zoo out there when it comes to bootloaders.

We expressed dislike for the Allwinner/FEX board specific bootloader due it its mainline Linux non-acceptance. This generic solution facilitates this case among many others and the reason its able to achieve that goal is it has no reliance on software policy. OTOH if we need to do everything board specific then we need to start deciding software policy for each and every board. For allwinner, FEX was a nack, which pretty much hangs out users of that linux kernel to dry.

Looking at QEMU ARM, we are in a position now where you can only boot systems two ways:

1: Exactly as real HW (have to use your boards bootrom, BIOS, storage media etc).
2. ARM Linux exactly to the letter of the mainline boot process.

With generic tools like this device, you at least let the users do a few flexible things for boots that do not fit these two limited use cases. And the device is completely unobtrusive on existing code. If developers in the future come along with their weird and wonderful board specific bootflows that we don't like we can now tell them to use the generic blob loader for their bits and pieces and everybody wins.

Quoted 5 lines

If anything, the boards implementing -machine firware="" should implement it by layer ontop of this device.

agree,

further more, "-machine firmware=" is really not generic, we may have to deprecate it.
because if use it, every boards should do specific things for it.

Thanks!

Quoted 6 lines
Quoted 4 lines

Paolo