qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting
@ 2014-10-07  8:00 arei.gonglei
  2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 01/34] bootdevice: move bootdevice related code to new file bootdevice.c arei.gonglei
                   ` (34 more replies)
  0 siblings, 35 replies; 46+ messages in thread
From: arei.gonglei @ 2014-10-07  8:00 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, weidong.huang, mst, aik, armbru, kraxel, dmitry,
	akong, agraf, Gonglei, lersek, ehabkost, marcel.a, somlo,
	luonengjun, peter.huangpeng, alex.williamson, stefanha, pbonzini,
	lcapitulino, rth, kwolf, peter.crosthwaite, chenliang88, imammedo,
	afaerber

From: Gonglei <arei.gonglei@huawei.com>

Changes since v10:
 1. add handler for virtio-blk-pci/s390/ccw in PATCH 28.
 2. add especial bootidnex setter/getter functions for usb-storage
    device in PATCH 29.
 3. add bootindex qom property for nvma and ne2k_isa devices,
    avoid regrassion in PATCH 30.
 4. change fprintf to error_report in bootdevice.c in PATCH 34.
 5. rebase on the latest qemu master tree.
 6. add 'Reviewed-by' in other patches. (Thanks, Gerd)

Changes since v9:
 - rework del_boot_device_path() for code sharing more better.(Gerd)
   Now, it has only one delete funciton, which work for update fw_cfg list
   both setting bootindex and hot-unplugging devices.

Changes since v8:
 - fix wrong rebase on PATCH 14/30 and 15/30.

Changes since v7:
 - IDE unit's value is set too later, so change IDE to not use
   device_add_bootindex_property(). IDE has its own getter/setter and a call
   to add_boot_device_path() on realize(). PATCH 25/30, 28/30 (Eduardo)
 - rewrite PATCH 5/30 using g_strcmp0. (Eduardo)
 - set 'ide_device_type_info.instance_init = ide_dev_instance_init'
   for all ide devices. PATCH 25/30 (Eduardo)
 - set 'scsi_device_type_info.instance_init = scsi_dev_instance_init'
   for all scsi devices. PATCH 24/30
 - initialize bootindex property to -1 in device_add_bootindex_property,
   so there is no need to duplicate the call to init bootindex with -1
   in all devices. (Gerd)

 Thanks for review!

Changes since v6:
 - move all bootindex/boot-device code to a new file, named bootdevice.c.
 - introduce a getter/setter wrapper for all device.
 - call add_boot_device_path in setter bootindx callback function.
 - call del_boot_device_path in finalize bootindex qom callback function.
 - other bugfixes.

 Thanks for Eduardo's good suggestion! And other guys, thanks too!

Changes since v5:
 rework by Gerd and Markus's suggestion(Thanks a lot):
 - Set/update bootindex on reset instead of realize/init.
 - Switch the property from qdev to qom, then use the set
   callback to also update the fw_cfg file.
 - using qom-set instead of 'set-bootindex' qmp interface,
   remove it.

 This is a huge change relative to the previous version. 

Changes since v4:
 - using error_setg() instead of qerror_report() in patch 1/8.
 - call del_boot_device_path() from device_finalize() instead
  of placing it into each individual device in patch 4/8.

Changes since v3:
 - rework del_* and modify_* function, because of virtio devices' specialation.
   For example, virtio-net's id is NULL, and its parent virtio-net-pci's id was assigned.
   Though the global fw_boot_order stored the virtio-net device.
 - call dell_boot_device_path in each individual device avoiding waste resouce.
 - introduce qmp "query-bootindex" command
 - introcude hmp "info bootindex" command
 - Fixes by Eric's reviewing comments, thanks.

Changes since v2:
 *address Gerd's reviewing suggestion:
 - use the old entry's suffix, if the caller do not pass it in.
 - call del_boot_device_path() from device_finalize() instead
   of placing it into each individual device.

Changes since v1:
 *rework by Gerd's suggestion:
 - split modify and del fw_boot_order for single function.
 - change modify bootindex's realization which simply lookup
   the device and modify the bootindex. if the new bootindex
   has already used by another device just throw an error.
 - change to del_boot_device_path(DeviceState *dev) and simply delete all
   entries belonging to the device.

Sometimes, we want to modify boot order of a guest, but no need to
shutdown it. We can call dynamic changing bootindex of a guest, which
can be assured taking effect just after the guest rebooting.

For example, in P2V scene, we boot a guest and then attach a
new system disk, for copying some thing. We want to assign the
new disk as the booting disk, which means its bootindex=1.

Different nics can be assigen different bootindex dynamically
also make sense.

This patch series do belows works:
 1. add an fw_cfg_machine_reset() assure re-read global fw_boot_order list
   during vm rebooting.
 2. switch the property from qdev to qom, then use the set
    callback to also update the fw_cfg file.

 Note:
 - Do not support change pci option rom's bootindex.

For Convenience of testing, my test case based on Andreas's patch series:
 [PATCH qom-next 0/4] qom: HMP commands to replace info qtree
 http://thread.gmane.org/gmane.comp.emulators.qemu/271513
However, there is no direct relation with this bootindex patch series.

$./qemu-system-x86_64 -enable-kvm -m 4096 -smp 4 -name redhat6.2 -drive \
file=/home/win7_32_2U,if=none,id=drive-ide0-0-0 -device ide-hd,bus=ide.0,\
unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive \
file=/home/rhel-server-7.0-x86_64-dvd.iso,if=none,id=drive-ide0-0-1 \
-device ide-cd,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1,bootindex=4 \
-vnc 0.0.0.0:10 -netdev type=user,id=net0 -device virtio-net-pci,netdev=net0,bootindex=3,id=nic1 \
-drive file=/mnt/sdb/gonglei/image/virtio-win-1.5.3.vfd,if=none,id=drive-fdc0-0-0,format=raw \
-device isa-fdc,driveA=drive-fdc0-0-0,bootindexA=5,id=floppy1 -qmp unix:/tmp/qmp,server,nowait \
-monitor stdio -netdev type=user,id=net1 -device e1000,netdev=net1,bootindex=2,id=nic \
-boot menu=on -device virtio-scsi-pci,id=scsi0 -drive file=/home/suse11_sp3_32,if=none,\
id=drive-scsi0-0-0-0,format=raw,cache=none,aio=native \
-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=8
QEMU 2.1.50 monitor - type 'help' for more information
(qemu) qom-get nic1 bootindex
3 (0x3)
(qemu) qom-set nic1 bootindex 3
The bootindex 3 has already been used
(qemu) qom-set nic1 bootindex 0
(qemu) qom-set floppy1 bootindexA 3
(qemu) system_reset
(qemu) qom-get nic1 bootindex
0 (0x0)
(qemu) qom-get scsi0-0-0-0 bootindex
8 (0x8)
(qemu) qom-set scsi0-0-0-0 bootindex 0
The bootindex 0 has already been used
(qemu) qom-set nic1 bootindex -1
(qemu) qom-set scsi0-0-0-0 bootindex 0
(qemu) qom-get scsi0-0-0-0 bootindex
0 (0x0)
(qemu)


Gonglei (34):
  bootdevice: move bootdevice related code to new file bootdevice.c
  bootindex: add check bootindex function
  bootindex: add del_boot_device_path function
  fw_cfg: add fw_cfg_machine_reset function
  bootindex: rework add_boot_device_path function
  bootindex: support to set a existent device's bootindex to -1
  bootindex: add a setter/getter functions wrapper for bootindex
    property
  virtio-net: add bootindex to qom property
  e1000: add bootindex to qom property
  eepro100: add bootindex to qom property
  ne2000: add bootindex to qom property
  pcnet: add bootindex to qom property
  rtl8139: add bootindex to qom property
  spapr_lian: add bootindex to qom property
  vmxnet3: add bootindex to qom property
  usb-net: add bootindex to qom property
  net: remove bootindex property from qdev to qom
  virtio-net: alias bootindex property explicitly for
    virt-net-pci/ccw/s390
  host-libusb: remove bootindex property from qdev to qom
  pci-assign: remove bootindex property from qdev to qom
  vfio: remove bootindex property from qdev to qom
  redirect: remove bootindex property from qdev to qom
  isa-fdc: remove bootindexA/B property from qdev to qom
  scsi: add bootindex to qom property
  ide: add bootindex to qom property
  virtio-blk: add bootindex to qom property
  block: remove bootindex property from qdev to qom
  virtio-blk: alias bootindex property explicitly for
    virt-blk-pci/ccw/s390
  usb-storage: add bootindex to qom property
  nvma: ide: add bootindex to qom property
  ide: add calling add_boot_device_patch in bootindex setter function
  bootindex: move calling add_boot_device_patch to bootindex setter
    function
  bootindex: delete bootindex when device is removed
  bootindex: change fprintf to error_report

 Makefile.target            |   2 +-
 bootdevice.c               | 258 +++++++++++++++++++++++++++++++++++++++++++++
 hw/block/fdc.c             |  18 +++-
 hw/block/nvme.c            |  44 ++++++++
 hw/block/virtio-blk.c      |   5 +-
 hw/i386/kvm/pci-assign.c   |  14 ++-
 hw/ide/qdev.c              |  47 +++++++++
 hw/misc/vfio.c             |  13 ++-
 hw/net/e1000.c             |  12 ++-
 hw/net/eepro100.c          |  13 ++-
 hw/net/lance.c             |  12 +++
 hw/net/ne2000-isa.c        |  44 ++++++++
 hw/net/ne2000.c            |  14 ++-
 hw/net/pcnet-pci.c         |  12 +++
 hw/net/pcnet.c             |   2 -
 hw/net/pcnet.h             |   1 -
 hw/net/rtl8139.c           |  12 ++-
 hw/net/spapr_llan.c        |  12 ++-
 hw/net/virtio-net.c        |   5 +-
 hw/net/vmxnet3.c           |  10 +-
 hw/nvram/fw_cfg.c          |  55 +++++++++-
 hw/s390x/s390-virtio-bus.c |   4 +
 hw/s390x/virtio-ccw.c      |   4 +
 hw/scsi/scsi-bus.c         |  14 ++-
 hw/scsi/scsi-disk.c        |   2 -
 hw/scsi/scsi-generic.c     |   4 -
 hw/usb/dev-network.c       |  11 +-
 hw/usb/dev-storage.c       |  52 +++++++++
 hw/usb/host-libusb.c       |  13 ++-
 hw/usb/redirect.c          |  13 ++-
 hw/virtio/virtio-pci.c     |   4 +
 include/hw/block/block.h   |   1 -
 include/hw/nvram/fw_cfg.h  |   2 +
 include/net/net.h          |   3 +-
 include/sysemu/sysemu.h    |   6 ++
 vl.c                       | 118 +--------------------
 36 files changed, 690 insertions(+), 166 deletions(-)
 create mode 100644 bootdevice.c

-- 
1.7.12.4

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2014-10-09 12:05 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-07  8:00 [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 01/34] bootdevice: move bootdevice related code to new file bootdevice.c arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 02/34] bootindex: add check bootindex function arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 03/34] bootindex: add del_boot_device_path function arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 04/34] fw_cfg: add fw_cfg_machine_reset function arei.gonglei
2014-10-09 11:12   ` Paolo Bonzini
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 05/34] bootindex: rework add_boot_device_path function arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 06/34] bootindex: support to set a existent device's bootindex to -1 arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 07/34] bootindex: add a setter/getter functions wrapper for bootindex property arei.gonglei
2014-10-09 11:14   ` Paolo Bonzini
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 08/34] virtio-net: add bootindex to qom property arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 09/34] e1000: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 10/34] eepro100: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 11/34] ne2000: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 12/34] pcnet: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 13/34] rtl8139: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 14/34] spapr_lian: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 15/34] vmxnet3: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 16/34] usb-net: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 17/34] net: remove bootindex property from qdev to qom arei.gonglei
2014-10-09 11:15   ` Paolo Bonzini
2014-10-09 11:56     ` Gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 18/34] virtio-net: alias bootindex property explicitly for virt-net-pci/ccw/s390 arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 19/34] host-libusb: remove bootindex property from qdev to qom arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 20/34] pci-assign: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 21/34] vfio: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 22/34] redirect: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 23/34] isa-fdc: remove bootindexA/B " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 24/34] scsi: add bootindex to qom property arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 25/34] ide: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 26/34] virtio-blk: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 27/34] block: remove bootindex property from qdev to qom arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 28/34] virtio-blk: alias bootindex property explicitly for virt-blk-pci/ccw/s390 arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 29/34] usb-storage: add bootindex to qom property arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 30/34] nvma: ide: " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 31/34] ide: add calling add_boot_device_patch in bootindex setter function arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 32/34] bootindex: move calling add_boot_device_patch to " arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 33/34] bootindex: delete bootindex when device is removed arei.gonglei
2014-10-07  8:00 ` [Qemu-devel] [PATCH v11 34/34] bootindex: change fprintf to error_report arei.gonglei
2014-10-08 11:00 ` [Qemu-devel] [PATCH v11 00/34] modify boot order of guest, and take effect after rebooting Gonglei
2014-10-09  9:47   ` Gerd Hoffmann
2014-10-09 10:09     ` Gonglei
2014-10-09 11:10       ` Andreas Färber
2014-10-09 11:07     ` Michael Mueller
2014-10-09 12:04       ` Gonglei
2014-10-09 11:17     ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).