mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23: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
|
@ -733,12 +733,10 @@ int pcistb_service_call(S390CPU *cpu, uint8_t r1, uint8_t r3, uint64_t gaddr,
|
|||
static int reg_irqs(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib)
|
||||
{
|
||||
int ret, len;
|
||||
uint8_t isc = FIB_DATA_ISC(ldl_p(&fib.data));
|
||||
|
||||
ret = css_register_io_adapter(CSS_IO_ADAPTER_PCI,
|
||||
FIB_DATA_ISC(ldl_p(&fib.data)), true, false,
|
||||
&pbdev->routes.adapter.adapter_id);
|
||||
assert(ret == 0);
|
||||
|
||||
pbdev->routes.adapter.adapter_id = css_get_adapter_id(
|
||||
CSS_IO_ADAPTER_PCI, isc);
|
||||
pbdev->summary_ind = get_indicator(ldq_p(&fib.aisb), sizeof(uint64_t));
|
||||
len = BITS_TO_LONGS(FIB_DATA_NOI(ldl_p(&fib.data))) * sizeof(unsigned long);
|
||||
pbdev->indicator = get_indicator(ldq_p(&fib.aibv), len);
|
||||
|
@ -757,7 +755,7 @@ static int reg_irqs(CPUS390XState *env, S390PCIBusDevice *pbdev, ZpciFib fib)
|
|||
pbdev->routes.adapter.summary_offset = FIB_DATA_AISBO(ldl_p(&fib.data));
|
||||
pbdev->routes.adapter.ind_addr = ldq_p(&fib.aibv);
|
||||
pbdev->routes.adapter.ind_offset = FIB_DATA_AIBVO(ldl_p(&fib.data));
|
||||
pbdev->isc = FIB_DATA_ISC(ldl_p(&fib.data));
|
||||
pbdev->isc = isc;
|
||||
pbdev->noi = FIB_DATA_NOI(ldl_p(&fib.data));
|
||||
pbdev->sum = FIB_DATA_SUM(ldl_p(&fib.data));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue