Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp1714267imj; Fri, 8 Feb 2019 06:14:02 -0800 (PST) X-Google-Smtp-Source: AHgI3IYvr+hj9AkWLRLLCSrINrjZ+4r7bkGJVEBF9DP3W8Rs2EO+fC9wFzm1bXe8tN1E2lfOoV0s X-Received: by 2002:a17:902:ba8b:: with SMTP id k11mr22918048pls.177.1549635242907; Fri, 08 Feb 2019 06:14:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549635242; cv=none; d=google.com; s=arc-20160816; b=NAWAzRjobRvEJaB1D6UYf+4a0LCpbGuouEtCd/EUqJ5H8j4e93LFC31IM676VP3tzM 7Ta6obgBDnTI6SKHJYZ5yd/1kAVYnSHRSlDcG93zuqj5Gccs6Qrqm41YDv12aBFEPhvV E82tvlA4aQwdM/mH7qv1ZCLgTK3DN60WNIporUXMPmb5T4geyTqZT8DWgBZwiW7pFSIm n3Rgb7T0gMu1p0hE9T10n6F6Ivn3ufLXVG3P+2ZYT5xmMP3VO1KjE+15K27ypiUPBYMF zeEXmcRBRPdxxtdUBaY9qx7wgE5Dw/egP+k+XsZNMS+ukOtT4DfFMHAm+qSuDuvcRe0k l8yg== 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:dkim-signature; bh=inb1g9mHvaQIoDT4XZnce2SB1hAGzO1F119E66oosEI=; b=rU2T97trQOkQsGd/ZZOxGoUw0PBAsz4phKjoA/6ZOCtC1pnCso5WTBrKfbkxBEVaj5 bIgBZr4LngAdQZGoHlLQGQrJAEAq1IsxEFGbCcvn45Nt156ialjIXJSDXILG3MrKfiIL S4PvEgY8pn23JWtPoWsIkhdgW7t7fQ3rJV6n596B8NMD1HUJmQcd9YFGNtcUhiiVjfIR PHVetp6IW8HrmFwQMd3tTNOkayVCKLpQ2MsNjFsF7yRHgTOmTVD4X2c7UCFAqhknGUYU m1LdbDrlFDNx/Sln/3hsJoSQcI/Jb+MxetgoOwfOwtLIpgpouxeIcDlAozLNtf0KNOfs yssA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Do8jFUfY; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 44si2419119plb.57.2019.02.08.06.13.46; Fri, 08 Feb 2019 06:14:02 -0800 (PST) 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=@kernel.org header.s=default header.b=Do8jFUfY; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727948AbfBHONT (ORCPT + 99 others); Fri, 8 Feb 2019 09:13:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:54794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727617AbfBHONT (ORCPT ); Fri, 8 Feb 2019 09:13:19 -0500 Received: from localhost (173-25-63-173.client.mchsi.com [173.25.63.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6390020844; Fri, 8 Feb 2019 14:13:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549635197; bh=dXIofY2YeXA/ZJaKecf3mgmXm6vF+WyXOcPwQr3jdmg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Do8jFUfYqrHu/SScyMLw6FCUJwCseAmkAHYohHRggGQpqg8yGdk17bXeM4zkxVMTT dMa3NFlLl/esqCBuZAQBNusVO8EkdPomcDkwGz59+VSp9q+Fu8xR0MaQcQPlqUTFOA bcVLnjqpzqsBKq/PjIo/GNKANrGasBMb1/EZ7h3Q= Date: Fri, 8 Feb 2019 08:13:15 -0600 From: Bjorn Helgaas To: Subrahmanya Lingappa Cc: "Z.q. Hou" , "mark.rutland@arm.com" , "devicetree@vger.kernel.org" , "lorenzo.pieralisi@arm.com" , Xiaowei Bao , "linux-pci@vger.kernel.org" , "will.deacon@arm.com" , "linux-kernel@vger.kernel.org" , Leo Li , "M.h. Lian" , "robh+dt@kernel.org" , Mingkai Hu , "catalin.marinas@arm.com" , "shawnguo@kernel.org" , "linux-arm-kernel@lists.infradead.org" , Thomas Petazzoni Subject: Re: [PATCHv3 17/27] PCI: mobiveil: fix the checking of valid device Message-ID: <20190208141315.GU7268@google.com> References: <20190129080926.36773-1-Zhiqiang.Hou@nxp.com> <20190129080926.36773-18-Zhiqiang.Hou@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+cc Thomas] On Fri, Feb 08, 2019 at 06:11:15PM +0530, Subrahmanya Lingappa wrote: > On Tue, Jan 29, 2019 at 1:40 PM Z.q. Hou wrote: > > > > From: Hou Zhiqiang > > > > Avoid to issue CFG transactions to link partner when the PCIe > > link is not up. And allow CFG transactions to all functions of > > Endpoint implemented multiple functions. > > > > Fixes: 9af6bcb11e12 ("PCI: mobiveil: Add Mobiveil PCIe Host > > Bridge IP driver") > > Signed-off-by: Hou Zhiqiang > > Reviewed-by: Minghuan Lian > > --- > > V3: > > - No change > > > > drivers/pci/controller/mobiveil/pcie-mobiveil-host.c | 6 +++++- > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > > index dc5324d94466..1ae82e790562 100644 > > --- a/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > > +++ b/drivers/pci/controller/mobiveil/pcie-mobiveil-host.c > > @@ -29,6 +29,10 @@ static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn) > > { > > struct mobiveil_pcie *pcie = bus->sysdata; > > > > + /* If there is no link, then there is no device */ > > + if (bus->number > pcie->rp.root_bus_nr && !mobiveil_pcie_link_up(pcie)) > > + return false; > > + > > /* Only one device down on each root port */ > > if ((bus->number == pcie->rp.root_bus_nr) && (devfn > 0)) > > return false; > > @@ -37,7 +41,7 @@ static bool mobiveil_pcie_valid_device(struct pci_bus *bus, unsigned int devfn) > > * Do not read more than one device on the bus directly > > * attached to RC > > */ > > - if ((bus->primary == pcie->rp.root_bus_nr) && (devfn > 0)) > > + if ((bus->primary == pcie->rp.root_bus_nr) && (PCI_SLOT(devfn) > 0)) > here change "primary" to "number", as it's a bug in the original driver too. This looks like it should be split into two patches: (1) checking for link up, and (2) checking root_bus_nr. And if you mean "bus->primary == pcie->rp.root_bus_nr" is a bug in pci-aardvark.c, too, it is imperative to fix that bug also (with a separate patch). > > return false; > > > > return true; > > -- > > 2.17.1 > > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel