s390x: bump ADAPTER_ROUTES_MAX_GSI
[qemu/ar7.git] / include / hw / s390x / s390_flic.h
blob7f8ec7541b1af17087300da8e6d978d06c99effe
1 /*
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
10 * directory.
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
24 * maximum right now.
26 #define ADAPTER_ROUTES_MAX_GSI VIRTIO_QUEUE_MAX
27 #define VIRTIO_CCW_QUEUE_MAX 64
29 typedef struct AdapterRoutes {
30 AdapterInfo adapter;
31 int num_routes;
32 int gsi[ADAPTER_ROUTES_MAX_GSI];
33 } AdapterRoutes;
35 #define TYPE_S390_FLIC_COMMON "s390-flic"
36 #define S390_FLIC_COMMON(obj) \
37 OBJECT_CHECK(S390FLICState, (obj), TYPE_S390_FLIC_COMMON)
39 typedef struct S390FLICState {
40 SysBusDevice parent_obj;
41 /* to limit AdapterRoutes.num_routes for compat */
42 uint32_t adapter_routes_max_batch;
44 } S390FLICState;
46 #define S390_FLIC_COMMON_CLASS(klass) \
47 OBJECT_CLASS_CHECK(S390FLICStateClass, (klass), TYPE_S390_FLIC_COMMON)
48 #define S390_FLIC_COMMON_GET_CLASS(obj) \
49 OBJECT_GET_CLASS(S390FLICStateClass, (obj), TYPE_S390_FLIC_COMMON)
51 typedef struct S390FLICStateClass {
52 DeviceClass parent_class;
54 int (*register_io_adapter)(S390FLICState *fs, uint32_t id, uint8_t isc,
55 bool swap, bool maskable);
56 int (*io_adapter_map)(S390FLICState *fs, uint32_t id, uint64_t map_addr,
57 bool do_map);
58 int (*add_adapter_routes)(S390FLICState *fs, AdapterRoutes *routes);
59 void (*release_adapter_routes)(S390FLICState *fs, AdapterRoutes *routes);
60 int (*clear_io_irq)(S390FLICState *fs, uint16_t subchannel_id,
61 uint16_t subchannel_nr);
62 } S390FLICStateClass;
64 #define TYPE_KVM_S390_FLIC "s390-flic-kvm"
65 #define KVM_S390_FLIC(obj) \
66 OBJECT_CHECK(KVMS390FLICState, (obj), TYPE_KVM_S390_FLIC)
68 #define TYPE_QEMU_S390_FLIC "s390-flic-qemu"
69 #define QEMU_S390_FLIC(obj) \
70 OBJECT_CHECK(QEMUS390FLICState, (obj), TYPE_QEMU_S390_FLIC)
72 typedef struct QEMUS390FLICState {
73 S390FLICState parent_obj;
74 } QEMUS390FLICState;
76 void s390_flic_init(void);
78 S390FLICState *s390_get_flic(void);
80 #ifdef CONFIG_KVM
81 DeviceState *s390_flic_kvm_create(void);
82 #else
83 static inline DeviceState *s390_flic_kvm_create(void)
85 return NULL;
87 #endif
89 #endif /* HW_S390_FLIC_H */