Commit Graph

188 Commits

Author SHA1 Message Date
Atsushi Nemoto 3171a0305d [PATCH] simplify update_times (avoid jiffies/jiffies_64 aliasing problem)
Pass ticks to do_timer() and update_times(), and adjust x86_64 and s390
timer interrupt handler with this change.

Currently update_times() calculates ticks by "jiffies - wall_jiffies", but
callers of do_timer() should know how many ticks to update.  Passing ticks
get rid of this redundant calculation.  Also there are another redundancy
pointed out by Martin Schwidefsky.

This cleanup make a barrier added by
5aee405c66 needless.  So this patch removes
it.

As a bonus, this cleanup make wall_jiffies can be removed easily, since now
wall_jiffies is always synced with jiffies.  (This patch does not really
remove wall_jiffies.  It would be another cleanup patch)

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Andi Kleen <ak@muc.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Acked-by: David Howells <dhowells@redhat.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Hirokazu Takata <takata.hirokazu@renesas.com>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Richard Curnow <rc@rc0.org.uk>
Cc: William Lee Irwin III <wli@holomorphy.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Miles Bader <uclinux-v850@lsi.nec.co.jp>
Cc: Chris Zankel <chris@zankel.net>
Acked-by: "Luck, Tony" <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:15 -07:00
Sukadev Bhattiprolu f400e198b2 [PATCH] pidspace: is_init()
This is an updated version of Eric Biederman's is_init() patch.
(http://lkml.org/lkml/2006/2/6/280).  It applies cleanly to 2.6.18-rc3 and
replaces a few more instances of ->pid == 1 with is_init().

Further, is_init() checks pid and thus removes dependency on Eric's other
patches for now.

Eric's original description:

	There are a lot of places in the kernel where we test for init
	because we give it special properties.  Most  significantly init
	must not die.  This results in code all over the kernel test
	->pid == 1.

	Introduce is_init to capture this case.

	With multiple pid spaces for all of the cases affected we are
	looking for only the first process on the system, not some other
	process that has pid == 1.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: <lxc-devel@lists.sourceforge.net>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:12 -07:00
Jason Baron df67b3daea [PATCH] make PROT_WRITE imply PROT_READ
Make PROT_WRITE imply PROT_READ for a number of architectures which don't
support write only in hardware.

While looking at this, I noticed that some architectures which do not
support write only mappings already take the exact same approach.  For
example, in arch/alpha/mm/fault.c:

"
        if (cause < 0) {
                if (!(vma->vm_flags & VM_EXEC))
                        goto bad_area;
        } else if (!cause) {
                /* Allow reads even for write-only mappings */
                if (!(vma->vm_flags & (VM_READ | VM_WRITE)))
                        goto bad_area;
        } else {
                if (!(vma->vm_flags & VM_WRITE))
                        goto bad_area;
        }
"

Thus, this patch brings other architectures which do not support write only
mappings in-line and consistent with the rest.  I've verified the patch on
ia64, x86_64 and x86.

Additional discussion:

Several architectures, including x86, can not support write-only mappings.
The pte for x86 reserves a single bit for protection and its two states are
read only or read/write.  Thus, write only is not supported in h/w.

Currently, if i 'mmap' a page write-only, the first read attempt on that page
creates a page fault and will SEGV.  That check is enforced in
arch/blah/mm/fault.c.  However, if i first write that page it will fault in
and the pte will be set to read/write.  Thus, any subsequent reads to the page
will succeed.  It is this inconsistency in behavior that this patch is
attempting to address.  Furthermore, if the page is swapped out, and then
brought back the first read will also cause a SEGV.  Thus, any arbitrary read
on a page can potentially result in a SEGV.

According to the SuSv3 spec, "if the application requests only PROT_WRITE, the
implementation may also allow read access." Also as mentioned, some
archtectures, such as alpha, shown above already take the approach that i am
suggesting.

The counter-argument to this raised by Arjan, is that the kernel is enforcing
the write only mapping the best it can given the h/w limitations.  This is
true, however Alan Cox, and myself would argue that the inconsitency in
behavior, that is applications can sometimes work/sometimes fails is highly
undesireable.  If you read through the thread, i think people, came to an
agreement on the last patch i posted, as nobody has objected to it...

Signed-off-by: Jason Baron <jbaron@redhat.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Andi Kleen <ak@muc.de>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Kazumoto Kojima <kkojima@rr.iij4u.or.jp>
Cc: Ian Molton <spyro@f2s.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:05 -07:00
Paul Mundt 33573c0e32 sh: Fix occasional flush_cache_4096() stack corruption.
IRQs disabling in flush_cache_4096 for cache purge. Under certain
workloads we would get an IRQ in the middle of a purge operation,
and the cachelines would remain in an inconsistent state, leading
to occasional stack corruption.

Signed-off-by: Takeo Takahashi <takahashi.takeo@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:37:30 +09:00
Paul Mundt f3c2575818 sh: Calculate shm alignment at runtime.
Set the SHM alignment at runtime, based off of probed cache desc.
Optimize get_unmapped_area() to only colour align shared mappings.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:36:17 +09:00
Paul Mundt 19f9a34f87 sh: Initial vsyscall page support.
This implements initial support for the vsyscall page on SH.
At the moment we leave it configurable due to having nommu
to support from the same code base. We hook it up for the
signal trampoline return at present, with more to be added
later, once uClibc catches up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:33:49 +09:00
Paul Mundt 28ccf7f91b sh: Selective flush_cache_mm() flushing.
flush_cache_mm() wraps in to flush_cache_all(), which is rather
excessive given that the number of PTEs within the specified context
are generally quite low.  Optimize for walking the mm's VMA list and
selectively flushing the VMA ranges from the dcache. Invalidate the
icache only if a VMA sets VM_EXEC.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:30:07 +09:00
Paul Mundt d15f456043 sh: More intelligent entry_mask/way_size calculation.
Figure out the cache desc entry_mask at runtime, and remove
hard-coded assumption about the cacheline size.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:28:34 +09:00
Paul Mundt 72c35543f8 sh: Support for L2 cache on newer SH-4A CPUs.
This implements preliminary support for the L2 caches found
on newer SH-4A CPUs.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:27:43 +09:00
Paul Mundt 9d549a7d8e sh: Update kexec support for API changes.
This was falling a bit behind..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:26:05 +09:00
Paul Mundt 05ae915851 sh: Optimized readsl()/writesl() support.
Implement optimized copies of readsl()/writesl().

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:25:24 +09:00
Paul Mundt 2220d16493 sh: Report movli.l/movco.l capabilities.
Add llsc to cpu_flags[] and comment cpu-features.h.

Signed-off-by: Jamie Lenehan <nynaeve@twibble.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:24:28 +09:00
Paul Mundt 315bb96824 sh: CPU flags in AT_HWCAP in ELF auxvt.
Encode processor flags in AT_HWCAP in the ELF auxiliary vector.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:22:53 +09:00
Paul Mundt a6a3113989 sh: Add support for 4K stacks.
This enables support for 4K stacks on SH.

Currently this depends on DEBUG_KERNEL, but likely all boards
will switch to this as the default in the future.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:22:14 +09:00
Paul Mundt 2cb7ce3bb3 sh: Enable /proc/kcore support.
This was previously unimplemented..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:20:58 +09:00
Paul Mundt d153ea88dc sh: stack debugging support.
This adds a DEBUG_STACK_USAGE and DEBUG_STACKOVERFLOW for SH.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:20:16 +09:00
Paul Mundt 7a440c950e sh: select CONFIG_EMBEDDED.
This solution isn't very optimal, but it's generaly the behaviour that
we want..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:18:31 +09:00
Paul Mundt 2c7834a6f1 sh: machvec rework.
Some more machvec overhauling and setup code cleanup. Kill off
get_system_type() and platform_setup(), we can do these both
through the machvec. While we're add it, kill off more useless
mach.c's and drop some legacy cruft from setup.c.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:17:31 +09:00
Paul Mundt bc8fb5d047 sh: Solution Engine SH7343 board support.
This adds support for the SE7343 board.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:09:34 +09:00
Paul Mundt 91b91d0141 sh: SH7710VoIPGW board support.
This adds support for the SH7710 VoIP Gateway board.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:08:33 +09:00
Paul Mundt 8599cf0592 sh: Cleanup IRQ disabling for hardirq handlers.
The generic hardirq layer already takes care of a lot of the
appropriate locking and disabling for us, no need to duplicate
it in the handlers..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:03:34 +09:00
Paul Mundt ba463937ef sh: maskreg IRQ support.
Formerly implemented by ADX, we can use this generically,
so move it over.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:01:16 +09:00
Paul Mundt 5a4053b232 sh: Kill off dead boards.
None of these have been maintained in years, and no one seems to
be interested in doing so, so just get rid of them.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 18:00:19 +09:00
Paul Mundt 15f57a29a1 sh: Add support for cacheline poking through debugfs.
A simple debugging aid for easier visibility of the respective
cachelines.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:51:01 +09:00
Nobuhiro Iwamatsu c7afb7e5cb sh: Fix memcpy() build error on sh4eb.
A trivial bug breaking the build on sh4eb.

Signed-off-by: Nobuhiro Iwamatsu <hemamu@t-base.ne.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:50:03 +09:00
Paul Mundt 91550f715b sh: Kill off the rest of the legacy rtc mess.
With the new RTC class driver, we can get rid of most of the
old left over cruft.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:45:01 +09:00
Takashi YOSHII 51e22e7a05 sh: SHMIN board support.
This adds support for the SHMIN SH7706 board.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:41:31 +09:00
Paul Mundt e5723e0eeb sh: Add support for SH7706/SH7710/SH7343 CPUs.
This adds support for the aforementioned CPU subtypes, and cleans
up some build issues encountered as a result.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:38:11 +09:00
Paul Mundt 7dec62e96b sh: Add setup code for various CPU subtypes.
This adds some simple setup code for most of the CPU subtypes,
primarily simple platform device registration.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:30:35 +09:00
Paul Mundt 237b98f61d sh: sem2mutex conversion for clock framework.
Simple sem2mutex conversion.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:28:20 +09:00
Paul Mundt 9f23e7e94f sh: pselect6 and ppoll, along with signal trampoline rework.
This implements support for ppoll() and pselect6()..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:27:00 +09:00
Yoshinori Sato a2d1a5fae6 sh: __addr_ok() and other misc nommu fixups.
A few more outstanding nommu fixups..

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:25:07 +09:00
Paul Mundt 0b8929354c sh: __NR_restart_syscall support.
This implements support for __NR_restart_syscall.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:22:49 +09:00
Yoshinori Sato e96636ccfa sh: Various nommu fixes.
This fixes up some of the various outstanding nommu bugs on
SH.

Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:21:02 +09:00
Paul Mundt e7f93a355c sh: Make PAGE_OFFSET configurable.
nommu needs to be able to shift PAGE_OFFSET, so we switch it to a
non-user-visible CONFIG_PAGE_OFFSET and use that in the few places
where it matters.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:19:13 +09:00
Paul Mundt adf1890b0c sh: Move voyagergx_reg.h to a more sensible place.
Other boards require this as well, so move it out of the
rts7751r2d directory.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:17:27 +09:00
Takashi YOSHII 4b565680d1 sh: math-emu support
This implements initial math-emu support, aimed primarily at SH-3.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:15:32 +09:00
Paul Mundt af514ca7d2 sh: Rename rtc_get/set_time() to avoid RTC_CLASS conflict.
We have a clash with RTC_CLASS over these names, so we
change them..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:11:32 +09:00
Paul Mundt 2991be7252 sh: Fixup __strnlen_user() behaviour.
Drop TIF_USERSPACE and add addr_limit to the thread_info struct.
Subsequently, use that for address checking in strnlen_user() to
ward off bogus -EFAULTs.

Make __strnlen_user() return 0 on exception, rather than -EFAULT.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:07:07 +09:00
Paul Mundt 0f08f33808 sh: More cosmetic cleanups and trivial fixes.
Nothing exciting here, just trivial fixes..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 17:03:56 +09:00
Paul Mundt 9e3043c091 sh: Fixup TEI IRQ requests in request_dma().
If a channel is not TEI capable, don't try to request_irq()..

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:55:24 +09:00
Paul Mundt e2d1864da5 sh: G2 DMA IRQ and residue sampling.
This fixes a long-standing FIXME for G2 DMA, where we finally
wire up the IRQ handler and allow for sampling remaining bytes
while in-flight.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:53:40 +09:00
Paul Mundt ade2b3f6ed sh: VoyagerGX cleanups and 8250 UART support.
This adds the VoyagerGX UART to the RTS7751R2D setup
code, and cleans up a few build issues.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:48:46 +09:00
Paul Mundt a3e61d50dc sh: Inhibit mapping PCI apertures through page tables.
Inhibit mapping through page tables in __ioremap() for PCI memory
apertures on SH7751 and SH7780-style PCI controllers, translation is
not possible for these areas. For other users that map a small window
in P1/P2 space, ioremap() traps that already, and should never make
it to __ioremap().

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:45:22 +09:00
Paul Mundt 959f85f8a3 sh: Consolidated SH7751/SH7780 PCI support.
This cleans up quite a lot of the PCI mess that we
currently have, and attempts to consolidate the
duplication in the SH7780 and SH7751 PCI controllers.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:43:28 +09:00
Paul Mundt 56e8d7b578 sh: kgdb stub cleanups.
Some kgdb cleanup. Move hexchars/highhex/lowhex to the header, so it can
be reused by sh-sci. Also drop silly ctrl_inl/outl() overloading being
done by the kgdb stub.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:24:55 +09:00
Paul Mundt 2549b3222f sh: Use generic CONFIG_FRAME_POINTER.
We had our own version, which serves no purpose. Simply
hook SH in to the generic one.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:22:33 +09:00
Andriy Skulysh 3aa770e797 sh: APM/PM support.
This adds some simple PM stubs and the basic APM interfaces,
primarily for use by hp6xx, where the existing userland
expects it.

Signed-off-by: Andriy Skulysh <askulysh@gmail.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:20:22 +09:00
Paul Mundt a328ff9a7e sh: SE73180 updates for IRQ changes.
SE73180 can use the generic support, we just need to
wire up the IRQ demuxing.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:14:54 +09:00
Paul Mundt ae31825e63 sh: Make O= builds work again.
Some of the paths were a bit broken, fix it up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2006-09-27 16:08:24 +09:00