Received: by 10.213.65.68 with SMTP id h4csp509922imn; Fri, 16 Mar 2018 09:57:03 -0700 (PDT) X-Google-Smtp-Source: AG47ELsUJocJ2QkIjLJeaEz7jbAYCvo+wllklHT5xlVyYuaSKCJPpuOoUOvG5Tu6zcxwmmjgvYf0 X-Received: by 2002:a17:902:2904:: with SMTP id g4-v6mr2898305plb.170.1521219423883; Fri, 16 Mar 2018 09:57:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521219423; cv=none; d=google.com; s=arc-20160816; b=SGBGHP3b7p18h2L474ylqWul5l5KLkdiTYlpPyevzVl+6fwef6amdLIwPGqBLswwhC lD4kswn5VfBFiJfAZlTHVfUVywPqLVX8EZ3AsTcCRkUGpZb4Ng4KPig3X6W3XAPWBpre 8YiU/dZFdRtQxTJdCneBBpz3ItC8fnuYGeQXHXOpKlAEWHqm+nTedH913D3hgMonMe05 2rcDSq6nv4RcALhP7AJS98SQ0BkWPm7diFG9Pd/StrAzXuk5s9OevITF4hgJlZ6btEp1 zwDWUROb61mYFt2RDjFmh+HJHvq4F+q7zV8xlLepgRyKAoLWSSt6niJTTmDLLQi3c4Rq btmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=Wu7lr2QPr1tkdPmV4o42KWX9d8aKrqB5dM+STt8BuzQ=; b=AE0zUmMH85/Z09tpM/Z1fi01T+tK3y7o2Ja5tFxBw0R0dMjuPil60yXR6QDiQNC/H/ h1cNN/FBCVDiEgqpqjmr4zn99e4duS6NMSfpBK56LxA7BGF2jWudlrGIW6u/2KmHdybS p0AuuOgSMdLGq87D5QlI4T281bskDtZhGTbwtis3k/7ydD+IySGp/4IWFllnOFFvY0mu AnLQCyi/SEjxTWSLoDTV8F5slGIRV5WzB26l2o7g3VrcVautogN9Ca+rgNxBgo9DBocB trnRfGsW8Fe11li7rpGmiv5x/fcc6vd8HEJe/vz/7U1weYBScRS8stYY8qqcTxDBn470 RQ2Q== 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 f13si5054894pgp.666.2018.03.16.09.56.27; Fri, 16 Mar 2018 09:57:03 -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 S1753412AbeCPQz1 (ORCPT + 99 others); Fri, 16 Mar 2018 12:55:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:39212 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933848AbeCPPd5 (ORCPT ); Fri, 16 Mar 2018 11:33:57 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 87DEDDFD; Fri, 16 Mar 2018 15:33:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Fabio Estevam , Sebastian Reichel , Koen Vandeputte , Lorenzo Pieralisi , Bjorn Helgaas , Mika Westerberg , Lucas Stach , Binghui Wang , Jesper Nilsson , Jianguo Sun , Jingoo Han , Kishon Vijay Abraham I , Minghuan Lian , Mingkai Hu , Murali Karicheri , Pratyush Anand , Richard Zhu , Roy Zang , Shawn Guo , Stanimir Varbanov , Thomas Petazzoni , Xiaowei Song , Zhou Wang Subject: [PATCH 4.9 86/86] PCI: dwc: Fix enumeration end when reaching root subordinate Date: Fri, 16 Mar 2018 16:23:49 +0100 Message-Id: <20180316152323.118180180@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180316152317.167709497@linuxfoundation.org> References: <20180316152317.167709497@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Koen Vandeputte commit fc110ebdd014dd1368c98e7685b47789c31fab42 upstream. The subordinate value indicates the highest bus number which can be reached downstream though a certain device. Commit a20c7f36bd3d ("PCI: Do not allocate more buses than available in parent") ensures that downstream devices cannot assign busnumbers higher than the upstream device subordinate number, which was indeed illogical. By default, dw_pcie_setup_rc() inits the Root Complex subordinate to a value of 0x01. Due to this combined with above commit, enumeration stops digging deeper downstream as soon as bus num 0x01 has been assigned, which is always the case for a bridge device. This results in all devices behind a bridge bus remaining undetected, as these would be connected to bus 0x02 or higher. Fix this by initializing the RC to a subordinate value of 0xff, which is not altering hardware behaviour in any way, but informs probing function pci_scan_bridge() later on which reads this value back from register. The following nasty errors during boot are also fixed by this: pci_bus 0000:02: busn_res: can not insert [bus 02-ff] under [bus 01] (conflicts with (null) [bus 01]) ... pci_bus 0000:03: [bus 03] partially hidden behind bridge 0000:01 [bus 01] ... pci_bus 0000:04: [bus 04] partially hidden behind bridge 0000:01 [bus 01] ... pci_bus 0000:05: [bus 05] partially hidden behind bridge 0000:01 [bus 01] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 05 pci_bus 0000:02: busn_res: can not insert [bus 02-05] under [bus 01] (conflicts with (null) [bus 01]) pci_bus 0000:02: [bus 02-05] partially hidden behind bridge 0000:01 [bus 01] Fixes: a20c7f36bd3d ("PCI: Do not allocate more buses than available in parent") Tested-by: Niklas Cassel Tested-by: Fabio Estevam Tested-by: Sebastian Reichel Signed-off-by: Koen Vandeputte Signed-off-by: Lorenzo Pieralisi Signed-off-by: Bjorn Helgaas Reviewed-by: Mika Westerberg Acked-by: Lucas Stach Cc: stable@vger.kernel.org # v4.15+ Cc: Binghui Wang Cc: Jesper Nilsson Cc: Jianguo Sun Cc: Jingoo Han Cc: Kishon Vijay Abraham I Cc: Lucas Stach Cc: Mika Westerberg Cc: Minghuan Lian Cc: Mingkai Hu Cc: Murali Karicheri Cc: Pratyush Anand Cc: Richard Zhu Cc: Roy Zang Cc: Shawn Guo Cc: Stanimir Varbanov Cc: Thomas Petazzoni Cc: Xiaowei Song Cc: Zhou Wang [fabio: adapted to the file location of 4.9 kernel] Signed-off-by: Fabio Estevam Signed-off-by: Greg Kroah-Hartman --- drivers/pci/host/pcie-designware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c @@ -861,7 +861,7 @@ void dw_pcie_setup_rc(struct pcie_port * /* setup bus numbers */ val = dw_pcie_readl_rc(pp, PCI_PRIMARY_BUS); val &= 0xff000000; - val |= 0x00010100; + val |= 0x00ff0100; dw_pcie_writel_rc(pp, PCI_PRIMARY_BUS, val); /* setup command register */