Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp362185rwe; Thu, 25 Aug 2022 01:26:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR5WOBP9lCnyuHsUEeafFahG03wy6TAY9g8u21hsQoS6O8NJti1ASQY6auZJTIR0TMys+n+A X-Received: by 2002:a17:902:f70d:b0:172:d1d1:9b8c with SMTP id h13-20020a170902f70d00b00172d1d19b8cmr2801540plo.129.1661415993291; Thu, 25 Aug 2022 01:26:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661415993; cv=none; d=google.com; s=arc-20160816; b=x9iX3Blq6JY6cKpNE4lmmGYYEaSPWL8JZjUWaJ/SgSJIR6n3NwhxiWh8Lo1yWT8Jye j/v1uVMFpKrF4S5pTSVKMWynX1n7E9PK0yGaWpM+R24kUXNJxx25t+Ir2Vja2C0rtF4e JuduT5pCcdZ4vtz81Ix1S1tt1uP93RHnK29xUdoXV3I+tKTU79SSWApaoaBkCYvzrX2h ADOLiiP4nYkyKpQGbnRORiWKk11AtinKY4hIq4PZHLuPxkUmultZLurSQmjVHxINcqBF CY+0bdxm5fN8s4OAXiKVVt1W6I0oqb0+YCxsuckuiUbPmrqtXu3j74BQFoWmYskRY8Na p4xA== 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:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=k/K7Js7dK6dxOfVTDaXcqeIh7AqfvCWAPYJNJN8qsTQ=; b=smkhIfWolFmfD+Ty8KRNfrqfUihjcbthgXYhNxjpEPchpa2gvdLStrCsc/s9mdguMn j7R3sxaHwpcVchwAYt+eDqDCwRmMqnmCwvyfBNtIpatoRCOiwiwXgpv26xY9AGdqmT6c NvWs6HzwBrVcm0wLb6VdcYGob42XNVAdPlTo1hJ8QA2ZC9TDkW+hP4MDPPFPZjQG6tgF TjFldJ4706zS6qBbcaYOVrQRhV2om8sU7FHMub1nmtTJNoZ/psGtrvE0/N2aJ2pED75L ZczURvUq++WBfFMBCAjmnd6NcGelx3oXRlL6b5gww6cquul1cXKMDewUMR9dDLI5tZmI k2AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=DccTqgAE; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a056a00191000b0052e6a336e03si21042998pfi.179.2022.08.25.01.26.21; Thu, 25 Aug 2022 01:26:33 -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=@ellerman.id.au header.s=201909 header.b=DccTqgAE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238511AbiHYHtn (ORCPT + 99 others); Thu, 25 Aug 2022 03:49:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233991AbiHYHtk (ORCPT ); Thu, 25 Aug 2022 03:49:40 -0400 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A271A0333; Thu, 25 Aug 2022 00:49:38 -0700 (PDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4MCw8s2Q2rz4xV7; Thu, 25 Aug 2022 17:49:33 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1661413773; bh=k/K7Js7dK6dxOfVTDaXcqeIh7AqfvCWAPYJNJN8qsTQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=DccTqgAEj8cQsbTwecf0Jayd3dBrvqd6U8m1Lt7V86aEL++OLOLr5xIxGu99atBxI 8Op6ppf0sepvXsD0m6OkdhzaHfgImYUmJPGiLiq3nJiq3ntzUck+GTN3FvFJV27GEU 4w0hN5KCHxMDg62pj4Q+gPJPSNhBdDSy7LVx3iHwYtaZaFf76dZGxLlkVEdYTsuVes cPfKQfSYwJCazV/Fwg8Wr1BfDBHuNGe+IzPBEfhXpzHVzAtNwu/5Xk0J6aE7z/Syo7 WRJmfyOLeFBd2IapKcyLn3WNadQqoAlge4tptmNzYmzmPjrBmjIwoZb83LvI3srdMO Qu38O06uVNhzg== From: Michael Ellerman To: Pali =?utf-8?Q?Roh=C3=A1r?= , Benjamin Herrenschmidt , Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] powerpc/pci: Enable PCI domains in /proc when PCI bus numbers are not unique In-Reply-To: <20220820115113.30581-1-pali@kernel.org> References: <20220820115113.30581-1-pali@kernel.org> Date: Thu, 25 Aug 2022 17:49:28 +1000 Message-ID: <878rnclq47.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Pali Roh=C3=A1r writes: > On 32-bit powerpc systems with more PCIe controllers and more PCI domains, > where on more PCI domains are same PCI numbers, when kernel is compiled > with CONFIG_PROC_FS=3Dy and CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT=3Dy > options, kernel prints "proc_dir_entry 'pci/01' already registered" error > message. Thanks, I'll pick this up. > This regression started appearing after commit 566356813082 ("powerpc/pci: > Add config option for using all 256 PCI buses") in case in each mPCIe slot > is connected PCIe card and therefore PCI bus 1 is populated in for every > PCIe controller / PCI domain. > > The reason is that PCI procfs code expects that when PCI bus numbers are > not unique across all PCI domains, function pci_proc_domain() returns true > for domain dependent buses. > > Fix this issue by setting PCI_ENABLE_PROC_DOMAINS and PCI_COMPAT_DOMAIN_0 > flags for 32-bit powerpc code when CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT > is enabled. Same approach is already implemented for 64-bit powerpc code > (where PCI bus numbers are always domain dependent). We also have the same in ppc4xx_pci_find_bridges(). And if we can eventually make CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT the standard behaviour on 32-bit then everything would behave the same and we could simplify pci_proc_domain() to match what other arches do. cheers > Fixes: 566356813082 ("powerpc/pci: Add config option for using all 256 PC= I buses") > Signed-off-by: Pali Roh=C3=A1r > --- > arch/powerpc/kernel/pci_32.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c > index ffc4e1928c80..8acbc9592ebb 100644 > --- a/arch/powerpc/kernel/pci_32.c > +++ b/arch/powerpc/kernel/pci_32.c > @@ -249,6 +249,15 @@ static int __init pcibios_init(void) >=20=20 > printk(KERN_INFO "PCI: Probing PCI hardware\n"); >=20=20 > +#ifdef CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT > + /* > + * Enable PCI domains in /proc when PCI bus numbers are not unique > + * across all PCI domains to prevent conflicts. And keep PCI domain 0 > + * backward compatible in /proc for video cards. > + */ > + pci_add_flags(PCI_ENABLE_PROC_DOMAINS | PCI_COMPAT_DOMAIN_0); > +#endif > + > if (pci_has_flag(PCI_REASSIGN_ALL_BUS)) > pci_assign_all_buses =3D 1; >=20=20 > --=20 > 2.20.1