Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp4605161ima; Mon, 4 Feb 2019 20:58:59 -0800 (PST) X-Google-Smtp-Source: AHgI3IbvxgHTTZwV/CMSjn/otUYv8H0iiLpMfsvc3YSdhvf0E86aeJXhNnVjW6DssjEVq2lOujgH X-Received: by 2002:a63:235f:: with SMTP id u31mr2839211pgm.122.1549342739572; Mon, 04 Feb 2019 20:58:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549342739; cv=none; d=google.com; s=arc-20160816; b=V25uKw6EJBuPxGIr/Uas6FXgNRq5YviIPGudM3JrGcGkoaatVJfQpWd9uanGzux2et fWN+hqtQ1J8cobzEr8ukuyi324NPheyF9V25pS0sJCv97Zmc00+ty4zeJwTwN8zkb+WG vxI9qkFeuqdo+MjLnvtsL0hJ3xQYwI4+QaMzTWOFwPo/M1vQ5FjTsLzwu4WcZ4/WJIj6 VOFy0uuhW66jrBCfL9tvphvk/RXPCBsKYX0YRPguiNwD3asoCYty/tlT9914O+o+kUim 1vhJYx8wQ3VoG3L3cjkFB8U2HFw12NSHFljl21zvjDeDjuy3V/Gb+5ec39cYaW1t02jG 0myA== 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=Zru6go97O+voj3WvByWsomLzeqljS4c2Zg0aKG5L14k=; b=jb4DINIOax10L6dCDohqO3RE6eDAkLK5jxLj6aw8wo6TIaYGSm/Gox06HZl9FAwgmi 0vgO3CKTRg3/UTzUVAH4PYNVlDE4StFAQfIW9kuwedREjLzyUg60mIemHhXFFw0k7hbF 5DhrJZR+M0l0FxJ6YHLxWAS6XRhicSIxPLNyATxbQ8vfqyd1PISD3ZupL19jLmFk0wZt p3OD2USMa7yaDGWDaFZi2ByVc7mIo4VAJEkB8vxKGZ8mVMBrv5qM9IRMIyEvf7nn238E k5bFGGJPareH6LSinJ68YEYT1Z5F+ZUuzhXcrvdL51SDsLJ0y3wbEJtEcmdk1xV7WyLo Mr8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=CR0ODXMl; 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 o61si1522879pld.246.2019.02.04.20.58.43; Mon, 04 Feb 2019 20:58:59 -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=CR0ODXMl; 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 S1727678AbfBEE5z (ORCPT + 99 others); Mon, 4 Feb 2019 23:57:55 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:44630 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727628AbfBEE5x (ORCPT ); Mon, 4 Feb 2019 23:57:53 -0500 Received: by mail-pf1-f196.google.com with SMTP id u6so950501pfh.11 for ; Mon, 04 Feb 2019 20:57:53 -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=Zru6go97O+voj3WvByWsomLzeqljS4c2Zg0aKG5L14k=; b=CR0ODXMlxHlxnhb4EKVfWfp0RxhXihztgOwDvU1TYPUDtJEtroTLkpD4P0H48y9Z/D bchw8yMzyGGzU7uA1xwyrz2jqemhak8/zB2pAvJvM7tHGv/KLMen882kiWcsHJeKelkW 1gZIbe1AtJcc5FK2bU+oD5vYs9G8WZ6R7M2nY= 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=Zru6go97O+voj3WvByWsomLzeqljS4c2Zg0aKG5L14k=; b=fhZiEmOOhMeJcTwwY/ySEwSWkiTKvjcZrRoveO6qG+DihjCoSavKzkFwNfCGzeyxpG yeRzGXwiISHgJBpGhX9IJm2Js1Gpc2stDefBbn96xSWTcGn7jT32bEjXb1ITh7QHoQbi 4b65eDgc7RKNlF7jDUnOdLo6BuTNHAtT6G8smUjhS6JJYaY3Iu0FPi/W4mRDmyfXrHuv Y8plzYenRHUyb2zYVXaxOmlVi3ghoJfUv/m/nvrR1hsgLhZBt15wUqTHVj5Va4S7IWAe bl008nQOTCRD4P2KHQQVnqipvUw9QagRFu/dhsty3MouwnAct6ptbJc+QcE0B/8oVeYb Z/Vw== X-Gm-Message-State: AHQUAubkbNJjhUmsVolyOtmWrzKAdBo5puwoAI08hgERSLyoI/khqFqw I0GIy6Q3rb6rkXv44nhOosgBkw== X-Received: by 2002:a63:be4d:: with SMTP id g13mr2873694pgo.378.1549342673003; Mon, 04 Feb 2019 20:57:53 -0800 (PST) Received: from mannams-OptiPlex-7010.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r76sm2895164pfb.69.2019.02.04.20.57.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 04 Feb 2019 20:57:52 -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 v2 2/2] PCI: iproc: Add PCIe 32bit outbound memory configuration Date: Tue, 5 Feb 2019 10:27:01 +0530 Message-Id: <1549342622-9929-3-git-send-email-srinath.mannam@broadcom.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1549342622-9929-1-git-send-email-srinath.mannam@broadcom.com> References: <1549342622-9929-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 Add configuration to support IPROC PCIe host controller outbound memory window mapping with SOC address range inside 4GB boundary, which is 32 bit AXI address. 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 b882255..080f142 100644 --- a/drivers/pci/controller/pcie-iproc.c +++ b/drivers/pci/controller/pcie-iproc.c @@ -955,8 +955,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