Re: [Qemu-devel] [PATCHv8 12/16] Add bootindex parameter to net/block/fd device
Gleb Natapov g...@redhat.com writes: If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov g...@redhat.com Just noticed something that slipped through review: [...] diff --git a/vl.c b/vl.c index 2cd263e..dadc161 100644 --- a/vl.c +++ b/vl.c [...] @@ -693,6 +704,35 @@ static void restore_boot_devices(void *opaque) qemu_free(standard_boot_devices); } +void add_boot_device_path(int32_t bootindex, DeviceState *dev, + const char *suffix) +{ +FWBootEntry *node, *i; + +if (bootindex 0) { +return; +} + +assert(dev != NULL || suffix != NULL); + +node = qemu_mallocz(sizeof(FWBootEntry)); +node-bootindex = bootindex; +node-suffix = strdup(suffix); qemu_strdup()? +node-dev = dev; + +QTAILQ_FOREACH(i, fw_boot_order, link) { +if (i-bootindex == bootindex) { +fprintf(stderr, Two devices with same boot index %d\n, bootindex); +exit(1); +} else if (i-bootindex bootindex) { +continue; +} +QTAILQ_INSERT_BEFORE(i, node, link); +return; +} +QTAILQ_INSERT_TAIL(fw_boot_order, node, link); +} + static void numa_add(const char *optarg) { char option[128];
Re: [Qemu-devel] [PATCHv8 12/16] Add bootindex parameter to net/block/fd device
On Wed, Feb 02, 2011 at 05:10:04PM +0200, Gleb Natapov wrote: On Wed, Feb 02, 2011 at 04:08:07PM +0100, Markus Armbruster wrote: Gleb Natapov g...@redhat.com writes: If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov g...@redhat.com Just noticed something that slipped through review: [...] diff --git a/vl.c b/vl.c index 2cd263e..dadc161 100644 --- a/vl.c +++ b/vl.c [...] @@ -693,6 +704,35 @@ static void restore_boot_devices(void *opaque) qemu_free(standard_boot_devices); } +void add_boot_device_path(int32_t bootindex, DeviceState *dev, + const char *suffix) +{ +FWBootEntry *node, *i; + +if (bootindex 0) { +return; +} + +assert(dev != NULL || suffix != NULL); + +node = qemu_mallocz(sizeof(FWBootEntry)); +node-bootindex = bootindex; +node-suffix = strdup(suffix); qemu_strdup()? Yap. Will fix. BTW we have 40 uses of strdup and 75 uses of qemu_strdup. +node-dev = dev; + +QTAILQ_FOREACH(i, fw_boot_order, link) { +if (i-bootindex == bootindex) { +fprintf(stderr, Two devices with same boot index %d\n, bootindex); +exit(1); +} else if (i-bootindex bootindex) { +continue; +} +QTAILQ_INSERT_BEFORE(i, node, link); +return; +} +QTAILQ_INSERT_TAIL(fw_boot_order, node, link); +} + static void numa_add(const char *optarg) { char option[128]; -- Gleb. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- Gleb.
Re: [Qemu-devel] [PATCHv8 12/16] Add bootindex parameter to net/block/fd device
On Wed, Feb 02, 2011 at 04:08:07PM +0100, Markus Armbruster wrote: Gleb Natapov g...@redhat.com writes: If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov g...@redhat.com Just noticed something that slipped through review: [...] diff --git a/vl.c b/vl.c index 2cd263e..dadc161 100644 --- a/vl.c +++ b/vl.c [...] @@ -693,6 +704,35 @@ static void restore_boot_devices(void *opaque) qemu_free(standard_boot_devices); } +void add_boot_device_path(int32_t bootindex, DeviceState *dev, + const char *suffix) +{ +FWBootEntry *node, *i; + +if (bootindex 0) { +return; +} + +assert(dev != NULL || suffix != NULL); + +node = qemu_mallocz(sizeof(FWBootEntry)); +node-bootindex = bootindex; +node-suffix = strdup(suffix); qemu_strdup()? Yap. Will fix. +node-dev = dev; + +QTAILQ_FOREACH(i, fw_boot_order, link) { +if (i-bootindex == bootindex) { +fprintf(stderr, Two devices with same boot index %d\n, bootindex); +exit(1); +} else if (i-bootindex bootindex) { +continue; +} +QTAILQ_INSERT_BEFORE(i, node, link); +return; +} +QTAILQ_INSERT_TAIL(fw_boot_order, node, link); +} + static void numa_add(const char *optarg) { char option[128]; -- Gleb.
Re: [Qemu-devel] [PATCHv8 12/16] Add bootindex parameter to net/block/fd device
Gleb Natapov g...@redhat.com writes: If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov g...@redhat.com Out of curiosity: what about qdev scsi-generic? Can't we boot from that?
Re: [Qemu-devel] [PATCHv8 12/16] Add bootindex parameter to net/block/fd device
On Fri, Jan 28, 2011 at 02:29:50PM +0100, Markus Armbruster wrote: Gleb Natapov g...@redhat.com writes: If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov g...@redhat.com Out of curiosity: what about qdev scsi-generic? Can't we boot from that? What device exactly scsi-generic supports? scsi-disk has call to add_boot_device_path() though we cannot boot from it without extboot now. -- Gleb.
Re: [Qemu-devel] [PATCHv8 12/16] Add bootindex parameter to net/block/fd device
Gleb Natapov g...@redhat.com writes: On Fri, Jan 28, 2011 at 02:29:50PM +0100, Markus Armbruster wrote: Gleb Natapov g...@redhat.com writes: If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov g...@redhat.com Out of curiosity: what about qdev scsi-generic? Can't we boot from that? What device exactly scsi-generic supports? scsi-disk has call to add_boot_device_path() though we cannot boot from it without extboot now. It's host SCSI generic device (/dev/sg*) pass through. So it's whatever real device is passed through.
[Qemu-devel] [PATCHv8 12/16] Add bootindex parameter to net/block/fd device
If bootindex is specified on command line a string that describes device in firmware readable way is added into sorted list. Later this list will be passed into firmware to control boot order. Signed-off-by: Gleb Natapov g...@redhat.com --- block_int.h |4 +++- hw/e1000.c |4 hw/eepro100.c |3 +++ hw/fdc.c|8 hw/ide/qdev.c |5 + hw/ne2000.c |3 +++ hw/pcnet.c |4 hw/qdev.c | 32 hw/qdev.h |1 + hw/rtl8139.c|4 hw/scsi-disk.c |1 + hw/usb-net.c|2 ++ hw/virtio-blk.c |2 ++ hw/virtio-net.c |2 ++ net.h |4 +++- sysemu.h|2 ++ vl.c| 40 17 files changed, 119 insertions(+), 2 deletions(-) diff --git a/block_int.h b/block_int.h index 3c3adb5..0a0e47d 100644 --- a/block_int.h +++ b/block_int.h @@ -227,6 +227,7 @@ typedef struct BlockConf { uint16_t logical_block_size; uint16_t min_io_size; uint32_t opt_io_size; +int32_t bootindex; } BlockConf; static inline unsigned int get_physical_block_exp(BlockConf *conf) @@ -249,6 +250,7 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) DEFINE_PROP_UINT16(physical_block_size, _state, \ _conf.physical_block_size, 512), \ DEFINE_PROP_UINT16(min_io_size, _state, _conf.min_io_size, 0), \ -DEFINE_PROP_UINT32(opt_io_size, _state, _conf.opt_io_size, 0) +DEFINE_PROP_UINT32(opt_io_size, _state, _conf.opt_io_size, 0),\ +DEFINE_PROP_INT32(bootindex, _state, _conf.bootindex, -1) \ #endif /* BLOCK_INT_H */ diff --git a/hw/e1000.c b/hw/e1000.c index 57d08cf..e411b03 100644 --- a/hw/e1000.c +++ b/hw/e1000.c @@ -30,6 +30,7 @@ #include net.h #include net/checksum.h #include loader.h +#include sysemu.h #include e1000_hw.h @@ -1154,6 +1155,9 @@ static int pci_e1000_init(PCIDevice *pci_dev) d-dev.qdev.info-name, d-dev.qdev.id, d); qemu_format_nic_info_str(d-nic-nc, macaddr); + +add_boot_device_path(d-conf.bootindex, pci_dev-qdev, /ethernet-...@0); + return 0; } diff --git a/hw/eepro100.c b/hw/eepro100.c index f8a700a..a464e9b 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -46,6 +46,7 @@ #include pci.h #include net.h #include eeprom93xx.h +#include sysemu.h #define KiB 1024 @@ -1907,6 +1908,8 @@ static int e100_nic_init(PCIDevice *pci_dev) s-vmstate-name = s-nic-nc.model; vmstate_register(pci_dev-qdev, -1, s-vmstate, s); +add_boot_device_path(s-conf.bootindex, pci_dev-qdev, /ethernet-...@0); + return 0; } diff --git a/hw/fdc.c b/hw/fdc.c index 22fb64a..a7c7c17 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -35,6 +35,7 @@ #include sysbus.h #include qdev-addr.h #include blockdev.h +#include sysemu.h // /* debug Floppy devices */ @@ -523,6 +524,8 @@ typedef struct FDCtrlSysBus { typedef struct FDCtrlISABus { ISADevice busdev; struct FDCtrl state; +int32_t bootindexA; +int32_t bootindexB; } FDCtrlISABus; static uint32_t fdctrl_read (void *opaque, uint32_t reg) @@ -1992,6 +1995,9 @@ static int isabus_fdc_init1(ISADevice *dev) qdev_set_legacy_instance_id(dev-qdev, iobase, 2); ret = fdctrl_init_common(fdctrl); +add_boot_device_path(isa-bootindexA, dev-qdev, /flo...@0); +add_boot_device_path(isa-bootindexB, dev-qdev, /flo...@1); + return ret; } @@ -2051,6 +2057,8 @@ static ISADeviceInfo isa_fdc_info = { .qdev.props = (Property[]) { DEFINE_PROP_DRIVE(driveA, FDCtrlISABus, state.drives[0].bs), DEFINE_PROP_DRIVE(driveB, FDCtrlISABus, state.drives[1].bs), +DEFINE_PROP_INT32(bootindexA, FDCtrlISABus, bootindexA, -1), +DEFINE_PROP_INT32(bootindexB, FDCtrlISABus, bootindexB, -1), DEFINE_PROP_END_OF_LIST(), }, }; diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 01a181b..2bb5c27 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -21,6 +21,7 @@ #include qemu-error.h #include hw/ide/internal.h #include blockdev.h +#include sysemu.h /* - */ @@ -143,6 +144,10 @@ static int ide_drive_initfn(IDEDevice *dev) if (!dev-serial) { dev-serial = qemu_strdup(s-drive_serial_str); } + +add_boot_device_path(dev-conf.bootindex, dev-qdev, + dev-unit ? /d...@1 : /d...@0); + return 0; } diff --git a/hw/ne2000.c b/hw/ne2000.c index 126e7cf..a030106 100644 --- a/hw/ne2000.c +++ b/hw/ne2000.c @@ -26,6 +26,7 @@ #include net.h #include ne2000.h #include loader.h +#include sysemu.h /* debug NE2000 card */ //#define DEBUG_NE2000 @@ -746,6 +747,8 @@ static int pci_ne2000_init(PCIDevice *pci_dev) } } +add_boot_device_path(s-c.bootindex, pci_dev-qdev, /ethernet-...@0); + return 0; }