Skip to contentSkip to conversation

ARM: Add support for PCI domains

PATCH New Anton Vorontsov 3 participants 4 messages Mar 30, 2010 – Apr 15, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Add support for PCI domains

This patch adds support for PCI domains on ARM platforms.

Also, protect asm/mach/pci.h from multiple inclustions, otherwise build fails because of pci_domain_nr() and pci_proc_domain() redefinitions.

p.s.

Not sure if it makes sense to do PCI domains support optional.

With PCI domains:
text data bss dec hex filename
3407890 139808 102016 3649714 37b0b2 vmlinux

Without PCI domains:
text data bss dec hex filename
3407730 139808 102016 3649554 37b012 vmlinux

I.e. 160 bytes saved. Is it worth the amount of ifdefs? We can just make it always enabled (and it seems other architectures always enable it).

pp.s.
I found that Richard Liu seem to have posted a similar patch[1], but it wasn't propely signed off... Heh.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2009-December/006244.html

---
 arch/arm/Kconfig                |    4 ++++
 arch/arm/include/asm/mach/pci.h |   11 +++++++++++
 arch/arm/include/asm/pci.h      |   15 +++++++++++++++
 arch/arm/kernel/bios32.c        |    3 +++
 4 files changed, 33 insertions(+), 0 deletions(-)
arch/arm/Kconfig +4 -0
index d779e25..2a1bc52 100644
@@ -1075,6 +1075,10 @@ config PCI
 	  your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or
 	  VESA. If you have PCI, say Y, otherwise N.
 
+config PCI_DOMAINS
+	bool
+	depends on PCI
+
 config PCI_SYSCALL
 	def_bool PCI
 
arch/arm/include/asm/mach/pci.h +11 -0
index a38bdc7..52f0da1 100644
@@ -8,10 +8,16 @@
  * published by the Free Software Foundation.
  */
 
+#ifndef __ASM_MACH_PCI_H
+#define __ASM_MACH_PCI_H
+
 struct pci_sys_data;
 struct pci_bus;
 
 struct hw_pci {
+#ifdef CONFIG_PCI_DOMAINS
+	int		domain;
+#endif
 	struct list_head buses;
 	int		nr_controllers;
 	int		(*setup)(int nr, struct pci_sys_data *);
@@ -26,6 +32,9 @@ struct hw_pci {
  * Per-controller structure
  */
 struct pci_sys_data {
+#ifdef CONFIG_PCI_DOMAINS
+	int		domain;
+#endif
 	struct list_head node;
 	int		busnr;		/* primary bus number			*/
 	u64		mem_offset;	/* bus->cpu memory mapping offset	*/
@@ -70,3 +79,5 @@ extern int pci_v3_setup(int nr, struct pci_sys_data *);
 extern struct pci_bus *pci_v3_scan_bus(int nr, struct pci_sys_data *);
 extern void pci_v3_preinit(void);
 extern void pci_v3_postinit(void);
+
+#endif /* __ASM_MACH_PCI_H */
arch/arm/include/asm/pci.h +15 -0
index 4798011..92e2a83 100644
@@ -4,8 +4,23 @@
 #ifdef __KERNEL__
 #include <asm-generic/pci-dma-compat.h>
 
+#include <asm/mach/pci.h> /* for pci_sys_data */
 #include <mach/hardware.h> /* for PCIBIOS_MIN_* */
 
+#ifdef CONFIG_PCI_DOMAINS
+static inline int pci_domain_nr(struct pci_bus *bus)
+{
+	struct pci_sys_data *root = bus->sysdata;
+
+	return root->domain;
+}
+
+static inline int pci_proc_domain(struct pci_bus *bus)
+{
+	return pci_domain_nr(bus);
+}
+#endif /* CONFIG_PCI_DOMAINS */
+
 #ifdef CONFIG_PCI_HOST_ITE8152
 /* ITE bridge requires setting latency timer to avoid early bus access
    termination by PIC bus mater devices
arch/arm/kernel/bios32.c +3 -0
index bd397e0..c6273a3 100644
@@ -527,6 +527,9 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
 		if (!sys)
 			panic("PCI: unable to allocate sys data!");
 
+#ifdef CONFIG_PCI_DOMAINS
+		sys->domain  = hw->domain;
+#endif
 		sys->hw      = hw;
 		sys->busnr   = busnr;
 		sys->swizzle = hw->swizzle;
Signature · 1 line
1.7.0.3
#1 lore raw

PATCH 1/1 ARM: Add support for PCI domains

Quoted 22 lines · Anton Vorontsov

This patch adds support for PCI domains on ARM platforms.

Also, protect asm/mach/pci.h from multiple inclustions, otherwise build fails because of pci_domain_nr() and pci_proc_domain() redefinitions.

p.s.

Not sure if it makes sense to do PCI domains support optional.

With PCI domains:
text data bss dec hex filename
3407890 139808 102016 3649714 37b0b2 vmlinux

Without PCI domains:
text data bss dec hex filename
3407730 139808 102016 3649554 37b012 vmlinux

I.e. 160 bytes saved. Is it worth the amount of ifdefs? We can just make it always enabled (and it seems other architectures always enable it).

Quoted 5 lines

pp.s.
I found that Richard Liu seem to have posted a similar patch[1], but it wasn't propely signed off... Heh.

[1] http://lists.infradead.org/pipermail/linux-arm-kernel/2009-December/006244.html

Seeing as arm is targeted as embedded, I suspect that saving every last byte is a good idea where possible.

Quoted 1 line
Quoted 108 lines
---
 arch/arm/Kconfig                |    4 ++++
 arch/arm/include/asm/mach/pci.h |   11 +++++++++++
 arch/arm/include/asm/pci.h      |   15 +++++++++++++++
 arch/arm/kernel/bios32.c        |    3 +++
 4 files changed, 33 insertions(+), 0 deletions(-)
arch/arm/Kconfig +4 -0
index d779e25..2a1bc52 100644
@@ -1075,6 +1075,10 @@ config PCI
 	  your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or
 	  VESA. If you have PCI, say Y, otherwise N.
 
+config PCI_DOMAINS
+	bool
+	depends on PCI
+
 config PCI_SYSCALL
 	def_bool PCI
 
arch/arm/include/asm/mach/pci.h +11 -0
index a38bdc7..52f0da1 100644
@@ -8,10 +8,16 @@
  * published by the Free Software Foundation.
  */
 
+#ifndef __ASM_MACH_PCI_H
+#define __ASM_MACH_PCI_H
+
 struct pci_sys_data;
 struct pci_bus;
 
 struct hw_pci {
+#ifdef CONFIG_PCI_DOMAINS
+	int		domain;
+#endif
 	struct list_head buses;
 	int		nr_controllers;
 	int		(*setup)(int nr, struct pci_sys_data *);
@@ -26,6 +32,9 @@ struct hw_pci {
  * Per-controller structure
  */
 struct pci_sys_data {
+#ifdef CONFIG_PCI_DOMAINS
+	int		domain;
+#endif
 	struct list_head node;
 	int		busnr;		/* primary bus number			*/
 	u64		mem_offset;	/* bus->cpu memory mapping offset	*/
@@ -70,3 +79,5 @@ extern int pci_v3_setup(int nr, struct pci_sys_data *);
 extern struct pci_bus *pci_v3_scan_bus(int nr, struct pci_sys_data *);
 extern void pci_v3_preinit(void);
 extern void pci_v3_postinit(void);
+
+#endif /* __ASM_MACH_PCI_H */
arch/arm/include/asm/pci.h +15 -0
index 4798011..92e2a83 100644
@@ -4,8 +4,23 @@
 #ifdef __KERNEL__
 #include <asm-generic/pci-dma-compat.h>
 
+#include <asm/mach/pci.h> /* for pci_sys_data */
 #include <mach/hardware.h> /* for PCIBIOS_MIN_* */
 
+#ifdef CONFIG_PCI_DOMAINS
+static inline int pci_domain_nr(struct pci_bus *bus)
+{
+	struct pci_sys_data *root = bus->sysdata;
+
+	return root->domain;
+}
+
+static inline int pci_proc_domain(struct pci_bus *bus)
+{
+	return pci_domain_nr(bus);
+}
+#endif /* CONFIG_PCI_DOMAINS */
+
 #ifdef CONFIG_PCI_HOST_ITE8152
 /* ITE bridge requires setting latency timer to avoid early bus access
    termination by PIC bus mater devices
arch/arm/kernel/bios32.c +3 -0
index bd397e0..c6273a3 100644
@@ -527,6 +527,9 @@ static void __init pcibios_init_hw(struct hw_pci *hw)
 		if (!sys)
 			panic("PCI: unable to allocate sys data!");
 
+#ifdef CONFIG_PCI_DOMAINS
+		sys->domain  = hw->domain;
+#endif
 		sys->hw      = hw;
 		sys->busnr   = busnr;
 		sys->swizzle = hw->swizzle;
Signature · 6 lines
1.7.0.3

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH 1/1 ARM: Add support for PCI domains

In reply to Anton Vorontsov
Quoted 5 lines · Anton Vorontsov

This patch adds support for PCI domains on ARM platforms.

Also, protect asm/mach/pci.h from multiple inclustions, otherwise build fails because of pci_domain_nr() and pci_proc_domain() redefinitions.

Ok.

#3 lore raw

PATCH 1/1 ARM: Add support for PCI domains

Quoted 8 lines · Russell King - ARM Linux
Quoted 5 lines · Anton Vorontsov

This patch adds support for PCI domains on ARM platforms.

Also, protect asm/mach/pci.h from multiple inclustions, otherwise build fails because of pci_domain_nr() and pci_proc_domain() redefinitions.

Ok.

Hi Russell,

what if anything needs to be done to merge this change?