2 * QEMU S390x floating interrupt controller (flic)
4 * Copyright 2014 IBM Corp.
5 * Author(s): Jens Freimann <jfrei@linux.vnet.ibm.com>
6 * Cornelia Huck <cornelia.huck@de.ibm.com>
8 * This work is licensed under the terms of the GNU GPL, version 2 or (at
9 * your option) any later version. See the COPYING file in the top-level
13 #ifndef HW_S390_FLIC_H
14 #define HW_S390_FLIC_H
16 #include "hw/sysbus.h"
17 #include "hw/s390x/adapter.h"
18 #include "hw/virtio/virtio.h"
21 * Reserve enough gsis to accommodate all virtio devices.
22 * If any other user of adapter routes needs more of these,
23 * we need to bump the value; but virtio looks like the
26 #define ADAPTER_ROUTES_MAX_GSI VIRTIO_QUEUE_MAX
28 typedef struct AdapterRoutes
{
31 int gsi
[ADAPTER_ROUTES_MAX_GSI
];
34 #define TYPE_S390_FLIC_COMMON "s390-flic"
35 #define S390_FLIC_COMMON(obj) \
36 OBJECT_CHECK(S390FLICState, (obj), TYPE_S390_FLIC_COMMON)
38 typedef struct S390FLICState
{
39 SysBusDevice parent_obj
;
40 /* to limit AdapterRoutes.num_routes for compat */
41 uint32_t adapter_routes_max_batch
;
45 #define S390_FLIC_COMMON_CLASS(klass) \
46 OBJECT_CLASS_CHECK(S390FLICStateClass, (klass), TYPE_S390_FLIC_COMMON)
47 #define S390_FLIC_COMMON_GET_CLASS(obj) \
48 OBJECT_GET_CLASS(S390FLICStateClass, (obj), TYPE_S390_FLIC_COMMON)
50 typedef struct S390FLICStateClass
{
51 DeviceClass parent_class
;
53 int (*register_io_adapter
)(S390FLICState
*fs
, uint32_t id
, uint8_t isc
,
54 bool swap
, bool maskable
);
55 int (*io_adapter_map
)(S390FLICState
*fs
, uint32_t id
, uint64_t map_addr
,
57 int (*add_adapter_routes
)(S390FLICState
*fs
, AdapterRoutes
*routes
);
58 void (*release_adapter_routes
)(S390FLICState
*fs
, AdapterRoutes
*routes
);
59 int (*clear_io_irq
)(S390FLICState
*fs
, uint16_t subchannel_id
,
60 uint16_t subchannel_nr
);
63 #define TYPE_KVM_S390_FLIC "s390-flic-kvm"
64 #define KVM_S390_FLIC(obj) \
65 OBJECT_CHECK(KVMS390FLICState, (obj), TYPE_KVM_S390_FLIC)
67 #define TYPE_QEMU_S390_FLIC "s390-flic-qemu"
68 #define QEMU_S390_FLIC(obj) \
69 OBJECT_CHECK(QEMUS390FLICState, (obj), TYPE_QEMU_S390_FLIC)
71 typedef struct QEMUS390FLICState
{
72 S390FLICState parent_obj
;
75 void s390_flic_init(void);
77 S390FLICState
*s390_get_flic(void);
80 DeviceState
*s390_flic_kvm_create(void);
82 static inline DeviceState
*s390_flic_kvm_create(void)
88 #endif /* HW_S390_FLIC_H */