arm_gicv3_common.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. /*
  2. * ARM GICv3 support - common bits of emulated and KVM kernel model
  3. *
  4. * Copyright (c) 2012 Linaro Limited
  5. * Copyright (c) 2015 Huawei.
  6. * Copyright (c) 2015 Samsung Electronics Co., Ltd.
  7. * Written by Peter Maydell
  8. * Reworked for GICv3 by Shlomo Pongratz and Pavel Fedin
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with this program; if not, see <http://www.gnu.org/licenses/>.
  22. */
  23. #include "qemu/osdep.h"
  24. #include "qapi/error.h"
  25. #include "qemu/module.h"
  26. #include "hw/core/cpu.h"
  27. #include "hw/intc/arm_gicv3_common.h"
  28. #include "hw/qdev-properties.h"
  29. #include "migration/vmstate.h"
  30. #include "gicv3_internal.h"
  31. #include "hw/arm/linux-boot-if.h"
  32. #include "sysemu/kvm.h"
  33. static void gicv3_gicd_no_migration_shift_bug_post_load(GICv3State *cs)
  34. {
  35. if (cs->gicd_no_migration_shift_bug) {
  36. return;
  37. }
  38. /* Older versions of QEMU had a bug in the handling of state save/restore
  39. * to the KVM GICv3: they got the offset in the bitmap arrays wrong,
  40. * so that instead of the data for external interrupts 32 and up
  41. * starting at bit position 32 in the bitmap, it started at bit
  42. * position 64. If we're receiving data from a QEMU with that bug,
  43. * we must move the data down into the right place.
  44. */
  45. memmove(cs->group, (uint8_t *)cs->group + GIC_INTERNAL / 8,
  46. sizeof(cs->group) - GIC_INTERNAL / 8);
  47. memmove(cs->grpmod, (uint8_t *)cs->grpmod + GIC_INTERNAL / 8,
  48. sizeof(cs->grpmod) - GIC_INTERNAL / 8);
  49. memmove(cs->enabled, (uint8_t *)cs->enabled + GIC_INTERNAL / 8,
  50. sizeof(cs->enabled) - GIC_INTERNAL / 8);
  51. memmove(cs->pending, (uint8_t *)cs->pending + GIC_INTERNAL / 8,
  52. sizeof(cs->pending) - GIC_INTERNAL / 8);
  53. memmove(cs->active, (uint8_t *)cs->active + GIC_INTERNAL / 8,
  54. sizeof(cs->active) - GIC_INTERNAL / 8);
  55. memmove(cs->edge_trigger, (uint8_t *)cs->edge_trigger + GIC_INTERNAL / 8,
  56. sizeof(cs->edge_trigger) - GIC_INTERNAL / 8);
  57. /*
  58. * While this new version QEMU doesn't have this kind of bug as we fix it,
  59. * so it needs to set the flag to true to indicate that and it's necessary
  60. * for next migration to work from this new version QEMU.
  61. */
  62. cs->gicd_no_migration_shift_bug = true;
  63. }
  64. static int gicv3_pre_save(void *opaque)
  65. {
  66. GICv3State *s = (GICv3State *)opaque;
  67. ARMGICv3CommonClass *c = ARM_GICV3_COMMON_GET_CLASS(s);
  68. if (c->pre_save) {
  69. c->pre_save(s);
  70. }
  71. return 0;
  72. }
  73. static int gicv3_post_load(void *opaque, int version_id)
  74. {
  75. GICv3State *s = (GICv3State *)opaque;
  76. ARMGICv3CommonClass *c = ARM_GICV3_COMMON_GET_CLASS(s);
  77. gicv3_gicd_no_migration_shift_bug_post_load(s);
  78. if (c->post_load) {
  79. c->post_load(s);
  80. }
  81. return 0;
  82. }
  83. static bool virt_state_needed(void *opaque)
  84. {
  85. GICv3CPUState *cs = opaque;
  86. return cs->num_list_regs != 0;
  87. }
  88. static const VMStateDescription vmstate_gicv3_cpu_virt = {
  89. .name = "arm_gicv3_cpu/virt",
  90. .version_id = 1,
  91. .minimum_version_id = 1,
  92. .needed = virt_state_needed,
  93. .fields = (VMStateField[]) {
  94. VMSTATE_UINT64_2DARRAY(ich_apr, GICv3CPUState, 3, 4),
  95. VMSTATE_UINT64(ich_hcr_el2, GICv3CPUState),
  96. VMSTATE_UINT64_ARRAY(ich_lr_el2, GICv3CPUState, GICV3_LR_MAX),
  97. VMSTATE_UINT64(ich_vmcr_el2, GICv3CPUState),
  98. VMSTATE_END_OF_LIST()
  99. }
  100. };
  101. static int vmstate_gicv3_cpu_pre_load(void *opaque)
  102. {
  103. GICv3CPUState *cs = opaque;
  104. /*
  105. * If the sre_el1 subsection is not transferred this
  106. * means SRE_EL1 is 0x7 (which might not be the same as
  107. * our reset value).
  108. */
  109. cs->icc_sre_el1 = 0x7;
  110. return 0;
  111. }
  112. static bool icc_sre_el1_reg_needed(void *opaque)
  113. {
  114. GICv3CPUState *cs = opaque;
  115. return cs->icc_sre_el1 != 7;
  116. }
  117. const VMStateDescription vmstate_gicv3_cpu_sre_el1 = {
  118. .name = "arm_gicv3_cpu/sre_el1",
  119. .version_id = 1,
  120. .minimum_version_id = 1,
  121. .needed = icc_sre_el1_reg_needed,
  122. .fields = (VMStateField[]) {
  123. VMSTATE_UINT64(icc_sre_el1, GICv3CPUState),
  124. VMSTATE_END_OF_LIST()
  125. }
  126. };
  127. static const VMStateDescription vmstate_gicv3_cpu = {
  128. .name = "arm_gicv3_cpu",
  129. .version_id = 1,
  130. .minimum_version_id = 1,
  131. .pre_load = vmstate_gicv3_cpu_pre_load,
  132. .fields = (VMStateField[]) {
  133. VMSTATE_UINT32(level, GICv3CPUState),
  134. VMSTATE_UINT32(gicr_ctlr, GICv3CPUState),
  135. VMSTATE_UINT32_ARRAY(gicr_statusr, GICv3CPUState, 2),
  136. VMSTATE_UINT32(gicr_waker, GICv3CPUState),
  137. VMSTATE_UINT64(gicr_propbaser, GICv3CPUState),
  138. VMSTATE_UINT64(gicr_pendbaser, GICv3CPUState),
  139. VMSTATE_UINT32(gicr_igroupr0, GICv3CPUState),
  140. VMSTATE_UINT32(gicr_ienabler0, GICv3CPUState),
  141. VMSTATE_UINT32(gicr_ipendr0, GICv3CPUState),
  142. VMSTATE_UINT32(gicr_iactiver0, GICv3CPUState),
  143. VMSTATE_UINT32(edge_trigger, GICv3CPUState),
  144. VMSTATE_UINT32(gicr_igrpmodr0, GICv3CPUState),
  145. VMSTATE_UINT32(gicr_nsacr, GICv3CPUState),
  146. VMSTATE_UINT8_ARRAY(gicr_ipriorityr, GICv3CPUState, GIC_INTERNAL),
  147. VMSTATE_UINT64_ARRAY(icc_ctlr_el1, GICv3CPUState, 2),
  148. VMSTATE_UINT64(icc_pmr_el1, GICv3CPUState),
  149. VMSTATE_UINT64_ARRAY(icc_bpr, GICv3CPUState, 3),
  150. VMSTATE_UINT64_2DARRAY(icc_apr, GICv3CPUState, 3, 4),
  151. VMSTATE_UINT64_ARRAY(icc_igrpen, GICv3CPUState, 3),
  152. VMSTATE_UINT64(icc_ctlr_el3, GICv3CPUState),
  153. VMSTATE_END_OF_LIST()
  154. },
  155. .subsections = (const VMStateDescription * []) {
  156. &vmstate_gicv3_cpu_virt,
  157. &vmstate_gicv3_cpu_sre_el1,
  158. NULL
  159. }
  160. };
  161. static int gicv3_pre_load(void *opaque)
  162. {
  163. GICv3State *cs = opaque;
  164. /*
  165. * The gicd_no_migration_shift_bug flag is used for migration compatibility
  166. * for old version QEMU which may have the GICD bmp shift bug under KVM mode.
  167. * Strictly, what we want to know is whether the migration source is using
  168. * KVM. Since we don't have any way to determine that, we look at whether the
  169. * destination is using KVM; this is close enough because for the older QEMU
  170. * versions with this bug KVM -> TCG migration didn't work anyway. If the
  171. * source is a newer QEMU without this bug it will transmit the migration
  172. * subsection which sets the flag to true; otherwise it will remain set to
  173. * the value we select here.
  174. */
  175. if (kvm_enabled()) {
  176. cs->gicd_no_migration_shift_bug = false;
  177. }
  178. return 0;
  179. }
  180. static bool needed_always(void *opaque)
  181. {
  182. return true;
  183. }
  184. const VMStateDescription vmstate_gicv3_gicd_no_migration_shift_bug = {
  185. .name = "arm_gicv3/gicd_no_migration_shift_bug",
  186. .version_id = 1,
  187. .minimum_version_id = 1,
  188. .needed = needed_always,
  189. .fields = (VMStateField[]) {
  190. VMSTATE_BOOL(gicd_no_migration_shift_bug, GICv3State),
  191. VMSTATE_END_OF_LIST()
  192. }
  193. };
  194. static const VMStateDescription vmstate_gicv3 = {
  195. .name = "arm_gicv3",
  196. .version_id = 1,
  197. .minimum_version_id = 1,
  198. .pre_load = gicv3_pre_load,
  199. .pre_save = gicv3_pre_save,
  200. .post_load = gicv3_post_load,
  201. .priority = MIG_PRI_GICV3,
  202. .fields = (VMStateField[]) {
  203. VMSTATE_UINT32(gicd_ctlr, GICv3State),
  204. VMSTATE_UINT32_ARRAY(gicd_statusr, GICv3State, 2),
  205. VMSTATE_UINT32_ARRAY(group, GICv3State, GICV3_BMP_SIZE),
  206. VMSTATE_UINT32_ARRAY(grpmod, GICv3State, GICV3_BMP_SIZE),
  207. VMSTATE_UINT32_ARRAY(enabled, GICv3State, GICV3_BMP_SIZE),
  208. VMSTATE_UINT32_ARRAY(pending, GICv3State, GICV3_BMP_SIZE),
  209. VMSTATE_UINT32_ARRAY(active, GICv3State, GICV3_BMP_SIZE),
  210. VMSTATE_UINT32_ARRAY(level, GICv3State, GICV3_BMP_SIZE),
  211. VMSTATE_UINT32_ARRAY(edge_trigger, GICv3State, GICV3_BMP_SIZE),
  212. VMSTATE_UINT8_ARRAY(gicd_ipriority, GICv3State, GICV3_MAXIRQ),
  213. VMSTATE_UINT64_ARRAY(gicd_irouter, GICv3State, GICV3_MAXIRQ),
  214. VMSTATE_UINT32_ARRAY(gicd_nsacr, GICv3State,
  215. DIV_ROUND_UP(GICV3_MAXIRQ, 16)),
  216. VMSTATE_STRUCT_VARRAY_POINTER_UINT32(cpu, GICv3State, num_cpu,
  217. vmstate_gicv3_cpu, GICv3CPUState),
  218. VMSTATE_END_OF_LIST()
  219. },
  220. .subsections = (const VMStateDescription * []) {
  221. &vmstate_gicv3_gicd_no_migration_shift_bug,
  222. NULL
  223. }
  224. };
  225. void gicv3_init_irqs_and_mmio(GICv3State *s, qemu_irq_handler handler,
  226. const MemoryRegionOps *ops, Error **errp)
  227. {
  228. SysBusDevice *sbd = SYS_BUS_DEVICE(s);
  229. int rdist_capacity = 0;
  230. int i;
  231. for (i = 0; i < s->nb_redist_regions; i++) {
  232. rdist_capacity += s->redist_region_count[i];
  233. }
  234. if (rdist_capacity < s->num_cpu) {
  235. error_setg(errp, "Capacity of the redist regions(%d) "
  236. "is less than number of vcpus(%d)",
  237. rdist_capacity, s->num_cpu);
  238. return;
  239. }
  240. /* For the GIC, also expose incoming GPIO lines for PPIs for each CPU.
  241. * GPIO array layout is thus:
  242. * [0..N-1] spi
  243. * [N..N+31] PPIs for CPU 0
  244. * [N+32..N+63] PPIs for CPU 1
  245. * ...
  246. */
  247. i = s->num_irq - GIC_INTERNAL + GIC_INTERNAL * s->num_cpu;
  248. qdev_init_gpio_in(DEVICE(s), handler, i);
  249. for (i = 0; i < s->num_cpu; i++) {
  250. sysbus_init_irq(sbd, &s->cpu[i].parent_irq);
  251. }
  252. for (i = 0; i < s->num_cpu; i++) {
  253. sysbus_init_irq(sbd, &s->cpu[i].parent_fiq);
  254. }
  255. for (i = 0; i < s->num_cpu; i++) {
  256. sysbus_init_irq(sbd, &s->cpu[i].parent_virq);
  257. }
  258. for (i = 0; i < s->num_cpu; i++) {
  259. sysbus_init_irq(sbd, &s->cpu[i].parent_vfiq);
  260. }
  261. memory_region_init_io(&s->iomem_dist, OBJECT(s), ops, s,
  262. "gicv3_dist", 0x10000);
  263. sysbus_init_mmio(sbd, &s->iomem_dist);
  264. s->iomem_redist = g_new0(MemoryRegion, s->nb_redist_regions);
  265. for (i = 0; i < s->nb_redist_regions; i++) {
  266. char *name = g_strdup_printf("gicv3_redist_region[%d]", i);
  267. memory_region_init_io(&s->iomem_redist[i], OBJECT(s),
  268. ops ? &ops[1] : NULL, s, name,
  269. s->redist_region_count[i] * GICV3_REDIST_SIZE);
  270. sysbus_init_mmio(sbd, &s->iomem_redist[i]);
  271. g_free(name);
  272. }
  273. }
  274. static void arm_gicv3_common_realize(DeviceState *dev, Error **errp)
  275. {
  276. GICv3State *s = ARM_GICV3_COMMON(dev);
  277. int i;
  278. /* revision property is actually reserved and currently used only in order
  279. * to keep the interface compatible with GICv2 code, avoiding extra
  280. * conditions. However, in future it could be used, for example, if we
  281. * implement GICv4.
  282. */
  283. if (s->revision != 3) {
  284. error_setg(errp, "unsupported GIC revision %d", s->revision);
  285. return;
  286. }
  287. if (s->num_irq > GICV3_MAXIRQ) {
  288. error_setg(errp,
  289. "requested %u interrupt lines exceeds GIC maximum %d",
  290. s->num_irq, GICV3_MAXIRQ);
  291. return;
  292. }
  293. if (s->num_irq < GIC_INTERNAL) {
  294. error_setg(errp,
  295. "requested %u interrupt lines is below GIC minimum %d",
  296. s->num_irq, GIC_INTERNAL);
  297. return;
  298. }
  299. /* ITLinesNumber is represented as (N / 32) - 1, so this is an
  300. * implementation imposed restriction, not an architectural one,
  301. * so we don't have to deal with bitfields where only some of the
  302. * bits in a 32-bit word should be valid.
  303. */
  304. if (s->num_irq % 32) {
  305. error_setg(errp,
  306. "%d interrupt lines unsupported: not divisible by 32",
  307. s->num_irq);
  308. return;
  309. }
  310. s->cpu = g_new0(GICv3CPUState, s->num_cpu);
  311. for (i = 0; i < s->num_cpu; i++) {
  312. CPUState *cpu = qemu_get_cpu(i);
  313. uint64_t cpu_affid;
  314. int last;
  315. s->cpu[i].cpu = cpu;
  316. s->cpu[i].gic = s;
  317. /* Store GICv3CPUState in CPUARMState gicv3state pointer */
  318. gicv3_set_gicv3state(cpu, &s->cpu[i]);
  319. /* Pre-construct the GICR_TYPER:
  320. * For our implementation:
  321. * Top 32 bits are the affinity value of the associated CPU
  322. * CommonLPIAff == 01 (redistributors with same Aff3 share LPI table)
  323. * Processor_Number == CPU index starting from 0
  324. * DPGS == 0 (GICR_CTLR.DPG* not supported)
  325. * Last == 1 if this is the last redistributor in a series of
  326. * contiguous redistributor pages
  327. * DirectLPI == 0 (direct injection of LPIs not supported)
  328. * VLPIS == 0 (virtual LPIs not supported)
  329. * PLPIS == 0 (physical LPIs not supported)
  330. */
  331. cpu_affid = object_property_get_uint(OBJECT(cpu), "mp-affinity", NULL);
  332. last = (i == s->num_cpu - 1);
  333. /* The CPU mp-affinity property is in MPIDR register format; squash
  334. * the affinity bytes into 32 bits as the GICR_TYPER has them.
  335. */
  336. cpu_affid = ((cpu_affid & 0xFF00000000ULL) >> 8) |
  337. (cpu_affid & 0xFFFFFF);
  338. s->cpu[i].gicr_typer = (cpu_affid << 32) |
  339. (1 << 24) |
  340. (i << 8) |
  341. (last << 4);
  342. }
  343. }
  344. static void arm_gicv3_finalize(Object *obj)
  345. {
  346. GICv3State *s = ARM_GICV3_COMMON(obj);
  347. g_free(s->redist_region_count);
  348. }
  349. static void arm_gicv3_common_reset(DeviceState *dev)
  350. {
  351. GICv3State *s = ARM_GICV3_COMMON(dev);
  352. int i;
  353. for (i = 0; i < s->num_cpu; i++) {
  354. GICv3CPUState *cs = &s->cpu[i];
  355. cs->level = 0;
  356. cs->gicr_ctlr = 0;
  357. cs->gicr_statusr[GICV3_S] = 0;
  358. cs->gicr_statusr[GICV3_NS] = 0;
  359. cs->gicr_waker = GICR_WAKER_ProcessorSleep | GICR_WAKER_ChildrenAsleep;
  360. cs->gicr_propbaser = 0;
  361. cs->gicr_pendbaser = 0;
  362. /* If we're resetting a TZ-aware GIC as if secure firmware
  363. * had set it up ready to start a kernel in non-secure, we
  364. * need to set interrupts to group 1 so the kernel can use them.
  365. * Otherwise they reset to group 0 like the hardware.
  366. */
  367. if (s->irq_reset_nonsecure) {
  368. cs->gicr_igroupr0 = 0xffffffff;
  369. } else {
  370. cs->gicr_igroupr0 = 0;
  371. }
  372. cs->gicr_ienabler0 = 0;
  373. cs->gicr_ipendr0 = 0;
  374. cs->gicr_iactiver0 = 0;
  375. cs->edge_trigger = 0xffff;
  376. cs->gicr_igrpmodr0 = 0;
  377. cs->gicr_nsacr = 0;
  378. memset(cs->gicr_ipriorityr, 0, sizeof(cs->gicr_ipriorityr));
  379. cs->hppi.prio = 0xff;
  380. /* State in the CPU interface must *not* be reset here, because it
  381. * is part of the CPU's reset domain, not the GIC device's.
  382. */
  383. }
  384. /* For our implementation affinity routing is always enabled */
  385. if (s->security_extn) {
  386. s->gicd_ctlr = GICD_CTLR_ARE_S | GICD_CTLR_ARE_NS;
  387. } else {
  388. s->gicd_ctlr = GICD_CTLR_DS | GICD_CTLR_ARE;
  389. }
  390. s->gicd_statusr[GICV3_S] = 0;
  391. s->gicd_statusr[GICV3_NS] = 0;
  392. memset(s->group, 0, sizeof(s->group));
  393. memset(s->grpmod, 0, sizeof(s->grpmod));
  394. memset(s->enabled, 0, sizeof(s->enabled));
  395. memset(s->pending, 0, sizeof(s->pending));
  396. memset(s->active, 0, sizeof(s->active));
  397. memset(s->level, 0, sizeof(s->level));
  398. memset(s->edge_trigger, 0, sizeof(s->edge_trigger));
  399. memset(s->gicd_ipriority, 0, sizeof(s->gicd_ipriority));
  400. memset(s->gicd_irouter, 0, sizeof(s->gicd_irouter));
  401. memset(s->gicd_nsacr, 0, sizeof(s->gicd_nsacr));
  402. /* GICD_IROUTER are UNKNOWN at reset so in theory the guest must
  403. * write these to get sane behaviour and we need not populate the
  404. * pointer cache here; however having the cache be different for
  405. * "happened to be 0 from reset" and "guest wrote 0" would be
  406. * too confusing.
  407. */
  408. gicv3_cache_all_target_cpustates(s);
  409. if (s->irq_reset_nonsecure) {
  410. /* If we're resetting a TZ-aware GIC as if secure firmware
  411. * had set it up ready to start a kernel in non-secure, we
  412. * need to set interrupts to group 1 so the kernel can use them.
  413. * Otherwise they reset to group 0 like the hardware.
  414. */
  415. for (i = GIC_INTERNAL; i < s->num_irq; i++) {
  416. gicv3_gicd_group_set(s, i);
  417. }
  418. }
  419. s->gicd_no_migration_shift_bug = true;
  420. }
  421. static void arm_gic_common_linux_init(ARMLinuxBootIf *obj,
  422. bool secure_boot)
  423. {
  424. GICv3State *s = ARM_GICV3_COMMON(obj);
  425. if (s->security_extn && !secure_boot) {
  426. /* We're directly booting a kernel into NonSecure. If this GIC
  427. * implements the security extensions then we must configure it
  428. * to have all the interrupts be NonSecure (this is a job that
  429. * is done by the Secure boot firmware in real hardware, and in
  430. * this mode QEMU is acting as a minimalist firmware-and-bootloader
  431. * equivalent).
  432. */
  433. s->irq_reset_nonsecure = true;
  434. }
  435. }
  436. static Property arm_gicv3_common_properties[] = {
  437. DEFINE_PROP_UINT32("num-cpu", GICv3State, num_cpu, 1),
  438. DEFINE_PROP_UINT32("num-irq", GICv3State, num_irq, 32),
  439. DEFINE_PROP_UINT32("revision", GICv3State, revision, 3),
  440. DEFINE_PROP_BOOL("has-security-extensions", GICv3State, security_extn, 0),
  441. DEFINE_PROP_ARRAY("redist-region-count", GICv3State, nb_redist_regions,
  442. redist_region_count, qdev_prop_uint32, uint32_t),
  443. DEFINE_PROP_END_OF_LIST(),
  444. };
  445. static void arm_gicv3_common_class_init(ObjectClass *klass, void *data)
  446. {
  447. DeviceClass *dc = DEVICE_CLASS(klass);
  448. ARMLinuxBootIfClass *albifc = ARM_LINUX_BOOT_IF_CLASS(klass);
  449. dc->reset = arm_gicv3_common_reset;
  450. dc->realize = arm_gicv3_common_realize;
  451. dc->props = arm_gicv3_common_properties;
  452. dc->vmsd = &vmstate_gicv3;
  453. albifc->arm_linux_init = arm_gic_common_linux_init;
  454. }
  455. static const TypeInfo arm_gicv3_common_type = {
  456. .name = TYPE_ARM_GICV3_COMMON,
  457. .parent = TYPE_SYS_BUS_DEVICE,
  458. .instance_size = sizeof(GICv3State),
  459. .class_size = sizeof(ARMGICv3CommonClass),
  460. .class_init = arm_gicv3_common_class_init,
  461. .instance_finalize = arm_gicv3_finalize,
  462. .abstract = true,
  463. .interfaces = (InterfaceInfo []) {
  464. { TYPE_ARM_LINUX_BOOT_IF },
  465. { },
  466. },
  467. };
  468. static void register_types(void)
  469. {
  470. type_register_static(&arm_gicv3_common_type);
  471. }
  472. type_init(register_types)