Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp617519imi; Thu, 21 Jul 2022 07:42:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sL6GiEjThuTtQxDN9qOloPA+JvZcUcADRb5ProygTs0tjrSGnC8u/Ky41n2VW/klrp3Snk X-Received: by 2002:a05:6e02:1cad:b0:2dc:6c56:a52a with SMTP id x13-20020a056e021cad00b002dc6c56a52amr20709153ill.263.1658414568241; Thu, 21 Jul 2022 07:42:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658414568; cv=none; d=google.com; s=arc-20160816; b=gGUG/3R7vTIEu1VzHD2xmajB5zyRGIjgOqqkcMaav4ftnatg+rEP20QyKeGuDi2Ta8 iAn3NuIA3sr6pgRgNOMhtRtIgrSxBmUYnVjR07VaGFTpTfZbhRo1CfNAPWnkfeVhcG2J u/1Ff3Ojh/h+drlzXxo02H+2tk3oYLrklQzHQft12xK93WZHBcdCmhcRTvyUylRDkti/ /z/n2CnDIXbdlaZDLd9XNA2Ang8NSaL6j6B2yzZ1pmdleu0d1dHAUsWJCTDZUwUWXREs 6ibplARNCoLjX8mDiX/nTBrwxcDID2qQpVTzyF+TWM6NugHjh5g0dphjFPXypqdv86SH /fpQ== 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=O3NW8StoMQqfZ5lEvH9Li2usMzQWsOyWcla1sD26BZA=; b=iSRao9QxPExsk4hIvhUwnAlAFAIqfgaxw/6ple68GzCXjQ929PPqigyOUy70/y12i5 TnR/MY4z5xo7DYEvMXfW+wXs/+GDHJHJwRdijLRe1EeeHflDWQC6LCITP5xryNLKSaLF OnLE3HO8TWRMiYNVo3vozpKvw5FKi8b49GWFtUiq5zdJNI9aGuw9itl07bRPiEw2ds+U rRoohawmqbZfk93+KLrEMD+Tu+H3KJKynJ0G0TpfChtsLN5HITSSp+4vIJxYG0bGy6gS oZ5CWVn1L0dQYdVC9ztT3VYu5Tg0AltSKMnKpqkirlbC5uVlVKh1YhDHxc0tMnrXVGxQ eF+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l4Jy+1eG; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a056e02164a00b002dcb7356028si1975042ilu.132.2022.07.21.07.42.34; Thu, 21 Jul 2022 07:42:48 -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=@gmail.com header.s=20210112 header.b=l4Jy+1eG; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230367AbiGUNul (ORCPT + 99 others); Thu, 21 Jul 2022 09:50:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230415AbiGUNu2 (ORCPT ); Thu, 21 Jul 2022 09:50:28 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69635192A7; Thu, 21 Jul 2022 06:50:21 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id q16so1731510pgq.6; Thu, 21 Jul 2022 06:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=O3NW8StoMQqfZ5lEvH9Li2usMzQWsOyWcla1sD26BZA=; b=l4Jy+1eGLeneEJth/E1CnZE/vsnjojIheWPBXvcrXjH+5BQBFbjvceMhq+o2pYAjKS MD+VaXcYRMyFQ16WfImVaSy1OSpSNO3QdZxATD45lmRC5q8WXWrh41xZ8lLcHXMHWme3 yZGGX36QpZNxL+P2fz44ZKZwUW4ptPlS4+EEtkTNXZHcyig8/8wP8+sqiscc2BxaVrpH ONRfaiu/jl6jB+cubZ542DsdjnE0Ne5GvBSHEQE4CAZXbdeQ70BLcUMXF7xU87BnGei8 x1dzKBuh/3S1IDjQOX2yebPuN3bRR5pO5c9YGGMKFT5ELeF+n2YXZ/a1UloYUeuOHSWi rIqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=O3NW8StoMQqfZ5lEvH9Li2usMzQWsOyWcla1sD26BZA=; b=JmqR07NmzZobv0i3ia3zi6Ti6wwUBrL0vozCmJEzNRWtXntZoDcq4Gadv0H/CoVIHP 2L74UcDutdBjydxJ3n8CMvo9Dk1DaFKboF8P7faQkDuWfCIjIJ2aqmfdtQjQzt5+Zofp /sCjRsdRVDZ7X0xArawHivFuFJngVjXVf6NW3YhpluM8rqNq7LAt2ImFW/4MacdgH8tT PcEBVV51rLyL/+27KJXEz7NCH83PQrHUNGMVCOYjUNxO1itb47v6Wh8l1Zqcy2AK02kg QzkRDn3grr4LnXXbWmkidxzm2wd1QM9GsFejgv4RaJJV/dX0KGFblmFc3BkUvGz+Hwfg /rPA== X-Gm-Message-State: AJIora9Oylijkw0Q2gmHFGP7V1y45jUQ3bmNxiTn3GxxhqeB4wTw4AWm 8h4/JSSaBg5AzC8JirqjsMFo+TgsDijINQ== X-Received: by 2002:a65:498b:0:b0:412:8e4:2842 with SMTP id r11-20020a65498b000000b0041208e42842mr38195607pgs.71.1658411420668; Thu, 21 Jul 2022 06:50:20 -0700 (PDT) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id a142-20020a621a94000000b0052b433aa45asm1794762pfa.159.2022.07.21.06.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Jul 2022 06:50:20 -0700 (PDT) From: Stafford Horne To: LKML Cc: Arnd Bergmann , Stafford Horne , Pierre Morel , Geert Uytterhoeven , Catalin Marinas , Will Deacon , Guo Ren , Paul Walmsley , Palmer Dabbelt , Albert Ou , Richard Weinberger , Anton Ivanov , Johannes Berg , Bjorn Helgaas , "Rafael J. Wysocki" , linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, linux-um@lists.infradead.org, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH v5 4/4] asm-generic: Add new pci.h and use it Date: Thu, 21 Jul 2022 22:49:24 +0900 Message-Id: <20220721134924.596152-5-shorne@gmail.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220721134924.596152-1-shorne@gmail.com> References: <20220721134924.596152-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 The asm/pci.h used for many newer architectures share similar definitions. Move the common parts to asm-generic/pci.h to allow for sharing code. Suggested-by: Arnd Bergmann Link: https://lore.kernel.org/lkml/CAK8P3a0JmPeczfmMBE__vn=Jbvf=nkbpVaZCycyv40pZNCJJXQ@mail.gmail.com/ Acked-by: Pierre Morel Acked-by: Geert Uytterhoeven Reviewed-by: Arnd Bergmann Signed-off-by: Stafford Horne --- Since v4: - Add reviewed-by arch/arm64/include/asm/pci.h | 10 ++-------- arch/csky/include/asm/pci.h | 17 ++--------------- arch/riscv/include/asm/pci.h | 23 ++++------------------- arch/um/include/asm/pci.h | 14 ++------------ include/asm-generic/pci.h | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 54 deletions(-) create mode 100644 include/asm-generic/pci.h diff --git a/arch/arm64/include/asm/pci.h b/arch/arm64/include/asm/pci.h index 682c922b5658..016eb6b46dc0 100644 --- a/arch/arm64/include/asm/pci.h +++ b/arch/arm64/include/asm/pci.h @@ -9,7 +9,6 @@ #include #define PCIBIOS_MIN_IO 0x1000 -#define PCIBIOS_MIN_MEM 0 /* * Set to 1 if the kernel should re-assign all PCI bus numbers @@ -18,13 +17,8 @@ (pci_has_flag(PCI_REASSIGN_ALL_BUS)) #define arch_can_pci_mmap_wc() 1 -#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1 -#ifdef CONFIG_PCI -static inline int pci_proc_domain(struct pci_bus *bus) -{ - return 1; -} -#endif /* CONFIG_PCI */ +/* Generic PCI */ +#include #endif /* __ASM_PCI_H */ diff --git a/arch/csky/include/asm/pci.h b/arch/csky/include/asm/pci.h index 875bc028f8f6..42724c630d30 100644 --- a/arch/csky/include/asm/pci.h +++ b/arch/csky/include/asm/pci.h @@ -9,20 +9,7 @@ #include -#define PCIBIOS_MIN_IO 0 -#define PCIBIOS_MIN_MEM 0 - -/* C-SKY shim does not initialize PCI bus */ -#define pcibios_assign_all_busses() 1 - -#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1 - -#ifdef CONFIG_PCI -static inline int pci_proc_domain(struct pci_bus *bus) -{ - /* always show the domain in /proc */ - return 1; -} -#endif /* CONFIG_PCI */ +/* Generic PCI */ +#include #endif /* __ASM_CSKY_PCI_H */ diff --git a/arch/riscv/include/asm/pci.h b/arch/riscv/include/asm/pci.h index f904df586c03..6ef4a1426194 100644 --- a/arch/riscv/include/asm/pci.h +++ b/arch/riscv/include/asm/pci.h @@ -12,23 +12,7 @@ #include -#define PCIBIOS_MIN_IO 0 -#define PCIBIOS_MIN_MEM 0 - -/* RISC-V shim does not initialize PCI bus */ -#define pcibios_assign_all_busses() 1 - -#define ARCH_GENERIC_PCI_MMAP_RESOURCE 1 - -#ifdef CONFIG_PCI -static inline int pci_proc_domain(struct pci_bus *bus) -{ - /* always show the domain in /proc */ - return 1; -} - -#ifdef CONFIG_NUMA - +#if defined(CONFIG_PCI) && defined(CONFIG_NUMA) static inline int pcibus_to_node(struct pci_bus *bus) { return dev_to_node(&bus->dev); @@ -38,8 +22,9 @@ static inline int pcibus_to_node(struct pci_bus *bus) cpu_all_mask : \ cpumask_of_node(pcibus_to_node(bus))) #endif -#endif /* CONFIG_NUMA */ +#endif /* defined(CONFIG_PCI) && defined(CONFIG_NUMA) */ -#endif /* CONFIG_PCI */ +/* Generic PCI */ +#include #endif /* _ASM_RISCV_PCI_H */ diff --git a/arch/um/include/asm/pci.h b/arch/um/include/asm/pci.h index 1211855aff34..34fe4921b5fa 100644 --- a/arch/um/include/asm/pci.h +++ b/arch/um/include/asm/pci.h @@ -4,18 +4,8 @@ #include #include -#define PCIBIOS_MIN_IO 0 -#define PCIBIOS_MIN_MEM 0 - -#define pcibios_assign_all_busses() 1 - -#ifdef CONFIG_PCI_DOMAINS -static inline int pci_proc_domain(struct pci_bus *bus) -{ - /* always show the domain in /proc */ - return 1; -} -#endif /* CONFIG_PCI */ +/* Generic PCI */ +#include #ifdef CONFIG_PCI_MSI_IRQ_DOMAIN /* diff --git a/include/asm-generic/pci.h b/include/asm-generic/pci.h new file mode 100644 index 000000000000..3ceb0cb12321 --- /dev/null +++ b/include/asm-generic/pci.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef __ASM_GENERIC_PCI_H +#define __ASM_GENERIC_PCI_H + +#include + +#ifndef PCIBIOS_MIN_IO +#define PCIBIOS_MIN_IO 0 +#endif + +#ifndef PCIBIOS_MIN_MEM +#define PCIBIOS_MIN_MEM 0 +#endif + +#ifndef pcibios_assign_all_busses +/* For bootloaders that do not initialize the PCI bus */ +#define pcibios_assign_all_busses() 1 +#endif + +/* Enable generic resource mapping code in drivers/pci/ */ +#define ARCH_GENERIC_PCI_MMAP_RESOURCE + +#ifdef CONFIG_PCI_DOMAINS +static inline int pci_proc_domain(struct pci_bus *bus) +{ + /* always show the domain in /proc */ + return 1; +} +#endif /* CONFIG_PCI_DOMAINS */ + +#endif /* __ASM_GENERIC_PCI_H */ -- 2.36.1