1ff8f06eeSShlomo Pongratz /* 2ff8f06eeSShlomo Pongratz * ARM GICv3 support - common bits of emulated and KVM kernel model 3ff8f06eeSShlomo Pongratz * 4ff8f06eeSShlomo Pongratz * Copyright (c) 2012 Linaro Limited 5ff8f06eeSShlomo Pongratz * Copyright (c) 2015 Huawei. 607e2034dSPavel Fedin * Copyright (c) 2015 Samsung Electronics Co., Ltd. 7ff8f06eeSShlomo Pongratz * Written by Peter Maydell 807e2034dSPavel Fedin * Reworked for GICv3 by Shlomo Pongratz and Pavel Fedin 9ff8f06eeSShlomo Pongratz * 10ff8f06eeSShlomo Pongratz * This program is free software; you can redistribute it and/or modify 11ff8f06eeSShlomo Pongratz * it under the terms of the GNU General Public License as published by 12ff8f06eeSShlomo Pongratz * the Free Software Foundation, either version 2 of the License, or 13ff8f06eeSShlomo Pongratz * (at your option) any later version. 14ff8f06eeSShlomo Pongratz * 15ff8f06eeSShlomo Pongratz * This program is distributed in the hope that it will be useful, 16ff8f06eeSShlomo Pongratz * but WITHOUT ANY WARRANTY; without even the implied warranty of 17ff8f06eeSShlomo Pongratz * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18ff8f06eeSShlomo Pongratz * GNU General Public License for more details. 19ff8f06eeSShlomo Pongratz * 20ff8f06eeSShlomo Pongratz * You should have received a copy of the GNU General Public License along 21ff8f06eeSShlomo Pongratz * with this program; if not, see <http://www.gnu.org/licenses/>. 22ff8f06eeSShlomo Pongratz */ 23ff8f06eeSShlomo Pongratz 248ef94f0bSPeter Maydell #include "qemu/osdep.h" 25da34e65cSMarkus Armbruster #include "qapi/error.h" 2607e2034dSPavel Fedin #include "qom/cpu.h" 27ff8f06eeSShlomo Pongratz #include "hw/intc/arm_gicv3_common.h" 2807e2034dSPavel Fedin #include "gicv3_internal.h" 2907e2034dSPavel Fedin #include "hw/arm/linux-boot-if.h" 30ff8f06eeSShlomo Pongratz 31ff8f06eeSShlomo Pongratz static void gicv3_pre_save(void *opaque) 32ff8f06eeSShlomo Pongratz { 33ff8f06eeSShlomo Pongratz GICv3State *s = (GICv3State *)opaque; 34ff8f06eeSShlomo Pongratz ARMGICv3CommonClass *c = ARM_GICV3_COMMON_GET_CLASS(s); 35ff8f06eeSShlomo Pongratz 36ff8f06eeSShlomo Pongratz if (c->pre_save) { 37ff8f06eeSShlomo Pongratz c->pre_save(s); 38ff8f06eeSShlomo Pongratz } 39ff8f06eeSShlomo Pongratz } 40ff8f06eeSShlomo Pongratz 41ff8f06eeSShlomo Pongratz static int gicv3_post_load(void *opaque, int version_id) 42ff8f06eeSShlomo Pongratz { 43ff8f06eeSShlomo Pongratz GICv3State *s = (GICv3State *)opaque; 44ff8f06eeSShlomo Pongratz ARMGICv3CommonClass *c = ARM_GICV3_COMMON_GET_CLASS(s); 45ff8f06eeSShlomo Pongratz 46ff8f06eeSShlomo Pongratz if (c->post_load) { 47ff8f06eeSShlomo Pongratz c->post_load(s); 48ff8f06eeSShlomo Pongratz } 49ff8f06eeSShlomo Pongratz return 0; 50ff8f06eeSShlomo Pongratz } 51ff8f06eeSShlomo Pongratz 52757caeedSPavel Fedin static const VMStateDescription vmstate_gicv3_cpu = { 53757caeedSPavel Fedin .name = "arm_gicv3_cpu", 54757caeedSPavel Fedin .version_id = 1, 55757caeedSPavel Fedin .minimum_version_id = 1, 56757caeedSPavel Fedin .fields = (VMStateField[]) { 57757caeedSPavel Fedin VMSTATE_UINT32(level, GICv3CPUState), 58757caeedSPavel Fedin VMSTATE_UINT32(gicr_ctlr, GICv3CPUState), 59757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(gicr_statusr, GICv3CPUState, 2), 60757caeedSPavel Fedin VMSTATE_UINT32(gicr_waker, GICv3CPUState), 61757caeedSPavel Fedin VMSTATE_UINT64(gicr_propbaser, GICv3CPUState), 62757caeedSPavel Fedin VMSTATE_UINT64(gicr_pendbaser, GICv3CPUState), 63757caeedSPavel Fedin VMSTATE_UINT32(gicr_igroupr0, GICv3CPUState), 64757caeedSPavel Fedin VMSTATE_UINT32(gicr_ienabler0, GICv3CPUState), 65757caeedSPavel Fedin VMSTATE_UINT32(gicr_ipendr0, GICv3CPUState), 66757caeedSPavel Fedin VMSTATE_UINT32(gicr_iactiver0, GICv3CPUState), 67757caeedSPavel Fedin VMSTATE_UINT32(edge_trigger, GICv3CPUState), 68757caeedSPavel Fedin VMSTATE_UINT32(gicr_igrpmodr0, GICv3CPUState), 69757caeedSPavel Fedin VMSTATE_UINT32(gicr_nsacr, GICv3CPUState), 70757caeedSPavel Fedin VMSTATE_UINT8_ARRAY(gicr_ipriorityr, GICv3CPUState, GIC_INTERNAL), 71757caeedSPavel Fedin VMSTATE_UINT64_ARRAY(icc_ctlr_el1, GICv3CPUState, 2), 72757caeedSPavel Fedin VMSTATE_UINT64(icc_pmr_el1, GICv3CPUState), 73757caeedSPavel Fedin VMSTATE_UINT64_ARRAY(icc_bpr, GICv3CPUState, 3), 74757caeedSPavel Fedin VMSTATE_UINT64_2DARRAY(icc_apr, GICv3CPUState, 3, 4), 75757caeedSPavel Fedin VMSTATE_UINT64_ARRAY(icc_igrpen, GICv3CPUState, 3), 76757caeedSPavel Fedin VMSTATE_UINT64(icc_ctlr_el3, GICv3CPUState), 77757caeedSPavel Fedin VMSTATE_END_OF_LIST() 78757caeedSPavel Fedin } 79757caeedSPavel Fedin }; 80757caeedSPavel Fedin 81ff8f06eeSShlomo Pongratz static const VMStateDescription vmstate_gicv3 = { 82ff8f06eeSShlomo Pongratz .name = "arm_gicv3", 83757caeedSPavel Fedin .version_id = 1, 84757caeedSPavel Fedin .minimum_version_id = 1, 85ff8f06eeSShlomo Pongratz .pre_save = gicv3_pre_save, 86ff8f06eeSShlomo Pongratz .post_load = gicv3_post_load, 87757caeedSPavel Fedin .fields = (VMStateField[]) { 88757caeedSPavel Fedin VMSTATE_UINT32(gicd_ctlr, GICv3State), 89757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(gicd_statusr, GICv3State, 2), 90757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(group, GICv3State, GICV3_BMP_SIZE), 91757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(grpmod, GICv3State, GICV3_BMP_SIZE), 92757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(enabled, GICv3State, GICV3_BMP_SIZE), 93757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(pending, GICv3State, GICV3_BMP_SIZE), 94757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(active, GICv3State, GICV3_BMP_SIZE), 95757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(level, GICv3State, GICV3_BMP_SIZE), 96757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(edge_trigger, GICv3State, GICV3_BMP_SIZE), 97757caeedSPavel Fedin VMSTATE_UINT8_ARRAY(gicd_ipriority, GICv3State, GICV3_MAXIRQ), 98757caeedSPavel Fedin VMSTATE_UINT64_ARRAY(gicd_irouter, GICv3State, GICV3_MAXIRQ), 99757caeedSPavel Fedin VMSTATE_UINT32_ARRAY(gicd_nsacr, GICv3State, 100757caeedSPavel Fedin DIV_ROUND_UP(GICV3_MAXIRQ, 16)), 101757caeedSPavel Fedin VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, GICv3State, num_cpu, 102757caeedSPavel Fedin vmstate_gicv3_cpu, GICv3CPUState), 103757caeedSPavel Fedin VMSTATE_END_OF_LIST() 104757caeedSPavel Fedin } 105ff8f06eeSShlomo Pongratz }; 106ff8f06eeSShlomo Pongratz 107ff8f06eeSShlomo Pongratz void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler, 108ff8f06eeSShlomo Pongratz const MemoryRegionOps *ops) 109ff8f06eeSShlomo Pongratz { 110ff8f06eeSShlomo Pongratz SysBusDevice *sbd = SYS_BUS_DEVICE(s); 111ff8f06eeSShlomo Pongratz int i; 112ff8f06eeSShlomo Pongratz 113ff8f06eeSShlomo Pongratz /* For the GIC, also expose incoming GPIO lines for PPIs for each CPU. 114ff8f06eeSShlomo Pongratz * GPIO array layout is thus: 115ff8f06eeSShlomo Pongratz * [0..N-1] spi 116ff8f06eeSShlomo Pongratz * [N..N+31] PPIs for CPU 0 117ff8f06eeSShlomo Pongratz * [N+32..N+63] PPIs for CPU 1 118ff8f06eeSShlomo Pongratz * ... 119ff8f06eeSShlomo Pongratz */ 120ff8f06eeSShlomo Pongratz i = s->num_irq - GIC_INTERNAL + GIC_INTERNAL * s->num_cpu; 121ff8f06eeSShlomo Pongratz qdev_init_gpio_in(DEVICE(s), handler, i); 122ff8f06eeSShlomo Pongratz 123ff8f06eeSShlomo Pongratz for (i = 0; i < s->num_cpu; i++) { 1243faf2b0cSPeter Maydell sysbus_init_irq(sbd, &s->cpu[i].parent_irq); 125ff8f06eeSShlomo Pongratz } 126ff8f06eeSShlomo Pongratz for (i = 0; i < s->num_cpu; i++) { 1273faf2b0cSPeter Maydell sysbus_init_irq(sbd, &s->cpu[i].parent_fiq); 128ff8f06eeSShlomo Pongratz } 129ff8f06eeSShlomo Pongratz 130ff8f06eeSShlomo Pongratz memory_region_init_io(&s->iomem_dist, OBJECT(s), ops, s, 131ff8f06eeSShlomo Pongratz "gicv3_dist", 0x10000); 132ff8f06eeSShlomo Pongratz memory_region_init_io(&s->iomem_redist, OBJECT(s), ops ? &ops[1] : NULL, s, 133ff8f06eeSShlomo Pongratz "gicv3_redist", 0x20000 * s->num_cpu); 134ff8f06eeSShlomo Pongratz 135ff8f06eeSShlomo Pongratz sysbus_init_mmio(sbd, &s->iomem_dist); 136ff8f06eeSShlomo Pongratz sysbus_init_mmio(sbd, &s->iomem_redist); 137ff8f06eeSShlomo Pongratz } 138ff8f06eeSShlomo Pongratz 139ff8f06eeSShlomo Pongratz static void arm_gicv3_common_realize(DeviceState *dev, Error **errp) 140ff8f06eeSShlomo Pongratz { 141ff8f06eeSShlomo Pongratz GICv3State *s = ARM_GICV3_COMMON(dev); 14207e2034dSPavel Fedin int i; 143ff8f06eeSShlomo Pongratz 144ff8f06eeSShlomo Pongratz /* revision property is actually reserved and currently used only in order 145ff8f06eeSShlomo Pongratz * to keep the interface compatible with GICv2 code, avoiding extra 146ff8f06eeSShlomo Pongratz * conditions. However, in future it could be used, for example, if we 147ff8f06eeSShlomo Pongratz * implement GICv4. 148ff8f06eeSShlomo Pongratz */ 149ff8f06eeSShlomo Pongratz if (s->revision != 3) { 150ff8f06eeSShlomo Pongratz error_setg(errp, "unsupported GIC revision %d", s->revision); 151ff8f06eeSShlomo Pongratz return; 152ff8f06eeSShlomo Pongratz } 15307e2034dSPavel Fedin 15407e2034dSPavel Fedin if (s->num_irq > GICV3_MAXIRQ) { 15507e2034dSPavel Fedin error_setg(errp, 15607e2034dSPavel Fedin "requested %u interrupt lines exceeds GIC maximum %d", 15707e2034dSPavel Fedin s->num_irq, GICV3_MAXIRQ); 15807e2034dSPavel Fedin return; 15907e2034dSPavel Fedin } 16007e2034dSPavel Fedin if (s->num_irq < GIC_INTERNAL) { 16107e2034dSPavel Fedin error_setg(errp, 16207e2034dSPavel Fedin "requested %u interrupt lines is below GIC minimum %d", 16307e2034dSPavel Fedin s->num_irq, GIC_INTERNAL); 16407e2034dSPavel Fedin return; 16507e2034dSPavel Fedin } 16607e2034dSPavel Fedin 16707e2034dSPavel Fedin /* ITLinesNumber is represented as (N / 32) - 1, so this is an 16807e2034dSPavel Fedin * implementation imposed restriction, not an architectural one, 16907e2034dSPavel Fedin * so we don't have to deal with bitfields where only some of the 17007e2034dSPavel Fedin * bits in a 32-bit word should be valid. 17107e2034dSPavel Fedin */ 17207e2034dSPavel Fedin if (s->num_irq % 32) { 17307e2034dSPavel Fedin error_setg(errp, 17407e2034dSPavel Fedin "%d interrupt lines unsupported: not divisible by 32", 17507e2034dSPavel Fedin s->num_irq); 17607e2034dSPavel Fedin return; 17707e2034dSPavel Fedin } 17807e2034dSPavel Fedin 17907e2034dSPavel Fedin s->cpu = g_new0(GICv3CPUState, s->num_cpu); 18007e2034dSPavel Fedin 18107e2034dSPavel Fedin for (i = 0; i < s->num_cpu; i++) { 18207e2034dSPavel Fedin CPUState *cpu = qemu_get_cpu(i); 18307e2034dSPavel Fedin uint64_t cpu_affid; 18407e2034dSPavel Fedin int last; 18507e2034dSPavel Fedin 18607e2034dSPavel Fedin s->cpu[i].cpu = cpu; 18707e2034dSPavel Fedin s->cpu[i].gic = s; 18807e2034dSPavel Fedin 18907e2034dSPavel Fedin /* Pre-construct the GICR_TYPER: 19007e2034dSPavel Fedin * For our implementation: 19107e2034dSPavel Fedin * Top 32 bits are the affinity value of the associated CPU 19207e2034dSPavel Fedin * CommonLPIAff == 01 (redistributors with same Aff3 share LPI table) 19307e2034dSPavel Fedin * Processor_Number == CPU index starting from 0 19407e2034dSPavel Fedin * DPGS == 0 (GICR_CTLR.DPG* not supported) 19507e2034dSPavel Fedin * Last == 1 if this is the last redistributor in a series of 19607e2034dSPavel Fedin * contiguous redistributor pages 19707e2034dSPavel Fedin * DirectLPI == 0 (direct injection of LPIs not supported) 19807e2034dSPavel Fedin * VLPIS == 0 (virtual LPIs not supported) 19907e2034dSPavel Fedin * PLPIS == 0 (physical LPIs not supported) 20007e2034dSPavel Fedin */ 20107e2034dSPavel Fedin cpu_affid = object_property_get_int(OBJECT(cpu), "mp-affinity", NULL); 20207e2034dSPavel Fedin last = (i == s->num_cpu - 1); 20307e2034dSPavel Fedin 20407e2034dSPavel Fedin /* The CPU mp-affinity property is in MPIDR register format; squash 20507e2034dSPavel Fedin * the affinity bytes into 32 bits as the GICR_TYPER has them. 20607e2034dSPavel Fedin */ 207*92204403SAndrew Jones cpu_affid = ((cpu_affid & 0xFF00000000ULL) >> 8) | 208*92204403SAndrew Jones (cpu_affid & 0xFFFFFF); 20907e2034dSPavel Fedin s->cpu[i].gicr_typer = (cpu_affid << 32) | 21007e2034dSPavel Fedin (1 << 24) | 21107e2034dSPavel Fedin (i << 8) | 21207e2034dSPavel Fedin (last << 4); 21307e2034dSPavel Fedin } 214ff8f06eeSShlomo Pongratz } 215ff8f06eeSShlomo Pongratz 216ff8f06eeSShlomo Pongratz static void arm_gicv3_common_reset(DeviceState *dev) 217ff8f06eeSShlomo Pongratz { 21807e2034dSPavel Fedin GICv3State *s = ARM_GICV3_COMMON(dev); 21907e2034dSPavel Fedin int i; 22007e2034dSPavel Fedin 22107e2034dSPavel Fedin for (i = 0; i < s->num_cpu; i++) { 22207e2034dSPavel Fedin GICv3CPUState *cs = &s->cpu[i]; 22307e2034dSPavel Fedin 22407e2034dSPavel Fedin cs->level = 0; 22507e2034dSPavel Fedin cs->gicr_ctlr = 0; 22607e2034dSPavel Fedin cs->gicr_statusr[GICV3_S] = 0; 22707e2034dSPavel Fedin cs->gicr_statusr[GICV3_NS] = 0; 22807e2034dSPavel Fedin cs->gicr_waker = GICR_WAKER_ProcessorSleep | GICR_WAKER_ChildrenAsleep; 22907e2034dSPavel Fedin cs->gicr_propbaser = 0; 23007e2034dSPavel Fedin cs->gicr_pendbaser = 0; 23107e2034dSPavel Fedin /* If we're resetting a TZ-aware GIC as if secure firmware 23207e2034dSPavel Fedin * had set it up ready to start a kernel in non-secure, we 23307e2034dSPavel Fedin * need to set interrupts to group 1 so the kernel can use them. 23407e2034dSPavel Fedin * Otherwise they reset to group 0 like the hardware. 23507e2034dSPavel Fedin */ 23607e2034dSPavel Fedin if (s->irq_reset_nonsecure) { 23707e2034dSPavel Fedin cs->gicr_igroupr0 = 0xffffffff; 23807e2034dSPavel Fedin } else { 23907e2034dSPavel Fedin cs->gicr_igroupr0 = 0; 24007e2034dSPavel Fedin } 24107e2034dSPavel Fedin 24207e2034dSPavel Fedin cs->gicr_ienabler0 = 0; 24307e2034dSPavel Fedin cs->gicr_ipendr0 = 0; 24407e2034dSPavel Fedin cs->gicr_iactiver0 = 0; 24507e2034dSPavel Fedin cs->edge_trigger = 0xffff; 24607e2034dSPavel Fedin cs->gicr_igrpmodr0 = 0; 24707e2034dSPavel Fedin cs->gicr_nsacr = 0; 24807e2034dSPavel Fedin memset(cs->gicr_ipriorityr, 0, sizeof(cs->gicr_ipriorityr)); 24907e2034dSPavel Fedin 250ce187c3cSPeter Maydell cs->hppi.prio = 0xff; 251ce187c3cSPeter Maydell 25207e2034dSPavel Fedin /* State in the CPU interface must *not* be reset here, because it 25307e2034dSPavel Fedin * is part of the CPU's reset domain, not the GIC device's. 25407e2034dSPavel Fedin */ 25507e2034dSPavel Fedin } 25607e2034dSPavel Fedin 25707e2034dSPavel Fedin /* For our implementation affinity routing is always enabled */ 25807e2034dSPavel Fedin if (s->security_extn) { 25907e2034dSPavel Fedin s->gicd_ctlr = GICD_CTLR_ARE_S | GICD_CTLR_ARE_NS; 26007e2034dSPavel Fedin } else { 26107e2034dSPavel Fedin s->gicd_ctlr = GICD_CTLR_DS | GICD_CTLR_ARE; 26207e2034dSPavel Fedin } 26307e2034dSPavel Fedin 26407e2034dSPavel Fedin s->gicd_statusr[GICV3_S] = 0; 26507e2034dSPavel Fedin s->gicd_statusr[GICV3_NS] = 0; 26607e2034dSPavel Fedin 26707e2034dSPavel Fedin memset(s->group, 0, sizeof(s->group)); 26807e2034dSPavel Fedin memset(s->grpmod, 0, sizeof(s->grpmod)); 26907e2034dSPavel Fedin memset(s->enabled, 0, sizeof(s->enabled)); 27007e2034dSPavel Fedin memset(s->pending, 0, sizeof(s->pending)); 27107e2034dSPavel Fedin memset(s->active, 0, sizeof(s->active)); 27207e2034dSPavel Fedin memset(s->level, 0, sizeof(s->level)); 27307e2034dSPavel Fedin memset(s->edge_trigger, 0, sizeof(s->edge_trigger)); 27407e2034dSPavel Fedin memset(s->gicd_ipriority, 0, sizeof(s->gicd_ipriority)); 27507e2034dSPavel Fedin memset(s->gicd_irouter, 0, sizeof(s->gicd_irouter)); 27607e2034dSPavel Fedin memset(s->gicd_nsacr, 0, sizeof(s->gicd_nsacr)); 277ce187c3cSPeter Maydell /* GICD_IROUTER are UNKNOWN at reset so in theory the guest must 278ce187c3cSPeter Maydell * write these to get sane behaviour and we need not populate the 279ce187c3cSPeter Maydell * pointer cache here; however having the cache be different for 280ce187c3cSPeter Maydell * "happened to be 0 from reset" and "guest wrote 0" would be 281ce187c3cSPeter Maydell * too confusing. 282ce187c3cSPeter Maydell */ 283ce187c3cSPeter Maydell gicv3_cache_all_target_cpustates(s); 28407e2034dSPavel Fedin 28507e2034dSPavel Fedin if (s->irq_reset_nonsecure) { 28607e2034dSPavel Fedin /* If we're resetting a TZ-aware GIC as if secure firmware 28707e2034dSPavel Fedin * had set it up ready to start a kernel in non-secure, we 28807e2034dSPavel Fedin * need to set interrupts to group 1 so the kernel can use them. 28907e2034dSPavel Fedin * Otherwise they reset to group 0 like the hardware. 29007e2034dSPavel Fedin */ 29107e2034dSPavel Fedin for (i = GIC_INTERNAL; i < s->num_irq; i++) { 29207e2034dSPavel Fedin gicv3_gicd_group_set(s, i); 29307e2034dSPavel Fedin } 29407e2034dSPavel Fedin } 29507e2034dSPavel Fedin } 29607e2034dSPavel Fedin 29707e2034dSPavel Fedin static void arm_gic_common_linux_init(ARMLinuxBootIf *obj, 29807e2034dSPavel Fedin bool secure_boot) 29907e2034dSPavel Fedin { 30007e2034dSPavel Fedin GICv3State *s = ARM_GICV3_COMMON(obj); 30107e2034dSPavel Fedin 30207e2034dSPavel Fedin if (s->security_extn && !secure_boot) { 30307e2034dSPavel Fedin /* We're directly booting a kernel into NonSecure. If this GIC 30407e2034dSPavel Fedin * implements the security extensions then we must configure it 30507e2034dSPavel Fedin * to have all the interrupts be NonSecure (this is a job that 30607e2034dSPavel Fedin * is done by the Secure boot firmware in real hardware, and in 30707e2034dSPavel Fedin * this mode QEMU is acting as a minimalist firmware-and-bootloader 30807e2034dSPavel Fedin * equivalent). 30907e2034dSPavel Fedin */ 31007e2034dSPavel Fedin s->irq_reset_nonsecure = true; 31107e2034dSPavel Fedin } 312ff8f06eeSShlomo Pongratz } 313ff8f06eeSShlomo Pongratz 314ff8f06eeSShlomo Pongratz static Property arm_gicv3_common_properties[] = { 315ff8f06eeSShlomo Pongratz DEFINE_PROP_UINT32("num-cpu", GICv3State, num_cpu, 1), 316ff8f06eeSShlomo Pongratz DEFINE_PROP_UINT32("num-irq", GICv3State, num_irq, 32), 317ff8f06eeSShlomo Pongratz DEFINE_PROP_UINT32("revision", GICv3State, revision, 3), 318ff8f06eeSShlomo Pongratz DEFINE_PROP_BOOL("has-security-extensions", GICv3State, security_extn, 0), 319ff8f06eeSShlomo Pongratz DEFINE_PROP_END_OF_LIST(), 320ff8f06eeSShlomo Pongratz }; 321ff8f06eeSShlomo Pongratz 322ff8f06eeSShlomo Pongratz static void arm_gicv3_common_class_init(ObjectClass *klass, void *data) 323ff8f06eeSShlomo Pongratz { 324ff8f06eeSShlomo Pongratz DeviceClass *dc = DEVICE_CLASS(klass); 32507e2034dSPavel Fedin ARMLinuxBootIfClass *albifc = ARM_LINUX_BOOT_IF_CLASS(klass); 326ff8f06eeSShlomo Pongratz 327ff8f06eeSShlomo Pongratz dc->reset = arm_gicv3_common_reset; 328ff8f06eeSShlomo Pongratz dc->realize = arm_gicv3_common_realize; 329ff8f06eeSShlomo Pongratz dc->props = arm_gicv3_common_properties; 330ff8f06eeSShlomo Pongratz dc->vmsd = &vmstate_gicv3; 33107e2034dSPavel Fedin albifc->arm_linux_init = arm_gic_common_linux_init; 332ff8f06eeSShlomo Pongratz } 333ff8f06eeSShlomo Pongratz 334ff8f06eeSShlomo Pongratz static const TypeInfo arm_gicv3_common_type = { 335ff8f06eeSShlomo Pongratz .name = TYPE_ARM_GICV3_COMMON, 336ff8f06eeSShlomo Pongratz .parent = TYPE_SYS_BUS_DEVICE, 337ff8f06eeSShlomo Pongratz .instance_size = sizeof(GICv3State), 338ff8f06eeSShlomo Pongratz .class_size = sizeof(ARMGICv3CommonClass), 339ff8f06eeSShlomo Pongratz .class_init = arm_gicv3_common_class_init, 340ff8f06eeSShlomo Pongratz .abstract = true, 34107e2034dSPavel Fedin .interfaces = (InterfaceInfo []) { 34207e2034dSPavel Fedin { TYPE_ARM_LINUX_BOOT_IF }, 34307e2034dSPavel Fedin { }, 34407e2034dSPavel Fedin }, 345ff8f06eeSShlomo Pongratz }; 346ff8f06eeSShlomo Pongratz 347ff8f06eeSShlomo Pongratz static void register_types(void) 348ff8f06eeSShlomo Pongratz { 349ff8f06eeSShlomo Pongratz type_register_static(&arm_gicv3_common_type); 350ff8f06eeSShlomo Pongratz } 351ff8f06eeSShlomo Pongratz 352ff8f06eeSShlomo Pongratz type_init(register_types) 353