Skip to content

Commit 3978b86

Browse files
bonziniagraf
authored andcommitted
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 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Alexander Graf <agraf@suse.de>
1 parent 8a0e110 commit 3978b86

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

hw/ppc/spapr.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -739,18 +739,10 @@ static void spapr_cpu_reset(void *opaque)
739739
static void spapr_create_nvram(sPAPREnvironment *spapr)
740740
{
741741
DeviceState *dev = qdev_create(&spapr->vio_bus->bus, "spapr-nvram");
742-
const char *drivename = qemu_opt_get(qemu_get_machine_opts(), "nvram");
742+
DriveInfo *dinfo = drive_get(IF_PFLASH, 0, 0);
743743

744-
if (drivename) {
745-
BlockDriverState *bs;
746-
747-
bs = bdrv_find(drivename);
748-
if (!bs) {
749-
fprintf(stderr, "No such block device \"%s\" for nvram\n",
750-
drivename);
751-
exit(1);
752-
}
753-
qdev_prop_set_drive_nofail(dev, "drive", bs);
744+
if (dinfo) {
745+
qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv);
754746
}
755747

756748
qdev_init_nofail(dev);

0 commit comments

Comments
 (0)