2 * ITS support for ARM GICv3
4 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
5 * Written by Pavel Fedin
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef QEMU_ARM_GICV3_ITS_COMMON_H
22 #define QEMU_ARM_GICV3_ITS_COMMON_H
24 #include "hw/sysbus.h"
25 #include "hw/intc/arm_gicv3_common.h"
26 #include "qom/object.h"
28 #define ITS_CONTROL_SIZE 0x10000
29 #define ITS_TRANS_SIZE 0x10000
30 #define ITS_SIZE (ITS_CONTROL_SIZE + ITS_TRANS_SIZE)
34 #define GITS_CBASER 0x80
35 #define GITS_CWRITER 0x88
36 #define GITS_CREADR 0x90
37 #define GITS_BASER 0x100
39 struct GICv3ITSState
{
40 SysBusDevice parent_obj
;
42 MemoryRegion iomem_main
;
43 MemoryRegion iomem_its_cntrl
;
44 MemoryRegion iomem_its_translation
;
48 int dev_fd
; /* kvm device fd if backed by kvm vgic support */
49 uint64_t gits_translater_gpa
;
50 bool translater_gpa_known
;
60 Error
*migration_blocker
;
63 typedef struct GICv3ITSState GICv3ITSState
;
65 void gicv3_its_init_mmio(GICv3ITSState
*s
, const MemoryRegionOps
*ops
);
67 #define TYPE_ARM_GICV3_ITS_COMMON "arm-gicv3-its-common"
68 typedef struct GICv3ITSCommonClass GICv3ITSCommonClass
;
69 #define ARM_GICV3_ITS_COMMON(obj) \
70 OBJECT_CHECK(GICv3ITSState, (obj), TYPE_ARM_GICV3_ITS_COMMON)
71 #define ARM_GICV3_ITS_COMMON_CLASS(klass) \
72 OBJECT_CLASS_CHECK(GICv3ITSCommonClass, (klass), TYPE_ARM_GICV3_ITS_COMMON)
73 #define ARM_GICV3_ITS_COMMON_GET_CLASS(obj) \
74 OBJECT_GET_CLASS(GICv3ITSCommonClass, (obj), TYPE_ARM_GICV3_ITS_COMMON)
76 struct GICv3ITSCommonClass
{
78 SysBusDeviceClass parent_class
;
81 int (*send_msi
)(GICv3ITSState
*s
, uint32_t data
, uint16_t devid
);
82 void (*pre_save
)(GICv3ITSState
*s
);
83 void (*post_load
)(GICv3ITSState
*s
);