Commit Graph

181 Commits

Author SHA1 Message Date
Jesper Nilsson
87ffbe679e cris: correct syscall numbers in unistd.h for timerfd_settime and timerfd_gettime
Last commit for unistd was not correct, it only had a partial update of
syscall numbers for __NR_timerfd_settime and __NR_timerfd_gettime.  Also,
NR_syscalls was not incremented for the new syscalls.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Mikael Starvik <mikael.starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-04 16:35:16 -08:00
Jesper Nilsson
07f2402b4a cris: correct usage of __user for copy to and from user space in lib/usercopy and uaccess.h
Function __copy_user_zeroing in arch/lib/usercopy.c had the wrong parameter
set as __user, and in include/asm-cris/uaccess.h, it was not set at all for
some of the calling functions.

This will cut the number of warnings quite dramatically when using sparse.

While we're here, remove useless CVS log and correct confusing typo.

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Mikael Starvik <mikael.starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-03-04 16:35:16 -08:00
Linus Torvalds
0cf975e169 Merge branch 'cris' of git://www.jni.nu/cris
* 'cris' of git://www.jni.nu/cris: (158 commits)
  CRIS v32: Remove hwregs/timer_defs.h, it is now architecture specific.
  CRIS v32: Change drivers/i2c.c locking.
  CRIS v32: Rewrite ARTPEC-3 gpio driver to avoid volatiles and general cleanup.
  CRIS: Add new timerfd syscall entries.
  MAINTAINERS: Add my information for the CRIS port.
  CRIS v32: Correct spelling of bandwidth in function name.
  CRIS v32: Clean up nandflash.c for ARTPEC-3 and ETRAX FS.
  CRIS v10: Cleanup of drivers/gpio.c
  CRIS v10: drivers/net/cris/eth_v10.c rename LED defines to CRIS_LED to avoid name clash.
  CRIS: Make io_pwm_set_period members unsigned in etraxgpio.h
  CRIS: Move ETRAX_AXISFLASHMAP to common Kconfig file.
  CRIS: Drop regs parameter from call to profile_tick in kernel/time.c
  CRIS v32: Fix minor formatting issue in mach-a3/io.c
  CRIS v32: Initialize GIO even if we're rambooting in kernel/head.S
  CRIS v32: Remove kernel/arbiter.c, it now exists in machine dependent directory.
  CRIS v32: Minor changes to avoid errors in asm-cris/arch-v32/hwregs/reg_rdwr.h
  CRIS v32: arch-v32/hwregs/intr_vect_defs.h moved to machine dependent directory.
  CRIS v32: Correct offset for TASK_pid in asm-cris/arch-v32/offset.h
  CRIS v32: Move register map header to machine dependent directory.
  CRIS v32: Let compiler know that memory is clobbered after a break op.
  ...
2008-02-08 10:01:28 -08:00
Martin Schwidefsky
2f569afd9c CONFIG_HIGHPTE vs. sub-page page tables.
Background: I've implemented 1K/2K page tables for s390.  These sub-page
page tables are required to properly support the s390 virtualization
instruction with KVM.  The SIE instruction requires that the page tables
have 256 page table entries (pte) followed by 256 page status table entries
(pgste).  The pgstes are only required if the process is using the SIE
instruction.  The pgstes are updated by the hardware and by the hypervisor
for a number of reasons, one of them is dirty and reference bit tracking.
To avoid wasting memory the standard pte table allocation should return
1K/2K (31/64 bit) and 2K/4K if the process is using SIE.

Problem: Page size on s390 is 4K, page table size is 1K or 2K.  That means
the s390 version for pte_alloc_one cannot return a pointer to a struct
page.  Trouble is that with the CONFIG_HIGHPTE feature on x86 pte_alloc_one
cannot return a pointer to a pte either, since that would require more than
32 bit for the return value of pte_alloc_one (and the pte * would not be
accessible since its not kmapped).

Solution: The only solution I found to this dilemma is a new typedef: a
pgtable_t.  For s390 pgtable_t will be a (pte *) - to be introduced with a
later patch.  For everybody else it will be a (struct page *).  The
additional problem with the initialization of the ptl lock and the
NR_PAGETABLE accounting is solved with a constructor pgtable_page_ctor and
a destructor pgtable_page_dtor.  The page table allocation and free
functions need to call these two whenever a page table page is allocated or
freed.  pmd_populate will get a pgtable_t instead of a struct page pointer.
 To get the pgtable_t back from a pmd entry that has been installed with
pmd_populate a new function pmd_pgtable is added.  It replaces the pmd_page
call in free_pte_range and apply_to_pte_range.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 09:22:42 -08:00
H. Peter Anvin
bdc807871d avoid overflows in kernel/time.c
When the conversion factor between jiffies and milli- or microseconds is
not a single multiply or divide, as for the case of HZ == 300, we currently
do a multiply followed by a divide.  The intervening result, however, is
subject to overflows, especially since the fraction is not simplified (for
HZ == 300, we multiply by 300 and divide by 1000).

This is exposed to the user when passing a large timeout to poll(), for
example.

This patch replaces the multiply-divide with a reciprocal multiplication on
32-bit platforms.  When the input is an unsigned long, there is no portable
way to do this on 64-bit platforms there is no portable way to do this
since it requires a 128-bit intermediate result (which gcc does support on
64-bit platforms but may generate libgcc calls, e.g.  on 64-bit s390), but
since the output is a 32-bit integer in the cases affected, just simplify
the multiply-divide (*3/10 instead of *300/1000).

The reciprocal multiply used can have off-by-one errors in the upper half
of the valid output range.  This could be avoided at the expense of having
to deal with a potential 65-bit intermediate result.  Since the intent is
to avoid overflow problems and most of the other time conversions are only
semiexact, the off-by-one errors were considered an acceptable tradeoff.

At Ralf Baechle's suggestion, this version uses a Perl script to compute
the necessary constants.  We already have dependencies on Perl for kernel
compiles.  This does, however, require the Perl module Math::BigInt, which
is included in the standard Perl distribution starting with version 5.8.0.
In order to support older versions of Perl, include a table of canned
constants in the script itself, and structure the script so that
Math::BigInt isn't required if pulling values from said table.

Running the script requires that the HZ value is available from the
Makefile.  Thus, this patch also adds the Kconfig variable CONFIG_HZ to the
architectures which didn't already have it (alpha, cris, frv, h8300, m32r,
m68k, m68knommu, sparc, v850, and xtensa.) It does *not* touch the sh or
sh64 architectures, since Paul Mundt has dealt with those separately in the
sh tree.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
Cc: Sam Ravnborg <sam@ravnborg.org>,
Cc: Paul Mundt <lethal@linux-sh.org>,
Cc: Richard Henderson <rth@twiddle.net>,
Cc: Michael Starvik <starvik@axis.com>,
Cc: David Howells <dhowells@redhat.com>,
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>,
Cc: Hirokazu Takata <takata@linux-m32r.org>,
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Cc: Roman Zippel <zippel@linux-m68k.org>,
Cc: William L. Irwin <sparclinux@vger.kernel.org>,
Cc: Chris Zankel <chris@zankel.net>,
Cc: H. Peter Anvin <hpa@zytor.com>,
Cc: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 09:22:39 -08:00
Mike Frysinger
531d7d4256 asm-*/posix_types.h: scrub __GLIBC__
Some arches (like alpha and ia64) already have a clean posix_types.h header.
This brings all the others in line by removing all references to __GLIBC__
(and some undocumented __USE_ALL).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Roland McGrath <roland@redhat.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 09:22:34 -08:00
David Howells
922a70d327 aout: move STACK_TOP[_MAX] to asm/processor.h
Move STACK_TOP[_MAX] out of asm/a.out.h and into asm/processor.h as they're
required whether or not A.OUT format is available.

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 09:22:29 -08:00
Jesper Nilsson
bc10ac3f2f CRIS v32: Remove hwregs/timer_defs.h, it is now architecture specific.
- File is moved to arch-v32/mach-fs/hwregs/timer_defs.h
2008-02-08 17:51:15 +01:00
Jesper Nilsson
7800029df3 CRIS: Add new timerfd syscall entries. 2008-02-08 11:54:30 +01:00
Jesper Nilsson
eb090473a7 CRIS v32: Correct spelling of bandwidth in function name. 2008-02-08 11:16:46 +01:00
Jesper Nilsson
a63461e9ea CRIS: Make io_pwm_set_period members unsigned in etraxgpio.h 2008-02-08 11:08:07 +01:00
Jesper Nilsson
1791f539cd CRIS v32: Minor changes to avoid errors in asm-cris/arch-v32/hwregs/reg_rdwr.h
- Add ifdef around macros to read and write hardware registers
- Add parens around REG_READ expression to avoid possible precedence errors.
- Remove useless CVS id tag.
2008-02-08 11:06:39 +01:00
Jesper Nilsson
b8ed6b4d83 CRIS v32: arch-v32/hwregs/intr_vect_defs.h moved to machine dependent directory. 2008-02-08 11:06:39 +01:00
Jesper Nilsson
fb5c6e1155 CRIS v32: Correct offset for TASK_pid in asm-cris/arch-v32/offset.h 2008-02-08 11:06:39 +01:00
Jesper Nilsson
78dbb60643 CRIS v32: Move register map header to machine dependent directory.
This file is machine dependent, and needs to be in
asm-cris/arch-v32/mach-fs/hwregs/reg_map.h instead.
2008-02-08 11:06:39 +01:00
Jesper Nilsson
57e6f9646c CRIS v32: Let compiler know that memory is clobbered after a break op. 2008-02-08 11:06:39 +01:00
Jesper Nilsson
12e1b1e790 CRIS v32: Remove SMP stub from asm-cris/arch-v32/system.h
CRIS v32 is not SMP.
2008-02-08 11:06:39 +01:00
Jesper Nilsson
de1c1419f9 CRIS v32: Completely rework spinlocks for ETRAX FS and ARTPEC-3 2008-02-08 11:06:39 +01:00
Jesper Nilsson
4258fb1932 CRIS v32: Change name for simulator config in asm-cris/arch-v32/processor.h 2008-02-08 11:06:38 +01:00
Jesper Nilsson
230d69cf2b CRIS v32: Add prototype for crisv32_pinmux_dealloc_fixed in asm-cris/arch-v32/pinmux.h
Deallocation was not possible before, but is now.
2008-02-08 11:06:38 +01:00
Jesper Nilsson
e919a1201c CRIS v32: Change name for simulator config in asm-cris/arch-v32/page.h
Also, fix a typo.
2008-02-08 11:06:38 +01:00
Jesper Nilsson
d9ebcacee9 CRIS v32: Remove juliette.h, it is not supported for CRIS v32. 2008-02-08 11:06:38 +01:00
Jesper Nilsson
6c6dc56c1e CRIS v32: Add support for ETRAX FS and ARTPEC-3 for arch-v32/hwregs/eth_defs.h
- A couple of fields have changed name:
reg_eth_rw_ga_lo.table -> tbl
reg_eth_rw_ga_hi.table -> tbl
reg_eth_rw_gen_ctrl.flow_ctrl_dis -> flow_ctrl

- Add some new register fields.
reg_eth_rw_gen_ctrl.gtxclk_out
reg_eth_rw_gen_ctrl.phyrst_n
reg_eth_rw_tr_ctrl.carrier_ext

- max_size in reg_eth_rw_rec_ctrl had the wrong size.

- Registers reg_eth_rw_mgm_ctrl and reg_eth_r_stat was reworked completely.
2008-02-08 11:06:38 +01:00
Jesper Nilsson
8d07328744 CRIS v32: Rename variable used in macro for arch-v32/hwregs/dma.h
The old name "r" would quite often produce warnings when other
variables with the same name was shadowed. Rename it __x to
make it more unlikely to happen.
2008-02-08 11:06:38 +01:00
Jesper Nilsson
3fb18a3387 CRIS v32: Remove useless CVS id tag from arch-v32/hwregs/Makefile 2008-02-08 11:06:38 +01:00
Jesper Nilsson
94ebe16415 CRIS v32: Add defines for udelay and ndelay in arch-v32/delay.h
Both of these are implemented using cris_delay10ns().
2008-02-08 11:06:38 +01:00
Jesper Nilsson
209e9c43ad CRIS v32: Adjust arch-v32/atomic.h for new spinlock/rwlock infrastructure 2008-02-08 11:06:38 +01:00
Jesper Nilsson
e52c2c72dd CRIS v32: Add missing header to include/asm-cris/arch-v32/Kbuild 2008-02-08 11:06:37 +01:00
Jesper Nilsson
581b4fdc15 CRIS: Break long comment line in include/asm-cris/arch-v10/page.h 2008-02-08 11:06:37 +01:00
Jesper Nilsson
0d9f2e6f86 CRIS: Rename LED macros to CRIS_LED to avoid name clash in io.h
This is done to avoid collision with linux/leds.h
2008-02-08 11:06:37 +01:00
Jesper Nilsson
a1a7dc1d06 CRIS: Add missing headers to include/asm-cris Kbuild files. 2008-02-08 11:06:37 +01:00
Jesper Nilsson
46aac058fe CRIS: Add support for ETRAX FS and ARTPEC-3 to etraxgpio.h
The CRIS v32 architectures have more gpio ports and built in PWM.
2008-02-08 11:06:34 +01:00
Jesper Nilsson
3c1d9303a9 CRIS: Fix bugs in return value of atomic_inc_return and atomic_dec_return.
Increment and decrement before assigning to return value.
2008-02-08 11:06:33 +01:00
Jesper Nilsson
b43890af88 CRIS: Allow arch dependent delay to override common version. 2008-02-08 11:06:32 +01:00
Jesper Nilsson
151f639830 CRIS: Include arch dependent bug.h. 2008-02-08 11:06:32 +01:00
Jesper Nilsson
620cf2e442 CRIS: Correct pfn_pte to make it possible to ioremap uncached addresses. 2008-02-08 11:06:32 +01:00
Jesper Nilsson
058f5fdfd9 CRIS: Correct comment in io.h to describe reality of I/O space.
The old comment stated that it was "junk needed for the arch-independent code
but which we never use in the CRIS port", but this is no longer true.
2008-02-08 11:06:32 +01:00
Jesper Nilsson
78759757df CRIS: Update cpu_possible_map and raw_smp_processor_id in smp.h header.
- Change name of __smp_processor_id to raw_smp_processor_id.
- cpu_possible_map is no longer a define for phys_cpu_present_map,
  it is now a cpumask_t.
2008-02-08 11:06:32 +01:00
Jesper Nilsson
d8468472e4 CRIS v10: Cleanup rtc.h
- Change RTC_VLOW_RD -> RTC_VL_READ, RTC_VLOW_SET -> RTC_VL_CLR
- Whitespace and formatting.
2008-02-08 11:06:29 +01:00
Jesper Nilsson
0dfb8c3570 CRIS: Add architecture dependent bug.h for CRIS v10 and CRIS v32 2008-02-08 11:06:28 +01:00
Jesper Nilsson
d8ca6b1593 CRIS v32: Minor fixes for io.h
- Shorten include paths for machine dependent header files.
- Add volatile to hardeware register pointers.
- Add spinlocks around critical region.
- Expand macros for handling of leds.
2008-02-08 11:06:28 +01:00
Jesper Nilsson
e867cefbaa CRIS v32: Include path fix for timex.h
- Shorten include path for machine dependent header files.
- Correct some formatting issues.
2008-02-08 11:06:27 +01:00
Jesper Nilsson
e8a8abf20e CRIS: Remove define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY 2008-02-08 11:06:24 +01:00
Jesper Nilsson
75e52b279c CRIS v32: Add headers for EtraxFS and Artpec-3 chips. 2008-02-08 11:06:24 +01:00
Jesper Nilsson
738af38bbc CRIS v32: Add prototypes for cache flushing
We need these to work around some cache bugs in CRISv32 chips.
2008-02-08 11:06:24 +01:00
Jesper Nilsson
1e5915b173 CRIS v32: Update asm-cris/arch-v32/irq.h for ETRAX FS and ARTPEC-3
- Correct include to use <>
- Rework calculation of number of IRQs and exceptions we have.
- Remove useless "mask" argument to BUILD_IRQ macro
2008-02-08 11:06:24 +01:00
Jesper Nilsson
0c2efc4848 CRIS: Merge axisflashmap.h with Axis internal changes.
- Add partition table struct to be used to parse partition table in flash.
- Add JFFS2 as a type, and add readoly flag.
- Improve some comments.
- Lindent has been run, fixing whitespace and formatting issues.
2008-02-08 11:06:24 +01:00
Jesper Nilsson
ca91d5b098 CRIS v32: Add SECOND_WORD_SYNC, used in sync_serial. 2008-02-08 11:06:23 +01:00
Jesper Nilsson
58d0831928 CRIS v32: Add hardware dependent include files and defconfigs for ETRAX FS and ARTPEC-3 chips.
The header files describe the hardware registers available in both
these chips, note that most of this documentation is automatically
generated from the hardware implementation.
2008-02-08 11:06:23 +01:00
Mathieu Desnoyers
7732ba3abc Add cmpxchg_local to cris
Use the new generic cmpxchg_local (disables interrupt). Also use the generic
cmpxchg as fallback if SMP is not set.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Mikael Starvik <starvik@axis.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-07 08:42:31 -08:00