qemu-patch-raspberry4/hw
Alexander Graf 61de36761b qdev: Keep global allocation counter per bus
When we have 2 separate qdev devices that both create a qbus of the
same type without specifying a bus name or device name, we end up
with two buses of the same name, such as ide.0 on the Mac machines:

  dev: macio-ide, id ""
    bus: ide.0
      type IDE
  dev: macio-ide, id ""
    bus: ide.0
      type IDE

If we now spawn a device that connects to a ide.0 the last created
bus gets the device, with the first created bus inaccessible to the
command line.

After some discussion on IRC we concluded that the best quick fix way
forward for this is to make automated bus-class type based allocation
count a global counter. That's what this patch implements. With this
we instead get

  dev: macio-ide, id ""
    bus: ide.1
      type IDE
  dev: macio-ide, id ""
    bus: ide.0
      type IDE

on the example mentioned above.

This also means that if you did -device ...,bus=ide.0 you got a device
on the first bus (the last created one) before this patch and get that
device on the second one (the first created one) now.  Breaks
migration unless you change bus=ide.0 to bus=ide.1 on the destination.

This is intended and makes the bus enumeration work as expected.

As per review request follows a list of otherwise affected boards and
the reasoning for the conclusion that they are ok:

   target      machine         bus id              times
   ------      -------         ------              -----

   aarch64     n800            i2c-bus.0           2
   aarch64     n810            i2c-bus.0           2
   arm         n800            i2c-bus.0           2
   arm         n810            i2c-bus.0           2

-> Devices are only created explicitly on one of the two buses, using
   s->mpu->i2c[0], so no change to the guest.

   aarch64     vexpress-a15    virtio-mmio-bus.0   4
   aarch64     vexpress-a9     virtio-mmio-bus.0   4
   aarch64     virt            virtio-mmio-bus.0   32
   arm         vexpress-a15    virtio-mmio-bus.0   4
   arm         vexpress-a9     virtio-mmio-bus.0   4
   arm         virt            virtio-mmio-bus.0   32

-> Makes -device bus= work for all virtio-mmio buses.  Breaks
   migration.  Workaround for migration from old to new: specify
   virtio-mmio-bus.4 or .32 respectively rather than .0 on the
   destination.

   aarch64     xilinx-zynq-a9  usb-bus.0           2
   arm         xilinx-zynq-a9  usb-bus.0           2
   mips64el    fulong2e        usb-bus.0           2

-> Normal USB operation not affected. Migration driver needs command
   line to use the other bus.

   i386        isapc           ide.0               2
   x86_64      isapc           ide.0               2
   mips        mips            ide.0               2
   mips64      mips            ide.0               2
   mips64el    mips            ide.0               2
   mipsel      mips            ide.0               2
   ppc         g3beige         ide.0               2
   ppc         mac99           ide.0               2
   ppc         prep            ide.0               2
   ppc64       g3beige         ide.0               2
   ppc64       mac99           ide.0               2
   ppc64       prep            ide.0               2

-> Makes -device bus= work for all IDE buses.  Breaks migration.
   Workaround for migration from old to new: specify ide.1 rather than
   ide.0 on the destination.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Andreas Faerber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2014-03-05 03:06:47 +01:00
..
9pfs hw/9pfs: fix P9_STATS_GEN handling 2014-02-02 22:09:16 +05:30
acpi QOM infrastructure fixes and device conversions 2014-02-20 13:05:48 +00:00
alpha exec: Make stq_*_phys input an AddressSpace 2014-02-11 22:57:12 +10:00
arm target-arm: Store AIF bits in env->pstate for AArch32 2014-02-26 17:20:06 +00:00
audio hda-audio: qom cleanups 2014-02-24 10:42:09 +01:00
block Block patches 2014-02-25 10:50:11 +00:00
bt Preparation for usb-bt-dongle conditional build 2013-09-10 11:14:41 +02:00
char QOM infrastructure fixes and device conversions 2014-02-20 13:05:48 +00:00
core qdev: Keep global allocation counter per bus 2014-03-05 03:06:47 +01:00
cpu icc_bus: QOM'ify ICC 2013-12-24 18:02:18 +01:00
cris cris: Remove the CRIS PIC glue 2014-02-03 14:04:00 +00:00
display sun4m: Add Sun CG3 framebuffer and corresponding OpenBIOS FCode ROM 2014-02-27 10:01:41 +00:00
dma dma/pl330: implement dmaadnh instruction 2014-02-26 17:20:09 +00:00
gpio max7310: QOM'ify 2014-02-14 16:22:32 +01:00
i2c i2c: Rename i2c_bus to I2CBus 2014-02-14 16:22:31 +01:00
i386 qdev: Keep global allocation counter per bus 2014-03-05 03:06:47 +01:00
ide Call pci_piix3_xen_ide_unplug from unplug_disks 2014-02-20 17:28:08 +00:00
input lm832x: QOM'ify 2014-02-14 16:22:32 +01:00
intc Several features, fixes and cleanups for kvm/s390: 2014-03-04 14:50:46 +00:00
ipack ipack: Move IndustryPack out of hw/char/ 2014-02-14 21:11:53 +01:00
isa QOM infrastructure fixes and device conversions 2014-02-20 13:05:48 +00:00
lm32 hw/lm32: print error if cpu model is not found 2014-02-04 19:47:39 +01:00
m68k an5206: Don't enforce use of kernel for qtest 2013-11-05 17:47:29 +01:00
microblaze xilinx: Delete hw/include/xilinx.h 2014-02-26 14:54:45 +10:00
mips i2c: Rename i2c_bus to I2CBus 2014-02-14 16:22:31 +01:00
misc Updates include: 2014-02-27 11:31:52 +00:00
moxie moxie: fix load_elf() usage 2014-03-05 03:06:46 +01:00
net Add Enhanced Three-Speed Ethernet Controller (eTSEC) 2014-03-05 03:06:45 +01:00
nvram qdev: Remove hex8/32/64 property types 2014-02-14 21:12:04 +01:00
openrisc openrisc-timer: Reduce overhead, Separate clock update functions 2013-11-20 21:46:45 +08:00
pci Use error_is_set() only when necessary 2014-02-17 11:57:23 -05:00
pci-bridge pci/shpc: convert SHPC hotplug to use hotplug-handler API 2014-02-10 10:27:00 +02:00
pci-host acpi,pc,pci fixes and enhancements 2014-02-13 15:02:04 +00:00
pcmcia pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState 2013-11-05 18:06:52 +01:00
ppc target-ppc: Update external_htab even when HTAB is managed by kernel 2014-03-05 03:06:47 +01:00
s390x elf-loader: add more return codes 2014-03-05 03:06:46 +01:00
scsi spapr_vscsi: Fix REPORT_LUNS handling 2014-03-05 03:06:26 +01:00
sd QOM infrastructure fixes and device conversions 2014-02-20 13:05:48 +00:00
sh4 exec: Make stw_*_phys input an AddressSpace 2014-02-11 22:57:32 +10:00
sparc sun4m: Add Sun CG3 framebuffer initialisation function 2014-02-27 10:01:41 +00:00
sparc64 pc,pci,virtio fixes and cleanups 2013-09-03 12:31:07 -05:00
ssi xilinx_spi: QOM cast cleanup 2013-07-29 21:07:01 +02:00
timer Merge remote-tracking branch 'remotes/mcayland/qemu-sparc' into staging 2014-03-04 13:09:06 +00:00
tpm aio / timers: Untangle include files 2013-08-22 19:10:27 +02:00
unicore32 puv3: Turn puv3_load_kernel() into a no-op for qtest without -kernel 2013-11-05 17:47:28 +01:00
usb - xhci improvements and fixes. 2014-02-20 15:25:05 +00:00
virtio qdev: Remove hex8/32/64 property types 2014-02-14 21:12:04 +01:00
watchdog qemu-option: Remove qemu_opts_create_nofail 2014-01-06 15:02:30 -05:00
xen Call pci_piix3_xen_ide_unplug from unplug_disks 2014-02-20 17:28:08 +00:00
xtensa hw/xtensa: add support for ML605 and KC705 FPGA board 2014-02-24 04:47:01 +04:00
Makefile.objs ipack: Move IndustryPack out of hw/char/ 2014-02-14 21:11:53 +01:00