Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1144474ybg; Fri, 18 Oct 2019 12:45:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS0mc7Xh6+Be9aNlH+JH/4wXDJCvAJiooh/wIC0O/yX7Eo6ZAim6KhjDKoEL0H7MsKyUbX X-Received: by 2002:aa7:c301:: with SMTP id l1mr11421086edq.281.1571427947198; Fri, 18 Oct 2019 12:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571427947; cv=none; d=google.com; s=arc-20160816; b=EeC/9GC56rfIsz87J6dmf6oq7OOIFtIHqtpcjeZIEk+ucqmhne4cFPV8/Ab2O6KMDd VVcca9rv4wwwaZWocNkg+4kWOisFmBcuBhmLQZ1LYyzL8vJE3XM2oKSrBClQwJPR8Mby X5T7XHrhoM/3YD1qH81ZNytqO966MhXSlEHwo7WxmJxpAkuyN7vTS+UNGKzXCNbUPf/K VTEhjFD4BBDWaeludQn5V8wJWUzEWUOi/vYFTRf6eOAKnuWiqIjwMYo9qmbjoA1/AhKj j3ns228bZdeJqjQQpFHCRtlb/fWVhnpj4dOwZy45wNbvs8HxGutmhCx+/mRmTdec2oJl 6Big== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=S2aBeWNRxDtTRHfUI9htMJzW/AtuitZvg8GIzAAl28Q=; b=sX1n7Etm1JG9OeT+FYviK/KnFLL961dQ5c9u3r2QfFVrfDG4uqW+EcYRr+eQdgGcAg b1N0Bhu+MU69JOrGRfDJlke6/haSvKB+dKwLTJct+Paj6DTznNrlUkERCPYz4rZoaoDZ nxLkhgYqt78m0v88sOXf0rE0/xOuIDPDJ8eTNxZE1+oABulx2aQHTWj1xt8/LZsXUeBN dsJ6w2tfIZNNe6EUkHCh5yEImnlWEIWwmHE/J3TBINOZNBXp8XLOCr1L2uENvbq6jZDh wpVg6uFBN3AoqShZ8R00Zgp5fvYjjMDUqzGBS5fY+HcyIlkMgwKoUxXVJdCjr3doDGJL GM9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=dBe6Yjax; 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 pk7si3923281ejb.216.2019.10.18.12.45.24; Fri, 18 Oct 2019 12:45:47 -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; dkim=pass header.i=@broadcom.com header.s=google header.b=dBe6Yjax; 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 S2437874AbfJQO2L (ORCPT + 99 others); Thu, 17 Oct 2019 10:28:11 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:34664 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726545AbfJQO2L (ORCPT ); Thu, 17 Oct 2019 10:28:11 -0400 Received: by mail-wm1-f67.google.com with SMTP id y135so7165696wmc.1 for ; Thu, 17 Oct 2019 07:28:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=S2aBeWNRxDtTRHfUI9htMJzW/AtuitZvg8GIzAAl28Q=; b=dBe6YjaxoHZnJhbTRjkiiW25KskKFuyEEzNZwJ3xB0fHdrmMgZNiXJ0YOJz+a9Edna SxqTulViehkQ8MxhZ1JzcAs/0ag5fwwYrZZag4c9ffQFKCW1lCuRXqmzkWQwOGWg0d6V ISljxqOj7xejKJGlCLKqFiRnbm9LJcvM4v4nA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S2aBeWNRxDtTRHfUI9htMJzW/AtuitZvg8GIzAAl28Q=; b=QD8pzHIYjYDfdjasS+1hvtNZlJPTWEtn1UZ19CXF8BplZ6oqmIRWUzZgp3KTkAvkkd qAidHDRAi1YkgkgI8rEiF2fi505OAFcegDz7lcyKk7AY2qeueMFCLIce9Gc+5CbOdDjW D4ng4+6vQnDbgK/N20Gh8rkjI6zNhMSyTLEhTxSZQhGQ4xrFJID5BccK4hN5BZKGR7oS D3CXmXQyK+2+cxU2UzHDybk6XidM9pWC5HArR66qw6LXBSkloCSUce1jfPkgfhkAdm9e EimxKMer9tuNSNFhCVcaVQchu4DUtw0yTXpSv3Xv4yYi1gXbH7JhgCajy26katc2QjL9 uvYQ== X-Gm-Message-State: APjAAAWxH+SFtCvCHJQkdUQYwDesJh+x65YYa7krpXrF+AbHOHGKKUkX b67l5sRhdMCrVHYxI5dRcmZZCMRO+IBb5jeN2TBGVw== X-Received: by 2002:a7b:ce12:: with SMTP id m18mr3107079wmc.108.1571322488120; Thu, 17 Oct 2019 07:28:08 -0700 (PDT) MIME-Version: 1.0 References: <20190906035813.24046-1-abhishek.shah@broadcom.com> <20191015164303.GC25674@e121166-lin.cambridge.arm.com> In-Reply-To: <20191015164303.GC25674@e121166-lin.cambridge.arm.com> From: Abhishek Shah Date: Thu, 17 Oct 2019 19:57:56 +0530 Message-ID: Subject: Re: [PATCH 1/1] PCI: iproc: Invalidate PAXB address mapping before programming it To: Lorenzo Pieralisi Cc: Bjorn Helgaas , Ray Jui , Scott Branden , linux-pci@vger.kernel.org, linux-arm-kernel , open list , BCM Kernel Feedback Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lorenzo, Please see my comments inline: On Tue, Oct 15, 2019 at 10:13 PM Lorenzo Pieralisi 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. > > This looks like a hack, explain to us please what it actually solves and > why a full reset is not necessary. > The PAXB IP performs address translation(PCI<->AXI address) for both inbound and outbound addresses (amongst other things) based on version of IP being used. It does so using the IMAP/IARR/OMAP/OARR registers. These registers get programmed as per mappings specified in device tree during PCI driver probe for each RC and do not get reset when kexec/kdump kernel boots. This results in driver assuming valid mappings in place for some mapping windows during kexec/kdump kernel boot, consequently it skips those windows and we run out of available mapping windows, leading to mapping failure. Normally, we take care of resetting PAXB block in firmware, but in primary kernel to kexec/kdump kernel handover, no firmware is executed in between. So, we just, by default, invalidate the mapping registers each time before programming them to solve the issue described above.. We do not need full reset for handling this. > > 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. > Ok, will remove. > > --- > > 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 ? For this category of IP(PAXC), no mappings need to be programmed in the first place. > > > + 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. > It would work for kexec kernel, but not for kdump kernel as only for kexec'ed kernel, "device_shutdown" callback is present. We are here taking care of both the cases with this patch. Regards, Abhishek > Lorenzo > > > if (pcie->need_ob_cfg) { > > ret = iproc_pcie_map_ranges(pcie, res); > > if (ret) { > > -- > > 2.17.1 > >