From nobody Tue Feb 10 14:49:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1511444719280268.08415349849963; Thu, 23 Nov 2017 05:45:19 -0800 (PST) Received: from localhost ([::1]:44433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHroN-0005I9-Aj for importer@patchew.org; Thu, 23 Nov 2017 08:45:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40034) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eHrca-0002Kh-6f for qemu-devel@nongnu.org; Thu, 23 Nov 2017 08:32:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eHrcW-0003RQ-8Y for qemu-devel@nongnu.org; Thu, 23 Nov 2017 08:32:52 -0500 Received: from 12.mo3.mail-out.ovh.net ([188.165.41.191]:45348) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eHrcW-0003QO-2i for qemu-devel@nongnu.org; Thu, 23 Nov 2017 08:32:48 -0500 Received: from player797.ha.ovh.net (gw6.ovh.net [213.251.189.206]) by mo3.mail-out.ovh.net (Postfix) with ESMTP id AA5FF171BED for ; Thu, 23 Nov 2017 14:32:46 +0100 (CET) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player797.ha.ovh.net (Postfix) with ESMTPSA id 7DE152E0096; Thu, 23 Nov 2017 14:32:41 +0100 (CET) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson , Benjamin Herrenschmidt Date: Thu, 23 Nov 2017 14:29:51 +0100 Message-Id: <20171123132955.1261-22-clg@kaod.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171123132955.1261-1-clg@kaod.org> References: <20171123132955.1261-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 14843301424967027539 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrledtgdefhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 188.165.41.191 Subject: [Qemu-devel] [PATCH 21/25] spapr: introduce a helper to map the XIVE memory regions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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=C3=A9dric Le Goater --- 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_prioriti= es))); } + +void spapr_xive_mmio_map(sPAPRMachineState *spapr) +{ + sPAPRXive *xive =3D 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); } =20 ret =3D spapr_populate_memory(spapr, fdt); @@ -1613,6 +1614,10 @@ static int spapr_post_load(void *opaque, int version= _id) } } =20 + if (spapr_ovec_test(spapr->ov5_cas, OV5_XIVE_EXPLOIT)) { + spapr_xive_mmio_map(spapr); + } + return err; } =20 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 *f= dt, uint32_t phandle); +void spapr_xive_mmio_map(sPAPRMachineState *spapr); =20 #endif /* PPC_SPAPR_XIVE_H */ --=20 2.13.6