From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 914FCC10F14 for ; Tue, 15 Oct 2019 16:43:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C3D120650 for ; Tue, 15 Oct 2019 16:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728672AbfJOQnH (ORCPT ); Tue, 15 Oct 2019 12:43:07 -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-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 >