From patchwork Wed Apr 19 05:14:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 752097 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w79FK5mbwz9s0m for ; Wed, 19 Apr 2017 15:15:49 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="TGY4mmFT"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3w79FK4YchzDqHV for ; Wed, 19 Apr 2017 15:15:49 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="TGY4mmFT"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3w79D80mspzDqBS for ; Wed, 19 Apr 2017 15:14:48 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="TGY4mmFT"; dkim-atps=neutral Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 05B1B2254; Wed, 19 Apr 2017 01:14:46 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Wed, 19 Apr 2017 01:14:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=A3LuupzXdVsErck24uv0Ps+6tihY/RTCRx60mBlpp 9Q=; b=TGY4mmFT8jcHfeHYQ4dJzoDTZ8d0TUmpXRIFfLeDIVseeZOH2TwIZdM0Y DJJwUVQrgFllg6phClXI+FxsU4ALaC3EpVFpouxrqhRLaf3RP2jNtp3IlA3/awHY obSqxej8nIPcXyJyBKZK4onnRpWb3KSJQ6e9H1xjffefueXdJ1BW91m2w9N+7PDW grPSdodm+Ho3VOe6PmQkw4xbapwuZOObLVlm4ZolyrF/EG7e1Ph0UI8NXe3zRy95 GlVB6c1rRXo/Umm+l4Vt073afM+auqMDUF0F7UI6KvXXbYKKHMJsrvPOb8pK/81w BwDFP9Q9yu+AryvBZ1T+bzgrmKzjQ== X-ME-Sender: X-Sasl-enc: s0E+s1/xP9puG8g4avRCEqFkSloCLXesCNIgoYDlCAu8 1492578885 Received: from snap.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 76CE02473E; Wed, 19 Apr 2017 01:14:44 -0400 (EDT) From: Russell Currey To: skiboot@lists.ozlabs.org Date: Wed, 19 Apr 2017 15:14:08 +1000 Message-Id: <20170419051408.26335-6-ruscur@russell.cc> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170419051408.26335-1-ruscur@russell.cc> References: <20170419051408.26335-1-ruscur@russell.cc> Subject: [Skiboot] [PATCH v2 5/5] phb4: Make M32 segment mappings two-to-one 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" PHB4 is currently configured to use half the available PEs due to DD1 limitations, with windows configured to allocate two segments per PE. phb4_map_pe_mmio_window() currently expects segment numbers to map one-to-one with PE numbers, so correct phb_map_pe_mmio_window() to use the two-to-one mapping. Signed-off-by: Russell Currey --- Changes since v1: - reword the commit message thanks to Mikey. --- hw/phb4.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index 5b2bf851..e9c59c52 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -1164,7 +1164,7 @@ static int64_t phb4_map_pe_mmio_window(struct phb *phb, uint16_t segment_num) { struct phb4 *p = phb_to_phb4(phb); - uint64_t mbt0, mbt1, mdt; + uint64_t mbt0, mbt1, mdt0, mdt1; if (pe_number >= p->num_pes) return OPAL_PARAMETER; @@ -1183,11 +1183,15 @@ static int64_t phb4_map_pe_mmio_window(struct phb *phb, if (window_num != 0 || segment_num >= p->max_num_pes) return OPAL_PARAMETER; - mdt = p->mdt_cache[segment_num]; - mdt = SETFIELD(IODA3_MDT_PE_A, mdt, pe_number); - p->mdt_cache[segment_num] = mdt; - phb4_ioda_sel(p, IODA3_TBL_MDT, segment_num, false); - out_be64(p->regs + PHB_IODA_DATA0, mdt); + mdt0 = p->mdt_cache[segment_num << 1]; + mdt1 = p->mdt_cache[(segment_num << 1) + 1]; + mdt0 = SETFIELD(IODA3_MDT_PE_A, mdt0, pe_number); + mdt1 = SETFIELD(IODA3_MDT_PE_A, mdt1, pe_number); + p->mdt_cache[segment_num << 1] = mdt0; + p->mdt_cache[(segment_num << 1) + 1] = mdt1; + phb4_ioda_sel(p, IODA3_TBL_MDT, segment_num << 1, true); + out_be64(p->regs + PHB_IODA_DATA0, mdt0); + out_be64(p->regs + PHB_IODA_DATA0, mdt1); break; case OPAL_M64_WINDOW_TYPE: if (window_num == 0 || window_num >= p->mbt_size)