From patchwork Tue Jan 9 14:42:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koen Vandeputte X-Patchwork-Id: 10152443 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6EA80601A1 for ; Tue, 9 Jan 2018 14:44:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BB2222A6B for ; Tue, 9 Jan 2018 14:44:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5052727DCD; Tue, 9 Jan 2018 14:44:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D427822A6B for ; Tue, 9 Jan 2018 14:44:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751592AbeAIOo2 (ORCPT ); Tue, 9 Jan 2018 09:44:28 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:43350 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758579AbeAIOoZ (ORCPT ); Tue, 9 Jan 2018 09:44:25 -0500 Received: by mail-wm0-f67.google.com with SMTP id g1so3064451wmg.2 for ; Tue, 09 Jan 2018 06:44:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ncentric.com; s=google; h=from:to:cc:subject:date:message-id; bh=bvqvf44OSUSLrcoEUUH+Gh+q31lgx37WEyMwy4Sy/vw=; b=rDOloiKMuHU0d1RHKozwhGMQeSSrKSxs9sb19b8ETXoB5FU2ArDHKGeV0CkkUMhuWt sUlTw+O/4SU5HTcSYtezs7EQddbm6ZszAHtbagSn6xhWLHaqI7dQCNCkhYhA3LTTzG8N RQhzC5VJZ0dfxv10fjnPXx4qabArjA+j+6GbU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bvqvf44OSUSLrcoEUUH+Gh+q31lgx37WEyMwy4Sy/vw=; b=sQvqBW0aj4xjgDJ/xwnUyzQnkbLuYx1wz1rTfl/if6Y9UJ2xWrx4ZATW+e2iINgJR2 yJK6DiMx8mNEjBW0oUZ4rFkEqZsNqeMiOUd2Sq+0ne9d7BuEVZizSMwP3fjHM8j7gy0J r7FUfvAHybs8+EumS1wuqqL5fg0viw1lqocwuaPl7jlmBtKfhIzPowu+0n591YEAADDL nEKNMCbQ5oEdEiv5X0pXTNrhoQgzga/Op83lZjyECtHDxOBR8aL24lLQEIa3UlKxyAS6 fv72CiFi1Ld5OAfpKQHF5VO7oLUh9b3eA1F911uexQ1Di2seJ3//aV2o4YROMaH+p7KS dO8A== X-Gm-Message-State: AKGB3mJeujyX2dn/Tu1F6wOm9TBK0HU9kIPXIcjYSsJv2/B5S9IeS/Lu geCGLnQLBg7197oSQ2yv5zozPRT/dNY= X-Google-Smtp-Source: ACJfBou+0SNhxDvy+gFaUYrKBegj+nh5crrj50pMTVWP9NtVR/BXGCT1EnqqMPwOVEBqJyPSBZsOng== X-Received: by 10.80.225.195 with SMTP id m3mr21576660edl.222.1515509064288; Tue, 09 Jan 2018 06:44:24 -0800 (PST) Received: from localhost.localdomain (d515300d8.static.telenet.be. [81.83.0.216]) by smtp.googlemail.com with ESMTPSA id j27sm9730651eda.59.2018.01.09.06.44.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 06:44:23 -0800 (PST) From: Koen Vandeputte To: linux-pci@vger.kernel.org Cc: bhelgaas@google.com, lorenzo.pieralisi@arm.com, Joao.Pinto@synopsys.com, jingoohan1@gmail.com, niklas.cassel@axis.com, Koen Vandeputte , Mika Westerberg Subject: [PATCH] PCI: dwc: fix enumeration end when reaching root subordinate Date: Tue, 9 Jan 2018 15:42:21 +0100 Message-Id: <1515508941-20055-1-git-send-email-koen.vandeputte@ncentric.com> X-Mailer: git-send-email 2.7.4 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 to remain undetected, as these would be connected to bus 0x02 or higher. Fix this by initializing the RC to a subordinate value of 0xff, meaning that all busses [0x00-0xff] are reachable through this RC. Fixes: a20c7f36bd3d ("PCI: Do not allocate more buses than available in parent") Signed-off-by: Koen Vandeputte Tested-by: Niklas Cassel Cc: Mika Westerberg --- Will send separate patches to stable as this file got moved/renamed drivers/pci/dwc/pcie-designware-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/dwc/pcie-designware-host.c b/drivers/pci/dwc/pcie-designware-host.c index bf558df5b7b3..2b5470173196 100644 --- a/drivers/pci/dwc/pcie-designware-host.c +++ b/drivers/pci/dwc/pcie-designware-host.c @@ -616,7 +616,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp) /* setup bus numbers */ val = dw_pcie_readl_dbi(pci, PCI_PRIMARY_BUS); val &= 0xff000000; - val |= 0x00010100; + val |= 0x00ff0100; dw_pcie_writel_dbi(pci, PCI_PRIMARY_BUS, val); /* setup command register */