From patchwork Tue Apr 3 14:20:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lombard X-Patchwork-Id: 894722 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 ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40FxBd0BP9z9ryG for ; Wed, 4 Apr 2018 03:38:01 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40FxBc5LKDzF2Bx for ; Wed, 4 Apr 2018 03:38:00 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=linux.vnet.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=prvs=0631bfd4ce=clombard@linux.vnet.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40Fx8X5xmNzF29w for ; Wed, 4 Apr 2018 03:36:11 +1000 (AEST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w33EJlRn025516 for ; Tue, 3 Apr 2018 10:20:23 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h4ahnu9t7-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Tue, 03 Apr 2018 10:20:22 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 3 Apr 2018 15:20:20 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 3 Apr 2018 15:20:18 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w33EKHYh31916118; Tue, 3 Apr 2018 14:20:17 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 709224C040; Tue, 3 Apr 2018 15:13:08 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 428B04C05C; Tue, 3 Apr 2018 15:13:08 +0100 (BST) Received: from lombard-w520.nice-meridia.fr.ibm.com (unknown [9.134.171.125]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 3 Apr 2018 15:13:08 +0100 (BST) From: Christophe Lombard To: skiboot@lists.ozlabs.org, fbarrat@linux.vnet.ibm.com, vaibhav@linux.vnet.ibm.com, andrew.donnellan@au1.ibm.com Date: Tue, 3 Apr 2018 16:20:17 +0200 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18040314-0012-0000-0000-000005C683A8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040314-0013-0000-0000-00001942920E Message-Id: <1522765217-25279-1-git-send-email-clombard@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-04-03_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804030149 Subject: [Skiboot] [PATCH] capi: Keep the current mmio windows in the mbt cache table. X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 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" When the phb is used as a CAPI interface, the current mmio windows list is cleaned before adding the capi and the prefetchable memory (M64) windows, which implies that the non-prefetchable BAR is no more configured. This patch allows to set only the mbt bar to pass capi mmio window and to keep, as defined, the other mmio values (M32 and M64). Signed-off-by: Christophe Lombard --- hw/phb4.c | 61 ++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/hw/phb4.c b/hw/phb4.c index e45be01..2f6ca32 100644 --- a/hw/phb4.c +++ b/hw/phb4.c @@ -3829,7 +3829,8 @@ static int64_t enable_capi_mode(struct phb4 *p, uint64_t pe_number, uint32_t capp_eng) { uint64_t reg, start_addr, end_addr, stq_eng, dma_eng; - int i; + uint64_t mbt_0, mbt_1; + int i, entc = -1, entf = -1; /* CAPP Control Register */ xscom_read(p->chip_id, p->pe_xscom + XPEC_NEST_CAPP_CNTL, ®); @@ -3975,41 +3976,43 @@ static int64_t enable_capi_mode(struct phb4 *p, uint64_t pe_number, for (i = 0; i < p->tvt_size; i++) out_be64(p->regs + PHB_IODA_DATA0, p->tve_cache[i]); - /* set mbt bar to pass capi mmio window. First applied cleared - * values to HW - */ - for (i = 0; i < p->mbt_size; i++) { - p->mbt_cache[i][0] = 0; - p->mbt_cache[i][1] = 0; - } - phb4_ioda_sel(p, IODA3_TBL_MBT, 0, true); - for (i = 0; i < p->mbt_size; i++) { - out_be64(p->regs + PHB_IODA_DATA0, p->mbt_cache[i][0]); - out_be64(p->regs + PHB_IODA_DATA0, p->mbt_cache[i][1]); - } - - p->mbt_cache[0][0] = IODA3_MBT0_ENABLE | - IODA3_MBT0_TYPE_M64 | - SETFIELD(IODA3_MBT0_MODE, 0ull, IODA3_MBT0_MODE_SINGLE_PE) | - SETFIELD(IODA3_MBT0_MDT_COLUMN, 0ull, 0) | - (p->mm0_base & IODA3_MBT0_BASE_ADDR); - p->mbt_cache[0][1] = IODA3_MBT1_ENABLE | - ((~(p->mm0_size - 1)) & IODA3_MBT1_MASK) | - SETFIELD(IODA3_MBT1_SINGLE_PE_NUM, 0ull, pe_number); - - p->mbt_cache[1][0] = IODA3_MBT0_ENABLE | - IODA3_MBT0_TYPE_M64 | + /* set mbt bar to pass capi mmio window and keep the other + * mmio values */ + mbt_0 = IODA3_MBT0_ENABLE | IODA3_MBT0_TYPE_M64 | SETFIELD(IODA3_MBT0_MODE, 0ull, IODA3_MBT0_MODE_SINGLE_PE) | SETFIELD(IODA3_MBT0_MDT_COLUMN, 0ull, 0) | (0x0002000000000000ULL & IODA3_MBT0_BASE_ADDR); - p->mbt_cache[1][1] = IODA3_MBT1_ENABLE | + + mbt_1 = IODA3_MBT1_ENABLE | (0x00ff000000000000ULL & IODA3_MBT1_MASK) | SETFIELD(IODA3_MBT1_SINGLE_PE_NUM, 0ull, pe_number); - phb4_ioda_sel(p, IODA3_TBL_MBT, 0, true); for (i = 0; i < p->mbt_size; i++) { - out_be64(p->regs + PHB_IODA_DATA0, p->mbt_cache[i][0]); - out_be64(p->regs + PHB_IODA_DATA0, p->mbt_cache[i][1]); + /* search if the capi mmio window is already present */ + if ((p->mbt_cache[i][0] == mbt_0) && + (p->mbt_cache[i][1] == mbt_1)) { + entc = i; + break; + } + /* search a free entry */ + if ((p->mbt_cache[i][0] == 0) && + (p->mbt_cache[i][1] == 0)) { + if (entf == -1) + entf = i; + } + } + + if ((entc == -1) && (entf == -1)) { + /* this case should never happen */ + PHBERR(p, "CAPP: Failed to add CAPI mmio window\n"); + } else if (entc == -1) { + /* no capi mmio window found, so add it */ + p->mbt_cache[entf][0] = mbt_0; + p->mbt_cache[entf][1] = mbt_1; + + phb4_ioda_sel(p, IODA3_TBL_MBT, 0, true); + out_be64(p->regs + PHB_IODA_DATA0, p->mbt_cache[entf][0]); + out_be64(p->regs + PHB_IODA_DATA0, p->mbt_cache[entf][1]); } phb4_init_capp_errors(p);