Skip to contentSkip to conversation

spapr: tie spapr-nvram to -pflash

PATCH In review Paolo Bonzini 2 participants 5 messages Nov 22, 2013 – Dec 10, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spapr: tie spapr-nvram to -pflash

spapr-nvram's drive property is currently connected to a non-existent "-machine nvram=<drivename>" option. Instead, tie it to -pflash like other non-volatile RAM devices. This provides the following possibilities for adding a backend for the sPAPR non-volatile RAM:

* -pflash filename

* -drive if=pflash,file=filename,format=raw,...

* -drive if=none,file=filename,format=raw,id=foo,... -global spapr-nvram.drive=foo

---
 hw/ppc/spapr.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
hw/ppc/spapr.c +3 -11
index 7e53a5f..38b43c9 100644
@@ -739,18 +739,10 @@ static void spapr_cpu_reset(void *opaque)
 static void spapr_create_nvram(sPAPREnvironment *spapr)
 {
     DeviceState *dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
-    const char *drivename = qemu_opt_get(qemu_get_machine_opts(), "nvram");
+    DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
 
-    if (drivename) {
-        BlockDriverState *bs;
-
-        bs = bdrv_find(drivename);
-        if (!bs) {
-            fprintf(stderr, "No such block device \"%s\" for nvram\n",
-                    drivename);
-            exit(1);
-        }
-        qdev_prop_set_drive_nofail(dev, "drive", bs);
+    if (dinfo) {
+        qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv);
     }
 
     qdev_init_nofail(dev);
Signature · 1 line
1.8.4.2
#1 lore raw

Il 22/11/2013 10:27, Paolo Bonzini ha scritto:

Quoted 33 lines

spapr-nvram's drive property is currently connected to a non-existent "-machine nvram=<drivename>" option. Instead, tie it to -pflash like other non-volatile RAM devices. This provides the following possibilities for adding a backend for the sPAPR non-volatile RAM:

* -pflash filename

* -drive if=pflash,file=filename,format=raw,...

* -drive if=none,file=filename,format=raw,id=foo,... -global spapr-nvram.drive=foo

---
 hw/ppc/spapr.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
hw/ppc/spapr.c +1 -6
index 7e53a5f..38b43c9 100644
@@ -739,18 +739,10 @@ static void spapr_cpu_reset(void *opaque)
 static void spapr_create_nvram(sPAPREnvironment *spapr)
 {
     DeviceState *dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
-    const char *drivename = qemu_opt_get(qemu_get_machine_opts(), "nvram");
+    DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
 
-    if (drivename) {
-        BlockDriverState *bs;
-
-        bs = bdrv_find(drivename);
-        if (!bs) {

hw/ppc/spapr.c static void spapr_cpu_reset(void *opaque) · line 748

Quoted 10 lines
hw/ppc/spapr.c +2 -5
-            fprintf(stderr, "No such block device \"%s\" for nvram\n",
-                    drivename);
-            exit(1);
-        }
-        qdev_prop_set_drive_nofail(dev, "drive", bs);
+    if (dinfo) {
+        qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv);
     }
 
     qdev_init_nofail(dev);

Ping?

Paolo

#2 lore raw
In reply to Paolo Bonzini
Quoted 9 lines

Am 22.11.2013 um 10:27 schrieb Paolo Bonzini <[email protected]>:

spapr-nvram's drive property is currently connected to a non-existent "-machine nvram=<drivename>" option. Instead, tie it to -pflash like other non-volatile RAM devices. This provides the following possibilities for adding a backend for the sPAPR non-volatile RAM:

Quoted 7 lines

* -pflash filename

* -drive if=pflash,file=filename,format=raw,...

* -drive if=none,file=filename,format=raw,id=foo,... -global spapr-nvram.drive=foo

Makes sense, but why for 1.7?

Alex

Quoted 33 lines

---
hw/ppc/spapr.c | 14 +++-----------

1 file changed, 3 insertions(+), 11 deletions(-)
hw/ppc/spapr.c +3 -11
index 7e53a5f..38b43c9 100644
@@ -739,18 +739,10 @@ static void spapr_cpu_reset(void *opaque)
 static void spapr_create_nvram(sPAPREnvironment *spapr)
 {
    DeviceState *dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
-    const char *drivename = qemu_opt_get(qemu_get_machine_opts(), "nvram");
+    DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
 
-    if (drivename) {
-        BlockDriverState *bs;
-
-        bs = bdrv_find(drivename);
-        if (!bs) {
-            fprintf(stderr, "No such block device \"%s\" for nvram\n",
-                    drivename);
-            exit(1);
-        }
-        qdev_prop_set_drive_nofail(dev, "drive", bs);
+    if (dinfo) {
+        qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv);
    }
 
    qdev_init_nofail(dev);
Signature · 1 line
1.8.4.2
#3 lore raw

Il 09/12/2013 20:25, Alexander Graf ha scritto:

Quoted 11 lines
Quoted 11 lines

Am 22.11.2013 um 10:27 schrieb Paolo Bonzini <[email protected]>:

spapr-nvram's drive property is currently connected to a non-existent "-machine nvram=<drivename>" option. Instead, tie it to -pflash like other non-volatile RAM devices. This provides the following possibilities for adding a backend for the sPAPR non-volatile RAM:

* -pflash filename

Quoted 7 lines
Quoted 5 lines

* -drive if=pflash,file=filename,format=raw,...

* -drive if=none,file=filename,format=raw,id=foo,... -global spapr-nvram.drive=foo

Makes sense, but why for 1.7?

At this point it is not for 1.7 of course. :)

Paolo

#4 lore raw
Quoted 14 lines · Paolo Bonzini

Il 09/12/2013 20:25, Alexander Graf ha scritto:

Quoted 13 lines
Quoted 13 lines

Am 22.11.2013 um 10:27 schrieb Paolo Bonzini <[email protected]>:

spapr-nvram's drive property is currently connected to a non-existent "-machine nvram=<drivename>" option. Instead, tie it to -pflash like other non-volatile RAM devices. This provides the following possibilities for adding a backend for the sPAPR non-volatile RAM:

* -pflash filename

* -drive if=pflash,file=filename,format=raw,...

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

* -drive if=none,file=filename,format=raw,id=foo,... -global spapr-nvram.drive=foo

Makes sense, but why for 1.7?

At this point it is not for 1.7 of course. :)

Heh alrighty then :). Thanks, applied to ppc-next.

Alex