From patchwork Mon Apr 10 01:57:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell Currey X-Patchwork-Id: 748811 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 3w1YTP5qnKz9s65 for ; Mon, 10 Apr 2017 12:06: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="exKZM5fv"; 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 3w1YTP4KTzzDqB9 for ; Mon, 10 Apr 2017 12:06: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="exKZM5fv"; 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 3w1YSn0pLBzDq88 for ; Mon, 10 Apr 2017 12:06:17 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="exKZM5fv"; dkim-atps=neutral Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 33432CC0; Sun, 9 Apr 2017 21:58:12 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Sun, 09 Apr 2017 21:58:12 -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=7UbN2Y2+Jx7048mv3y9M46nf6Ml2XGN9/44ICJPEJ xc=; b=exKZM5fv/II+QiNBORJJD8J6NxlOlSuQkUt1iOjRKJhZCx4n6hQPqn6zL Ywuhe8rKRYzil2Fax06XXhCOG2mOHiHulTj3CAudf9O0o1L0Bv0Ial4KK/5FmxMS qMjAgyXYhSfesDBUSq7ezm21Nwm6fRhAgxeALrmnBiJPSsOn3//vvSI3xkfC6uJI hygit4VrTu4YFf+FMWjrJ0b7AH/dDRf7YiBN5YPOjgVShdDL1ONsPLgXkHAu79Ps 6eMucv/13mcev5eXcfb1ghVGPNJFVjnmxEPE4xULYp253RqY/iLMHi+0qZJLmul8 RxPfuftL5EzzsqqV0OzaZeqC2Jx2A== X-ME-Sender: X-Sasl-enc: mVyGgYyrkWZQsXN38Jz240VNVB8xtiL9kyjVtTkMQZgT 1491789491 Received: from snap.ozlabs.ibm.com (unknown [122.99.82.10]) by mail.messagingengine.com (Postfix) with ESMTPA id 9496A24216; Sun, 9 Apr 2017 21:58:10 -0400 (EDT) From: Russell Currey To: skiboot@lists.ozlabs.org Date: Mon, 10 Apr 2017 11:57:37 +1000 Message-Id: <20170410015737.9487-5-ruscur@russell.cc> X-Mailer: git-send-email 2.12.1 In-Reply-To: <20170410015737.9487-1-ruscur@russell.cc> References: <20170410015737.9487-1-ruscur@russell.cc> Subject: [Skiboot] [PATCH 4/4] phb4: Fix M32 window mapping 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 it to use the two-to-one mapping. Signed-off-by: Russell Currey --- hw/phb4.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index 7a212809..767f3d38 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)