From patchwork Sat Jun 23 23:52:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timothy Pearson X-Patchwork-Id: 933819 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@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 41Ctw20ffpz9s2R for ; Sun, 24 Jun 2018 10:48:34 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="Kcu6bNqU"; 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 41Ctw1674vzF0wq for ; Sun, 24 Jun 2018 10:48:33 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="Kcu6bNqU"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=raptorengineering.com (client-ip=192.119.205.245; helo=mail.rptsys.com; envelope-from=tpearson@raptorengineering.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=raptorengineering.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=raptorengineering.com header.i=@raptorengineering.com header.b="Kcu6bNqU"; dkim-atps=neutral Received: from mail.rptsys.com (mail.rptsys.com [192.119.205.245]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41Csp94WkLzF14f for ; Sun, 24 Jun 2018 09:58:25 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by mail.rptsys.com (Postfix) with ESMTP id 15B986428A2; Sat, 23 Jun 2018 18:52:33 -0500 (CDT) Received: from mail.rptsys.com ([127.0.0.1]) by localhost (vali.starlink.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id AQ1QZ927D5uc; Sat, 23 Jun 2018 18:52:31 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by mail.rptsys.com (Postfix) with ESMTP id 670A66428A9; Sat, 23 Jun 2018 18:52:31 -0500 (CDT) DKIM-Filter: OpenDKIM Filter v2.9.2 mail.rptsys.com 670A66428A9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raptorengineering.com; s=B8E824E6-0BE2-11E6-931D-288C65937AAD; t=1529797951; bh=4D5wi8kxunDLSxbQJ4fR37/ZSWDQEQkkQhPeivK+BRo=; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding; b=Kcu6bNqUrW3WFMhUqivJY98th43Rs/P05v2fegA7yPyKdCHmUWMEWOK0r0bYTUAbH KoCh/vs6Xf1kLRR4bevzOpVy+KhbM30jJaimsX3khn+YPByRsiqZ4aa0GLLkdMYzMA fCTxU+ZrVj0eCVtz0VRnjuA/c3O1Q/2gxPjWy6fY= X-Virus-Scanned: amavisd-new at rptsys.com Received: from mail.rptsys.com ([127.0.0.1]) by localhost (vali.starlink.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id SAWbxcMH1uJB; Sat, 23 Jun 2018 18:52:31 -0500 (CDT) Received: from vali.starlink.edu (netrouter.starlink.edu [192.168.3.1]) by mail.rptsys.com (Postfix) with ESMTP id 1FF976428A2; Sat, 23 Jun 2018 18:52:31 -0500 (CDT) Date: Sat, 23 Jun 2018 18:52:30 -0500 (CDT) From: Timothy Pearson To: linuxppc-dev@lists.ozlabs.org Message-ID: <77952537.2569246.1529797950974.JavaMail.zimbra@raptorengineeringinc.com> Subject: [PATCH 1/7] powerpc/powernv/pci: Track largest available TCE order MIME-Version: 1.0 X-Mailer: Zimbra 8.5.0_GA_3042 (ZimbraWebClient - FF3.6 (Linux)/8.5.0_GA_3042) Thread-Topic: powerpc/powernv/pci: Track largest available TCE order Thread-Index: w/cN0CTC+T9U81zi83C5HZaodRl3JA== X-Mailman-Approved-At: Sun, 24 Jun 2018 10:42:17 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Mackerras Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" per PHB Knowing the largest possible TCE size of a PHB is useful, so get it out of the device tree. This relies on the property being added in OPAL. It is assumed that any PHB4 or later machine would be running firmware that implemented this property, and otherwise assumed to be PHB3, which has a maximum TCE order of 28 bits or 256MB TCEs. This is used later in the series. Signed-off-by: Russell Currey --- arch/powerpc/platforms/powernv/pci-ioda.c | 16 ++++++++++++++++ arch/powerpc/platforms/powernv/pci.h | 3 +++ 2 files changed, 19 insertions(+) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index 5bd0eb6681bc..bcb3bfce072a 100644 --- a/arch/powerpc/platforms/powernv/pci-ioda.c +++ b/arch/powerpc/platforms/powernv/pci-ioda.c @@ -3873,11 +3873,13 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, struct resource r; const __be64 *prop64; const __be32 *prop32; + struct property *prop; int len; unsigned int segno; u64 phb_id; void *aux; long rc; + u32 val; if (!of_device_is_available(np)) return; @@ -4016,6 +4018,20 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np, } phb->ioda.pe_array = aux + pemap_off; + phb->ioda.max_tce_order = 0; + // Get TCE order from the DT. If it's not present, assume P8 + if (!of_get_property(np, "ibm,supported-tce-sizes", NULL)) { + phb->ioda.max_tce_order = 28; // assume P8 256mb TCEs + } else { + of_property_for_each_u32(np, "ibm,supported-tce-sizes", prop, + prop32, val) { + if (val > phb->ioda.max_tce_order) + phb->ioda.max_tce_order = val; + } + pr_debug("PHB%llx Found max TCE order of %d bits\n", + phb->opal_id, phb->ioda.max_tce_order); + } + /* * Choose PE number for root bus, which shouldn't have * M64 resources consumed by its child devices. To pick diff --git a/arch/powerpc/platforms/powernv/pci.h b/arch/powerpc/platforms/powernv/pci.h index eada4b6068cb..c9952def5e93 100644 --- a/arch/powerpc/platforms/powernv/pci.h +++ b/arch/powerpc/platforms/powernv/pci.h @@ -173,6 +173,9 @@ struct pnv_phb { struct list_head pe_list; struct mutex pe_list_mutex; + /* Largest supported TCE order bits */ + uint8_t max_tce_order; + /* Reverse map of PEs, indexed by {bus, devfn} */ unsigned int pe_rmap[0x10000]; } ioda;