From patchwork Thu Nov 10 07:34:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 693087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tDw161Czxz9t1b for ; Thu, 10 Nov 2016 18:39:38 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tDw160QvfzDvj2 for ; Thu, 10 Nov 2016 18:39:38 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tDw0K758fzDvhF for ; Thu, 10 Nov 2016 18:38:57 +1100 (AEDT) Received: from pasglop.au.ibm.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id uAA7Ysa0030578; Thu, 10 Nov 2016 01:35:10 -0600 From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Thu, 10 Nov 2016 18:34:43 +1100 Message-Id: <1478763292-23238-7-git-send-email-benh@kernel.crashing.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478763292-23238-1-git-send-email-benh@kernel.crashing.org> References: <1478763292-23238-1-git-send-email-benh@kernel.crashing.org> Subject: [Skiboot] [PATCH 07/16] xive: Configure forwarding ports X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" In multi-chip environments, the XIVEs need to communicate to each other via these ports, so they need to be configured properly Signed-off-by: Benjamin Herrenschmidt --- hw/xive.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/hw/xive.c b/hw/xive.c index ba32925..a819716 100644 --- a/hw/xive.c +++ b/hw/xive.c @@ -1180,9 +1180,47 @@ static void xive_create_mmio_dt_node(struct xive *x) MAX_INT_ENTRIES); } -static void late_init_one_xive(struct xive *x __unused) +static void xive_setup_forward_ports(struct xive *x, struct proc_chip *remote_chip) { - // XXX Setup fwd ports + struct xive *remote_xive = remote_chip->xive; + uint64_t base = SETFIELD(VSD_MODE, 0ull, VSD_MODE_FORWARD); + uint32_t remote_id = remote_chip->id; + uint64_t nport; + + /* ESB(SBE), EAS(IVT) and END(EQ) point to the notify port */ + nport = ((uint64_t)remote_xive->ic_base) + (1ul << remote_xive->ic_shift); + if (!xive_set_vsd(x, VST_TSEL_IVT, remote_id, base | nport)) + goto error; + if (!xive_set_vsd(x, VST_TSEL_SBE, remote_id, base | nport)) + goto error; + if (!xive_set_vsd(x, VST_TSEL_EQDT, remote_id, base | nport)) + goto error; + + /* NVT/VPD points to the remote NVT MMIO sets */ + if (!xive_set_vsd(x, VST_TSEL_VPDT, remote_id, + base | (uint64_t)remote_xive->pc_base)) + goto error; + return; + + error: + xive_err(x, "Failure configuring forwarding ports\n"); +} + +static void late_init_one_xive(struct xive *x) +{ + struct proc_chip *chip; + + /* We need to setup the cross-chip forward ports. Let's + * iterate all chip and set them up accordingly + */ + for_each_chip(chip) { + /* We skip ourselves or chips without a xive */ + if (chip->xive == x || !chip->xive) + continue; + + /* Setup our forward ports to that chip */ + xive_setup_forward_ports(x, chip); + } } uint32_t xive_alloc_hw_irqs(uint32_t chip_id, uint32_t count, uint32_t align)