From patchwork Sat Jan 28 13:34:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 49859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1344649wrn; Sat, 28 Jan 2023 05:41:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXtFf31ETIj2ATjkKnE4Ef87i/p9kGhPQdi7FiYhNvzwo/lpr6PDzklB6ezztrr+eJHbqIbW X-Received: by 2002:a17:907:2910:b0:86f:9fb1:307b with SMTP id eq16-20020a170907291000b0086f9fb1307bmr39662732ejc.31.1674913264070; Sat, 28 Jan 2023 05:41:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674913264; cv=none; d=google.com; s=arc-20160816; b=b+J7BRSuXuyMpuTehmKIsuvSV5HxuWfeOBp2RoPmWfFm4xZ2Ezszt375Ylyy0RF8Nk Zk6iBgLJ8RrJndNjUAtRn5Xfk8ZAxeG4hFyAYuWBxDwtaap1dEefgizkBOgthbOJs0iI bP4wdRH11ZsJOwbDEtKLO8sh4/jIMsbQj+ak/3b7aVakKRaSAs17pl+o3vV+2DYo3Iqt OvcXSO8SJEV0fbLm/UZ8CGrfq8kSgAxWOkrUHqeukuGnzGea42pJii2BJcwD0ai1H3rG ebU8ucsRKGby1DYYxSbIHTyoKu4I62nWBrUfBbXqop7ozgBJ4rq9+o+aQzDTtxRb2OKf ifgA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0WDCmMzUnJyHVyhc3cVPobdXVqP7dvsEsTVKB9OIiLM=; b=gZ4TvXYXMeV+N/Y6WtSYdy7S+jqlXhXhAC5+iULLvU/552VFpLyQ8Hd3985WBjOLct sU6E+vkmoSu9c7vsgvEPFDJmTNZrb+TnbIA1dTrLKv9e1q6AJl/E+v/4ZuH+xDk6gXTi Tk5Ej+CmNuxr8BVRyhlRLJ3tNhEFB1Aax7VVLsne+tpj0r8Ugc6GvEH9K9w9FL6ZljQE ux4wRcuRgYygKDQLt1sp/aXaB95VBw3KtOWhXFxyDvE+9zkpkmoN2njmlRPN72tGEsD6 Ezv3MItsdkd/dr9+lFp3LN/CYJcliWzww/QEM+xYXMw+hXzZad5oWSUVnAqUEuzeJEJG mRCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="mV/K6ZyP"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mr30-20020a170907829e00b0087861bdac01si8038823ejc.749.2023.01.28.05.40.40; Sat, 28 Jan 2023 05:41:04 -0800 (PST) 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="mV/K6ZyP"; 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 S234327AbjA1Ng1 (ORCPT + 99 others); Sat, 28 Jan 2023 08:36:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233502AbjA1Ng0 (ORCPT ); Sat, 28 Jan 2023 08:36:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A12FB1C30D for ; Sat, 28 Jan 2023 05:36:25 -0800 (PST) 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 4FE72B803F2 for ; Sat, 28 Jan 2023 13:36:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8A9BC433EF; Sat, 28 Jan 2023 13:36:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674912982; bh=RvsXLt3jtOi+fa454bVDIfyl7OhqRvd7dFiGrnsbL88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mV/K6ZyPDiJg1yvjjD69N06b3ko1lwcuHxYuiXMGknLOrx4L0rpdAr4QmEhj8GBPF P5avS8/vy9cl4xnTm3utMeFEKm5YUlScbzpMnGyIhXRcmNTOFlM9kiIKTtzGAHrERa o+OIA55VM3cEz5IoL9gv4UMmE3Bv7g1IF4n6Uu8BNzHLCZDjBLgO6GOXuwPiUj1Uo+ vAh/pZ+u7/HW0Q0Viqo+KrnhZlSHJoZ/YT8htH8aUsWLSNX+wz+IQL002nlkRmLVib L0I5Njz/x+5S0XZ86UTFLxllh83kNgJ0JzkOtnRGrUUfB3a5x0ywlpSmzVPNpeIFYi CkElJW47Mqyvg== Received: by pali.im (Postfix) id 1CEDC639; Sat, 28 Jan 2023 14:36:20 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] powerpc/pci: Enable PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default Date: Sat, 28 Jan 2023 14:34:58 +0100 Message-Id: <20230128133459.32123-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220817163927.24453-1-pali@kernel.org> References: <20220817163927.24453-1-pali@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756273850679699586?= X-GMAIL-MSGID: =?utf-8?q?1756273850679699586?= It makes sense to enable CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT by default (when possible by dependencies) to take advantages of all 256 PCI buses on each PCI domain, like it is already on all other kernel architectures. Fixes: 566356813082 ("powerpc/pci: Add config option for using all 256 PCI buses") Signed-off-by: Pali Rohár --- arch/powerpc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index b8c4ac56bddc..fad25aa602c8 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -392,6 +392,7 @@ config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT depends on PPC32 depends on !PPC_PMAC && !PPC_CHRP bool "Assign PCI bus numbers from zero individually for each PCI domain" + default y help By default on PPC32 were PCI bus numbers unique across all PCI domains. So system could have only 256 PCI buses independently of available From patchwork Sat Jan 28 13:34:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 49861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1345639wrn; Sat, 28 Jan 2023 05:43:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXvifgIu8Ob/odERKp+XvN2JFi2uzeKae24MX4PnszqhcU8/a7mtX9TLnkK3m0d7nqPx9+IL X-Received: by 2002:aa7:cacd:0:b0:49e:20f9:4ade with SMTP id l13-20020aa7cacd000000b0049e20f94ademr43475434edt.10.1674913429290; Sat, 28 Jan 2023 05:43:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674913429; cv=none; d=google.com; s=arc-20160816; b=ReVlHJJ/7NrZkY+XzJkRsp8bWf3E0vSPudIRVsCgE8JB23g4K6tS7kfzYpPmWQYfZR ayPX9mJ/gIFYwDfX1gZC5Ippaff2w1gaFtKulADB8U1kY3z50bKR8kXgN2IFjFwCbS/7 NZe4g5/fs4gxD2eP3LK69IKPpmZrFaJ+xNhghmKROVP3udukBA4/n3DZn+N2uhDeORXj KPJ+rtKYWN7a+gqQfkZcCv43zCPJes7tuT5FkSYKweKRT9db8oVqwyH6WJPM5jiUFTAw J3dVKW6Plh0CVUDVlDvgli2CaTWi4isoD24e1IWMdGlziPvGl8ybXw39faCzJ94wSQMB g1SA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HPZYNuzluTud1Wx8aOpPV7nldKa78b0/XvdqygT/wOQ=; b=0qOpJT1SCiSjGt0irk7QUwTNX4oZMuj3wYDL9Vf6f1z4oecg8riqgRZVP8ESIj8Fzu lUD6rKRKy4aS3NuHpns8+bFPi2od8H3UqWQ4UCYBktFML3Xh029zoG/jDVYfz0JrPB00 eKz2SKbpuno8dkm3yQp4nl+g7azLfWtpJ82W4qKsQ01YwT0nOEM7S33i8xfgd1JN3wZH U4zrx9irIB/B+O/7h80RuEuXthu6wdb1vdqbyG7+kWzhvCfC8WV0umSW7xS24vFPjN42 O9mVuhlnN00Oi6JBc9anXZKWvNgLdAcZwVutjYjre3XkgJktVhHgHwv6cr5keX3nDMOr RwHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SBbNprxW; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cx13-20020a05640222ad00b004a0b02e49c1si8234411edb.50.2023.01.28.05.43.25; Sat, 28 Jan 2023 05:43:49 -0800 (PST) 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=SBbNprxW; 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 S234376AbjA1Ng3 (ORCPT + 99 others); Sat, 28 Jan 2023 08:36:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233188AbjA1Ng0 (ORCPT ); Sat, 28 Jan 2023 08:36:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F40814EAF for ; Sat, 28 Jan 2023 05:36:25 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 1361060C03 for ; Sat, 28 Jan 2023 13:36:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B03CC4339B; Sat, 28 Jan 2023 13:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674912984; bh=CxsGwxondKYbEH8oAkJtUvwrFSvm/Rfl3p6vmW1mWVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SBbNprxWWv62MZNa2aRCFAtqYR+f0DdnMWqffMNVBJvKd8EpIwKGXCw3EISJfkJ4y NxqkInP0g+ARTJdXYOFAokV2FHz0uut6vxsM6415+nPQKtj69SD6vr6nyCNdaK6w4N CGQpGL5w8lA406XVjumWIcWSJHo3pbwgTvtw9+8PcvHr/vsL6JGwfbxOogJn7MPIzz 1M6Max7PgF+0wIvylK+/jhPgPwMG8DyZkXioLw8rkvB+loz6yeS2Ffuqp6y0PX0TJ8 ST+3V2FBd0SvIOoQx1ojxWKMf1iGOPW/a0qmfqA4iMeymlZ09hNrHk4ISECLT7hZOO 77pp3HOlGO3Yw== Received: by pali.im (Postfix) id D8098639; Sat, 28 Jan 2023 14:36:23 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Michael Ellerman , Nicholas Piggin , Christophe Leroy Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/2] powerpc/pci: Allow to disable filling deprecated pci-OF-bus-map Date: Sat, 28 Jan 2023 14:34:59 +0100 Message-Id: <20230128133459.32123-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230128133459.32123-1-pali@kernel.org> References: <20220817163927.24453-1-pali@kernel.org> <20230128133459.32123-1-pali@kernel.org> MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748334778170649110?= X-GMAIL-MSGID: =?utf-8?q?1756274023863710102?= Creating or filling pci-OF-bus-map property in the device-tree is deprecated since May 2006 [1]. Allow to disable filling this property by unsetting config option CONFIG_PPC_PCI_OF_BUS_MAP_FILL for remaining chrp and powermac code. Disabling of pci-OF-bus-map property allows to enable new option CONFIG_PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT also for chrp and powermac. [1] - https://lore.kernel.org/linuxppc-dev/1148016268.13249.14.camel@localhost.localdomain/ Signed-off-by: Pali Rohár --- Changes in v2: * Provide stripped version of pci_device_from_OF_node() without pci_to_OF_bus_map when compiling with CONFIG_PPC_PCI_OF_BUS_MAP_FILL=n --- arch/powerpc/Kconfig | 12 +++++++++++- arch/powerpc/kernel/pci_32.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index fad25aa602c8..3f8499faa88a 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -388,9 +388,19 @@ config PPC_DCR depends on PPC_DCR_NATIVE || PPC_DCR_MMIO default y +config PPC_PCI_OF_BUS_MAP_FILL + bool "Fill pci-OF-bus-map property in the device-tree" + depends on PPC32 + depends on PPC_PMAC || PPC_CHRP + default y + help + This option creates and fills pci-OF-bus-map property in the + device-tree which is deprecated and is needed only for old + platforms. + config PPC_PCI_BUS_NUM_DOMAIN_DEPENDENT depends on PPC32 - depends on !PPC_PMAC && !PPC_CHRP + depends on !PPC_PCI_OF_BUS_MAP_FILL bool "Assign PCI bus numbers from zero individually for each PCI domain" default y help diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c index 855b59892c5c..82a8981d4c47 100644 --- a/arch/powerpc/kernel/pci_32.c +++ b/arch/powerpc/kernel/pci_32.c @@ -64,6 +64,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CPC710_PCI64, fixu #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL + static u8* pci_to_OF_bus_map; static int pci_bus_count; @@ -223,6 +225,32 @@ pci_create_OF_bus_map(void) } #endif +#else /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */ + +/* + * Returns the PCI device matching a given OF node without pci_to_OF_bus_map + */ +int pci_device_from_OF_node(struct device_node *node, u8 *bus, u8 *devfn) +{ + const __be32 *reg; + int size; + + /* Check if it might have a chance to be a PCI device */ + if (!pci_find_hose_for_OF_device(node)) + return -ENODEV; + + reg = of_get_property(node, "reg", &size); + if (!reg || size < 5 * sizeof(u32)) + return -ENODEV; + + *bus = (be32_to_cpup(®[0]) >> 16) & 0xff; + *devfn = (be32_to_cpup(®[0]) >> 8) & 0xff; + + return 0; +} + +#endif /* CONFIG_PPC_PCI_OF_BUS_MAP_FILL */ + #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) */ void pcibios_setup_phb_io_space(struct pci_controller *hose) @@ -273,6 +301,7 @@ static int __init pcibios_init(void) } #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_CHRP) +#ifdef CONFIG_PPC_PCI_OF_BUS_MAP_FILL pci_bus_count = next_busno; /* OpenFirmware based machines need a map of OF bus @@ -281,6 +310,7 @@ static int __init pcibios_init(void) */ if (pci_assign_all_buses) pcibios_make_OF_bus_map(); +#endif #endif /* Call common code to handle resource allocation */