Skip to contentSkip to conversation

Initial steps to compile AMBA for x86

PATCH NAK Alessandro Rubini 4 participants 9 messages Mar 1, 2012

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

cover Initial steps to compile AMBA for x86

I'm working on the sta2x11 I/O Hub, which is basically a bridge from PCIe to AMBA. While current code uses PCI drivers for all the PrimeCell devices (with a lot of code duplication), I think we should be able to compile native amba drivers. The chip has uart, spi, mmc, i2c and dma cells, for which an AMBA driver is already in the kernel.

This patch-set is the first steps needed to build amba drivers for x86. I'm currently using the pl011 UART as a testbed, and it's up on my system (with other not-ready-to-be-published patches).

As for sizes, there are a number of users of <asm/sizes.h>. If these initial patches are accepted, I'll take care to convert other stuff, add a #warning to asm/sizes.h and remove it after a pair of releases.

The patches have been build-tested under ARM with versatile_defconfig, at91sam9263_defconfig, vexpress_defconfig and realview-smp_defconfig -- as well as sta2x11 on x86.

Alessandro Rubini (4):
x86: add NO_IRQ macro
sizes.h: move from asm-generic to <linux/sizes.h>
amba: use the new linux/sizes.h
ARM: use the new linux/sizes.h

 arch/arm/include/asm/memory.h |    2 +-
 arch/arm/mm/dma-mapping.c     |    2 +-
 arch/arm/mm/init.c            |    2 +-
 arch/arm/mm/ioremap.c         |    2 +-
 arch/arm/mm/mmu.c             |    2 +-
 arch/x86/include/asm/irq.h    |    2 +
 drivers/amba/bus.c            |    2 +-
 include/asm-generic/sizes.h   |   49 +---------------------------------------
 include/linux/sizes.h         |   47 +++++++++++++++++++++++++++++++++++++++
 9 files changed, 57 insertions(+), 53 deletions(-)
 create mode 100644 include/linux/sizes.h
Signature · 1 line
1.7.7.2
#1 lore raw

PATCH 1/4 x86: add NO_IRQ macro

This is needed to compile AMBA drivers. Most architectures define NO_IRQ as -1, and this does the same for the PC.

---
 arch/x86/include/asm/irq.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/include/asm/irq.h +2 -0
index ba870bb..c9072f5 100644
@@ -10,6 +10,8 @@
 #include <asm/apicdef.h>
 #include <asm/irq_vectors.h>
 
+#define NO_IRQ	(-1)
+
 static inline int irq_canonicalize(int irq)
 {
 	return ((irq == 2) ? 9 : irq);
Signature · 1 line
1.7.7.2
#2 lore raw

Re: [PATCH 1/4] x86: add NO_IRQ macro

Quoted 2 lines · Alessandro Rubini

This is needed to compile AMBA drivers. Most architectures define NO_IRQ as -1, and this does the same for the PC.

No. We're getting rid of NO_IRQ, and it will be gone from AMBA stuff probably for 3.5.

#3 lore raw

Re: [PATCH 1/4] x86: add NO_IRQ macro

In reply to Alessandro Rubini
Quoted 2 lines · On Thu, 1 Mar 2012 14:28:36 +0100 Alessandro Rubini <[email protected]> wrote:

This is needed to compile AMBA drivers. Most architectures define NO_IRQ as -1, and this does the same for the PC.

NAK

"No IRQ" is 0. There are a few platforms which incorrectly still define it as -1 but they are broken and in fact many drivers won't work with platforms that still incorrectly use -1. Nothing should be using a NO_IRQ define.

Fix the users.

Alan

#4 lore raw

Re: [PATCH 1/4] x86: add NO_IRQ macro

Quoted 6 lines · Alan Cox
Quoted 2 lines · On Thu, 1 Mar 2012 14:28:36 +0100 Alessandro Rubini <[email protected]> wrote:

This is needed to compile AMBA drivers. Most architectures define NO_IRQ as -1, and this does the same for the PC.

Quoted 8 lines

NAK

"No IRQ" is 0. There are a few platforms which incorrectly still define it as -1 but they are broken and in fact many drivers won't work with platforms that still incorrectly use -1. Nothing should be using a NO_IRQ define.

Fix the users.

The users in this area are fixed and have been 'fixed' since December, it's just going to take a couple of kernel cycles to get rid of it in a sane way without causing breakage. And yes, this has fallen squarely on my shoulders to 'fix' because no one else is the least bit interested in the problem.

So, as I'm about the only one who has done any work towards this, you can expect NO_IRQ to take a long time to finally go away.

#5 lore raw

PATCH 2/4 sizes.h: move from asm-generic to <linux/sizes.h>

In reply to Alessandro Rubini

sizes.h is used throughout the AMBA code and drivers, so the header should be available to everyone in order to driver AMBA/PrimeCell peripherals behind a PCI bridge where the host can be any platform (I'm doing it under x86).

At this step <asm-generic/sizes.h> includes <linux/sizes.h>, to allow a grace period for both in-tree and out-of-tree drivers.

---
 include/asm-generic/sizes.h |   49 +-----------------------------------------
 include/linux/sizes.h       |   47 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 47 deletions(-)
 create mode 100644 include/linux/sizes.h
include/asm-generic/sizes.h +2 -47
index ea5d4ef..1dcfad9 100644
@@ -1,47 +1,2 @@
-/*
- * linux/include/asm-generic/sizes.h
- *
- * 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.
- */
-#ifndef __ASM_GENERIC_SIZES_H__
-#define __ASM_GENERIC_SIZES_H__
-
-#define SZ_1				0x00000001
-#define SZ_2				0x00000002
-#define SZ_4				0x00000004
-#define SZ_8				0x00000008
-#define SZ_16				0x00000010
-#define SZ_32				0x00000020
-#define SZ_64				0x00000040
-#define SZ_128				0x00000080
-#define SZ_256				0x00000100
-#define SZ_512				0x00000200
-
-#define SZ_1K				0x00000400
-#define SZ_2K				0x00000800
-#define SZ_4K				0x00001000
-#define SZ_8K				0x00002000
-#define SZ_16K				0x00004000
-#define SZ_32K				0x00008000
-#define SZ_64K				0x00010000
-#define SZ_128K				0x00020000
-#define SZ_256K				0x00040000
-#define SZ_512K				0x00080000
-
-#define SZ_1M				0x00100000
-#define SZ_2M				0x00200000
-#define SZ_4M				0x00400000
-#define SZ_8M				0x00800000
-#define SZ_16M				0x01000000
-#define SZ_32M				0x02000000
-#define SZ_64M				0x04000000
-#define SZ_128M				0x08000000
-#define SZ_256M				0x10000000
-#define SZ_512M				0x20000000
-
-#define SZ_1G				0x40000000
-#define SZ_2G				0x80000000
-
-#endif /* __ASM_GENERIC_SIZES_H__ */
+/* This is a placeholder, to be removed over time */
+#include <linux/sizes.h>
include/linux/sizes.h new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.7.7.2
maintainer Acked-by on v1 2/4
#6 lore raw

Re: [PATCH 2/4] sizes.h: move from asm-generic to <linux/sizes.h>

Quoted 5 lines · Alessandro Rubini

sizes.h is used throughout the AMBA code and drivers, so the header should be available to everyone in order to driver AMBA/PrimeCell peripherals behind a PCI bridge where the host can be any platform (I'm doing it under x86).

Quoted 7 lines

At this step <asm-generic/sizes.h> includes <linux/sizes.h>, to allow a grace period for both in-tree and out-of-tree drivers.

For the asm-generic part of this.

#7 lore raw

PATCH 3/4 amba: use the new linux/sizes.h

In reply to Alessandro Rubini
---
 drivers/amba/bus.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/amba/bus.c +1 -1
index 01c2cf4..d7fe84a 100644
@@ -18,7 +18,7 @@
 #include <linux/amba/bus.h>
 
 #include <asm/irq.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #define to_amba_driver(d)	container_of(d, struct amba_driver, drv)
 
Signature · 1 line
1.7.7.2
#8 lore raw

PATCH 4/4 ARM: use the new linux/sizes.h

In reply to Alessandro Rubini
---
 arch/arm/include/asm/memory.h |    2 +-
 arch/arm/mm/dma-mapping.c     |    2 +-
 arch/arm/mm/init.c            |    2 +-
 arch/arm/mm/ioremap.c         |    2 +-
 arch/arm/mm/mmu.c             |    2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/include/asm/memory.h +1 -1
index a8997d7..5848eba 100644
@@ -16,7 +16,7 @@
 #include <linux/compiler.h>
 #include <linux/const.h>
 #include <linux/types.h>
-#include <asm/sizes.h>
+#include <linux/sizes.h>
 
 #ifdef CONFIG_NEED_MACH_MEMORY_H
 #include <mach/memory.h>
arch/arm/mm/dma-mapping.c +1 -1
index db23ae4..364defd 100644
@@ -19,12 +19,12 @@
 #include <linux/dma-mapping.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
+#include <linux/sizes.h>
 
 #include <asm/memory.h>
 #include <asm/highmem.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/sizes.h>
 #include <asm/mach/arch.h>
 
 #include "mm.h"
arch/arm/mm/init.c +1 -1
index 595079f..288b77d 100644
@@ -20,13 +20,13 @@
 #include <linux/highmem.h>
 #include <linux/gfp.h>
 #include <linux/memblock.h>
+#include <linux/sizes.h>
 
 #include <asm/mach-types.h>
 #include <asm/memblock.h>
 #include <asm/prom.h>
 #include <asm/sections.h>
 #include <asm/setup.h>
-#include <asm/sizes.h>
 #include <asm/tlb.h>
 #include <asm/fixmap.h>
 
arch/arm/mm/ioremap.c +1 -1
index 66daf17..1d24bef 100644
@@ -25,6 +25,7 @@
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/io.h>
+#include <linux/sizes.h>
 
 #include <asm/cp15.h>
 #include <asm/cputype.h>
@@ -32,7 +33,6 @@
 #include <asm/mmu_context.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
-#include <asm/sizes.h>
 
 #include <asm/mach/map.h>
 #include "mm.h"
arch/arm/mm/mmu.c +1 -1
index f77f1db..f3ee2b8 100644
@@ -16,13 +16,13 @@
 #include <linux/memblock.h>
 #include <linux/fs.h>
 #include <linux/vmalloc.h>
+#include <linux/sizes.h>
 
 #include <asm/cp15.h>
 #include <asm/cputype.h>
 #include <asm/sections.h>
 #include <asm/cachetype.h>
 #include <asm/setup.h>
-#include <asm/sizes.h>
 #include <asm/smp_plat.h>
 #include <asm/tlb.h>
 #include <asm/highmem.h>
Signature · 1 line
1.7.7.2