Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp6345803ybp; Tue, 15 Oct 2019 13:30:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGb0e/KUHdH7CVRqAunNyPl2ZL4QHdoy4uAiTW27A6romtiI97Pd606WRH3oRo81MOsDZp X-Received: by 2002:a05:6402:1686:: with SMTP id a6mr8482155edv.174.1571171449417; Tue, 15 Oct 2019 13:30:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571171449; cv=none; d=google.com; s=arc-20160816; b=yjpVo0O9ndjik9l/LnaWxxiEUqUh3S8EL+IIpv1nzXdD7CllO2izr6TgNfUflczIzk rvXbYAmoTUpg7HeLpC6zkVwEqEnjyEVU0tT9gT2jVdycEdvM3nMhJaf3hHAYJrvkwT4F +A9V/XXrBMLbiSduRoj6TMMWE/w2LrnL8M7sgNC2qMSWpcFKGAL1oP2iB7DfdJDeu54S cfLKDMgPH8eLU/SceBAq5kW4RW4PXcj/A05dIZjd2aOU9nAC/k6amwYCCc2gw4opk8TJ FQK6vdSy71NXSfyacLxdbv875OGpe/8MvU3Kwg6uzXhVUpkIKleECNBjU2KuKZ6S78X5 pRuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jPIw6WNJGnroteB2KNrbmEB4SKAi/Igil9bV0kjmsAU=; b=nEvWzWAWB/+T9DJrHF5V5JTfLCyM1xKHNWIKL4kH3TOkZ7oYR2r3ODf5cH5P3hn7k0 TiUcXvKPiP+3kObxUxCVUkYkt3u/tvdgyfObs8KgONszDwtQ3RRTARRYHmwjDTme1LqC m+Ip8pfxK+OEXl6U+kLf25w1CLcv4FCSkFt10aCM2KhhV3/kKltrdLdnmkoLDYmfQtHI VNxm7jG5CrIWBW5jtKI2WmBZz+eCQUetcOJXwmEyXoiKukSoPYSjZVFvGj55zs4udfH/ 2a7JnEZNZrAte4dCCCNcMjSbDrewghsChGO4ZjECNCix0O9k7JNpDvvqgCdNXFoMcCdx xwIw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si13939690edk.331.2019.10.15.13.30.25; Tue, 15 Oct 2019 13:30:49 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388182AbfJOQnI (ORCPT + 99 others); Tue, 15 Oct 2019 12:43:08 -0400 Received: from foss.arm.com ([217.140.110.172]:43072 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728083AbfJOQnH (ORCPT ); Tue, 15 Oct 2019 12:43:07 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 09AD6337; Tue, 15 Oct 2019 09:43:07 -0700 (PDT) Received: from e121166-lin.cambridge.arm.com (unknown [10.1.196.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E03A23F68E; Tue, 15 Oct 2019 09:43:05 -0700 (PDT) Date: Tue, 15 Oct 2019 17:43:03 +0100 From: Lorenzo Pieralisi To: Abhishek Shah Cc: Bjorn Helgaas , Ray Jui , Scott Branden , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com Subject: Re: [PATCH 1/1] PCI: iproc: Invalidate PAXB address mapping before programming it Message-ID: <20191015164303.GC25674@e121166-lin.cambridge.arm.com> References: <20190906035813.24046-1-abhishek.shah@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906035813.24046-1-abhishek.shah@broadcom.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 06, 2019 at 09:28:13AM +0530, Abhishek Shah wrote: > Invalidate PAXB inbound/outbound address mapping each time before > programming it. This is helpful for the cases where we need to > reprogram inbound/outbound address mapping without resetting PAXB. > kexec kernel is one such example. This looks like a hack, explain to us please what it actually solves and why a full reset is not necessary. > Signed-off-by: Abhishek Shah > Reviewed-by: Ray Jui > Reviewed-by: Vikram Mysore Prakash Patches are reviewed on public mailing lists, remove tags given on internal reviews - they are not relevant. > --- > drivers/pci/controller/pcie-iproc.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c > index e3ca46497470..99a9521ba7ab 100644 > --- a/drivers/pci/controller/pcie-iproc.c > +++ b/drivers/pci/controller/pcie-iproc.c > @@ -1245,6 +1245,32 @@ static int iproc_pcie_map_dma_ranges(struct iproc_pcie *pcie) > return ret; > } > > +static void iproc_pcie_invalidate_mapping(struct iproc_pcie *pcie) > +{ > + struct iproc_pcie_ib *ib = &pcie->ib; > + struct iproc_pcie_ob *ob = &pcie->ob; > + int idx; > + > + if (pcie->ep_is_internal) What's this check for and why leaving mappings in place is safe for this category of IPs ? > + return; > + > + if (pcie->need_ob_cfg) { > + /* iterate through all OARR mapping regions */ > + for (idx = ob->nr_windows - 1; idx >= 0; idx--) { > + iproc_pcie_write_reg(pcie, > + MAP_REG(IPROC_PCIE_OARR0, idx), 0); > + } > + } > + > + if (pcie->need_ib_cfg) { > + /* iterate through all IARR mapping regions */ > + for (idx = 0; idx < ib->nr_regions; idx++) { > + iproc_pcie_write_reg(pcie, > + MAP_REG(IPROC_PCIE_IARR0, idx), 0); > + } > + } > +} > + > static int iproce_pcie_get_msi(struct iproc_pcie *pcie, > struct device_node *msi_node, > u64 *msi_addr) > @@ -1517,6 +1543,8 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) > iproc_pcie_perst_ctrl(pcie, true); > iproc_pcie_perst_ctrl(pcie, false); > > + iproc_pcie_invalidate_mapping(pcie); It makes more sense to call this in the .shutdown() method if I understand what it does. Lorenzo > if (pcie->need_ob_cfg) { > ret = iproc_pcie_map_ranges(pcie, res); > if (ret) { > -- > 2.17.1 >