Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2699773imu; Thu, 17 Jan 2019 20:25:13 -0800 (PST) X-Google-Smtp-Source: ALg8bN58TEeDWGEG/xqHQf6iFIQHmtqEv5iS6QPkNh/7kvI6tgdxKM2A7D9A+rTi5G6ytGmC0Odm X-Received: by 2002:a63:b94c:: with SMTP id v12mr15972499pgo.221.1547785513824; Thu, 17 Jan 2019 20:25:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547785513; cv=none; d=google.com; s=arc-20160816; b=OMunXChWGAxZzzo+613EJFChNh3SscEDbaZ+8RgJ7aoSj6tlmmv4S7WWfkkwLOBiRU 7luPzJvbpGoFf4CYGG9V24rpNmREwnqM0L+I7mNZt1L7fPbNQmrD6LwRfE8b/Ghns72X rSftbHNtsu0E9hJuXHabehoZ96pLmJXHD+0WyHCjrdh5bmJMchPYNRzNw/mNJYkp+ihL LNjK96n1Nv7gVASVnVYRVOe9Cu3eTZ42QGgnVU8j9hLUJm/Gai+h7H74UO8dUevWe3bt 7h3xOgeZjW/bt7VGUb+oAbHBN969vcFoLMDbf1uExQ4cUOir3nZRyucgUBxxWyyrpKV+ wUow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=gd0kst7cuRr2aJzLZ1SyEXPC1v7Rd0v/exoBmWBr5Lk=; b=Jw1i4bQGxhZ0/8/hoNHPVhBqJ7yrI6qbbPjYbPR1en8Lfy4byGr+X/UWHmD8mYAc3+ IddA8yG6GLQ++92Yq0QSFan5Zr6d5lvk8pS7A8OdH5eWhJqiyEuP0KqNvCxEbJMYRpDT uVIGGD+9kcY8E2FPCeXpSy72mWNbHZxvfrP6V8h+Qf+fr02bvyocUx65WZlhQQjzwZyU NLee/Iz8qgXxQcyuxG5LNdPZOSaOi41TGFYrL1gkeJPjQxwwVwj7TUkkkFHS59lsP9I6 /aL0lCOvDqlcV2VNX6hhD/KsLlK8As4lVvXcRK/L8XoiaF9nR5GxERMLRd3pZpQuXrti 0NXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=J6knWjID; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g187si3524457pfc.43.2019.01.17.20.24.58; Thu, 17 Jan 2019 20:25:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=J6knWjID; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727177AbfAREXs (ORCPT + 99 others); Thu, 17 Jan 2019 23:23:48 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:33719 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727105AbfAREXq (ORCPT ); Thu, 17 Jan 2019 23:23:46 -0500 Received: by mail-pf1-f196.google.com with SMTP id c123so5939321pfb.0 for ; Thu, 17 Jan 2019 20:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gd0kst7cuRr2aJzLZ1SyEXPC1v7Rd0v/exoBmWBr5Lk=; b=J6knWjIDQCLGBYyOXOnhUuv743heQ74vXvmaqSmUkO1oZX5huX+onum4NfQtdxgpbb Ft0MKPck9Y6biFY4zI0ebMMZISj8MEh5yqmF1yIMZ3Me+iY5+Jf4OkalnKyPQVsYn7XK YZb1KjhuP0EExGOcK1VRuEJD9k9drzCx6CF7M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gd0kst7cuRr2aJzLZ1SyEXPC1v7Rd0v/exoBmWBr5Lk=; b=UdGBsJSk/FrzAkIfsFdy1sC77k/swiNKjS1xMvNKh05sL9G4bD38YDVQo9WTPJSOes aO+WYronbBg5lObEOvLtVt0y04iLyjH9pD46+jMS0+xOEyUH2NblaGnJxJ9S9KUN11ai 0yltFwvAntkpMadHhJLs87V5TEEdZPPypXKo4SnuJ7UJdu4juD3HeFiMcyUMdMgi9DF/ zUzUYEE9/ah801wj55snfuXk2Pgvse9C5IVZ18KlReCVRjlYpaILOOiSNP75dPJfPozw PrRNqeYAVm0aTksFvIzA2YdzNy4p2ADf12iuZRzCIVrLbGyQAJAPL3Ep8swUPrtChhI8 xNeg== X-Gm-Message-State: AJcUukfEwcRHIlivwwQa/gtdXFZCQcgHxYO+SzSIQOn0kyT7nXzrzL6v Q2hXgj5OIRo1nXE8BoFTFTDxJw== X-Received: by 2002:a63:ab08:: with SMTP id p8mr15772500pgf.87.1547785425262; Thu, 17 Jan 2019 20:23:45 -0800 (PST) Received: from mannams-OptiPlex-7010.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id l19sm7339642pfi.71.2019.01.17.20.23.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Jan 2019 20:23:44 -0800 (PST) From: Srinath Mannam To: Bjorn Helgaas , Lorenzo Pieralisi , Ray Jui , Scott Branden Cc: bcm-kernel-feedback-list@broadcom.com, linux-pci@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Srinath Mannam , Abhishek Shah , Ray Jui Subject: [PATCH 3/3] PCI: iproc: Add PCIe 32bit outbound memory configuration Date: Fri, 18 Jan 2019 09:53:23 +0530 Message-Id: <1547785403-32268-4-git-send-email-srinath.mannam@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1547785403-32268-1-git-send-email-srinath.mannam@broadcom.com> References: <1547785403-32268-1-git-send-email-srinath.mannam@broadcom.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IPROC PCIe RC supports outbound memory mapping with SOC address inside 4GB address boundary, which is 32 bit AXI address. This patch add the support. Signed-off-by: Srinath Mannam Signed-off-by: Abhishek Shah Signed-off-by: Ray Jui Reviewed-by: Scott Branden Reviewed-by: Vikram Prakash --- drivers/pci/controller/pcie-iproc.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c index ee89d56..4d0e63b 100644 --- a/drivers/pci/controller/pcie-iproc.c +++ b/drivers/pci/controller/pcie-iproc.c @@ -982,8 +982,25 @@ static int iproc_pcie_setup_ob(struct iproc_pcie *pcie, u64 axi_addr, resource_size_t window_size = ob_map->window_sizes[size_idx] * SZ_1M; - if (size < window_size) - continue; + /* + * Keep iterating until we reach the last window and + * with the minimal window size at index zero. In this + * case, we take a compromise by mapping it using the + * minimum window size that can be supported + */ + if (size < window_size) { + if (size_idx > 0 || window_idx > 0) + continue; + + /* + * For the corner case of reaching the minimal + * window size that can be supported on the + * last window + */ + axi_addr = ALIGN_DOWN(axi_addr, window_size); + pci_addr = ALIGN_DOWN(pci_addr, window_size); + size = window_size; + } if (!IS_ALIGNED(axi_addr, window_size) || !IS_ALIGNED(pci_addr, window_size)) { -- 2.7.4