xref: /openbmc/qemu/hw/ppc/spapr_irq.c (revision f550805d)
1 /*
2  * QEMU PowerPC sPAPR IRQ interface
3  *
4  * Copyright (c) 2018, IBM Corporation.
5  *
6  * This code is licensed under the GPL version 2 or later. See the
7  * COPYING file in the top-level directory.
8  */
9 
10 #include "qemu/osdep.h"
11 #include "qemu/log.h"
12 #include "qemu/error-report.h"
13 #include "qapi/error.h"
14 #include "hw/ppc/spapr.h"
15 #include "hw/ppc/spapr_xive.h"
16 #include "hw/ppc/xics.h"
17 #include "hw/ppc/xics_spapr.h"
18 #include "sysemu/kvm.h"
19 
20 #include "trace.h"
21 
22 void spapr_irq_msi_init(sPAPRMachineState *spapr, uint32_t nr_msis)
23 {
24     spapr->irq_map_nr = nr_msis;
25     spapr->irq_map = bitmap_new(spapr->irq_map_nr);
26 }
27 
28 int spapr_irq_msi_alloc(sPAPRMachineState *spapr, uint32_t num, bool align,
29                         Error **errp)
30 {
31     int irq;
32 
33     /*
34      * The 'align_mask' parameter of bitmap_find_next_zero_area()
35      * should be one less than a power of 2; 0 means no
36      * alignment. Adapt the 'align' value of the former allocator
37      * to fit the requirements of bitmap_find_next_zero_area()
38      */
39     align -= 1;
40 
41     irq = bitmap_find_next_zero_area(spapr->irq_map, spapr->irq_map_nr, 0, num,
42                                      align);
43     if (irq == spapr->irq_map_nr) {
44         error_setg(errp, "can't find a free %d-IRQ block", num);
45         return -1;
46     }
47 
48     bitmap_set(spapr->irq_map, irq, num);
49 
50     return irq + SPAPR_IRQ_MSI;
51 }
52 
53 void spapr_irq_msi_free(sPAPRMachineState *spapr, int irq, uint32_t num)
54 {
55     bitmap_clear(spapr->irq_map, irq - SPAPR_IRQ_MSI, num);
56 }
57 
58 void spapr_irq_msi_reset(sPAPRMachineState *spapr)
59 {
60     bitmap_clear(spapr->irq_map, 0, spapr->irq_map_nr);
61 }
62 
63 
64 /*
65  * XICS IRQ backend.
66  */
67 
68 static ICSState *spapr_ics_create(sPAPRMachineState *spapr,
69                                   const char *type_ics,
70                                   int nr_irqs, Error **errp)
71 {
72     Error *local_err = NULL;
73     Object *obj;
74 
75     obj = object_new(type_ics);
76     object_property_add_child(OBJECT(spapr), "ics", obj, &error_abort);
77     object_property_add_const_link(obj, ICS_PROP_XICS, OBJECT(spapr),
78                                    &error_abort);
79     object_property_set_int(obj, nr_irqs, "nr-irqs", &local_err);
80     if (local_err) {
81         goto error;
82     }
83     object_property_set_bool(obj, true, "realized", &local_err);
84     if (local_err) {
85         goto error;
86     }
87 
88     return ICS_BASE(obj);
89 
90 error:
91     error_propagate(errp, local_err);
92     return NULL;
93 }
94 
95 static void spapr_irq_init_xics(sPAPRMachineState *spapr, Error **errp)
96 {
97     MachineState *machine = MACHINE(spapr);
98     int nr_irqs = spapr->irq->nr_irqs;
99     Error *local_err = NULL;
100 
101     if (kvm_enabled()) {
102         if (machine_kernel_irqchip_allowed(machine) &&
103             !xics_kvm_init(spapr, &local_err)) {
104             spapr->icp_type = TYPE_KVM_ICP;
105             spapr->ics = spapr_ics_create(spapr, TYPE_ICS_KVM, nr_irqs,
106                                           &local_err);
107         }
108         if (machine_kernel_irqchip_required(machine) && !spapr->ics) {
109             error_prepend(&local_err,
110                           "kernel_irqchip requested but unavailable: ");
111             goto error;
112         }
113         error_free(local_err);
114         local_err = NULL;
115     }
116 
117     if (!spapr->ics) {
118         xics_spapr_init(spapr);
119         spapr->icp_type = TYPE_ICP;
120         spapr->ics = spapr_ics_create(spapr, TYPE_ICS_SIMPLE, nr_irqs,
121                                       &local_err);
122     }
123 
124 error:
125     error_propagate(errp, local_err);
126 }
127 
128 #define ICS_IRQ_FREE(ics, srcno)   \
129     (!((ics)->irqs[(srcno)].flags & (XICS_FLAGS_IRQ_MASK)))
130 
131 static int spapr_irq_claim_xics(sPAPRMachineState *spapr, int irq, bool lsi,
132                                 Error **errp)
133 {
134     ICSState *ics = spapr->ics;
135 
136     assert(ics);
137 
138     if (!ics_valid_irq(ics, irq)) {
139         error_setg(errp, "IRQ %d is invalid", irq);
140         return -1;
141     }
142 
143     if (!ICS_IRQ_FREE(ics, irq - ics->offset)) {
144         error_setg(errp, "IRQ %d is not free", irq);
145         return -1;
146     }
147 
148     ics_set_irq_type(ics, irq - ics->offset, lsi);
149     return 0;
150 }
151 
152 static void spapr_irq_free_xics(sPAPRMachineState *spapr, int irq, int num)
153 {
154     ICSState *ics = spapr->ics;
155     uint32_t srcno = irq - ics->offset;
156     int i;
157 
158     if (ics_valid_irq(ics, irq)) {
159         trace_spapr_irq_free(0, irq, num);
160         for (i = srcno; i < srcno + num; ++i) {
161             if (ICS_IRQ_FREE(ics, i)) {
162                 trace_spapr_irq_free_warn(0, i);
163             }
164             memset(&ics->irqs[i], 0, sizeof(ICSIRQState));
165         }
166     }
167 }
168 
169 static qemu_irq spapr_qirq_xics(sPAPRMachineState *spapr, int irq)
170 {
171     ICSState *ics = spapr->ics;
172     uint32_t srcno = irq - ics->offset;
173 
174     if (ics_valid_irq(ics, irq)) {
175         return spapr->qirqs[srcno];
176     }
177 
178     return NULL;
179 }
180 
181 static void spapr_irq_print_info_xics(sPAPRMachineState *spapr, Monitor *mon)
182 {
183     CPUState *cs;
184 
185     CPU_FOREACH(cs) {
186         PowerPCCPU *cpu = POWERPC_CPU(cs);
187 
188         icp_pic_print_info(cpu->icp, mon);
189     }
190 
191     ics_pic_print_info(spapr->ics, mon);
192 }
193 
194 static void spapr_irq_cpu_intc_create_xics(sPAPRMachineState *spapr,
195                                            PowerPCCPU *cpu, Error **errp)
196 {
197     Error *local_err = NULL;
198     Object *obj;
199 
200     obj = icp_create(OBJECT(cpu), spapr->icp_type, XICS_FABRIC(spapr),
201                      &local_err);
202     if (local_err) {
203         error_propagate(errp, local_err);
204         return;
205     }
206 
207     cpu->icp = ICP(obj);
208 }
209 
210 static int spapr_irq_post_load_xics(sPAPRMachineState *spapr, int version_id)
211 {
212     if (!object_dynamic_cast(OBJECT(spapr->ics), TYPE_ICS_KVM)) {
213         CPUState *cs;
214         CPU_FOREACH(cs) {
215             PowerPCCPU *cpu = POWERPC_CPU(cs);
216             icp_resend(cpu->icp);
217         }
218     }
219     return 0;
220 }
221 
222 static void spapr_irq_set_irq_xics(void *opaque, int srcno, int val)
223 {
224     sPAPRMachineState *spapr = opaque;
225     MachineState *machine = MACHINE(opaque);
226 
227     if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) {
228         ics_kvm_set_irq(spapr->ics, srcno, val);
229     } else {
230         ics_simple_set_irq(spapr->ics, srcno, val);
231     }
232 }
233 
234 static void spapr_irq_reset_xics(sPAPRMachineState *spapr, Error **errp)
235 {
236     /* TODO: create the KVM XICS device */
237 }
238 
239 #define SPAPR_IRQ_XICS_NR_IRQS     0x1000
240 #define SPAPR_IRQ_XICS_NR_MSIS     \
241     (XICS_IRQ_BASE + SPAPR_IRQ_XICS_NR_IRQS - SPAPR_IRQ_MSI)
242 
243 sPAPRIrq spapr_irq_xics = {
244     .nr_irqs     = SPAPR_IRQ_XICS_NR_IRQS,
245     .nr_msis     = SPAPR_IRQ_XICS_NR_MSIS,
246     .ov5         = SPAPR_OV5_XIVE_LEGACY,
247 
248     .init        = spapr_irq_init_xics,
249     .claim       = spapr_irq_claim_xics,
250     .free        = spapr_irq_free_xics,
251     .qirq        = spapr_qirq_xics,
252     .print_info  = spapr_irq_print_info_xics,
253     .dt_populate = spapr_dt_xics,
254     .cpu_intc_create = spapr_irq_cpu_intc_create_xics,
255     .post_load   = spapr_irq_post_load_xics,
256     .reset       = spapr_irq_reset_xics,
257     .set_irq     = spapr_irq_set_irq_xics,
258 };
259 
260 /*
261  * XIVE IRQ backend.
262  */
263 static void spapr_irq_init_xive(sPAPRMachineState *spapr, Error **errp)
264 {
265     MachineState *machine = MACHINE(spapr);
266     uint32_t nr_servers = spapr_max_server_number(spapr);
267     DeviceState *dev;
268     int i;
269 
270     /* KVM XIVE device not yet available */
271     if (kvm_enabled()) {
272         if (machine_kernel_irqchip_required(machine)) {
273             error_setg(errp, "kernel_irqchip requested. no KVM XIVE support");
274             return;
275         }
276     }
277 
278     dev = qdev_create(NULL, TYPE_SPAPR_XIVE);
279     qdev_prop_set_uint32(dev, "nr-irqs", spapr->irq->nr_irqs);
280     /*
281      * 8 XIVE END structures per CPU. One for each available priority
282      */
283     qdev_prop_set_uint32(dev, "nr-ends", nr_servers << 3);
284     qdev_init_nofail(dev);
285 
286     spapr->xive = SPAPR_XIVE(dev);
287 
288     /* Enable the CPU IPIs */
289     for (i = 0; i < nr_servers; ++i) {
290         spapr_xive_irq_claim(spapr->xive, SPAPR_IRQ_IPI + i, false);
291     }
292 
293     spapr_xive_hcall_init(spapr);
294 }
295 
296 static int spapr_irq_claim_xive(sPAPRMachineState *spapr, int irq, bool lsi,
297                                 Error **errp)
298 {
299     if (!spapr_xive_irq_claim(spapr->xive, irq, lsi)) {
300         error_setg(errp, "IRQ %d is invalid", irq);
301         return -1;
302     }
303     return 0;
304 }
305 
306 static void spapr_irq_free_xive(sPAPRMachineState *spapr, int irq, int num)
307 {
308     int i;
309 
310     for (i = irq; i < irq + num; ++i) {
311         spapr_xive_irq_free(spapr->xive, i);
312     }
313 }
314 
315 static qemu_irq spapr_qirq_xive(sPAPRMachineState *spapr, int irq)
316 {
317     sPAPRXive *xive = spapr->xive;
318 
319     if (irq >= xive->nr_irqs) {
320         return NULL;
321     }
322 
323     /* The sPAPR machine/device should have claimed the IRQ before */
324     assert(xive_eas_is_valid(&xive->eat[irq]));
325 
326     return spapr->qirqs[irq];
327 }
328 
329 static void spapr_irq_print_info_xive(sPAPRMachineState *spapr,
330                                       Monitor *mon)
331 {
332     CPUState *cs;
333 
334     CPU_FOREACH(cs) {
335         PowerPCCPU *cpu = POWERPC_CPU(cs);
336 
337         xive_tctx_pic_print_info(cpu->tctx, mon);
338     }
339 
340     spapr_xive_pic_print_info(spapr->xive, mon);
341 }
342 
343 static void spapr_irq_cpu_intc_create_xive(sPAPRMachineState *spapr,
344                                            PowerPCCPU *cpu, Error **errp)
345 {
346     Error *local_err = NULL;
347     Object *obj;
348 
349     obj = xive_tctx_create(OBJECT(cpu), XIVE_ROUTER(spapr->xive), &local_err);
350     if (local_err) {
351         error_propagate(errp, local_err);
352         return;
353     }
354 
355     cpu->tctx = XIVE_TCTX(obj);
356 
357     /*
358      * (TCG) Early setting the OS CAM line for hotplugged CPUs as they
359      * don't beneficiate from the reset of the XIVE IRQ backend
360      */
361     spapr_xive_set_tctx_os_cam(cpu->tctx);
362 }
363 
364 static int spapr_irq_post_load_xive(sPAPRMachineState *spapr, int version_id)
365 {
366     return 0;
367 }
368 
369 static void spapr_irq_reset_xive(sPAPRMachineState *spapr, Error **errp)
370 {
371     CPUState *cs;
372 
373     CPU_FOREACH(cs) {
374         PowerPCCPU *cpu = POWERPC_CPU(cs);
375 
376         /* (TCG) Set the OS CAM line of the thread interrupt context. */
377         spapr_xive_set_tctx_os_cam(cpu->tctx);
378     }
379 
380     /* Activate the XIVE MMIOs */
381     spapr_xive_mmio_set_enabled(spapr->xive, true);
382 }
383 
384 static void spapr_irq_set_irq_xive(void *opaque, int srcno, int val)
385 {
386     sPAPRMachineState *spapr = opaque;
387 
388     xive_source_set_irq(&spapr->xive->source, srcno, val);
389 }
390 
391 /*
392  * XIVE uses the full IRQ number space. Set it to 8K to be compatible
393  * with XICS.
394  */
395 
396 #define SPAPR_IRQ_XIVE_NR_IRQS     0x2000
397 #define SPAPR_IRQ_XIVE_NR_MSIS     (SPAPR_IRQ_XIVE_NR_IRQS - SPAPR_IRQ_MSI)
398 
399 sPAPRIrq spapr_irq_xive = {
400     .nr_irqs     = SPAPR_IRQ_XIVE_NR_IRQS,
401     .nr_msis     = SPAPR_IRQ_XIVE_NR_MSIS,
402     .ov5         = SPAPR_OV5_XIVE_EXPLOIT,
403 
404     .init        = spapr_irq_init_xive,
405     .claim       = spapr_irq_claim_xive,
406     .free        = spapr_irq_free_xive,
407     .qirq        = spapr_qirq_xive,
408     .print_info  = spapr_irq_print_info_xive,
409     .dt_populate = spapr_dt_xive,
410     .cpu_intc_create = spapr_irq_cpu_intc_create_xive,
411     .post_load   = spapr_irq_post_load_xive,
412     .reset       = spapr_irq_reset_xive,
413     .set_irq     = spapr_irq_set_irq_xive,
414 };
415 
416 /*
417  * Dual XIVE and XICS IRQ backend.
418  *
419  * Both interrupt mode, XIVE and XICS, objects are created but the
420  * machine starts in legacy interrupt mode (XICS). It can be changed
421  * by the CAS negotiation process and, in that case, the new mode is
422  * activated after an extra machine reset.
423  */
424 
425 /*
426  * Returns the sPAPR IRQ backend negotiated by CAS. XICS is the
427  * default.
428  */
429 static sPAPRIrq *spapr_irq_current(sPAPRMachineState *spapr)
430 {
431     return spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT) ?
432         &spapr_irq_xive : &spapr_irq_xics;
433 }
434 
435 static void spapr_irq_init_dual(sPAPRMachineState *spapr, Error **errp)
436 {
437     MachineState *machine = MACHINE(spapr);
438     Error *local_err = NULL;
439 
440     if (kvm_enabled() && machine_kernel_irqchip_allowed(machine)) {
441         error_setg(errp, "No KVM support for the 'dual' machine");
442         return;
443     }
444 
445     spapr_irq_xics.init(spapr, &local_err);
446     if (local_err) {
447         error_propagate(errp, local_err);
448         return;
449     }
450 
451     /*
452      * Align the XICS and the XIVE IRQ number space under QEMU.
453      *
454      * However, the XICS KVM device still considers that the IRQ
455      * numbers should start at XICS_IRQ_BASE (0x1000). Either we
456      * should introduce a KVM device ioctl to set the offset or ignore
457      * the lower 4K numbers when using the get/set ioctl of the XICS
458      * KVM device. The second option seems the least intrusive.
459      */
460     spapr->ics->offset = 0;
461 
462     spapr_irq_xive.init(spapr, &local_err);
463     if (local_err) {
464         error_propagate(errp, local_err);
465         return;
466     }
467 }
468 
469 static int spapr_irq_claim_dual(sPAPRMachineState *spapr, int irq, bool lsi,
470                                 Error **errp)
471 {
472     Error *local_err = NULL;
473     int ret;
474 
475     ret = spapr_irq_xics.claim(spapr, irq, lsi, &local_err);
476     if (local_err) {
477         error_propagate(errp, local_err);
478         return ret;
479     }
480 
481     ret = spapr_irq_xive.claim(spapr, irq, lsi, &local_err);
482     if (local_err) {
483         error_propagate(errp, local_err);
484         return ret;
485     }
486 
487     return ret;
488 }
489 
490 static void spapr_irq_free_dual(sPAPRMachineState *spapr, int irq, int num)
491 {
492     spapr_irq_xics.free(spapr, irq, num);
493     spapr_irq_xive.free(spapr, irq, num);
494 }
495 
496 static qemu_irq spapr_qirq_dual(sPAPRMachineState *spapr, int irq)
497 {
498     sPAPRXive *xive = spapr->xive;
499     ICSState *ics = spapr->ics;
500 
501     if (irq >= spapr->irq->nr_irqs) {
502         return NULL;
503     }
504 
505     /*
506      * The IRQ number should have been claimed under both interrupt
507      * controllers.
508      */
509     assert(!ICS_IRQ_FREE(ics, irq - ics->offset));
510     assert(xive_eas_is_valid(&xive->eat[irq]));
511 
512     return spapr->qirqs[irq];
513 }
514 
515 static void spapr_irq_print_info_dual(sPAPRMachineState *spapr, Monitor *mon)
516 {
517     spapr_irq_current(spapr)->print_info(spapr, mon);
518 }
519 
520 static void spapr_irq_dt_populate_dual(sPAPRMachineState *spapr,
521                                        uint32_t nr_servers, void *fdt,
522                                        uint32_t phandle)
523 {
524     spapr_irq_current(spapr)->dt_populate(spapr, nr_servers, fdt, phandle);
525 }
526 
527 static void spapr_irq_cpu_intc_create_dual(sPAPRMachineState *spapr,
528                                            PowerPCCPU *cpu, Error **errp)
529 {
530     Error *local_err = NULL;
531 
532     spapr_irq_xive.cpu_intc_create(spapr, cpu, &local_err);
533     if (local_err) {
534         error_propagate(errp, local_err);
535         return;
536     }
537 
538     spapr_irq_xics.cpu_intc_create(spapr, cpu, errp);
539 }
540 
541 static int spapr_irq_post_load_dual(sPAPRMachineState *spapr, int version_id)
542 {
543     /*
544      * Force a reset of the XIVE backend after migration. The machine
545      * defaults to XICS at startup.
546      */
547     if (spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT)) {
548         spapr_irq_xive.reset(spapr, &error_fatal);
549     }
550 
551     return spapr_irq_current(spapr)->post_load(spapr, version_id);
552 }
553 
554 static void spapr_irq_reset_dual(sPAPRMachineState *spapr, Error **errp)
555 {
556     /*
557      * Deactivate the XIVE MMIOs. The XIVE backend will reenable them
558      * if selected.
559      */
560     spapr_xive_mmio_set_enabled(spapr->xive, false);
561 
562     spapr_irq_current(spapr)->reset(spapr, errp);
563 }
564 
565 static void spapr_irq_set_irq_dual(void *opaque, int srcno, int val)
566 {
567     sPAPRMachineState *spapr = opaque;
568 
569     spapr_irq_current(spapr)->set_irq(spapr, srcno, val);
570 }
571 
572 /*
573  * Define values in sync with the XIVE and XICS backend
574  */
575 #define SPAPR_IRQ_DUAL_NR_IRQS     0x2000
576 #define SPAPR_IRQ_DUAL_NR_MSIS     (SPAPR_IRQ_DUAL_NR_IRQS - SPAPR_IRQ_MSI)
577 
578 sPAPRIrq spapr_irq_dual = {
579     .nr_irqs     = SPAPR_IRQ_DUAL_NR_IRQS,
580     .nr_msis     = SPAPR_IRQ_DUAL_NR_MSIS,
581     .ov5         = SPAPR_OV5_XIVE_BOTH,
582 
583     .init        = spapr_irq_init_dual,
584     .claim       = spapr_irq_claim_dual,
585     .free        = spapr_irq_free_dual,
586     .qirq        = spapr_qirq_dual,
587     .print_info  = spapr_irq_print_info_dual,
588     .dt_populate = spapr_irq_dt_populate_dual,
589     .cpu_intc_create = spapr_irq_cpu_intc_create_dual,
590     .post_load   = spapr_irq_post_load_dual,
591     .reset       = spapr_irq_reset_dual,
592     .set_irq     = spapr_irq_set_irq_dual
593 };
594 
595 /*
596  * sPAPR IRQ frontend routines for devices
597  */
598 void spapr_irq_init(sPAPRMachineState *spapr, Error **errp)
599 {
600     /* Initialize the MSI IRQ allocator. */
601     if (!SPAPR_MACHINE_GET_CLASS(spapr)->legacy_irq_allocation) {
602         spapr_irq_msi_init(spapr, spapr->irq->nr_msis);
603     }
604 
605     spapr->irq->init(spapr, errp);
606 
607     spapr->qirqs = qemu_allocate_irqs(spapr->irq->set_irq, spapr,
608                                       spapr->irq->nr_irqs);
609 }
610 
611 int spapr_irq_claim(sPAPRMachineState *spapr, int irq, bool lsi, Error **errp)
612 {
613     return spapr->irq->claim(spapr, irq, lsi, errp);
614 }
615 
616 void spapr_irq_free(sPAPRMachineState *spapr, int irq, int num)
617 {
618     spapr->irq->free(spapr, irq, num);
619 }
620 
621 qemu_irq spapr_qirq(sPAPRMachineState *spapr, int irq)
622 {
623     return spapr->irq->qirq(spapr, irq);
624 }
625 
626 int spapr_irq_post_load(sPAPRMachineState *spapr, int version_id)
627 {
628     return spapr->irq->post_load(spapr, version_id);
629 }
630 
631 void spapr_irq_reset(sPAPRMachineState *spapr, Error **errp)
632 {
633     if (spapr->irq->reset) {
634         spapr->irq->reset(spapr, errp);
635     }
636 }
637 
638 /*
639  * XICS legacy routines - to deprecate one day
640  */
641 
642 static int ics_find_free_block(ICSState *ics, int num, int alignnum)
643 {
644     int first, i;
645 
646     for (first = 0; first < ics->nr_irqs; first += alignnum) {
647         if (num > (ics->nr_irqs - first)) {
648             return -1;
649         }
650         for (i = first; i < first + num; ++i) {
651             if (!ICS_IRQ_FREE(ics, i)) {
652                 break;
653             }
654         }
655         if (i == (first + num)) {
656             return first;
657         }
658     }
659 
660     return -1;
661 }
662 
663 int spapr_irq_find(sPAPRMachineState *spapr, int num, bool align, Error **errp)
664 {
665     ICSState *ics = spapr->ics;
666     int first = -1;
667 
668     assert(ics);
669 
670     /*
671      * MSIMesage::data is used for storing VIRQ so
672      * it has to be aligned to num to support multiple
673      * MSI vectors. MSI-X is not affected by this.
674      * The hint is used for the first IRQ, the rest should
675      * be allocated continuously.
676      */
677     if (align) {
678         assert((num == 1) || (num == 2) || (num == 4) ||
679                (num == 8) || (num == 16) || (num == 32));
680         first = ics_find_free_block(ics, num, num);
681     } else {
682         first = ics_find_free_block(ics, num, 1);
683     }
684 
685     if (first < 0) {
686         error_setg(errp, "can't find a free %d-IRQ block", num);
687         return -1;
688     }
689 
690     return first + ics->offset;
691 }
692 
693 #define SPAPR_IRQ_XICS_LEGACY_NR_IRQS     0x400
694 
695 sPAPRIrq spapr_irq_xics_legacy = {
696     .nr_irqs     = SPAPR_IRQ_XICS_LEGACY_NR_IRQS,
697     .nr_msis     = SPAPR_IRQ_XICS_LEGACY_NR_IRQS,
698     .ov5         = SPAPR_OV5_XIVE_LEGACY,
699 
700     .init        = spapr_irq_init_xics,
701     .claim       = spapr_irq_claim_xics,
702     .free        = spapr_irq_free_xics,
703     .qirq        = spapr_qirq_xics,
704     .print_info  = spapr_irq_print_info_xics,
705     .dt_populate = spapr_dt_xics,
706     .cpu_intc_create = spapr_irq_cpu_intc_create_xics,
707     .post_load   = spapr_irq_post_load_xics,
708     .set_irq     = spapr_irq_set_irq_xics,
709 };
710