@@ -263,3 +263,16 @@ void spapr_xive_mmio_unmap(sPAPRXive *xive)
sysbus_mmio_unmap(SYS_BUS_DEVICE(xive), 0);
sysbus_mmio_unmap(SYS_BUS_DEVICE(xive), 1);
}
+
+qemu_irq spapr_xive_qirq(sPAPRXive *xive, int lisn)
+{
+ XiveIVE *ive = spapr_xive_get_ive(XIVE_FABRIC(xive), lisn);
+ XiveSource *xsrc = &xive->source;
+
+ if (!ive || !(ive->w & IVE_VALID)) {
+ qemu_log_mask(LOG_GUEST_ERROR, "XIVE: invalid LISN %d\n", lisn);
+ return NULL;
+ }
+
+ return xive_source_qirq(xsrc, lisn - xsrc->offset);
+}
@@ -3941,6 +3941,10 @@ qemu_irq spapr_qirq(sPAPRMachineState *spapr, int irq)
{
ICSState *ics = spapr->ics;
+ if (spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT)) {
+ return spapr_xive_qirq(spapr->xive, irq);
+ }
+
if (ics_valid_irq(ics, irq)) {
return ics->qirqs[irq - ics->offset];
}
@@ -37,6 +37,7 @@ bool spapr_xive_irq_disable(sPAPRXive *xive, uint32_t lisn);
void spapr_xive_pic_print_info(sPAPRXive *xive, Monitor *mon);
void spapr_xive_mmio_map(sPAPRXive *xive);
void spapr_xive_mmio_unmap(sPAPRXive *xive);
+qemu_irq spapr_xive_qirq(sPAPRXive *xive, int lisn);
/*
* sPAPR encoding of EQ indexes
@@ -155,6 +155,12 @@ static inline void xive_source_irq_set(XiveSource *xsrc, uint32_t srcno,
xsrc->status[srcno] |= lsi ? XIVE_STATUS_LSI : 0;
}
+static inline qemu_irq xive_source_qirq(XiveSource *xsrc, uint32_t srcno)
+{
+ assert(srcno < xsrc->nr_irqs);
+ return xsrc->qirqs[srcno];
+}
+
/*
* XIVE Interrupt Presenter
*/
The XIVE object has its own set of qirqs which is to be used when the XIVE exploitation interrupt mode is activated. Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/intc/spapr_xive.c | 13 +++++++++++++ hw/ppc/spapr.c | 4 ++++ include/hw/ppc/spapr_xive.h | 1 + include/hw/ppc/xive.h | 6 ++++++ 4 files changed, 24 insertions(+)