mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
spapr: proper qdevification
Right now the spapr devices cannot be instantiated with -device, because the IRQs need to be passed to the spapr_*_create functions. Do this instead in the bus's init wrapper. This is particularly important with the conversion from scsi-disk to scsi-{cd,hd} that Markus made. After his patches, if you specify a scsi-cd device attached to an if=none drive, the default VSCSI controller will not be created and, without qdevification, you will not be able to add yours. NOTE from agraf: added small compile fix Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Cc: Alexander Graf <agraf@suse.de> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
e4fc8781db
commit
277f9acf79
7 changed files with 25 additions and 39 deletions
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "hw/spapr.h"
|
||||
#include "hw/spapr_vio.h"
|
||||
#include "hw/xics.h"
|
||||
|
||||
#ifdef CONFIG_FDT
|
||||
#include <libfdt.h>
|
||||
|
@ -595,6 +596,7 @@ static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo)
|
|||
{
|
||||
VIOsPAPRDeviceInfo *info = (VIOsPAPRDeviceInfo *)qinfo;
|
||||
VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev;
|
||||
VIOsPAPRBus *bus = DO_UPCAST(VIOsPAPRBus, bus, dev->qdev.parent_bus);
|
||||
char *id;
|
||||
|
||||
if (asprintf(&id, "%s@%x", info->dt_name, dev->reg) < 0) {
|
||||
|
@ -602,6 +604,8 @@ static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo)
|
|||
}
|
||||
|
||||
dev->qdev.id = id;
|
||||
dev->vio_irq_num = bus->irq++;
|
||||
dev->qirq = spapr_find_qirq(spapr, dev->vio_irq_num);
|
||||
|
||||
rtce_init(dev);
|
||||
|
||||
|
@ -656,6 +660,7 @@ VIOsPAPRBus *spapr_vio_bus_init(void)
|
|||
|
||||
qbus = qbus_create(&spapr_vio_bus_info, dev, "spapr-vio");
|
||||
bus = DO_UPCAST(VIOsPAPRBus, bus, qbus);
|
||||
bus->irq = 16;
|
||||
|
||||
/* hcall-vio */
|
||||
spapr_register_hypercall(H_VIO_SIGNAL, h_vio_signal);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue