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.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 E0380C43331 for ; Fri, 6 Sep 2019 10:01:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B5EF22082C for ; Fri, 6 Sep 2019 10:01:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aJveOCIj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B5EF22082C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LslbX6r0n2mv1t1m+i8z53qNy3CX1w/rF5Fru30aPfk=; b=aJveOCIjQXs7sk IoK2tdjoHgfFXVKA2HT888nOPgz2qks4Q8EC46UTaA8OHkQw+go/vz+Q0pvuDsjJ8QIeFcVNC7HHL B9U8iikT38A+mDKGlDYIB5xl1Klhz1CHhh9kcRg3U9T4RRQ8AXpdHbROcmeAS8yBuRv7QwCq9MXiP wBQ/W66HPW/v0qC8BPpCVU8vSmBzNWAq8arqC1cU1FebxCuEy4TxoJvZloDj76pRK7JPbAjsVX/14 JUMs4o0kh36VabiNC+hlTcPk0i2a6amYqdQ8XevmP7E0k3E4P7wy+BChTdjl1/tjbMs7LKcWRrDBl 5bFBK0tWsaWCwISTyCFw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i6B3T-0008FD-An; Fri, 06 Sep 2019 10:01:23 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i6B3O-0008EF-OM for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2019 10:01:21 +0000 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 B67721570; Fri, 6 Sep 2019 03:01:16 -0700 (PDT) Received: from localhost (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2F8F23F59C; Fri, 6 Sep 2019 03:01:16 -0700 (PDT) Date: Fri, 6 Sep 2019 11:01:14 +0100 From: Andrew Murray To: Abhishek Shah Subject: Re: [PATCH 1/1] PCI: iproc: Invalidate PAXB address mapping before programming it Message-ID: <20190906100114.GE9720@e119886-lin.cambridge.arm.com> References: <20190906035813.24046-1-abhishek.shah@broadcom.com> <20190906083816.GD9720@e119886-lin.cambridge.arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1+81 (426a6c1) (2018-08-26) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190906_030118_883664_5CAFF0BF X-CRM114-Status: GOOD ( 26.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lorenzo Pieralisi , Scott Branden , Ray Jui , open list , BCM Kernel Feedback , linux-pci@vger.kernel.org, Bjorn Helgaas , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 06, 2019 at 02:55:19PM +0530, Abhishek Shah wrote: > Hi Andrew, > > Thanks for the review. Please see my response inline: > > On Fri, Sep 6, 2019 at 2:08 PM Andrew Murray wrote: > > > > 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. > > > > Why is this approach better than resetting the PAXB (I assume that's > > the PCI controller IP)? Wouldn't resetting the PAXB address this issue, > > and ensure that no other configuration is left behind? > > > We normally reset PAXB in the firmware(ATF). But for cases like kexec > kernel boot, > we do not execute any firmware code and directly boot into kernel. > > We could have done PAXB reset in the driver itself as you have suggested here. > But note that this detail could vary for each SoC, because these > registers are not part > of PAXB register space itself, rather exists in a register space responsible for > controlling power to various wrappers in PCIe IP. Normally, this kind > of SoC specific > details are handled in firmware itself, we don't bring them to driver level. OK understood. > > > Or is this related to earlier boot stages loading firmware for the emulated > > downstream endpoints (ep_is_internal)? > > > > Finally, in the case where ep_is_internal do you need to disable anything > > prior to invalidating the mappings? > > > No, ep_is_internal is indicator for PAXC IP. It does not have > mappings as in PAXB. I think I meant !ep_is_internal. I.e. is there possibility of inbound traffic prior to invalidating the mappings. I'd assume not, but that's an assumption. Either way: Reviewed-by: Andrew Murray > > > Regards, > Abhishek > > > > > > Signed-off-by: Abhishek Shah > > > Reviewed-by: Ray Jui > > > Reviewed-by: Vikram Mysore Prakash > > > --- > > > 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) > > > + 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); > > > + > > > if (pcie->need_ob_cfg) { > > > ret = iproc_pcie_map_ranges(pcie, res); > > > if (ret) { > > > > The code changes look good to me. > > > > Thanks, > > > > Andrew Murray > > > > > -- > > > 2.17.1 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel