qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-ppc] [PATCH 21/25] spapr: introduce a helper to map the XIVE memor


From: Cédric Le Goater
Subject: [Qemu-ppc] [PATCH 21/25] spapr: introduce a helper to map the XIVE memory regions
Date: Thu, 23 Nov 2017 14:29:51 +0100

When the XIVE interrupt mode is activated, the machine needs to expose
to the guest the MMIO regions use by the controller :

  - Event State Buffer (ESB)
  - Thread Interrupt Management Area (TIMA)

Migration will also need to reflect the current interrupt mode in use.

Signed-off-by: Cédric Le Goater <address@hidden>
---
 hw/intc/spapr_xive_hcall.c  | 14 ++++++++++++++
 hw/ppc/spapr.c              |  5 +++++
 include/hw/ppc/spapr_xive.h |  1 +
 3 files changed, 20 insertions(+)

diff --git a/hw/intc/spapr_xive_hcall.c b/hw/intc/spapr_xive_hcall.c
index 60c6c9f4be8f..ba217144878e 100644
--- a/hw/intc/spapr_xive_hcall.c
+++ b/hw/intc/spapr_xive_hcall.c
@@ -933,3 +933,17 @@ void spapr_xive_populate(sPAPRMachineState *spapr, int 
nr_servers,
     _FDT(fdt_setprop(fdt, 0, "ibm,plat-res-int-priorities",
                      plat_res_int_priorities, 
sizeof(plat_res_int_priorities)));
 }
+
+void spapr_xive_mmio_map(sPAPRMachineState *spapr)
+{
+    sPAPRXive *xive = spapr->xive;
+
+    /* ESBs */
+    sysbus_mmio_map(SYS_BUS_DEVICE(xive), 0, xive->esb_base);
+
+    /* Thread Management Interrupt Areas */
+    /* TODO: Only map the OS TIMA for the moment. Mapping the whole
+     * region needs some rework in the handlers */
+    sysbus_mmio_map(SYS_BUS_DEVICE(xive), 1,
+                    xive->tm_base + (1 << xive->tm_shift));
+}
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 3a62369883cc..734706c18cb3 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1132,6 +1132,7 @@ static void *spapr_build_fdt(sPAPRMachineState *spapr,
     } else {
         /* Populate device tree for XIVE */
         spapr_xive_populate(spapr, xics_max_server_number(), fdt, 
PHANDLE_XICP);
+        spapr_xive_mmio_map(spapr);
     }
 
     ret = spapr_populate_memory(spapr, fdt);
@@ -1613,6 +1614,10 @@ static int spapr_post_load(void *opaque, int version_id)
         }
     }
 
+    if (spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT)) {
+        spapr_xive_mmio_map(spapr);
+    }
+
     return err;
 }
 
diff --git a/include/hw/ppc/spapr_xive.h b/include/hw/ppc/spapr_xive.h
index f6d4bf26e06a..88355f7eb643 100644
--- a/include/hw/ppc/spapr_xive.h
+++ b/include/hw/ppc/spapr_xive.h
@@ -84,5 +84,6 @@ typedef struct sPAPRMachineState sPAPRMachineState;
 void spapr_xive_hcall_init(sPAPRMachineState *spapr);
 void spapr_xive_populate(sPAPRMachineState *spapr, int nr_servers, void *fdt,
                          uint32_t phandle);
+void spapr_xive_mmio_map(sPAPRMachineState *spapr);
 
 #endif /* PPC_SPAPR_XIVE_H */
-- 
2.13.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]