From nobody Wed Nov 5 10:33:21 2025 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499275559965792.3689436971802; Wed, 5 Jul 2017 10:25:59 -0700 (PDT) Received: from localhost ([::1]:47332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSo3q-0005XH-NI for importer@patchew.org; Wed, 05 Jul 2017 13:25:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSnu5-0004ey-Lh for qemu-devel@nongnu.org; Wed, 05 Jul 2017 13:15:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSnu1-00040B-LY for qemu-devel@nongnu.org; Wed, 05 Jul 2017 13:15:53 -0400 Received: from 15.mo3.mail-out.ovh.net ([87.98.150.177]:43678) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSnu1-0003xr-EK for qemu-devel@nongnu.org; Wed, 05 Jul 2017 13:15:49 -0400 Received: from player158.ha.ovh.net (b6.ovh.net [213.186.33.56]) by mo3.mail-out.ovh.net (Postfix) with ESMTP id 4A1E8FCCD6 for ; Wed, 5 Jul 2017 19:15:48 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-10652-153.w90-89.abo.wanadoo.fr [90.89.238.153]) (Authenticated sender: clg@kaod.org) by player158.ha.ovh.net (Postfix) with ESMTPSA id 20E8C62007C; Wed, 5 Jul 2017 19:15:42 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: David Gibson Date: Wed, 5 Jul 2017 19:13:31 +0200 Message-Id: <1499274819-15607-19-git-send-email-clg@kaod.org> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1499274819-15607-1-git-send-email-clg@kaod.org> References: <1499274819-15607-1-git-send-email-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 2216896917331020774 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelkedrudeigdduuddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm 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: 87.98.150.177 Subject: [Qemu-devel] [RFC PATCH 18/26] ppc/xive: add device tree support 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?= , qemu-ppc@nongnu.org, Alexander Graf , qemu-devel@nongnu.org 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" As for XICS, the XIVE interface for the guest is described in the device tree under the interrupt controller node. A couple of new properties are specific to XIVE : - "reg" contains the base address and size of the thread interrupt managnement areas (TIMA) for the user level for the OS level. Only the OS level is taken into account. - "ibm,xive-eq-sizes" the size of the event queues. - "ibm,xive-lisn-ranges" the interrupt numbers ranges assigned to the guest. These are allocated using a simple bitmap. Signed-off-by: C=C3=A9dric Le Goater --- hw/intc/xive_spapr.c | 36 ++++++++++++++++++++++++++++++++++++ include/hw/ppc/xive.h | 1 + 2 files changed, 37 insertions(+) diff --git a/hw/intc/xive_spapr.c b/hw/intc/xive_spapr.c index b634d1f28f10..64282cb4bfab 100644 --- a/hw/intc/xive_spapr.c +++ b/hw/intc/xive_spapr.c @@ -743,3 +743,39 @@ void xive_spapr_init(sPAPRMachineState *spapr) spapr_register_hypercall(H_INT_SYNC, h_int_sync); spapr_register_hypercall(H_INT_RESET, h_int_reset); } + +void xive_spapr_populate(XIVE *x, void *fdt) +{ + int node; + uint64_t timas[2 * 2]; + uint32_t lisn_ranges[] =3D { + cpu_to_be32(x->int_ipi_top - x->int_base - x->nr_targets), /* sta= rt */ + cpu_to_be32(x->nr_targets), /* count */ + }; + uint32_t eq_sizes[] =3D { + cpu_to_be32(12), /* 4K */ + cpu_to_be32(16), /* 64K */ + cpu_to_be32(21), /* 2M */ + cpu_to_be32(24), /* 16M */ + }; + int i; + + /* Thread Interrupt Management Areas : User and OS */ + for (i =3D 0; i < 2; i++) { + timas[i * 2] =3D cpu_to_be64(x->tm_base + i * (1 << x->tm_shift)); + timas[i * 2 + 1] =3D cpu_to_be64(1 << x->tm_shift); + } + + _FDT(node =3D fdt_add_subnode(fdt, 0, "interrupt-controller")); + + _FDT(fdt_setprop_string(fdt, node, "name", "interrupt-controller")); + _FDT(fdt_setprop_string(fdt, node, "device_type", "power-ivpe")); + _FDT(fdt_setprop(fdt, node, "reg", timas, sizeof(timas))); + + _FDT(fdt_setprop_string(fdt, node, "compatible", "ibm,power-ivpe")); + _FDT(fdt_setprop_cell(fdt, node, "#interrupt-cells", 2)); + _FDT(fdt_setprop(fdt, node, "ibm,xive-eq-sizes", eq_sizes, + sizeof(eq_sizes))); + _FDT(fdt_setprop(fdt, node, "ibm,xive-lisn-ranges", lisn_ranges, + sizeof(lisn_ranges))); +} diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h index af48d62cc776..288116aeb8f4 100644 --- a/include/hw/ppc/xive.h +++ b/include/hw/ppc/xive.h @@ -66,5 +66,6 @@ struct XiveICPState { typedef struct sPAPRMachineState sPAPRMachineState; =20 void xive_spapr_init(sPAPRMachineState *spapr); +void xive_spapr_populate(XIVE *x, void *fdt); =20 #endif /* PPC_XIVE_H */ --=20 2.7.5