mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
s390x: register I/O adapters per ISC during init
The I/O adapters should exist as soon as the bus/infrastructure exists, and not only when the guest is actually trying to do something with them. While the lazy allocation was not wrong, allocating at init time is cleaner, both for the architecture and the code. Let's adjust this by having each device type (currently for PCI and virtio-ccw) register the adapters for each ISC (as now we don't know which ISC the guest will use) as soon as it initializes. Use a two-dimensional array io_adapters[type][isc] to store adapters in ChannelSubSys, so that we can conveniently get the adapter id by the helper function css_get_adapter_id(type, isc). Signed-off-by: Fei Li <sherrylf@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
bc66d6cbca
commit
dde522bbc5
6 changed files with 74 additions and 47 deletions
|
@ -616,10 +616,9 @@ static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw)
|
|||
dev->routes.adapter.ind_offset = ind_bit;
|
||||
dev->routes.adapter.summary_offset = 7;
|
||||
cpu_physical_memory_unmap(thinint, hw_len, 0, hw_len);
|
||||
ret = css_register_io_adapter(CSS_IO_ADAPTER_VIRTIO,
|
||||
dev->thinint_isc, true, false,
|
||||
&dev->routes.adapter.adapter_id);
|
||||
assert(ret == 0);
|
||||
dev->routes.adapter.adapter_id = css_get_adapter_id(
|
||||
CSS_IO_ADAPTER_VIRTIO,
|
||||
dev->thinint_isc);
|
||||
sch->thinint_active = ((dev->indicators != NULL) &&
|
||||
(dev->summary_indicator != NULL));
|
||||
sch->curr_status.scsw.count = ccw.count - len;
|
||||
|
@ -1308,9 +1307,9 @@ static int virtio_ccw_load_config(DeviceState *d, QEMUFile *f)
|
|||
dev->thinint_isc = qemu_get_byte(f);
|
||||
dev->revision = qemu_get_be32(f);
|
||||
if (s->thinint_active) {
|
||||
return css_register_io_adapter(CSS_IO_ADAPTER_VIRTIO,
|
||||
dev->thinint_isc, true, false,
|
||||
&dev->routes.adapter.adapter_id);
|
||||
dev->routes.adapter.adapter_id = css_get_adapter_id(
|
||||
CSS_IO_ADAPTER_VIRTIO,
|
||||
dev->thinint_isc);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue