Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp387819rwa; Sat, 20 Aug 2022 05:54:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR7a5LPzBERP85iOq2QlfFf5fgBiINrdW+NbgQvPHpU/0g9+rDpRqODPb1Wx7ul6sv7Go3l5 X-Received: by 2002:a17:906:9f2a:b0:730:bc30:da30 with SMTP id fy42-20020a1709069f2a00b00730bc30da30mr7808932ejc.763.1661000099134; Sat, 20 Aug 2022 05:54:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661000099; cv=none; d=google.com; s=arc-20160816; b=S2XtkG2Rz7xV+4rzTQ0Uj69cJDzUdthQ8+bHVCQcZdr0hbUlZ03BvY57ALGwNyaJtc o4kBh1KKMBKjqsgEgPtxasFCtnbb50VvDxzQjRrRpMkHcfTVAK/GBUAgD+8SxVNjNwwp BXHFN7OS2vCnMw9lY/nerS4x5kZPXaamk8kKOkfVzRS2eYu9soeF99rh+wQBgKqK5ZIP NKmpUWtiGWucGzi06ZygrFNY5LNq9/VP/eUVjTVL+NQL+3pPdbtq6ukou1K7RwkvlWkn 1Ajjk4PX0ZU/nryySnwrLtSPcqaHso9RuHYt7U371xw7EVcQjXX5wwWlTQjeFIn6mgrG 6QTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=JX6oHjSwuXaFjFjUplIHI4aoC8crrRW237FTl96pWpY=; b=v4bfgp+qpNRLa+eiTFiL/msiZChHF2zqaKBuWukfCnG+/7lzQhLS3ewpN1p9rs3ODn nR1pRmU59IpRIbWdQ+ZU7Qes2X/jsz504I/qW05UOzdhToTLFd08Je7xk4j+aejMM6DY 24SVDOQnbkTxV3RdmToNbcF1YMIjaRTXg91O+y+IY/EhdYPNu2a1q4qby6/Fa8aOzR5u mgk492WUmpTTJ6H8fLhNQgR6hfsLHaX7ryI4gzFe2UGI9FRR+4AH9om8ZzGRank/A/9t w3Q4ow0OQOt4RJkuI/7t8K8ZFmnMhmK0ExHIEXj1CXkRTyBc6h/rQioq3t6JNiU6T1ed 1Nqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DBch2/TS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he19-20020a1709073d9300b0073d69d25e10si910888ejc.385.2022.08.20.05.54.33; Sat, 20 Aug 2022 05:54:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DBch2/TS"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1345800AbiHTMeC (ORCPT + 99 others); Sat, 20 Aug 2022 08:34:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231621AbiHTMeA (ORCPT ); Sat, 20 Aug 2022 08:34:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36FA01BEA9 for ; Sat, 20 Aug 2022 05:33:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C376CB80926 for ; Sat, 20 Aug 2022 12:33:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53AD6C433C1; Sat, 20 Aug 2022 12:33:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660998834; bh=mCz2SxJKYp8oLIDh+dfPccwFT6pIPPbM7vRC1B7QWME=; h=From:To:Cc:Subject:Date:From; b=DBch2/TSovQN6bsHK3PYXvYmjx2yg/WBvzNi404oyhcuXHxP22Vpx73Rc0tI6hAtL 7p5eI8zlCjDwcow2VW3jrLtUl4RbN7MNBeEpAsXOYFUlND1OWD7QQlVUyb9n5JaDRA 0qQaLrd1/g5hWz0ovxwYHrJKPIkbt49e256KHrrd64BKTjZT0dVaUstVrR2EzIkx37 96kJTYUwiAaKPtPxFVJc2/4rOITmT644yH0EEu04gO6OoITQY/Bb31V2rskJfcqHBs M169miU07sCQxviv/SMR7CgUgCVekCVrxNLMGDphs00Qtlwve4kcrhAyliMCZXRRP4 K4aXS/jywVBEg== Received: by pali.im (Postfix) id 9F2095D0; Sat, 20 Aug 2022 14:33:51 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] powerpc/fsl-pci: Choose PCI host bridge with alias pci0 as the primary Date: Sat, 20 Aug 2022 14:33:27 +0200 Message-Id: <20220820123327.20551-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If there's no PCI host bridge with ISA then check for PCI host bridge with alias "pci0" (first PCI host bridge) and if it exists then choose it as the primary PCI host bridge. This makes choice of primary PCI host bridge more stable across boots and updates as the last fallback candidate for primary PCI host bridge (if there is no choice) is selected arbitrary. Signed-off-by: Pali Rohár --- arch/powerpc/sysdev/fsl_pci.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 1011cfea2e32..e4b703943dd3 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -1125,6 +1125,19 @@ void __init fsl_pci_assign_primary(void) return; } + /* + * If there's no PCI host bridge with ISA then check for + * PCI host bridge with alias "pci0" (first PCI host bridge). + */ + np = of_find_node_by_path("pci0"); + if (np && of_match_node(pci_ids, np) && of_device_is_available(np)) { + fsl_pci_primary = np; + of_node_put(np); + return; + } + if (np) + of_node_put(np); + /* * If there's no PCI host bridge with ISA, arbitrarily * designate one as primary. This can go away once -- 2.20.1