Skip to contentSkip to conversation

Hexagon: Add configuration and makefiles for the Hexagon architecture.

PATCH In review Richard Kuo 2 participants 5 messages Nov 1, 2011 Qualcomm hexagon architecture

lore
Share & tools
lore
#0 lore raw

PATCH v5 33/36 Hexagon: Add configuration and makefiles for the Hexagon architecture.

---
 arch/hexagon/Kconfig              |  220 +++++++++++++++++++++++++++++++++++++
 arch/hexagon/Makefile             |   59 ++++++++++
 arch/hexagon/kernel/Makefile      |   19 +++
 arch/hexagon/kernel/asm-offsets.c |  104 +++++++++++++++++
 arch/hexagon/kernel/vmlinux.lds.S |   93 ++++++++++++++++
 arch/hexagon/lib/Makefile         |    4 +
 arch/hexagon/mm/Makefile          |    7 +
 7 files changed, 506 insertions(+), 0 deletions(-)
 create mode 100644 arch/hexagon/Kconfig
 create mode 100644 arch/hexagon/Makefile
 create mode 100644 arch/hexagon/kernel/Makefile
 create mode 100644 arch/hexagon/kernel/asm-offsets.c
 create mode 100644 arch/hexagon/kernel/vmlinux.lds.S
 create mode 100644 arch/hexagon/lib/Makefile
 create mode 100644 arch/hexagon/mm/Makefile
arch/hexagon/Kconfig new file +220 -0
new file mode 100644
index 0000000..02513c2
@@ -0,0 +1,220 @@
+# Hexagon configuration
+comment "Linux Kernel Configuration for Hexagon"
+
+config HEXAGON
+	def_bool y
+	select HAVE_OPROFILE
+	select USE_GENERIC_SMP_HELPERS if SMP
+	# Other pending projects/to-do items.
+	# select HAVE_REGS_AND_STACK_ACCESS_API
+	# select HAVE_HW_BREAKPOINT if PERF_EVENTS
+	# select ARCH_HAS_CPU_IDLE_WAIT
+	# select ARCH_WANT_OPTIONAL_GPIOLIB
+	# select ARCH_REQUIRE_GPIOLIB
+	# select HAVE_CLK
+	# select IRQ_PER_CPU
+	select HAVE_IRQ_WORK
+	# select GENERIC_PENDING_IRQ if SMP
+	select GENERIC_ATOMIC64
+	select HAVE_PERF_EVENTS
+	select HAVE_GENERIC_HARDIRQS
+	select GENERIC_HARDIRQS_NO__DO_IRQ
+	select GENERIC_HARDIRQS_NO_DEPRECATED
+	# GENERIC_ALLOCATOR is used by dma_alloc_coherent()
+	select GENERIC_ALLOCATOR
+	select GENERIC_IRQ_SHOW
+	select HAVE_ARCH_KGDB
+	select HAVE_ARCH_TRACEHOOK
+	select NO_IOPORT
+	# mostly generic routines, with some accelerated ones
+	---help---
+	  Qualcomm Hexagon is a processor architecture designed for high
+	  performance and low power across a wide variety of applications.
+
+config HEXAGON_ARCH_V1
+	bool
+
+config HEXAGON_ARCH_V2
+	bool
+
+config HEXAGON_ARCH_V3
+	bool
+
+config HEXAGON_ARCH_V4
+	bool
+
+config FRAME_POINTER
+	def_bool y
+
+config LOCKDEP_SUPPORT
+	def_bool y
+
+config PCI
+	def_bool n
+
+config EARLY_PRINTK
+	def_bool y
+
+config KTIME_SCALAR
+	def_bool y
+
+config MMU
+	def_bool y
+
+config TRACE_IRQFLAGS_SUPPORT
+	def_bool y
+
+config GENERIC_CSUM
+	def_bool y
+
+#
+# Use the generic interrupt handling code in kernel/irq/:
+#
+config GENERIC_IRQ_PROBE
+	def_bool y
+
+config GENERIC_IOMAP
+	def_bool y
+
+#config ZONE_DMA
+#	bool
+#	default y
+
+config HAS_DMA
+	bool
+	select HAVE_DMA_ATTRS
+	default y
+
+config NEED_SG_DMA_LENGTH
+	def_bool y
+
+config RWSEM_GENERIC_SPINLOCK
+	def_bool n
+
+config RWSEM_XCHGADD_ALGORITHM
+	def_bool y
+
+config GENERIC_FIND_NEXT_BIT
+	def_bool y
+
+config GENERIC_HWEIGHT
+	def_bool y
+
+config GENERIC_TIME
+	def_bool y
+
+config GENERIC_CLOCKEVENTS
+	def_bool y
+
+config GENERIC_CLOCKEVENTS_BROADCAST
+	def_bool y
+
+config STACKTRACE_SUPPORT
+	def_bool y
+	select STACKTRACE
+
+config GENERIC_BUG
+	def_bool y
+	depends on BUG
+
+config BUG
+	def_bool y
+
+menu "Machine selection"
+
+choice
+	prompt "System type"
+	default HEXAGON_ARCH_V2
+
+config HEXAGON_COMET
+	bool "Comet Board"
+	select HEXAGON_ARCH_V2
+	---help---
+	  Support for the Comet platform.
+
+endchoice
+
+config HEXAGON_VM
+	def_bool y
+
+config CMDLINE
+	string "Default kernel command string"
+	default ""
+	help
+	  On some platforms, there is currently no way for the boot loader
+	  to pass arguments to the kernel. For these, you should supply some
+	  command-line options at build time by entering them here.  At a
+	  minimum, you should specify the memory size and the root device
+	  (e.g., mem=64M root=/dev/nfs).
+
+config HEXAGON_ANGEL_TRAPS
+	bool "Use Angel Traps"
+	default n
+	---help---
+	  Enable angel debug traps (for printk's).
+
+config SMP
+	bool "Multi-Processing support"
+	---help---
+	  Enables SMP support in the kernel.  If unsure, say "Y"
+
+config NR_CPUS
+	int "Maximum number of CPUs" if SMP
+	range 2 6 if SMP
+	default "1" if !SMP
+	default "6" if SMP
+	---help---
+	  This allows you to specify the maximum number of CPUs which this
+	  kernel will support.  The maximum supported value is 6 and the
+	  minimum value which makes sense is 2.
+
+	  This is purely to save memory - each supported CPU adds
+	  approximately eight kilobytes to the kernel image.
+
+choice
+	prompt "Kernel page size"
+	default PAGE_SIZE_4KB
+	---help---
+	  Changes the default page size; use with caution.
+
+config PAGE_SIZE_4KB
+	bool "4KB"
+
+config PAGE_SIZE_16KB
+	bool "16KB"
+
+config PAGE_SIZE_64KB
+	bool "64KB"
+
+config PAGE_SIZE_256KB
+	bool "256KB"
+
+endchoice
+
+source "mm/Kconfig"
+
+source "kernel/Kconfig.hz"
+source "kernel/time/Kconfig"
+
+config GENERIC_GPIO
+	bool "Generic GPIO support"
+	default n
+
+endmenu
+
+source "init/Kconfig"
+source "drivers/Kconfig"
+source "fs/Kconfig"
+
+menu "Executable File Formats"
+source "fs/Kconfig.binfmt"
+endmenu
+
+source "net/Kconfig"
+source "security/Kconfig"
+source "crypto/Kconfig"
+source "lib/Kconfig"
+
+menu "Kernel hacking"
+source "lib/Kconfig.debug"
+endmenu
arch/hexagon/Makefile new file +59 -0

59 lines not on this page · raw message

arch/hexagon/kernel/Makefile new file +19 -0
new file mode 100644
index 0000000..27be2f6
@@ -0,0 +1,19 @@
+extra-y := head.o vmlinux.lds init_task.o
+
+obj-$(CONFIG_SMP) += smp.o topology.o
+
+obj-y += setup.o irq_cpu.o traps.o syscalltab.o signal.o time.o
+obj-y += process.o syscall.o trampoline.o reset.o ptrace.o
+obj-y += vdso.o
+
+obj-$(CONFIG_KGDB)    += kgdb.o
+obj-$(CONFIG_MODULES) += module.o hexagon_ksyms.o
+
+# Modules required to work with the Hexagon Virtual Machine
+obj-y += vm_entry.o vm_events.o vm_switch.o vm_ops.o vm_init_segtable.o
+obj-y += vm_vectors.o
+
+obj-$(CONFIG_HAS_DMA) += dma.o
+
+obj-$(CONFIG_STACKTRACE) += stacktrace.o
+
arch/hexagon/kernel/asm-offsets.c new file +104 -0

104 lines not on this page · raw message

arch/hexagon/kernel/vmlinux.lds.S new file +93 -0

93 lines not on this page · raw message

arch/hexagon/lib/Makefile new file +4 -0
new file mode 100644
index 0000000..874655e
@@ -0,0 +1,4 @@
+#
+# Makefile for hexagon-specific library files.
+#
+obj-y = checksum.o io.o memcpy.o memset.o
arch/hexagon/mm/Makefile new file +7 -0
new file mode 100644
index 0000000..018be76
@@ -0,0 +1,7 @@
+#
+# Makefile for Hexagon memory management subsystem
+#
+
+obj-y := init.o pgalloc.o ioremap.o uaccess.o vm_fault.o cache.o
+obj-y += copy_to_user.o copy_from_user.o strnlen_user.o vm_tlb.o
+
Signature · 7 lines
1.7.1


--

Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#1 lore raw

(I'd like to add some quick comments, Kconfig related. It's too late, I guess.)

Quoted 13 lines · Richard Kuo
arch/hexagon/Kconfig new file +7 -0
new file mode 100644
index 0000000..02513c2
@@ -0,0 +1,220 @@
+# Hexagon configuration
+comment "Linux Kernel Configuration for Hexagon"
+
+config HEXAGON
+	def_bool y
+	select HAVE_OPROFILE
+	select USE_GENERIC_SMP_HELPERS if SMP

arch/hexagon/Kconfig line 17

Quoted 10 lines
arch/hexagon/Kconfig new file +10 -0
+	# Other pending projects/to-do items.
+	# select HAVE_REGS_AND_STACK_ACCESS_API
+	# select HAVE_HW_BREAKPOINT if PERF_EVENTS
+	# select ARCH_HAS_CPU_IDLE_WAIT
+	# select ARCH_WANT_OPTIONAL_GPIOLIB
+	# select ARCH_REQUIRE_GPIOLIB
+	# select HAVE_CLK
+	# select IRQ_PER_CPU
+	select HAVE_IRQ_WORK
+	# select GENERIC_PENDING_IRQ if SMP

Is GENERIC_PENDING_IRQ also a pending project?

arch/hexagon/Kconfig line 29

Quoted 12 lines
arch/hexagon/Kconfig new file +12 -0
+	select GENERIC_ATOMIC64
+	select HAVE_PERF_EVENTS
+	select HAVE_GENERIC_HARDIRQS
+	select GENERIC_HARDIRQS_NO__DO_IRQ
+	select GENERIC_HARDIRQS_NO_DEPRECATED
+	# GENERIC_ALLOCATOR is used by dma_alloc_coherent()
+	select GENERIC_ALLOCATOR
+	select GENERIC_IRQ_SHOW
+	select HAVE_ARCH_KGDB
+	select HAVE_ARCH_TRACEHOOK
+	select NO_IOPORT
+	# mostly generic routines, with some accelerated ones

What does this comment on?

Quoted 15 lines
arch/hexagon/Kconfig new file +15 -0
+	---help---
+	  Qualcomm Hexagon is a processor architecture designed for high
+	  performance and low power across a wide variety of applications.
+
+config HEXAGON_ARCH_V1
+	bool
+
+config HEXAGON_ARCH_V2
+	bool
+
+config HEXAGON_ARCH_V3
+	bool
+
+config HEXAGON_ARCH_V4
+	bool

[...]

arch/hexagon/Kconfig line 81

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+#config ZONE_DMA
+#	bool
+#	default y

Why is this added commented out?

arch/hexagon/Kconfig line 86

Quoted 4 lines
arch/hexagon/Kconfig new file +4 -0
+config HAS_DMA
+	bool
+	select HAVE_DMA_ATTRS
+	default y

HAS_DMA isn't supposed to be used this way, is it? See commit 411f0f3edc141a582190d3605cadd1d993abb6df ("Introduce CONFIG_HAS_DMA"). Can't this entry be replaced by a "select HAVE_DMA_ATTRS" line in the "config HEXAGON" entry? That seems to be the common idiom.

[...]

arch/hexagon/Kconfig line 114

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+config STACKTRACE_SUPPORT
+	def_bool y
+	select STACKTRACE

Some grepping suggests that the tracing infrastructure will "select STACKTRACE" if the architecture sets STACKTRACE_SUPPORT (tile apparently also gets this wrong). Have I grepped this correctly?

arch/hexagon/Kconfig line 121

Quoted 6 lines
arch/hexagon/Kconfig new file +6 -0
+config GENERIC_BUG
+	def_bool y
+	depends on BUG
+
+config BUG
+	def_bool y

Why do you have this? Other architecture don't (there's just one BUG entry in all the Kconfig files).

arch/hexagon/Kconfig line 135

Quoted 13 lines
arch/hexagon/Kconfig new file +13 -0
+menu "Machine selection"
+
+choice
+	prompt "System type"
+	default HEXAGON_ARCH_V2
+
+config HEXAGON_COMET
+	bool "Comet Board"
+	select HEXAGON_ARCH_V2
+	---help---
+	  Support for the Comet platform.
+
+endchoice

The default doesn't match the (single) config option here (it should default to HEXAGON_COMET). That shouldn't matter because there's only one option, which the config tools will then pick (that's the way they seem to work).

But why is this a choice when there's nothing to actually choose? Moreover, just looking at this patch suggests HEXAGON_COMET is yet unused (CONFIG_HEXAGON_COMET is commented out in the Makefile). So at first glance this seems an elaborate way to select HEXAGON_ARCH_V2.

[...]

arch/hexagon/Kconfig line 159

Quoted 4 lines
arch/hexagon/Kconfig new file +4 -0
+config SMP
+	bool "Multi-Processing support"
+	---help---
+	  Enables SMP support in the kernel.  If unsure, say "Y"

Odd. Even x86 and powerpc (the only two architectures I looked at) suggest to say "N" to those not knowing what to do here.

arch/hexagon/Kconfig line 172

Quoted 12 lines
arch/hexagon/Kconfig new file +12 -0
+config NR_CPUS
+	int "Maximum number of CPUs" if SMP
+	range 2 6 if SMP
+	default "1" if !SMP
+	default "6" if SMP
+	---help---
+	  This allows you to specify the maximum number of CPUs which this
+	  kernel will support.  The maximum supported value is 6 and the
+	  minimum value which makes sense is 2.
+
+	  This is purely to save memory - each supported CPU adds
+	  approximately eight kilobytes to the kernel image.

This is good. Quite a number of architectures do net set this (especially the default of "1" in the !SMP case).

[...]

arch/hexagon/Kconfig line 201

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+config GENERIC_GPIO
+	bool "Generic GPIO support"
+	default n

I know next to nothing about GENERIC_GPIO but does it make sense for Hexagon? If not, wouldn't a "def_bool n" do? (Perhaps you could even drop this entry entirely.)

[...]

Quoted 5 lines
arch/hexagon/Makefile new file +0 -0
new file mode 100644
index 0000000..7ce9563

[...]

arch/hexagon/Makefile line 58

Quoted 4 lines
arch/hexagon/Makefile new file +4 -0
+#	arch/hexagon/platform/common/
+#
+#core-$(CONFIG_HEXAGON_COMET)		+= arch/hexagon/platform/comet/
+#machine-$(CONFIG_HEXAGON_COMET)		:= comet

Paul Bolle

#2 lore raw
Quoted 2 lines · Paul Bolle

(I'd like to add some quick comments, Kconfig related. It's too late, I guess.)

Sure, always appreciated.

Quoted 4 lines · Richard Kuo

arch/hexagon/Kconfig line 17

Quoted 1 line
arch/hexagon/Kconfig new file +1 -0
+	# select GENERIC_PENDING_IRQ if SMP

Is GENERIC_PENDING_IRQ also a pending project?

Yes.

Quoted 3 lines

arch/hexagon/Kconfig line 29

Quoted 1 line
arch/hexagon/Kconfig new file +1 -0
+	# mostly generic routines, with some accelerated ones

What does this comment on?

That was an early debugging thing that was removed; missed the comment the comment that went with it.

Quoted 5 lines

arch/hexagon/Kconfig line 81

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+#config ZONE_DMA
+#	bool
+#	default y

Why is this added commented out?

We were using it before, but not anymore.

Quoted 9 lines

arch/hexagon/Kconfig line 86

Quoted 4 lines
arch/hexagon/Kconfig new file +4 -0
+config HAS_DMA
+	bool
+	select HAVE_DMA_ATTRS
+	default y

HAS_DMA isn't supposed to be used this way, is it? See commit 411f0f3edc141a582190d3605cadd1d993abb6df ("Introduce CONFIG_HAS_DMA"). Can't this entry be replaced by a "select HAVE_DMA_ATTRS" line in the "config HEXAGON" entry? That seems to be the common idiom.

Yes, that appears to be the more appropriate way to select it.

Quoted 7 lines

arch/hexagon/Kconfig line 114

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+config STACKTRACE_SUPPORT
+	def_bool y
+	select STACKTRACE

Some grepping suggests that the tracing infrastructure will "select STACKTRACE" if the architecture sets STACKTRACE_SUPPORT (tile apparently also gets this wrong). Have I grepped this correctly?

Only if DEBUG_KMEMLEAK is selected apparently (?)

Quoted 9 lines

arch/hexagon/Kconfig line 121

Quoted 6 lines
arch/hexagon/Kconfig new file +6 -0
+config GENERIC_BUG
+	def_bool y
+	depends on BUG
+
+config BUG
+	def_bool y

Why do you have this? Other architecture don't (there's just one BUG entry in all the Kconfig files).

Thought we needed it; didn't realize it was in init/Kconfig.

Quoted 19 lines

arch/hexagon/Kconfig line 135

Quoted 13 lines
arch/hexagon/Kconfig new file +13 -0
+menu "Machine selection"
+
+choice
+	prompt "System type"
+	default HEXAGON_ARCH_V2
+
+config HEXAGON_COMET
+	bool "Comet Board"
+	select HEXAGON_ARCH_V2
+	---help---
+	  Support for the Comet platform.
+
+endchoice

The default doesn't match the (single) config option here (it should default to HEXAGON_COMET). That shouldn't matter because there's only one option, which the config tools will then pick (that's the way they seem to work).

Quoted 4 lines

But why is this a choice when there's nothing to actually choose? Moreover, just looking at this patch suggests HEXAGON_COMET is yet unused (CONFIG_HEXAGON_COMET is commented out in the Makefile). So at first glance this seems an elaborate way to select HEXAGON_ARCH_V2.

Yes... need to fix that default.

We felt it was better to remove the platform code for this submission as it was not exactly clean and did not use the devtree code. That's why it's commented out of the Makefiles.

Quoted 7 lines

arch/hexagon/Kconfig line 159

Quoted 4 lines
arch/hexagon/Kconfig new file +4 -0
+config SMP
+	bool "Multi-Processing support"
+	---help---
+	  Enables SMP support in the kernel.  If unsure, say "Y"

Odd. Even x86 and powerpc (the only two architectures I looked at) suggest to say "N" to those not knowing what to do here.

I think for us, I think most people will want an SMP kernel.

Quoted 7 lines

arch/hexagon/Kconfig line 201

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+config GENERIC_GPIO
+	bool "Generic GPIO support"
+	default n

I know next to nothing about GENERIC_GPIO but does it make sense for Hexagon? If not, wouldn't a "def_bool n" do? (Perhaps you could even drop this entry entirely.)

We have another platform that does use it, but yes, a "def_bool n" will suffice.

I'll have these cleaned up in my local tree and produce a followup patch if necessary...

Thanks for the feedback.
-Richard Kuo

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
#3 lore raw
Quoted 4 lines · Richard Kuo
Quoted 1 line · Paul Bolle

Is GENERIC_PENDING_IRQ also a pending project?

Yes.

So, you'll move it up a line?

Quoted 7 lines
Quoted 5 lines

arch/hexagon/Kconfig line 81

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+#config ZONE_DMA
+#	bool
+#	default y

Why is this added commented out?

We were using it before, but not anymore.

So, please drop it.

Quoted 9 lines
Quoted 7 lines

arch/hexagon/Kconfig line 114

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+config STACKTRACE_SUPPORT
+	def_bool y
+	select STACKTRACE

Some grepping suggests that the tracing infrastructure will "select STACKTRACE" if the architecture sets STACKTRACE_SUPPORT (tile apparently also gets this wrong). Have I grepped this correctly?

Only if DEBUG_KMEMLEAK is selected apparently (?)

But "config TRACING" (in kernel/trace/Kconfig) also selects it if STACKTRACE_SUPPORT is set. It seems GENERIC_TRACER is the hidden magic here. GENERIC_TRACER is selected by the various tracer options - see kernel/trace/Kconfig again, I'm unfamiliar with this stuff - and will itself select TRACING. So if an arch has STACKTRACE_SUPPORT set it doesn't have to select STACKTRACE itself. (Note that - except for tile - no other arch selects STACKTRACE.)

But hopefully someone who doesn't have to grep the Kconfig files to understand this, can tell us for sure.

Quoted 3 lines

We felt it was better to remove the platform code for this submission as it was not exactly clean and did not use the devtree code. That's why it's commented out of the Makefiles.

If you really feel you need to add it, but commented out, perhaps a comment can be added to keep people like me from submitting patches to remove it.

Paul Bolle

#4 lore raw
Quoted 11 lines · Paul Bolle

So, you'll move it up a line?

Quoted 7 lines
Quoted 5 lines

arch/hexagon/Kconfig line 81

Quoted 3 lines
arch/hexagon/Kconfig new file +3 -0
+#config ZONE_DMA
+#	bool
+#	default y

Why is this added commented out?

We were using it before, but not anymore.

So, please drop it.

Yes to both of these.

Quoted 10 lines

But "config TRACING" (in kernel/trace/Kconfig) also selects it if STACKTRACE_SUPPORT is set. It seems GENERIC_TRACER is the hidden magic here. GENERIC_TRACER is selected by the various tracer options - see kernel/trace/Kconfig again, I'm unfamiliar with this stuff - and will itself select TRACING. So if an arch has STACKTRACE_SUPPORT set it doesn't have to select STACKTRACE itself. (Note that - except for tile - no other arch selects STACKTRACE.)

But hopefully someone who doesn't have to grep the Kconfig files to understand this, can tell us for sure.

Ah... Well, if nothing else, I'll just try not setting it and see if it works as it seems to be intended.

Quoted 3 lines

If you really feel you need to add it, but commented out, perhaps a comment can be added to keep people like me from submitting patches to remove it.

Sounds reasonable. I'll either add a comment or just remove it altogether (which is the long term goal).

Not that I mind getting patches, of course.

I'll have all these fixed in my tree and push them out when I can.

Thanks,
Richard Kuo

Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.