Skip to contentSkip to conversation

Add PCI support on nios2 architecture

PATCH In review Ley Foon Tan 3 participants 10 messages Oct 14, 2015 – Oct 22, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Add PCI support on nios2 architecture

This is 2nd version of patch to add pci support for nios2 architecture. This patchset also update asm-generic/pci.h to include PCI generic define/function as suggested by Arnd.
It requires pci_fixup_irqs() from setup-irq.c.

v1->v2 changes:
- nios2: remove PCI_SYSCALL from Kconfig
- nios2: set IO_SPACE_LIMIT to 0xffff
- nios2: remove arch/nios2/include/asm/pci.h and use asm-generic pci.h
- pci: add include <linux/dma-mapping.h> to pci.c
- asm-generic: add pci generic functions/defines to pci.h

History
-------
[v1]: https://lkml.org/lkml/2015/9/22/44

Ley Foon Tan (4):
asm-generic: add pci required defines and functions
pci: add include <linux/dma-mapping.h>
PCI: Build setup-irq.o for nios2
nios2: Add architectural support for PCIe

 arch/nios2/Kconfig            | 21 +++++++++++++++++++++
 arch/nios2/include/asm/Kbuild |  1 +
 arch/nios2/include/asm/io.h   | 12 ++++++++++--
 arch/nios2/kernel/Makefile    |  1 +
 arch/nios2/kernel/pci.c       | 33 +++++++++++++++++++++++++++++++++
 drivers/pci/Makefile          |  1 +
 drivers/pci/pci.c             |  1 +
 include/asm-generic/pci.h     | 34 ++++++++++++++++++++++++++++++++++
 8 files changed, 102 insertions(+), 2 deletions(-)
 create mode 100644 arch/nios2/kernel/pci.c
Signature · 1 line
1.8.2.1
#1 lore raw

PATCH v2 1/4 asm-generic: add pci required defines and functions

Add the generic #define and functions that required by the PCI framework. Architecture pci.h can overwrite with their implementation if needed.

---
 include/asm-generic/pci.h | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
include/asm-generic/pci.h +34 -0
index f24bc51..2771b32 100644
@@ -21,4 +21,38 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 #define PCI_DMA_BUS_IS_PHYS	(1)
 #endif
 
+#ifdef CONFIG_PCI
+
+#ifndef PCIBIOS_MIN_IO
+#define PCIBIOS_MIN_IO	(0UL)
+#endif
+
+#ifndef PCIBIOS_MIN_MEM
+#define PCIBIOS_MIN_MEM	(0UL)
+#endif
+
+#ifndef pcibios_assign_all_busses
+#define pcibios_assign_all_busses()	(pci_has_flag(PCI_REASSIGN_ALL_BUS))
+#endif
+
+#ifndef pci_proc_domain
+#define pci_proc_domain pci_proc_domain
+static inline int pci_proc_domain(struct pci_bus *bus)
+{
+#ifdef CONFIG_PCI_DOMAINS_GENERIC
+	return pci_domain_nr(bus);
+#else
+	return 1;
+#endif
+}
+#endif
+
+extern int isa_dma_bridge_buggy;
+
+#else
+
+#define isa_dma_bridge_buggy	(0)
+
+#endif /* CONFIG_PCI */
+
 #endif /* _ASM_GENERIC_PCI_H */
Signature · 1 line
1.8.2.1
#5 lore raw

PATCH v2 2/4 pci: add include <linux/dma-mapping.h>

In reply to Ley Foon Tan

Include <linux/dma-mapping.h> explicitly, it depends on architecture's pci.h to include it before this. It cause compilation error when we move to asm-generic pci.

---
 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/pci.c +1 -0
index 6a9a111..ef2f09e 100644
@@ -25,6 +25,7 @@
 #include <linux/device.h>
 #include <linux/pm_runtime.h>
 #include <linux/pci_hotplug.h>
+#include <linux/dma-mapping.h>
 #include <asm-generic/pci-bridge.h>
 #include <asm/setup.h>
 #include "pci.h"
Signature · 1 line
1.8.2.1
#6 lore raw

PATCH v2 3/4 PCI: Build setup-irq.o for nios2

In reply to Ley Foon Tan

nios2 requires setup-irq.o to provide pci_fixup_irqs() implementation.

---
 drivers/pci/Makefile | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/Makefile +1 -0
index be3f631..282b1b4 100644
@@ -40,6 +40,7 @@ obj-$(CONFIG_MIPS) += setup-irq.o
 obj-$(CONFIG_TILE) += setup-irq.o
 obj-$(CONFIG_SPARC_LEON) += setup-irq.o
 obj-$(CONFIG_M68K) += setup-irq.o
+obj-$(CONFIG_NIOS2) += setup-irq.o
 
 #
 # ACPI Related PCI FW Functions
Signature · 1 line
1.8.2.1
#7 lore raw

PATCH v2 4/4 nios2: Add architectural support for PCIe

In reply to Ley Foon Tan

This patch add pcie support on nios2 platform.

---
 arch/nios2/Kconfig            | 21 +++++++++++++++++++++
 arch/nios2/include/asm/Kbuild |  1 +
 arch/nios2/include/asm/io.h   | 12 ++++++++++--
 arch/nios2/kernel/Makefile    |  1 +
 arch/nios2/kernel/pci.c       | 33 +++++++++++++++++++++++++++++++++
 5 files changed, 66 insertions(+), 2 deletions(-)
 create mode 100644 arch/nios2/kernel/pci.c
arch/nios2/Kconfig +21 -0
index 4375554..bde323f 100644
@@ -11,6 +11,7 @@ config NIOS2
 	select HAVE_ARCH_KGDB
 	select IRQ_DOMAIN
 	select MODULES_USE_ELF_RELA
+	select MIGHT_HAVE_PCI
 	select OF
 	select OF_EARLY_FLATTREE
 	select SOC_BUS
@@ -194,6 +195,26 @@ config NIOS2_IO_REGION_BASE
 
 endmenu
 
+menu "Bus support"
+config PCI
+	bool "PCI support"
+	select GENERIC_PCI_IOMAP
+	help
+	  This feature enables support for PCIe bus system. If you say Y
+	  here, the kernel will include drivers and infrastructure code
+	  to support PCIe bus devices.
+
+config PCI_DOMAINS
+	def_bool PCI
+
+config PCI_DOMAINS_GENERIC
+	def_bool PCI
+
+source "drivers/pci/Kconfig"
+source "drivers/pci/pcie/Kconfig"
+
+endmenu
+
 menu "Executable file formats"
 
 source "fs/Kconfig.binfmt"
arch/nios2/include/asm/Kbuild +1 -0
index d63330e..a7cace1 100644
@@ -34,6 +34,7 @@ generic-y += mm-arch-hooks.h
 generic-y += mman.h
 generic-y += module.h
 generic-y += msgbuf.h
+generic-y += msi.h
 generic-y += param.h
 generic-y += pci.h
 generic-y += percpu.h
arch/nios2/include/asm/io.h +10 -2
index c5a62da..0ba8388 100644
@@ -14,8 +14,7 @@
 #include <linux/types.h>
 #include <asm/pgtable-bits.h>
 
-/* PCI is not supported in nios2, set this to 0. */
-#define IO_SPACE_LIMIT 0
+#define IO_SPACE_LIMIT 0xffff
 
 #define readb_relaxed(addr)	readb(addr)
 #define readw_relaxed(addr)	readw(addr)
@@ -45,6 +44,15 @@ static inline void iounmap(void __iomem *addr)
 	__iounmap(addr);
 }
 
+static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
+{
+	return NULL;
+}
+
+static inline void ioport_unmap(void __iomem *p)
+{
+}
+
 #define ioremap_wc ioremap_nocache
 #define ioremap_wt ioremap_nocache
 
arch/nios2/kernel/Makefile +1 -0
index 1aae257..bb1ef81 100644
@@ -10,6 +10,7 @@ obj-y	+= entry.o
 obj-y	+= insnemu.o
 obj-y	+= irq.o
 obj-y	+= nios2_ksyms.o
+obj-y	+= pci.o
 obj-y	+= process.o
 obj-y	+= prom.o
 obj-y	+= ptrace.o
arch/nios2/kernel/pci.c new file +33 -0
new file mode 100644
index 0000000..d28aed7
@@ -0,0 +1,33 @@
+/* Copyright Altera Corporation (C) 2015. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+#include <linux/pci.h>
+
+/*
+ * Called after each bus is probed, but before its children are examined
+ */
+void pcibios_fixup_bus(struct pci_bus *bus)
+{
+	/* nothing to do, expected to be removed in the future */
+}
+
+/*
+ * We don't have to worry about legacy ISA devices, so nothing to do here
+ */
+resource_size_t pcibios_align_resource(void *data, const struct resource *res,
+				resource_size_t size, resource_size_t align)
+{
+	return res->start;
+}
Signature · 1 line
1.8.2.1
#2 lore raw

Re: [PATCH v2 1/4] asm-generic: add pci required defines and functions

In reply to Ley Foon Tan
reproduce:

Hi Ley,

[auto build test ERROR on v4.3-rc5 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Ley-Foon-Tan/Add-PCI-support-on-nios2-architecture/20151014-143651
config: x86_64-lkp (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

In file included from arch/x86/include/asm/pci.h:112:0,

                    from include/linux/pci.h:1497,
                    from arch/x86/kernel/setup.c:48:
>> include/asm-generic/pci.h:39:25: error: redefinition of 'pci_proc_domain'
    #define pci_proc_domain pci_proc_domain
                            ^
>> include/asm-generic/pci.h:40:19: note: in expansion of macro 'pci_proc_domain'
    static inline int pci_proc_domain(struct pci_bus *bus)
                      ^
   In file included from include/linux/pci.h:1497:0,
                    from arch/x86/kernel/setup.c:48:

arch/x86/include/asm/pci.h:38:19: note: previous definition of 'pci_proc_domain' was here
static inline int pci_proc_domain(struct pci_bus *bus)
^
--
In file included from arch/x86/include/asm/pci.h:112:0,

                    from include/linux/pci.h:1497,
                    from arch/x86/pci/common.c:8:
>> include/asm-generic/pci.h:39:25: error: redefinition of 'pci_proc_domain'
    #define pci_proc_domain pci_proc_domain
                            ^
>> include/asm-generic/pci.h:40:19: note: in expansion of macro 'pci_proc_domain'
    static inline int pci_proc_domain(struct pci_bus *bus)
                      ^
   In file included from include/linux/pci.h:1497:0,
                    from arch/x86/pci/common.c:8:
   arch/x86/include/asm/pci.h:38:19: note: previous definition of 'pci_proc_domain' was here
    static inline int pci_proc_domain(struct pci_bus *bus)
                      ^
>> arch/x86/pci/common.c:639:44: error: macro "pcibios_assign_all_busses" passed 1 arguments, but takes just 0
    unsigned int pcibios_assign_all_busses(void)
                                               ^
>> arch/x86/pci/common.c:640:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^

vim +/pci_proc_domain +39 include/asm-generic/pci.h

    33	
    34	#ifndef pcibios_assign_all_busses
    35	#define pcibios_assign_all_busses()	(pci_has_flag(PCI_REASSIGN_ALL_BUS))
    36	#endif
    37	
    38	#ifndef pci_proc_domain
  > 39	#define pci_proc_domain pci_proc_domain
  > 40	static inline int pci_proc_domain(struct pci_bus *bus)
    41	{
    42	#ifdef CONFIG_PCI_DOMAINS_GENERIC
    43		return pci_domain_nr(bus);

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#3 lore raw

Re: [PATCH v2 1/4] asm-generic: add pci required defines and functions

In reply to Ley Foon Tan
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…

Hi Ley,

[auto build test WARNING on v4.3-rc5 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Ley-Foon-Tan/Add-PCI-support-on-nios2-architecture/20151014-143651
config: frv-defconfig (attached as .config)

reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=frv

All warnings (new ones prefixed by >>):

In file included from arch/frv/include/asm/pci.h:19:0,

                    from include/linux/pci.h:1497,
                    from arch/frv/mm/dma-alloc.c:38:
   include/asm-generic/pci.h:39:25: error: redefinition of 'pci_proc_domain'
    #define pci_proc_domain pci_proc_domain
                            ^
   include/asm-generic/pci.h:40:19: note: in expansion of macro 'pci_proc_domain'
    static inline int pci_proc_domain(struct pci_bus *bus)
                      ^
   In file included from arch/frv/mm/dma-alloc.c:38:0:
   include/linux/pci.h:1360:19: note: previous definition of 'pci_proc_domain' was here
    static inline int pci_proc_domain(struct pci_bus *bus) { return 0; }
                      ^
   In file included from include/linux/pci.h:1497:0,
                    from arch/frv/mm/dma-alloc.c:38:
>> arch/frv/include/asm/pci.h:23:0: warning: "pcibios_assign_all_busses" redefined
    #define pcibios_assign_all_busses() 0
    ^
   In file included from arch/frv/include/asm/pci.h:19:0,
                    from include/linux/pci.h:1497,
                    from arch/frv/mm/dma-alloc.c:38:
   include/asm-generic/pci.h:35:0: note: this is the location of the previous definition
    #define pcibios_assign_all_busses() (pci_has_flag(PCI_REASSIGN_ALL_BUS))
    ^
   In file included from include/linux/pci.h:1497:0,
                    from arch/frv/mm/dma-alloc.c:38:
>> arch/frv/include/asm/pci.h:48:0: warning: "PCIBIOS_MIN_IO" redefined
    #define PCIBIOS_MIN_IO  0x100
    ^
   In file included from arch/frv/include/asm/pci.h:19:0,
                    from include/linux/pci.h:1497,
                    from arch/frv/mm/dma-alloc.c:38:
   include/asm-generic/pci.h:27:0: note: this is the location of the previous definition
    #define PCIBIOS_MIN_IO (0UL)
    ^
   In file included from include/linux/pci.h:1497:0,
                    from arch/frv/mm/dma-alloc.c:38:
>> arch/frv/include/asm/pci.h:49:0: warning: "PCIBIOS_MIN_MEM" redefined
    #define PCIBIOS_MIN_MEM  0x00010000
    ^
   In file included from arch/frv/include/asm/pci.h:19:0,
                    from include/linux/pci.h:1497,
                    from arch/frv/mm/dma-alloc.c:38:
   include/asm-generic/pci.h:31:0: note: this is the location of the previous definition
    #define PCIBIOS_MIN_MEM (0UL)
    ^

vim +/pcibios_assign_all_busses +23 arch/frv/include/asm/pci.h

d7c4f1b7 arch/frv/include/asm/pci.h Arnd Bergmann     2009-05-13  13  #ifndef _ASM_FRV_PCI_H
d7c4f1b7 arch/frv/include/asm/pci.h Arnd Bergmann     2009-05-13  14  #define _ASM_FRV_PCI_H
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  15  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  16  #include <linux/mm.h>
84be456f arch/frv/include/asm/pci.h Christoph Hellwig 2015-05-01  17  #include <linux/scatterlist.h>
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  18  #include <asm-generic/pci-dma-compat.h>
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16 @19  #include <asm-generic/pci.h>
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  20  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  21  struct pci_dev;
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  22  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16 @23  #define pcibios_assign_all_busses()	0
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  24  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  25  extern void pcibios_set_master(struct pci_dev *dev);
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  26  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  27  #ifdef CONFIG_MMU
a5da7d3c include/asm-frv/pci.h      Al Viro           2005-10-21  28  extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  29  extern void consistent_free(void *vaddr);
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  30  extern void consistent_sync(void *vaddr, size_t size, int direction);
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  31  extern void consistent_sync_page(struct page *page, unsigned long offset,
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  32  				 size_t size, int direction);
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  33  #endif
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  34  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  35  extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  36  				  dma_addr_t *dma_handle);
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  37  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  38  extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  39  				void *vaddr, dma_addr_t dma_handle);
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  40  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  41  /* Return the index of the PCI controller for device PDEV. */
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  42  #define pci_controller_num(PDEV)	(0)
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  43  
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  44  /*
25985edc arch/frv/include/asm/pci.h Lucas De Marchi   2011-03-30  45   *	These are pretty much arbitrary with the CoMEM implementation.
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  46   *	We have the whole address space to ourselves.
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  47   */
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16 @48  #define PCIBIOS_MIN_IO		0x100
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16 @49  #define PCIBIOS_MIN_MEM		0x00010000
^1da177e include/asm-frv/pci.h      Linus Torvalds    2005-04-16  50  
d7c4f1b7 arch/frv/include/asm/pci.h Arnd Bergmann     2009-05-13  51  #endif /* _ASM_FRV_PCI_H */

:::::: The code at line 23 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#4 lore raw

Re: [PATCH v2 1/4] asm-generic: add pci required defines and functions

In reply to Ley Foon Tan
url: https://github.com/0day-ci/linux/commits/Ley-Foon-Tan/Add-PCI-support-on-nios2-architecture/20151014-143651 reproduce:

Hi Ley,

[auto build test WARNING on v4.3-rc5 -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url: https://github.com/0day-ci/linux/commits/Ley-Foon-Tan/Add-PCI-support-on-nios2-architecture/20151014-143651
reproduce:

        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__

sparse warnings: (new ones prefixed by >>)

>> arch/x86/pci/common.c:639:14: sparse: macro "pcibios_assign_all_busses" passed 1 arguments, but takes just 0
   arch/x86/pci/common.c:640:1: sparse: Expected ; at end of declaration
   arch/x86/pci/common.c:640:1: sparse: got {
   arch/x86/pci/common.c:642:1: sparse: Expected ; at the end of type declaration
   arch/x86/pci/common.c:642:1: sparse: got }
>> arch/x86/pci/common.c:651:9: sparse: Trying to use reserved word 'while' as identifier
>> arch/x86/pci/common.c:673:9: sparse: Trying to use reserved word 'return' as identifier
   arch/x86/pci/common.c:673:16: sparse: Expected ; at end of declaration
   arch/x86/pci/common.c:673:16: sparse: got 0
   arch/x86/pci/common.c:674:1: sparse: Expected ; at the end of type declaration
   arch/x86/pci/common.c:674:1: sparse: got }
   arch/x86/pci/common.c:679:1: sparse: Expected ; at the end of type declaration
   arch/x86/pci/common.c:679:1: sparse: got }
   arch/x86/pci/common.c:685:1: sparse: Expected ; at the end of type declaration
   arch/x86/pci/common.c:685:1: sparse: got }
   arch/x86/pci/common.c:690:1: sparse: Expected ; at the end of type declaration
   arch/x86/pci/common.c:690:1: sparse: got }
>> arch/x86/pci/common.c:696:9: sparse: Trying to use reserved word 'else' as identifier
   arch/x86/pci/common.c:697:17: sparse: Expected ; at end of declaration
   arch/x86/pci/common.c:697:17: sparse: got return
   arch/x86/pci/common.c:698:1: sparse: Expected ; at the end of type declaration
   arch/x86/pci/common.c:698:1: sparse: got }
   arch/x86/pci/common.c:639:14: sparse: symbol 'pcibios_assign_all_busses' redeclared with different type (originally declared at arch/x86/include/asm/pci.h:48) - different base types
   arch/x86/pci/common.c:650:9: sparse: symbol 'pa_data' redeclared with different type (originally declared at arch/x86/pci/common.c:648) - different base types
   arch/x86/pci/common.c:652:17: sparse: undefined identifier 'data'
   arch/x86/pci/common.c:653:22: sparse: undefined identifier 'data'
   arch/x86/pci/common.c:656:21: sparse: undefined identifier 'data'
   arch/x86/pci/common.c:657:55: sparse: undefined identifier 'data'
   arch/x86/pci/common.c:659:44: sparse: undefined identifier 'dev'
   arch/x86/pci/common.c:665:33: sparse: undefined identifier 'dev'
   arch/x86/pci/common.c:667:33: sparse: undefined identifier 'dev'
   arch/x86/pci/common.c:670:27: sparse: undefined identifier 'data'
   arch/x86/pci/common.c:671:25: sparse: undefined identifier 'data'
   In file included from arch/x86/include/asm/pci.h:112:0,
                    from include/linux/pci.h:1497,
                    from arch/x86/pci/common.c:8:
   include/asm-generic/pci.h:39:25: error: redefinition of 'pci_proc_domain'
    #define pci_proc_domain pci_proc_domain
                            ^
   include/asm-generic/pci.h:40:19: note: in expansion of macro 'pci_proc_domain'
    static inline int pci_proc_domain(struct pci_bus *bus)
                      ^
   In file included from include/linux/pci.h:1497:0,
                    from arch/x86/pci/common.c:8:
   arch/x86/include/asm/pci.h:38:19: note: previous definition of 'pci_proc_domain' was here
    static inline int pci_proc_domain(struct pci_bus *bus)
                      ^
   arch/x86/pci/common.c:639:44: error: macro "pcibios_assign_all_busses" passed 1 arguments, but takes just 0
    unsigned int pcibios_assign_all_busses(void)
                                               ^
   arch/x86/pci/common.c:640:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
    {
    ^

--
drivers/scsi/bfa/bfa_svc.c:751:71: sparse: incorrect type in argument 5 (different base types)
drivers/scsi/bfa/bfa_svc.c:751:71: expected unsigned int [unsigned] [usertype] rsp_len
drivers/scsi/bfa/bfa_svc.c:751:71: got restricted __be32 [usertype] rsp_len
drivers/scsi/bfa/bfa_svc.c:752:49: sparse: incorrect type in argument 6 (different base types)
drivers/scsi/bfa/bfa_svc.c:752:49: expected unsigned int [unsigned] [usertype] resid_len
drivers/scsi/bfa/bfa_svc.c:752:49: got restricted __be32 [usertype] residue_len
drivers/scsi/bfa/bfa_svc.c:759:39: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:759:39: expected unsigned int [unsigned] [usertype] rsp_len
drivers/scsi/bfa/bfa_svc.c:759:39: got restricted __be32 [usertype] rsp_len
drivers/scsi/bfa/bfa_svc.c:760:43: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:760:43: expected unsigned int [unsigned] [usertype] residue_len
drivers/scsi/bfa/bfa_svc.c:760:43: got restricted __be32 [usertype] residue_len
drivers/scsi/bfa/bfa_svc.c:3619:39: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:3619:39: expected restricted __be16 [usertype] maxfrsize
drivers/scsi/bfa/bfa_svc.c:3619:39: got unsigned short [unsigned] [usertype] maxfrsize
drivers/scsi/bfa/bfa_svc.c:3654:41: sparse: cast from restricted __be16 drivers/scsi/bfa/bfa_svc.c:3654:41: sparse: incorrect type in argument 1 (different base types)
drivers/scsi/bfa/bfa_svc.c:3654:41: expected unsigned short [unsigned] [usertype] val
drivers/scsi/bfa/bfa_svc.c:3654:41: got restricted __be16 [usertype] maxfrsize
drivers/scsi/bfa/bfa_svc.c:3654:41: sparse: cast from restricted __be16 drivers/scsi/bfa/bfa_svc.c:3654:41: sparse: cast from restricted __be16 drivers/scsi/bfa/bfa_svc.c:3655:54: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:3655:54: expected unsigned short [unsigned] [usertype] path_tov
drivers/scsi/bfa/bfa_svc.c:3655:54: got restricted __be16 [usertype] <noident>
drivers/scsi/bfa/bfa_svc.c:3657:53: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:3657:53: expected unsigned short [unsigned] [usertype] q_depth
drivers/scsi/bfa/bfa_svc.c:3657:53: got restricted __be16 [usertype] <noident>
drivers/scsi/bfa/bfa_svc.c:3993:9: sparse: cast from restricted __be16 drivers/scsi/bfa/bfa_svc.c:4003:31: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:4003:31: expected restricted __be16 [usertype] maxfrsize
drivers/scsi/bfa/bfa_svc.c:4003:31: got unsigned short [unsigned] [usertype] maxfrsize
drivers/scsi/bfa/bfa_svc.c:4012:27: sparse: incorrect type in return expression (different base types)
drivers/scsi/bfa/bfa_svc.c:4012:27: expected unsigned short
drivers/scsi/bfa/bfa_svc.c:4012:27: got restricted __be16 [usertype] maxfrsize
drivers/scsi/bfa/bfa_svc.c:4378:1: sparse: symbol 'bfa_fcport_ddportenable' was not declared. Should it be static? drivers/scsi/bfa/bfa_svc.c:4387:1: sparse: symbol 'bfa_fcport_ddportdisable' was not declared. Should it be static? drivers/scsi/bfa/bfa_ioc.h:193:22: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_ioc.h:193:22: expected unsigned int [unsigned] [usertype] al_len
drivers/scsi/bfa/bfa_ioc.h:193:22: got restricted __be32 [usertype] <noident>
drivers/scsi/bfa/bfa_svc.c:5656:22: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:5656:22: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:5656:22: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:5656:22: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:5657:22: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:5657:22: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:5657:22: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:5657:22: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6675:21: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:6675:21: expected int enum bfa_status [signed] status
drivers/scsi/bfa/bfa_svc.c:6675:21: got restricted __be32 [usertype] <noident>
drivers/scsi/bfa/bfa_svc.c:6726:49: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:6726:49: expected unsigned int [unsigned] [usertype] roundtrip_latency
drivers/scsi/bfa/bfa_svc.c:6726:49: got restricted __be32 [usertype] <noident>
drivers/scsi/bfa/bfa_svc.c:6728:50: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:6728:50: expected unsigned int [unsigned] [usertype] est_cable_distance
drivers/scsi/bfa/bfa_svc.c:6728:50: got restricted __be32 [usertype] <noident>
drivers/scsi/bfa/bfa_svc.c:6731:25: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6731:25: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6731:25: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6731:25: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6733:39: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6733:39: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6733:39: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6733:39: sparse: cast to restricted __be16 drivers/scsi/bfa/bfa_svc.c:6760:30: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:6760:30: expected unsigned int [unsigned] [usertype] lpcnt
drivers/scsi/bfa/bfa_svc.c:6760:30: got restricted __be32 [usertype] <noident>
drivers/scsi/bfa/bfa_svc.c:6013:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6013:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6013:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6013:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6013:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6013:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6014:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6014:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6014:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6014:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6014:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6014:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6015:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6015:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6015:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6015:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6015:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6015:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6016:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6016:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6016:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6016:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6016:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6016:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6017:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6017:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6017:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6017:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6017:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6017:27: sparse: cast to restricted __be32 drivers/scsi/bfa/bfa_svc.c:6652:26: sparse: incorrect type in assignment (different base types)
drivers/scsi/bfa/bfa_svc.c:6652:26: expected unsigned int [unsigned] [usertype] lpcnt
drivers/scsi/bfa/bfa_svc.c:6652:26: got restricted __be32 [usertype] <noident>

>> drivers/scsi/bfa/bfa_svc.c:6653:28: sparse: too many warnings
   In file included from arch/x86/include/asm/pci.h:112:0,
                    from include/linux/pci.h:1497,
                    from drivers/scsi/bfa/bfad_drv.h:30,
                    from drivers/scsi/bfa/bfa_svc.c:18:
   include/asm-generic/pci.h:39:25: error: redefinition of 'pci_proc_domain'
    #define pci_proc_domain pci_proc_domain
                            ^
   include/asm-generic/pci.h:40:19: note: in expansion of macro 'pci_proc_domain'
    static inline int pci_proc_domain(struct pci_bus *bus)
                      ^
   In file included from include/linux/pci.h:1497:0,
                    from drivers/scsi/bfa/bfad_drv.h:30,
                    from drivers/scsi/bfa/bfa_svc.c:18:

arch/x86/include/asm/pci.h:38:19: note: previous definition of 'pci_proc_domain' was here
static inline int pci_proc_domain(struct pci_bus *bus)
^

vim +/pcibios_assign_all_busses +639 arch/x86/pci/common.c

41b9eb26 arch/x86/pci/common.c  Stefan Assmann    2008-07-15  633  			noioapicreroute = 1;
41b9eb26 arch/x86/pci/common.c  Stefan Assmann    2008-07-15  634  		return NULL;
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  635  	}
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  636  	return str;
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  637  }
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  638  
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16 @639  unsigned int pcibios_assign_all_busses(void)
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  640  {
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  641  	return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  642  }
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  643  
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  644  int pcibios_add_device(struct pci_dev *dev)
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  645  {
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  646  	struct setup_data *data;
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  647  	struct pci_setup_rom *rom;
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  648  	u64 pa_data;
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  649  
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  650  	pa_data = boot_params.hdr.setup_data;
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05 @651  	while (pa_data) {
65694c5a arch/x86/pci/common.c  Matt Fleming      2013-06-05  652  		data = ioremap(pa_data, sizeof(*rom));
65694c5a arch/x86/pci/common.c  Matt Fleming      2013-06-05  653  		if (!data)
65694c5a arch/x86/pci/common.c  Matt Fleming      2013-06-05  654  			return -ENOMEM;
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  655  
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  656  		if (data->type == SETUP_PCI) {
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  657  			rom = (struct pci_setup_rom *)data;
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  658  
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  659  			if ((pci_domain_nr(dev->bus) == rom->segment) &&
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  660  			    (dev->bus->number == rom->bus) &&
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  661  			    (PCI_SLOT(dev->devfn) == rom->device) &&
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  662  			    (PCI_FUNC(dev->devfn) == rom->function) &&
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  663  			    (dev->vendor == rom->vendor) &&
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  664  			    (dev->device == rom->devid)) {
dbd3fc33 arch/x86/pci/common.c  Bjorn Helgaas     2012-12-10  665  				dev->rom = pa_data +
dbd3fc33 arch/x86/pci/common.c  Bjorn Helgaas     2012-12-10  666  				      offsetof(struct pci_setup_rom, romdata);
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  667  				dev->romlen = rom->pcilen;
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  668  			}
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  669  		}
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  670  		pa_data = data->next;
65694c5a arch/x86/pci/common.c  Matt Fleming      2013-06-05  671  		iounmap(data);
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  672  	}
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05 @673  	return 0;
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  674  }
f9a37be0 arch/x86/pci/common.c  Matthew Garrett   2012-12-05  675  
991de2e5 arch/x86/pci/common.c  Jiang Liu         2015-06-10  676  int pcibios_alloc_irq(struct pci_dev *dev)
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  677  {
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  678  	return pcibios_enable_irq(dev);
^1da177e arch/i386/pci/common.c Linus Torvalds    2005-04-16  679  }
87bec66b arch/i386/pci/common.c David Shaohua Li  2005-07-27  680  
991de2e5 arch/x86/pci/common.c  Jiang Liu         2015-06-10  681  void pcibios_free_irq(struct pci_dev *dev)
9e8ce4b9 arch/x86/pci/common.c  Rafael J. Wysocki 2015-03-20  682  {
991de2e5 arch/x86/pci/common.c  Jiang Liu         2015-06-10  683  	if (pcibios_disable_irq)
9e8ce4b9 arch/x86/pci/common.c  Rafael J. Wysocki 2015-03-20  684  		pcibios_disable_irq(dev);
9e8ce4b9 arch/x86/pci/common.c  Rafael J. Wysocki 2015-03-20  685  }
9e8ce4b9 arch/x86/pci/common.c  Rafael J. Wysocki 2015-03-20  686  
991de2e5 arch/x86/pci/common.c  Jiang Liu         2015-06-10  687  int pcibios_enable_device(struct pci_dev *dev, int mask)
991de2e5 arch/x86/pci/common.c  Jiang Liu         2015-06-10  688  {
991de2e5 arch/x86/pci/common.c  Jiang Liu         2015-06-10  689  	return pci_enable_resources(dev, mask);
991de2e5 arch/x86/pci/common.c  Jiang Liu         2015-06-10  690  }
991de2e5 arch/x86/pci/common.c  Jiang Liu         2015-06-10  691  
642c92da arch/x86/pci/common.c  Taku Izumi        2012-10-30  692  int pci_ext_cfg_avail(void)
0ef5f8f6 arch/x86/pci/common.c  Andrew Patterson  2008-11-10  693  {
0ef5f8f6 arch/x86/pci/common.c  Andrew Patterson  2008-11-10  694  	if (raw_pci_ext_ops)
0ef5f8f6 arch/x86/pci/common.c  Andrew Patterson  2008-11-10  695  		return 1;
0ef5f8f6 arch/x86/pci/common.c  Andrew Patterson  2008-11-10 @696  	else
0ef5f8f6 arch/x86/pci/common.c  Andrew Patterson  2008-11-10  697  		return 0;
0ef5f8f6 arch/x86/pci/common.c  Andrew Patterson  2008-11-10  698  }

:::::: The code at line 639 was first introduced by commit :::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#8 lore raw
In reply to Ley Foon Tan

Hi Ley,

I'm ignoring this series for now because of the build errors reported by the kbuild test robot.

Bjorn

Quoted 40 lines · Ley Foon Tan

This is 2nd version of patch to add pci support for nios2 architecture. This patchset also update asm-generic/pci.h to include PCI generic define/function as suggested by Arnd.
It requires pci_fixup_irqs() from setup-irq.c.

v1->v2 changes:
- nios2: remove PCI_SYSCALL from Kconfig
- nios2: set IO_SPACE_LIMIT to 0xffff
- nios2: remove arch/nios2/include/asm/pci.h and use asm-generic pci.h
- pci: add include <linux/dma-mapping.h> to pci.c
- asm-generic: add pci generic functions/defines to pci.h

History
-------
[v1]: https://lkml.org/lkml/2015/9/22/44

Ley Foon Tan (4):
asm-generic: add pci required defines and functions
pci: add include <linux/dma-mapping.h>
PCI: Build setup-irq.o for nios2
nios2: Add architectural support for PCIe

 arch/nios2/Kconfig            | 21 +++++++++++++++++++++
 arch/nios2/include/asm/Kbuild |  1 +
 arch/nios2/include/asm/io.h   | 12 ++++++++++--
 arch/nios2/kernel/Makefile    |  1 +
 arch/nios2/kernel/pci.c       | 33 +++++++++++++++++++++++++++++++++
 drivers/pci/Makefile          |  1 +
 drivers/pci/pci.c             |  1 +
 include/asm-generic/pci.h     | 34 ++++++++++++++++++++++++++++++++++
 8 files changed, 102 insertions(+), 2 deletions(-)
 create mode 100644 arch/nios2/kernel/pci.c
Signature · 6 lines
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw
Quoted 7 lines · Bjorn Helgaas

Hi Ley,

I'm ignoring this series for now because of the build errors reported by the kbuild test robot.

Bjorn

Hi Bjorn

I'm working on the newer version to fix the build errors. Thanks.

Regards
Ley Foon