Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2306420ybi; Mon, 17 Jun 2019 02:31:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQU6Ele6a7T7tWRDmm4XvWOwyQaPXAuX8duQIRB7qr1cDiUs1IcJ6RCfw/+wdL6J/PCLRH X-Received: by 2002:a17:90a:d3c3:: with SMTP id d3mr25704151pjw.17.1560763873179; Mon, 17 Jun 2019 02:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560763873; cv=none; d=google.com; s=arc-20160816; b=U9OvTBfxrq/Z+pAezlRuFwH9ju9LIMZVkCiJZ1aN041+b5O5NWdVhQXYfj8NLpYtas kQYWPRRaR8cRMErVqMtYq840X5xzvzb57wyXmHbKiFBdgjH+8iFOQo+shaIWXy3teVln wfdEHJweBjU/Nz8US3ypBjWt8re1IJFnm6fZKQ6JTTCZgLr8UD11tWa1yuH8AURxWw1m 2zA+VVZGe5gGuKHynHSqorNqmnxJBrVh5anpWEb+HGk9DUV9jeCMRNuh4pID9iS6wnIV fx3imJbIFghnFjDwaqy86IozwGMxcMGvuT1YZ5naL2cF590tyTQ/NaNCNQ4/N8QZKp9a mitQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=vxv1p5Gw40in8Ive5HD00zqqYyYeTFjRtsATlGGzI6Y=; b=RhMdqj1qVm1cYT2Zv9Imf+aykCsPOLvAsadVTJFnMLX2HmbS5R6ZbpjuwylHPEcYkq PokAc8A8jw+ZxxXexB8DdRUT6RK8nObdUyYZBuiqSurFf4IFLvGf37exd16cXVOV9j7y U5OtdCvWs1on6GVGuVMfmQ/sgX11jZgo6BgvbHVpPvDHquOPV4LIg7yP7dlwIc7LUBEz OeuwP6jTuRjNu7HASzEmx6bGQxC5gOXelg+OSj6UkooeFAhzGKenwG+ZElUPx3Se7B+A pzTD3FXd0ghLDEEuKh0P5RUnRozEklMJhNa5En/OrQomnRtuqsJw3XC2ksdSQ/qIGQhc B6aA== 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 r17si10241136pga.205.2019.06.17.02.30.57; Mon, 17 Jun 2019 02:31:13 -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 S1728083AbfFQJap (ORCPT + 99 others); Mon, 17 Jun 2019 05:30:45 -0400 Received: from foss.arm.com ([217.140.110.172]:43036 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725962AbfFQJap (ORCPT ); Mon, 17 Jun 2019 05:30:45 -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 79858344; Mon, 17 Jun 2019 02:30:44 -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 7761A3F246; Mon, 17 Jun 2019 02:30:42 -0700 (PDT) Date: Mon, 17 Jun 2019 10:30:40 +0100 From: Lorenzo Pieralisi To: "Z.q. Hou" Cc: "bhelgaas@google.com" , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "robh+dt@kernel.org" , "mark.rutland@arm.com" , "l.subrahmanya@mobiveil.co.in" , "shawnguo@kernel.org" , Leo Li , "catalin.marinas@arm.com" , "will.deacon@arm.com" , Mingkai Hu , "M.h. Lian" , Xiaowei Bao Subject: Re: [PATCHv5 18/20] PCI: mobiveil: Disable IB and OB windows set by bootloader Message-ID: <20190617093040.GC18020@e121166-lin.cambridge.arm.com> References: <20190412083635.33626-1-Zhiqiang.Hou@nxp.com> <20190412083635.33626-19-Zhiqiang.Hou@nxp.com> <20190612162347.GF15747@redmoon> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 Sat, Jun 15, 2019 at 05:03:33AM +0000, Z.q. Hou wrote: > Hi Lorenzo, > > > -----Original Message----- > > From: Lorenzo Pieralisi [mailto:lorenzo.pieralisi@arm.com] > > Sent: 2019年6月13日 0:24 > > To: Z.q. Hou ; bhelgaas@google.com > > Cc: linux-pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org; > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; > > robh+dt@kernel.org; mark.rutland@arm.com; l.subrahmanya@mobiveil.co.in; > > shawnguo@kernel.org; Leo Li ; > > catalin.marinas@arm.com; will.deacon@arm.com; Mingkai Hu > > ; M.h. Lian ; Xiaowei Bao > > > > Subject: Re: [PATCHv5 18/20] PCI: mobiveil: Disable IB and OB windows set > > by bootloader > > > > On Fri, Apr 12, 2019 at 08:37:00AM +0000, Z.q. Hou wrote: > > > From: Hou Zhiqiang > > > > > > Disable all inbound and outbound windows before set up the windows in > > > kernel, in case transactions match the window set by bootloader. > > > > There must be no PCI transactions ongoing at bootloader<->OS handover. > > > > Yes, exact. > > > The bootloader needs fixing and this patch should be dropped, the host bridge > > driver assumes the host bridge state is disabled, > > The host bridge driver should not assumes the host state is disabled, > actually u-boot enable/initialize the host and without disabling it > when transfer the control to Linux. Fix the bootloader and drop this patch, I explain to you why. > > it will program the bridge > > apertures from scratch with no ongoing transactions, anything deviating from > > this behaviour is a bootloader bug and a recipe for disaster. > > The point of this patch is not to fix the ongoing transaction issue, > it is to avoid a potential issue which is caused by the outbound > window enabled by bootloader overlapping with Linux enabled. See above. Lorenzo > Thanks, > Zhiqiang > > > Lorenzo > > > > > Signed-off-by: Hou Zhiqiang > > > Reviewed-by: Minghuan Lian > > > Reviewed-by: Subrahmanya Lingappa > > > --- > > > V5: > > > - No functionality change. > > > > > > drivers/pci/controller/pcie-mobiveil.c | 25 +++++++++++++++++++++++++ > > > 1 file changed, 25 insertions(+) > > > > > > diff --git a/drivers/pci/controller/pcie-mobiveil.c > > > b/drivers/pci/controller/pcie-mobiveil.c > > > index 8dc87c7a600e..411e9779da12 100644 > > > --- a/drivers/pci/controller/pcie-mobiveil.c > > > +++ b/drivers/pci/controller/pcie-mobiveil.c > > > @@ -565,6 +565,24 @@ static int mobiveil_bringup_link(struct > > mobiveil_pcie *pcie) > > > return -ETIMEDOUT; > > > } > > > > > > +static void mobiveil_pcie_disable_ib_win(struct mobiveil_pcie *pcie, > > > +int idx) { > > > + u32 val; > > > + > > > + val = csr_readl(pcie, PAB_PEX_AMAP_CTRL(idx)); > > > + val &= ~(1 << AMAP_CTRL_EN_SHIFT); > > > + csr_writel(pcie, val, PAB_PEX_AMAP_CTRL(idx)); } > > > + > > > +static void mobiveil_pcie_disable_ob_win(struct mobiveil_pcie *pcie, > > > +int idx) { > > > + u32 val; > > > + > > > + val = csr_readl(pcie, PAB_AXI_AMAP_CTRL(idx)); > > > + val &= ~(1 << WIN_ENABLE_SHIFT); > > > + csr_writel(pcie, val, PAB_AXI_AMAP_CTRL(idx)); } > > > + > > > static void mobiveil_pcie_enable_msi(struct mobiveil_pcie *pcie) { > > > phys_addr_t msg_addr = pcie->pcie_reg_base; @@ -585,6 +603,13 @@ > > > static int mobiveil_host_init(struct mobiveil_pcie *pcie) { > > > u32 value, pab_ctrl, type; > > > struct resource_entry *win; > > > + int i; > > > + > > > + /* Disable all inbound/outbound windows */ > > > + for (i = 0; i < pcie->apio_wins; i++) > > > + mobiveil_pcie_disable_ob_win(pcie, i); > > > + for (i = 0; i < pcie->ppio_wins; i++) > > > + mobiveil_pcie_disable_ib_win(pcie, i); > > > > > > /* setup bus numbers */ > > > value = csr_readl(pcie, PCI_PRIMARY_BUS); > > > -- > > > 2.17.1 > > >