s390x/virtio-ccw: reference-counted indicators

Make code using the same indicators point to a single allocated structure
that is freed when the last user goes away.

This will be used by the irqfd code to unmap addresses after the last user
is gone.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
Cornelia Huck 2013-08-01 17:27:00 +02:00
parent 03cf077ac9
commit 7bca3892cb
2 changed files with 73 additions and 20 deletions

View file

@ -75,6 +75,13 @@ typedef struct VirtIOCCWDeviceClass {
#define VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT 1
#define VIRTIO_CCW_FLAG_USE_IOEVENTFD (1 << VIRTIO_CCW_FLAG_USE_IOEVENTFD_BIT)
typedef struct IndAddr {
hwaddr addr;
unsigned long refcnt;
int len;
QTAILQ_ENTRY(IndAddr) sibling;
} IndAddr;
struct VirtioCcwDevice {
DeviceState parent_obj;
SubchDev *sch;
@ -87,9 +94,9 @@ struct VirtioCcwDevice {
uint8_t thinint_isc;
uint32_t adapter_id;
/* Guest provided values: */
hwaddr indicators;
hwaddr indicators2;
hwaddr summary_indicator;
IndAddr *indicators;
IndAddr *indicators2;
IndAddr *summary_indicator;
uint64_t ind_bit;
};