Commit Graph

650 Commits

Author SHA1 Message Date
Harvey Harrison 398cf93a39 sparc: use the new byteorder headers
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-29 15:36:00 -07:00
Krzysztof Helt 12a9ee3cce rtc-m48t59: shift zero year to 1968 on sparc (rev 2)
Shift the first year to 1968 for Sun SPARC machines.

Move this logic from platform specific files to rtc driver
as this fixes problems with calculating a century bit.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Tested-by: Alexander Beregalov
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-29 15:35:24 -07:00
Linus Torvalds 5579a782ad Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  math-emu: Fix thinko in _FP_DIV
  math-emu: Fix signalling of underflow and inexact while packing result.
  sparc: Add checkstack support
  sparc: correct section of current_pc()
  sparc: correct section of apc_no_idle
  sparc64: Fix race in arch/sparc64/kernel/trampoline.S
2008-10-23 19:19:14 -07:00
Linus Torvalds 92fb83afd6 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile: (21 commits)
  OProfile: Fix buffer synchronization for IBS
  oprofile: hotplug cpu fix
  oprofile: fixing whitespaces in arch/x86/oprofile/*
  oprofile: fixing whitespaces in arch/x86/oprofile/*
  oprofile: fixing whitespaces in drivers/oprofile/*
  x86/oprofile: add the logic for enabling additional IBS bits
  x86/oprofile: reordering functions in nmi_int.c
  x86/oprofile: removing unused function parameter in add_ibs_begin()
  oprofile: more whitespace fixes
  oprofile: whitespace fixes
  OProfile: Rename IBS sysfs dir into "ibs_op"
  OProfile: Rework string handling in setup_ibs_files()
  OProfile: Rework oprofile_add_ibs_sample() function
  oprofile: discover counters for op ppro too
  oprofile: Implement Intel architectural perfmon support
  oprofile: Don't report Nehalem as core_2
  oprofile: drop const in num counters field
  Revert "Oprofile Multiplexing Patch"
  x86, oprofile: BUG: using smp_processor_id() in preemptible code
  x86/oprofile: fix on_each_cpu build error
  ...

Manually fixed trivial conflicts in
	drivers/oprofile/{cpu_buffer.c,event_buffer.h}
2008-10-23 10:05:40 -07:00
Frederic Weisbecker 8dd9453737 sparc: correct section of current_pc()
Latest mainline gives this section mismatch on sparc:

The function current_pc() references
the variable __init no_sun4u_here.
This is often because current_pc lacks a __init
annotation or the annotation of no_sun4u_here is wrong.

Since current_pc() is used only in early time, it is correct to
put it in .init section.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-22 21:53:47 -07:00
Frederic Weisbecker a1731e5b9a sparc: correct section of apc_no_idle
The latest mainline gives this section mismatch on sparc:

The function __devinit apc_probe() references
a variable __initdata apc_no_idle.
If apc_no_idle is only used by apc_probe then
annotate apc_no_idle with a matching annotation.

Since the commit 7e7e2f0356,
apc_probe() is on __devinit so we have to correct apc_no_idle
which is referenced by this function.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-22 21:53:43 -07:00
Matt Helsley dc52ddc0e6 container freezer: implement freezer cgroup subsystem
This patch implements a new freezer subsystem in the control groups
framework.  It provides a way to stop and resume execution of all tasks in
a cgroup by writing in the cgroup filesystem.

The freezer subsystem in the container filesystem defines a file named
freezer.state.  Writing "FROZEN" to the state file will freeze all tasks
in the cgroup.  Subsequently writing "RUNNING" will unfreeze the tasks in
the cgroup.  Reading will return the current state.

* Examples of usage :

   # mkdir /containers/freezer
   # mount -t cgroup -ofreezer freezer  /containers
   # mkdir /containers/0
   # echo $some_pid > /containers/0/tasks

to get status of the freezer subsystem :

   # cat /containers/0/freezer.state
   RUNNING

to freeze all tasks in the container :

   # echo FROZEN > /containers/0/freezer.state
   # cat /containers/0/freezer.state
   FREEZING
   # cat /containers/0/freezer.state
   FROZEN

to unfreeze all tasks in the container :

   # echo RUNNING > /containers/0/freezer.state
   # cat /containers/0/freezer.state
   RUNNING

This is the basic mechanism which should do the right thing for user space
task in a simple scenario.

It's important to note that freezing can be incomplete.  In that case we
return EBUSY.  This means that some tasks in the cgroup are busy doing
something that prevents us from completely freezing the cgroup at this
time.  After EBUSY, the cgroup will remain partially frozen -- reflected
by freezer.state reporting "FREEZING" when read.  The state will remain
"FREEZING" until one of these things happens:

	1) Userspace cancels the freezing operation by writing "RUNNING" to
		the freezer.state file
	2) Userspace retries the freezing operation by writing "FROZEN" to
		the freezer.state file (writing "FREEZING" is not legal
		and returns EIO)
	3) The tasks that blocked the cgroup from entering the "FROZEN"
		state disappear from the cgroup's set of tasks.

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: export thaw_process]
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Tested-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-20 08:52:34 -07:00
Matt Helsley 83224b0837 container freezer: add TIF_FREEZE flag to all architectures
This patch series introduces a cgroup subsystem that utilizes the swsusp
freezer to freeze a group of tasks.  It's immediately useful for batch job
management scripts.  It should also be useful in the future for
implementing container checkpoint/restart.

The freezer subsystem in the container filesystem defines a cgroup file
named freezer.state.  Reading freezer.state will return the current state
of the cgroup.  Writing "FROZEN" to the state file will freeze all tasks
in the cgroup.  Subsequently writing "RUNNING" will unfreeze the tasks in
the cgroup.

* Examples of usage :

   # mkdir /containers/freezer
   # mount -t cgroup -ofreezer freezer  /containers
   # mkdir /containers/0
   # echo $some_pid > /containers/0/tasks

to get status of the freezer subsystem :

   # cat /containers/0/freezer.state
   RUNNING

to freeze all tasks in the container :

   # echo FROZEN > /containers/0/freezer.state
   # cat /containers/0/freezer.state
   FREEZING
   # cat /containers/0/freezer.state
   FROZEN

to unfreeze all tasks in the container :

   # echo RUNNING > /containers/0/freezer.state
   # cat /containers/0/freezer.state
   RUNNING

This patch:

The first step in making the refrigerator() available to all
architectures, even for those without power management.

The purpose of such a change is to be able to use the refrigerator() in a
new control group subsystem which will implement a control group freezer.

[akpm@linux-foundation.org: fix sparc]
Signed-off-by: Cedric Le Goater <clg@fr.ibm.com>
Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Acked-by: Pavel Machek <pavel@suse.cz>
Acked-by: Serge E. Hallyn <serue@us.ibm.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Nigel Cunningham <nigel@tuxonice.net>
Tested-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-20 08:52:33 -07:00
Martin Schwidefsky 0b59268285 [PATCH] remove unused ibcs2/PER_SVR4 in SET_PERSONALITY
The SET_PERSONALITY macro is always called with a second argument of 0.
Remove the ibcs argument and the various tests to set the PER_SVR4
personality.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2008-10-16 15:40:05 +02:00
Robert Richter 25ad2913ca oprofile: more whitespace fixes
Signed-off-by: Robert Richter <robert.richter@amd.com>
2008-10-15 20:55:51 +02:00
Linus Torvalds 5723ff931a Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  chmc: Mark %ver register inline asm with __volatile__
  sparc64: Add missing notify_cpu_starting() call.
  sparc32: fix build errors
2008-10-13 10:07:53 -07:00
Linus Torvalds 244dc4e54b Merge git://git.infradead.org/users/dwmw2/random-2.6
* git://git.infradead.org/users/dwmw2/random-2.6:
  Fix autoloading of MacBook Pro backlight driver.
  Automatic MODULE_ALIAS() for DMI match tables.
  Remove asm/a.out.h files for all architectures without a.out support.
  Introduce HAVE_AOUT symbol to remove hard-coded arch list for BINFMT_AOUT
  Remove redundant CONFIG_ARCH_SUPPORTS_AOUT
  S390: Update comments about why we don't use <asm-generic/statfs.h>
  SPARC: Use <asm-generic/statfs.h>
  PowerPC: Use <asm-generic/statfs.h>
  PARISC: Use <asm-generic/statfs.h>
  x86_64: Use <asm-generic/statfs.h>
  IA64: Use <asm-generic/statfs.h>
  ARM: Use <asm-generic/statfs.h>
  Make <asm-generic/statfs.h> suitable for 64-bit platforms.
  Define and use PCI_DEVICE_ID_MARVELL_88ALP01_CCIC for CAFÉ camera driver
  [MTD] [NAND] Define and use PCI_DEVICE_ID_MARVELL_88ALP01_NAND for CAFÉ
  Use PCI_DEVICE_ID_88ALP01 for CAFÉ chip, rather than PCI_DEVICE_ID_CAFE.
  EFS: Don't set f_fsid in statfs().
2008-10-13 09:59:14 -07:00
David Miller b70ac77185 serial: allow 8250 to be used on sparc
This requires three changes:

1) Remove !SPARC restriction in Kconfig.

2) Move Sparc specific serial drivers before 8250, so that serial
   console devices don't change names on us, even if 8250 finds
   devices.

3) Since the Sparc specific serial drivers try to use the
   same major/minor device namespace as 8250, some coordination
   is necessary.  Use the sunserial_*() layer routines to allocate
   minor number space within TTY_MAJOR when CONFIG_SPARC.

   This has no effect on other platforms.

Thanks to Josip Rodin for bringing up this issue and testing
plus debugging various revisions of this patch.

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-10-13 09:51:40 -07:00
David Woodhouse e758936e02 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:

	include/asm-x86/statfs.h
2008-10-13 17:13:56 +01:00
Robert Reif 4245e59d12 sparc32: fix build errors
arch/sparc/kernel/sun4d_smp.c: In function ‘smp4d_callin’:
arch/sparc/kernel/sun4d_smp.c:101: error: implicit declaration of function ‘notify_cpu_starting’
arch/sparc/kernel/sun4m_smp.c: In function ‘smp4m_callin’:
arch/sparc/kernel/sun4m_smp.c:74: error: implicit declaration of function ‘notify_cpu_starting’

Signed-off-by: Robert Reif <reif@earthlink.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-12 23:55:45 -07:00
David S. Miller 56c5d900db Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:

	sound/core/memalloc.c
2008-10-11 12:39:35 -07:00
Ingo Molnar 990d0f2ced Merge branches 'sched/devel', 'sched/cpu-hotplug', 'sched/cpusets' and 'sched/urgent' into sched/core 2008-10-08 11:31:02 +02:00
Robert Reif 6cf4a9243a sparc32: sun4m interrupt mask cleanup
Here is an updated version of a patch I wrote 6 years ago
http://marc.info/?l=linux-sparc&m=103939103607617&w=2
that simplifies interrupt mask lookup.  It's main purpose
is to add VME bus support but it's really a cleanup of the mask code.

Signed-off-by: Robert Reif <reif@earthlink.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-10-07 15:24:02 -07:00
David Brownell a1cd0464c6 sparc: arch/sparc/kernel/pmc.c -- extra #include?
I have no SPARC compiler handy to verify, but it looks like this
is another file that doesn't need <linux/miscdevices.h> ...

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-21 00:28:26 -07:00
David S. Miller 778b1c65bf sparc32: Add more extensive documentation of sun4m interrupts.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:18:05 -07:00
David S. Miller e7913de928 sparc32: Kill irq_rcvreg from sun4m_irq.c
Unused.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:18:04 -07:00
David S. Miller c7e606a8f8 sparc32: Delete master_l10_limit.
It is only set, never used.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:18:03 -07:00
David S. Miller 8bd8deead7 sparc32: Use PROM device probing for sun4c timers.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:18:02 -07:00
David S. Miller 45bb5a7cbf sparc32: Use PROM device probing for sun4c interrupt register.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:18:01 -07:00
David S. Miller 5ff0d55f93 sparc32: Delete claim_ticker14().
No more users.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:18:01 -07:00
David S. Miller b218fa0e9c sparc32: Stop calling claim_ticker14() from sun4c_irq.c
Since the first argument is always NULL, the only side effect
is to disable the PROFILE_IRQ, so just do that directly.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:17:59 -07:00
David S. Miller 76954261ba sparc32: Kill clear_profile_irq btfixup entry.
Unused.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:17:59 -07:00
David S. Miller 1de937a536 sparc32: Call sun4m_clear_profile_irq() directly from sun4m_smp.c
This is the only use of the clear_profile_irq() btfixup entry,
which just eats up lots of dead space on other platform types.

A subsequent commit will delete the other implementations and
the btfixup entry as well.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:17:58 -07:00
David S. Miller a73554aedb sparc32: Remove #if 0'd code from sun4c_irq.c
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:17:57 -07:00
David S. Miller f8376e933c sparc32: Remove some SMP ifdefs in sun4d_irq.c
Always do the sbus_tid[] handling.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:17:56 -07:00
David S. Miller f5f1085720 sparc32: Use PROM infrastructure for probing and mapping sun4d timers.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:17:56 -07:00
David S. Miller 69c010b245 sparc32: Use PROM device probing for sun4m irq registers.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-19 21:17:43 -07:00
David S. Miller 2e57572a50 Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
Conflicts:

	arch/sparc64/kernel/pci_psycho.c
2008-09-16 14:11:43 -07:00
David S. Miller 9b2e43ae4e sparc32: Use PROM device probing for sun4m timer registers.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-13 21:37:32 -07:00
David S. Miller 7d4ee289d1 sparc: Fix user_regset 'n' field values.
As noticed by Russell King, we were not setting this properly
to the number of entries, but rather the total size.

This results in the core dumping code allocating waayyyy too
much memory.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-12 15:55:44 -07:00
David S. Miller 3c50370103 sparc: Fix user_regset 'n' field values.
As noticed by Russell King, we were not setting this properly
to the number of entries, but rather the total size.

This results in the core dumping code allocating waayyyy too
much memory.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-12 15:01:31 -07:00
David S. Miller b539c46766 sparc64: Fix sparse warnings in fault.c
1) set_brkpt() is referenced by nothing and hasn't been used by anyone
   to my knowledge for many many years.  So just delete it.

2) add extern decl for do_sparc64_fault() in asm/pgtable_64.h

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-12 00:10:32 -07:00
David S. Miller 7e0b1e6186 sparc64: Fix sparse warnings in visemul.c
1) edge8 tables should be static
2) add vis_emul() extern decl. to asm/visasm.h

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-11 23:46:40 -07:00
David S. Miller b0f1e7962f sparc64: Define WANT_PAGE_VIRTUAL
As sparse warns, without this struct page pointer subtraction is
extremely expensive, and this is a pretty common operation in
fast paths.

With this define struct page becomes 64 bytes which makes for a
simple subtract and shift, instead of a costly divide or reciprocol
multiply.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-11 23:36:32 -07:00
David S. Miller 17f04fbb0f sysctl: Use header file for sysctl knob declarations on sparc.
This also takes care of a sparse warning as scons_pwroff's definition
point.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-11 23:33:53 -07:00
David S. Miller 8f20b20de7 sparc64: Fix sparse warnings in global reg snapshotting.
Lots of shadowed local variables and global_reg_snapshot[] needs
an extern declaration in asm/ptrace_64.h.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-11 23:19:22 -07:00
David S. Miller 3fbe36d8da sparc32: Call parse_early_param() in setup_arch().
Mirror sparc64.  This will allow us to use early_param() on
sparc32 too.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-10 23:40:32 -07:00
David S. Miller bdba4d6b77 sparc32: Fix function signature of of_bus_sbus_get_flags().
This doesn't match the function pointer type it gets assigned
to.  Luckily, this was harmless.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-10 23:38:51 -07:00
David S. Miller d3ae4b5bc7 sparc64: Get rid of pci_controller_info.
It is just used as a parent to encapsulate two PBM objects.

But that layout is only really relevant and necessary for
psycho PCI controllers, which unlike all the others share
a single IOMMU instance between sibling PCI busses.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-10 23:07:41 -07:00
David S. Miller ab138c031f sparc32: Need to close openned RTC device just like sparc64.
Otherwise we get refcount problems.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-10 13:36:13 -07:00
Bjoern B. Brandenburg 4944f7e5c9 sparc: remove unused includes
The spinlock code does not use NR_CPUS.
Compile tested using allyesconfig and allnoconfig.

Signed-off-by: Bjoern B. Brandenburg <bbb@cs.unc.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-09 19:43:33 -07:00
David S. Miller 7b1af32f52 sparc32: Move sun4d show_leds() out of asm/obio.h
Put it, as well as cpu_leds[] array, into sun4d_irq.c

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-08 15:40:45 -07:00
David S. Miller 365b50f0f0 sparc32: Fix coding style of sparc_cpu_model setting code.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-08 15:40:31 -07:00
David S. Miller 98d86c0915 Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
Conflicts:

	arch/sparc/kernel/of_device.c
2008-09-08 15:39:30 -07:00
Manfred Spraul e545a6140b kernel/cpu.c: create a CPU_STARTING cpu_chain notifier
Right now, there is no notifier that is called on a new cpu, before the new
cpu begins processing interrupts/softirqs.
Various kernel function would need that notification, e.g. kvm works around
by calling smp_call_function_single(), rcu polls cpu_online_map.

The patch adds a CPU_STARTING notification. It also adds a helper function
that sends the message to all cpu_chain handlers.

Tested on x86-64.
All other archs are untested. Especially on sparc, I'm not sure if I got
it right.

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-09-08 19:25:24 +02:00
David Woodhouse 52d90f4dad SPARC: Use <asm-generic/statfs.h>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2008-09-06 19:30:17 +01:00
Robert Reif 1aa0365f27 sparc32: add init memory poisoning
This patch adds init memory poisoning.  It looks like
totalram_pages was not updated properly in free_initrd_mem
so I fixed that as well.

Signed-off-by: Robert Reif <reif@earthlink.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-03 16:29:42 -07:00
David S. Miller 94d5b5432b sparc: Remove asm/rtc.h
No more users.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-03 16:19:46 -07:00
David S. Miller f6e30ffcf3 sparc32: Kill asm/mostek.h.
No longer used.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-03 15:57:04 -07:00
David S. Miller 81c4fdb1d6 sparc32: Kill remaining asm/mostek.h inclusions.
No longer needed.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-03 15:56:27 -07:00
David S. Miller c4cbe6f96e sparc32: use RTC subsystem
Use rtc subsystem for sparc32 architecture.
Actually, only one driver is needed: m48t59
as it supports the most common clocks on sparc32
machines: m48t08 and m48t02.

[ Add proper RTC layer calls to set_rtc_mmss() -DaveM ]

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-03 15:52:38 -07:00
David S. Miller 5280267c1d sparc: Fix handling of LANCE and ESP parent nodes in of_device.c
The device nodes that sit above 'esp' and 'le' on SBUS lack a 'ranges'
property, but we should pass the translation up to the parent node so
that the SBUS level ranges get applied.

Based upon a bug report from Robert Reif.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-03 02:05:19 -07:00
David S. Miller 9723f38eb5 sparc32: Fix sun4c build warnings.
Reported by Stephen Rothwell.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-02 03:15:44 -07:00
David S. Miller 446139a8f7 sparc64: Implement SSTATE purely using notifiers and initcalls.
Don't clutter up the tree with sstate_blah() scattered all over the
place.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-02 00:49:38 -07:00
David S. Miller cdb3592a20 sparc64: Move reboot handling into seperate file and kill power reg programming.
We should always use prom_power_off().

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-09-02 00:31:11 -07:00
David S. Miller ba4962d7a6 sparc64: Clean up CPU chip type probing code.
Three main things:

1) Make prober an arch initcall instead of using hard-coded invocation
   from paging_init()

2) Shrink table size, the fpu ident stuff was never used.

3) Use named struct initialized in table.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-31 21:48:12 -07:00
Adrian Bunk 5110bd21b8 sparc: remove CONFIG_SUN4
While doing some easy cleanups on the sparc code I noticed that the
CONFIG_SUN4 code seems to be worse than the rest - there were some
"I don't know how it should work, but the current code definitely cannot
work." places.

And while I have seen people running Linux on machines like a
SPARCstation 5 a few years ago I don't recall having seen sun4
machines, even less ones running Linux.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-31 20:59:37 -07:00
David S. Miller b69416b51b sparc64: Rewrite central driver.
This driver is now limited to just doing the basic clock board and FHC
chip initialization and registering the platform devices for the
per-board LEDs, which are driven by the new LEDS_STARFIRE driver.

The IRQ register handling is already confined purely to the device
tree code.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-31 20:56:15 -07:00
David S. Miller 10d29ff907 sparc64: Delete starfire_cpu_setup().
It does nothing.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-31 01:40:12 -07:00
David S. Miller fd098316ef sparc: Annotate of_device_id arrays with const or __initdata.
As suggested by Stephen Rothwell.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-31 01:23:17 -07:00
David S. Miller 933b2a1d8d sparc: Stop setting NO_DMA.
This fixes the build with PCI disabled, we do want the
generic DMA facilities and interfaces even when just SBUS
is enabled.

Based upon a build failure report by Robert Reif.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-30 12:34:20 -07:00
David S. Miller e0ac612e69 sparc: Kill ebus_bus_type.
No longer used.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-30 00:37:36 -07:00
David S. Miller 356d164757 sparc: Kill EBUS driver layer.
All that remains is the EBUS DMA programming library for
sparc64.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-30 00:36:11 -07:00
David S. Miller 3ae627a19e sparc64: Convert EBUS floppy support to pure OF driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 23:26:23 -07:00
David S. Miller aae7fb87ec sparc: Move EBUS DMA interfaces into seperate header file.
These have no dependencies on the EBUS probing layer, the clients
setup the registers and all of those details.  The EBUS DMA layer
just programs and manages the DMA controller found in EBUS.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 23:10:21 -07:00
David S. Miller da86783dda sparc64: Use generic CMOS driver.
Based largely upon a patch by Krzysztof Helt <krzysztof.h1@poczta.fm>

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 14:16:48 -07:00
David S. Miller e8b75c4fd6 sparc: asm/mostek.h is now 32-bit only
No need for the 64-bit header version any more.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 14:16:47 -07:00
David S. Miller 7eb1aae555 sparc: Delete asm/sbus*.h
No longer used.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:24 -07:00
David S. Miller 9dc69230a9 sparc: Kill now spurious includes of sbus.h
In order to make this week I also had to add an include
of linux/dma-mapping.h to asm/pci_32.h because drivers/pci/pci.c
really depends upon getting this header somehow.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:23 -07:00
David S. Miller 0ad626a2a4 sparc32: Kill iounit_map_dma_*().
Unused.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:23 -07:00
David S. Miller 47a2d72885 sparc: Kill sbus_bus_type.
No longer used.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:22 -07:00
David S. Miller 046e26a8ba sparc: Remove generic SBUS probing layer.
The individual SBUS IOMMU arch code now sets the IOMMU information
directly into the OF device objects.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:21 -07:00
David S. Miller 5059625ed8 sparc: Add OF archdata propagation helper.
Add a helper function that, given a bus of_device node, propagates
all iommu, stc, and host_controller values down to the child nodes.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:20 -07:00
David S. Miller f8e4d32cb5 sparc: Kill sbus_arch_preinit().
32-bit sparc just needed it to register the ioport procfs bits, do this
via an arch_initcall() instead.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:19 -07:00
David S. Miller d32bcdd7a9 sparc32: Kill sbus_is_slave().
Unused.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:19 -07:00
David S. Miller c6e5f661ee sparc: Kill OBP property members of sbus_dev and sbus_bus
Unused.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:18 -07:00
David S. Miller 9b9644c6d9 sparc: Kill sbus_devaddr() and sbus_dev_slot().
Unused.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:14 -07:00
David S. Miller 615deeb27b sparc: Kill sbus_ioremap() and sbus_iounmap().
No more users.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:13 -07:00
David S. Miller 454eeb2dd7 sparc: Convert remaining sbus_ioremap() and sbus_iounmap() users.
Use of_ioremap() and of_iounmap() instead.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:13 -07:00
David S. Miller 98261dd1a3 sparc: Remove dinky old-style SBUS probing facilities.
No drivers or code uses this stuff any more, every driver has been
converted over to OF device probing.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:12 -07:00
David S. Miller 104364810f sparc: Remove SBUS layer resource and irq handling.
All the drivers use OF device objects now for this
information.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:11 -07:00
David S. Miller 33c4655c00 sparc: Kill SBUS layer IRQ hooks.
IRQs are obtained by drivers from the of_device struct.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:10 -07:00
David S. Miller 71d3721189 sparc32: Convert sun4d IRQ code to use generic device tree probing.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:09 -07:00
David S. Miller f1b6aa87b7 sparc32: Convert pmc to OF driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:09 -07:00
David S. Miller 7e7e2f0356 sparc32: Convert apc to OF driver.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:08 -07:00
David S. Miller 4b1c5df2af sparc32: Make mmu_map_dma_area and mmu_unmap_dma_area take a device pointer.
This lets us kill this "map it in every IOMMU" crazy code, and also
some of the final references to sbus_root.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:07 -07:00
David S. Miller b1387c35be sparc32: Kill mmu_translate_dvma and implementations.
No longer used.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:03 -07:00
David S. Miller aba945e76b sparc32: Kill mmu_translate_dvma() usage.
Just simply use virt_to_page() on the provided virtual address pointer.

Kill #if 0'd code.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:02 -07:00
David S. Miller 10a104f9c5 sparc64: Convert SBUS floppy probing to use OF device objects.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:15:01 -07:00
David S. Miller 63237eeb5a sparc: Move SBUS DMA attribute interfaces out of asm/sbus.h
This is in preparation for the subsequent asm/sbus.h removal.

Also, make these routines take a "struct device" or no
arguments, as appropriate.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:31 -07:00
David S. Miller 738f2b7b81 sparc: Convert all SBUS drivers to dma_*() interfaces.
And all the SBUS dma interfaces are deleted.

A private implementation remains inside of the 32-bit sparc port which
exists only for the sake of the implementation of dma_*().

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:15 -07:00
David S. Miller 944c67dff7 sparc32: Implement more generic dma_*() interfaces.
These dispatch to either PCI or SBUS routines based upon
the device bus type.

This will allow us to let SBUS drivers call these routines.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:14 -07:00
David S. Miller 260489fa8a sparc32: Make mmu_{get,release}_*() take a struct device pointer.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:13 -07:00
David S. Miller 7a715f4601 sparc: Make SBUS DMA interfaces take struct device.
This is the first step in converting all the SBUS drivers
over to generic dma_*().

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:12 -07:00
David S. Miller e003934876 sparc32: Make IOMMU and IO-UNIT init work with device nodes.
And stick the iommu archdata pointer into the generic OF device tree
of_device struct as well.

We still have to pass the sbus_bus object down into the routines so
that the SBUS bus objects get the iommu cookies set properly.  After
drivers get converted to being pure OF drivers, that can go away.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:11 -07:00
David S. Miller 334ae61477 sparc: Kill SBUS DVMA layer.
This thing was completely pointless.

Just find the OF device in the parent of drivers that want to program
this device, and map the DMA regs inside such drivers too.

This also moves the dummy claim_dma_lock() and release_dma_lock()
implementation to floppy_32.h, which makes it handle this issue
just like floppy_64.h does.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:10 -07:00
David S. Miller 7f06a3b2c1 sparc: Kill videopix SBUS driver.
This has been marked BROKEN for a long time and it's more likely
to get rewritten from scratch than to be fixed up and made usable.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:09 -07:00
David S. Miller 902663f6ea sparc: Delete bare sbus char bpp driver, obsoleted by parport_sunbpp
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-29 02:13:08 -07:00
David S. Miller e3c71a3291 sparc: Fix resource flags for PCI children in OF device tree.
When a device is under an EBUS or ISA bus, the resource flags
don't get set properly.

Fix this by re-evaluating the resource flags at each level of
bus as we apply ranges on the way to the root.  And let PCI
override any existing flags setting, but don't let the
default flags calculator make such overrides.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-28 22:59:10 -07:00
David S. Miller 66e4f8c076 sparc32: Implement smp_call_function_single().
Reported by Stephen Rothwell.

Needed to fix the build when CONFIG_RELAY is enabled.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-27 20:03:22 -07:00
David S. Miller 51e0f004a9 sparc64: Fix irq_of_parse_and_map() and irq_dispose_mapping().
Stephen Rothwell noticed that I committed an earlier version
of the patch that didn't have two things fixed:

1) irq_of_parse_and_map() should return "unsigned int" not "int"
   and it should return zero for "no irq"

2) irq_dispose_mapping() should be an inline function, not a macro,
   for type checking

With feedback and suggestions from Anton Vorontsov.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-25 16:44:58 -07:00
David S. Miller 881d021ab0 sparc64: Add generic interface for registering a dimm printing handler.
The way to do this varies by platform type and the exact memory
controller the cpu uses.

For Spitfire cpus we currently just use prom_getunumber() and hope
that works.

For Cheetah cpus we have a memory controller driver that can
compute this information.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-24 22:08:34 -07:00
Martin Habets 349101da8e sparc: Add target for a stripped kernel
Add a target for a stripped kernel. This is used for the various
packaging targets (*-pkg).

Signed-off-by: Martin Habets <errandir_news@mph.eclipse.co.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-24 20:35:47 -07:00
David S. Miller 15df0f3302 sparc: Add GPIO layer support.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-24 20:33:56 -07:00
David S. Miller 44266215e3 sparc: Implement irq_of_parse_and_map() and irq_dispose_mapping().
This allows more OF layer code to be shared between powerpc and
sparc.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-24 20:33:55 -07:00
David S. Miller 2481d76615 sparc: Add mutex for set property calls.
On some platforms, the I2C controller is shared between the OS and
OBP.  OBP uses this I2C controller to access the EEPROM, and thus is
programmed when the kernel calls prom_setprop().

Wrap such calls with the new of_set_property_mutex.

Relevant I2C bus drivers can grab this mutex around top-level I2C
operations to provide the proper protection.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-24 20:33:55 -07:00
David S. Miller 4f70f7a91b sparc64: Implement IRQ stacks.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-12 18:33:56 -07:00
Stephen Rothwell e34456825d sparc: remove include of linux/of_device.h from asm/of_device.h
Now that all the direct includes of asm/of_device.h are gone, this is
safe to do.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-12 17:45:23 -07:00
Stephen Rothwell 764f2579d9 sparc: don't use asm/of_device.h
Use linux/of_device.h instead.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-07 15:33:36 -07:00
Stephen Rothwell f8d91faff3 of/sparc: remove include of linux/of_platform.h from asm/of_platform.h
Now that we have removed all inclusions of asm/of_platform.h, this
compatability include can be removed.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-08-06 18:14:28 -07:00
David S. Miller 6717c282e4 sparc: Add __KERNEL__ ifdef protection to pt_regs helpers.
Some of them use 'bool' and whatnot and therefore are not
kosher for userspace, so don't export them there.

Reported by Roland McGrath.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-31 20:32:35 -07:00
David S. Miller 09ee167cbf sparc64: Hook up trigger_all_cpu_backtrace().
We already have code that does this, but it is only currently attached
to sysrq-'y'.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-30 22:35:00 -07:00
David S. Miller 5afe27380b sparc64: Make global reg dumping even more useful.
Record one more level of stack frame program counter.

Particularly when lockdep and all sorts of spinlock debugging is
enabled, figuring out the caller of spin_lock() is difficult when the
cpu is stuck on the lock.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-30 21:57:59 -07:00
Mikael Pettersson d72609e17f sparc64: FUTEX_OP_ANDN fix
Correct sparc64's implementation of FUTEX_OP_ANDN to do a
bitwise negate of the oparg parameter before applying the
AND operation. All other archs that support FUTEX_OP_ANDN
either negate oparg explicitly (frv, ia64, mips, sh, x86),
or do so indirectly by using an and-not instruction (powerpc).
Since sparc64 has and-not, I chose to use that solution.

I've not found any use of FUTEX_OP_ANDN in glibc so the
impact of this bug is probably minor. But other user-space
components may try to use it so it should still get fixed.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-30 15:40:50 -07:00
Stephen Rothwell 19fd3cabba sparc: merge of_platform_{32,64}.h
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-29 23:54:33 -07:00
David S. Miller 71fc324b5b sparc64: Kill isa_bus_type.
I forgot to delete this when I removed the ISA bus layer
from the sparc ports.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-29 23:47:17 -07:00
David S. Miller 04d91cb816 sparc: Set CONFIG_HAVE_ARCH_TRACEHOOK
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-27 17:34:02 -07:00
David S. Miller ebd3c00333 sparc: Add task_pt_regs().
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-27 17:33:55 -07:00
David S. Miller b8b751bedc sparc: Add call to tracehook_signal_handler().
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-27 17:33:44 -07:00
David S. Miller 5a157d5bf8 sparc: Create and use TIF_NOTIFY_RESUME.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-27 17:33:37 -07:00
David S. Miller 1c133b4b3d sparc: Use tracehook routines in syscall_trace().
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-27 17:33:14 -07:00
David S. Miller ac76cfd088 sparc: Add user_stack_pointer().
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-27 17:32:58 -07:00
Roland McGrath e35a8925e0 sparc64: tracehook: TIF_NOTIFY_RESUME
This adds TIF_NOTIFY_RESUME support for sparc64.
When set, we call tracehook_notify_resume() on the way to user mode.

Signed-off-by: Roland McGrath <roland@redhat.com>
2008-07-27 17:32:19 -07:00
David S. Miller badcbf0e86 sparc: Add asm/syscall.h
Based upon a patch by Roland McGrath.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-27 17:31:48 -07:00
Sam Ravnborg a1bd021e56 sparc: enable headers_export again
Update include/asm/Kbuild so we export
all relvant headers for sparc.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-07-27 23:03:09 +02:00
Sam Ravnborg a439fe51a1 sparc, sparc64: use arch/sparc/include
The majority of this patch was created by the following script:

***
ASM=arch/sparc/include/asm
mkdir -p $ASM
git mv include/asm-sparc64/ftrace.h $ASM
git rm include/asm-sparc64/*
git mv include/asm-sparc/* $ASM
sed -ie 's/asm-sparc64/asm/g' $ASM/*
sed -ie 's/asm-sparc/asm/g' $ASM/*
***

The rest was an update of the top-level Makefile to use sparc
for header files when sparc64 is being build.
And a small fixlet to pick up the correct unistd.h from
sparc64 code.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-07-27 23:00:59 +02:00
Linus Torvalds 7b35fa86e4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  sparc: Wire up new system calls.
2008-07-25 17:33:34 -07:00
David S. Miller f1373da87b sparc: Wire up new system calls.
This wires up the recently added Wire up signalfd4, eventfd2,
epoll_create1, dup3, pipe2, and inotify_init1 system calls.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-25 15:18:31 -07:00
Adrian Bunk 7833351b52 pty: remove unused UNIX98_PTY_COUNT options
The h8300 and sparc options somehow survived when the code stopped using
CONFIG_UNIX98_PTY_COUNT.

Reviewed-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-25 10:53:42 -07:00
Ulrich Drepper ed8cae8ba0 flag parameters: pipe
This patch introduces the new syscall pipe2 which is like pipe but it also
takes an additional parameter which takes a flag value.  This patch implements
the handling of O_CLOEXEC for the flag.  I did not add support for the new
syscall for the architectures which have a special sys_pipe implementation.  I
think the maintainers of those archs have the chance to go with the unified
implementation but that's up to them.

The implementation introduces do_pipe_flags.  I did that instead of changing
all callers of do_pipe because some of the callers are written in assembler.
I would probably screw up changing the assembly code.  To avoid breaking code
do_pipe is now a small wrapper around do_pipe_flags.  Once all callers are
changed over to do_pipe_flags the old do_pipe function can be removed.

The following test must be adjusted for architectures other than x86 and
x86-64 and in case the syscall numbers changed.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/syscall.h>

#ifndef __NR_pipe2
# ifdef __x86_64__
#  define __NR_pipe2 293
# elif defined __i386__
#  define __NR_pipe2 331
# else
#  error "need __NR_pipe2"
# endif
#endif

int
main (void)
{
  int fd[2];
  if (syscall (__NR_pipe2, fd, 0) != 0)
    {
      puts ("pipe2(0) failed");
      return 1;
    }
  for (int i = 0; i < 2; ++i)
    {
      int coe = fcntl (fd[i], F_GETFD);
      if (coe == -1)
        {
          puts ("fcntl failed");
          return 1;
        }
      if (coe & FD_CLOEXEC)
        {
          printf ("pipe2(0) set close-on-exit for fd[%d]\n", i);
          return 1;
        }
    }
  close (fd[0]);
  close (fd[1]);

  if (syscall (__NR_pipe2, fd, O_CLOEXEC) != 0)
    {
      puts ("pipe2(O_CLOEXEC) failed");
      return 1;
    }
  for (int i = 0; i < 2; ++i)
    {
      int coe = fcntl (fd[i], F_GETFD);
      if (coe == -1)
        {
          puts ("fcntl failed");
          return 1;
        }
      if ((coe & FD_CLOEXEC) == 0)
        {
          printf ("pipe2(O_CLOEXEC) does not set close-on-exit for fd[%d]\n", i);
          return 1;
        }
    }
  close (fd[0]);
  close (fd[1]);

  puts ("OK");

  return 0;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Ulrich Drepper <drepper@redhat.com>
Acked-by: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk.manpages@googlemail.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-07-24 10:47:28 -07:00
Johannes Weiner 9109fb7b35 mm: drop unneeded pgdat argument from free_area_init_node()
free_area_init_node() gets passed in the node id as well as the node
descriptor.  This is redundant as the function can trivially get the node
descriptor itself by means of NODE_DATA() and the node's id.

I checked all the users and NODE_DATA() seems to be usable everywhere
from where this function is called.

Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-24 10:47:16 -07:00
Stephen Rothwell 4a0a088970 sparc32: pass -m32 when building vmlinux.lds
Otherwise it breaks since we merged asm/page.h

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-22 15:47:17 -07:00
David Howells e4f25060b8 sparc: Remove Sparc's asm-offsets for sclow.S
Remove Sparc's asm-offsets for sclow.S as the (E)UID/(E)GID size and
offset definitions will cease to be correct if COW credentials are
merged.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-19 00:44:32 -07:00
David S. Miller 4fe3ebec12 sparc: Use new '%pS' infrastructure to print symbols.
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-17 22:11:32 -07:00
Robert Reif f538f3df4f sparc32: fix init.c allnoconfig build error
Fix allnoconfig build error.

Signed-off-by: Robert Reif <reif@earthlink.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-17 21:56:26 -07:00
Stoyan Gaydarov ab772027ca sparc: arch/sparc/kernel/apc.c to unlocked_ioctl
This changes arch/sparc/kernel/apc.c to use unlocked_ioctl

Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-17 21:56:16 -07:00
Sam Ravnborg b1a8bf92a0 sparc: export openprom.h to userspace
sparc64 exports openprom.h to userspace so let sparc follow
the example.
As openprom.h pulled in another not-for-export vaddrs.h header
file it required a few changes to fix the build.

The definition af VMALLOC_* were moved to pgtable as this is
where sparc64 has them.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-07-17 21:42:23 -07:00
Adrian Bunk 50215d6511 sparc/mm/: possible cleanups
This patch contains the following possible cleanups:
- make the following needlessly global code static:
  - fault.c: force_user_fault()
  - init.c: calc_max_low_pfn()
  - init.c: pgt_cache_water[]
  - init.c: map_high_region()
  - srmmu.c: hwbug_bitmask
  - srmmu.c: srmmu_swapper_pg_dir
  - srmmu.c: srmmu_context_table
  - srmmu.c: is_hypersparc
  - srmmu.c: srmmu_cache_pagetables
  - srmmu.c: srmmu_nocache_size
  - srmmu.c: srmmu_nocache_end
  - srmmu.c: srmmu_get_nocache()
  - srmmu.c: srmmu_free_nocache()
  - srmmu.c: srmmu_early_allocate_ptable_skeleton()
  - srmmu.c: srmmu_nocache_calcsize()
  - srmmu.c: srmmu_nocache_init()
  - srmmu.c: srmmu_alloc_thread_info()
  - srmmu.c: early_pgtable_allocfail()
  - srmmu.c: srmmu_early_allocate_ptable_skeleton()
  - srmmu.c: srmmu_allocate_ptable_skeleton()
  - srmmu.c: srmmu_inherit_prom_mappings()
  - sunami.S: tsunami_copy_1page
- remove the following unused code:
  - init.c: struct sparc_aliases

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-17 21:38:01 -07:00
Adrian Bunk c61c65cdcd sparc/kernel/: possible cleanups
This patch contains the following possible cleanups:
- make the following needlessly global code static:
  - apc.c: apc_swift_idle()
  - ebus.c: ebus_blacklist_irq()
  - ebus.c: fill_ebus_child()
  - ebus.c: fill_ebus_device()
  - entry.S: syscall_is_too_hard
  - etra: tsetup_sun4c_stackchk
  - head.S: cputyp
  - head.S: prom_vector_p
  - idprom.c: Sun_Machines[]
  - ioport.c: _sparc_find_resource()
  - ioport.c: create_proc_read_entry()
  - irq.c: struct sparc_irq[]
  - rtrap.S: sun4c_rett_stackchk
  - setup.c: prom_sync_me()
  - setup.c: boot_flags
  - sun4c_irq.c: sun4c_sbint_to_irq()
  - sun4d_irq.c: sbus_tid[]
  - sun4d_irq.c: struct sbus_actions
  - sun4d_irq.c: sun4d_sbint_to_irq()
  - sun4m_irq.c: sun4m_sbint_to_irq()
  - sun4m_irq.c: sun4m_get_irqmask()
  - sun4m_irq.c: sun4m_timers
  - sun4m_smp.c: smp4m_cross_call()
  - sun4m_smp.c: smp4m_blackbox_id()
  - sun4m_smp.c: smp4m_blackbox_current()
  - time.c: sp_clock_typ
  - time.c: sbus_time_init()
  - traps.c: instruction_dump()
  - wof.S: spwin_sun4c_stackchk
  - wuf.S: sun4c_fwin_stackchk
- #if 0 the following unused code:
  - process.c: sparc_backtrace_lock
  - process.c: __show_backtrace()
  - process.c: show_backtrace()
  - process.c: smp_show_backtrace_all_cpus()
- remove the following unused code:
  - entry.S: __handle_exception
  - smp.c: smp_num_cpus
  - smp.c: smp_activated
  - smp.c: __cpu_number_map[]
  - smp.c: __cpu_logical_map[]
  - smp.c: bitops_spinlock
  - traps.c: trap_curbuf
  - traps.c: trapbuf[]
  - traps.c: linux_smp_still_initting
  - traps.c: thiscpus_tbr
  - traps.c: thiscpus_mid

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-07-17 21:37:46 -07:00
Jonathan Corbet 2fceef397f Merge commit 'v2.6.26' into bkl-removal 2008-07-14 15:29:34 -06:00
Arnd Bergmann ee30d64e42 sparc-apc: BKL pushdown
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2008-07-02 15:06:25 -06:00
Alexey Dobriyan 399dc43bc2 sparc: switch /proc/led to seq_file
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-06-03 15:21:21 -07:00
Adrian Bunk 88278ca27a sparc: remove CVS keywords
This patch removes the CVS keywords that weren't updated for a long time
from comments.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-20 00:33:44 -07:00
Al Viro f52111b154 [PATCH] take init_files to fs/file.c
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-05-16 17:22:20 -04:00
David S. Miller 94d149c34c sparc: Fix mremap address range validation.
Just like mmap, we need to validate address ranges regardless
of MAP_FIXED.

sparc{,64}_mmap_check()'s flag argument is unused, remove.

Based upon a report and preliminary patch by
Jan Lieskovsky <jlieskov@redhat.com>

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-12 16:33:33 -07:00
Robert Reif 8bf3028ede sparc32: fix rtrap.S typo
Fix compile problem in rtrap.S

arch/sparc/kernel/built-in.o: In function `ret_trap_userwins_ok':
arch/sparc/kernel/rtrap.S:(.text+0x1900): undefined reference to 
`PSR_SYCALL'

Signed-off-by: Robert Reif <reif@earthlink.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-11 18:05:20 -07:00
David S. Miller 28e6103665 sparc: Fix debugger syscall restart interactions.
So, forever, we've had this ptrace_signal_deliver implementation
which tries to handle all of the nasties that can occur when the
debugger looks at a process about to take a signal.  It's meant
to address all of these issues inside of the kernel so that the
debugger need not be mindful of such things.

Problem is, this doesn't work.

The idea was that we should do the syscall restart business first, so
that the debugger captures that state.  Otherwise, if the debugger for
example saves the child's state, makes the child execute something
else, then restores the saved state, we won't handle the syscall
restart properly because we lose the "we're in a syscall" state.

The code here worked for most cases, but if the debugger actually
passes the signal through to the child unaltered, it's possible that
we would do a syscall restart when we shouldn't have.

In particular this breaks the case of debugging a process under a gdb
which is being debugged by yet another gdb.  gdb uses sigsuspend
to wait for SIGCHLD of the inferior, but if gdb itself is being
debugged by a top-level gdb we get a ptrace_stop().  The top-level gdb
does a PTRACE_CONT with SIGCHLD to let the inferior gdb see the
signal.  But ptrace_signal_deliver() assumed the debugger would cancel
out the signal and therefore did a syscall restart, because the return
error was ERESTARTNOHAND.

Fix this by simply making ptrace_signal_deliver() a nop, and providing
a way for the debugger to control system call restarting properly:

1) Report a "in syscall" software bit in regs->{tstate,psr}.
   It is set early on in trap entry to a system call and is fully
   visible to the debugger via ptrace() and regsets.

2) Test this bit right before doing a syscall restart.  We have
   to do a final recheck right after get_signal_to_deliver() in
   case the debugger cleared the bit during ptrace_stop().

3) Clear the bit in trap return so we don't accidently try to set
   that bit in the real register.

As a result we also get a ptrace_{is,clear}_syscall() for sparc32 just
like sparc64 has.

M68K has this same exact bug, and is now the only other user of the
ptrace_signal_deliver hook.  It needs to be fixed in the same exact
way as sparc.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-11 02:07:19 -07:00
David S. Miller 986bef854f sparc: Fix ptrace() detach.
Forever we had a PTRACE_SUNOS_DETACH which was unconditionally
recognized, regardless of the personality of the process.

Unfortunately, this value is what ended up in the GLIBC sys/ptrace.h
header file on sparc as PTRACE_DETACH and PT_DETACH.

So continue to recognize this old value.  Luckily, it doesn't conflict
with anything we actually care about.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-11 01:59:05 -07:00
David S. Miller c07c6053c4 sparc32: Don't twiddle PT_DTRACE in exec.
That bit isn't used on this platform.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-10 00:31:28 -07:00
David S. Miller dc5dc7e6d7 sparc: Fix SA_ONSTACK signal handling.
We need to be more liberal about the alignment of the buffer given to
us by sigaltstack().  The user should not need to be mindful of all of
the alignment constraints we have for the stack frame.

This mirrors how we handle this situation in clone() as well.

Also, we align the stack even in non-SA_ONSTACK cases so that signals
due to bad stack alignment can be delivered properly.  This makes such
errors easier to debug and recover from.

Finally, add the sanity check x86 has to make sure we won't overflow
the signal stack.

This fixes glibc testcases nptl/tst-cancel20.c and
nptl/tst-cancelx20.c

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-07 18:54:05 -07:00
David S. Miller 1e38c126c9 sparc: Fix fork/clone/vfork system call restart.
We clobber %i1 as well as %i0 for these system calls,
because they give two return values.

Therefore, on error, we have to restore %i1 properly
or else the restart explodes since it uses the wrong
arguments.

This fixes glibc's nptl/tst-eintr1.c testcase.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-07 16:21:28 -07:00
David S. Miller 5816339310 sparc: Fix mmap VA span checking.
We should not conditionalize VA range checks on MAP_FIXED.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-07 02:24:28 -07:00
David S. Miller 4a1236ac6e sparc32: Delete prom_stdin and prom_stdout.
They are written, but never used.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 05:22:54 -07:00
David S. Miller 9f2b2a5f68 sparc32: More memory probing consolidation.
The PROM library function prom_meminit() builds a table,
prom_phys_avail[], just so that probe_memory() in
arch/sparc/mm/fault.c can copy it into sp_banks[].

Just have prom_meminit() fill in the sp_banks[] array directly, and
remove duplicated sort() function.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 05:22:53 -07:00
David S. Miller ccc34028d4 sparc32: Kill totally unused memory information tables.
The code in arch/sparc/prom/memory.c computes three tables, the list
of total memory, the list of available memory (total minus what
firmware is using), and the list of firmware taken memory.

Only the available memory list is even used.

Therefore, kill those unused tables and make prom_meminfo() return
just the available memory list.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-05-02 05:22:53 -07:00
Linus Torvalds 7cece14acd Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  sparc64: remove duplicated include
  sparc: Add kgdb support.
  kgdbts: Sparc needs sstep emulation.
  sparc32: Kill smp_message_pass() and related code.
  sparc64: Kill PIL_RESERVED, unused.
  sparc64: Split entry.S up into seperate files.
2008-04-30 08:46:16 -07:00
David S. Miller e2fdd7fd99 sparc: Add kgdb support.
Current limitations:

1) On SMP single stepping has some fundamental issues,
   shared with other sw single-step architectures such
   as mips and arm.

2) On 32-bit sparc we don't support SMP kgdb yet.  That
   requires some reworking of the IPI mechanisms and
   infrastructure on that platform.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-04-29 02:38:50 -07:00
David S. Miller 0a9e9b110c sparc32: Kill smp_message_pass() and related code.
Completely unused, and it just makes the SMP message
passing code on 32-bit sparc look more complex than
it is.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-04-29 01:14:10 -07:00
David S. Miller 5526b7e451 sparc: Remove old style signal frame support.
Back around the same time we were bootstrapping the first 32-bit sparc
Linux kernel with a SunOS userland, we made the signal frame match
that of SunOS.

By the time we even started putting together a native Linux userland
for 32-bit Sparc we realized this layout wasn't sufficient for Linux's
needs.

Therefore we changed the layout, yet kept support for the old style
signal frame layout in there.  The detection mechanism is that we had
sys_sigaction() start passing in a negative signal number to indicate
"new style signal frames please".

Anyways, no binaries exist in the world that use the old stuff.  In
fact, I bet Jakub Jelinek and myself are the only two people who ever
had such binaries to be honest.

So let's get rid of this stuff.

I added an assertion using WARN_ON_ONCE() that makes sure 32-bit
applications are passing in that negative signal number still.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-04-27 02:26:36 -07:00
Adrian Bunk a5c5642798 sparc: cleanup after SunOS binary emulation removal
The following cleanups are now possible:
- arch/sparc/kernel/entry.S:ret_sys_call no longer has to be global
- arch/sparc/kernel/signal.c:sys_sigpause() can be removed

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-04-23 23:32:18 -07:00
Linus Torvalds 8a32272688 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SPARC]: Remove SunOS and Solaris binary support.
2008-04-21 17:20:53 -07:00
David S. Miller ec98c6b9b4 [SPARC]: Remove SunOS and Solaris binary support.
As per Documentation/feature-removal-schedule.txt

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-04-21 15:10:15 -07:00
Jeff Garzik 5dc0742b41 [SPARC] minor irq handler cleanups
- mark timer_interrupt() static

- sparc_floppy_request_irq() prototype should use irq_handler_t

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: David S. Miller <davem@davemloft.net>
2008-04-20 18:43:05 -04:00
Matthew Wilcox 64ac24e738 Generic semaphore implementation
Semaphores are no longer performance-critical, so a generic C
implementation is better for maintainability, debuggability and
extensibility.  Thanks to Peter Zijlstra for fixing the lockdep
warning.  Thanks to Harvey Harrison for pointing out that the
unlikely() was unnecessary.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
2008-04-17 10:42:34 -04:00
Aneesh Kumar K.V 35802c0b2b sparc: Export symbols for ZERO_PAGE usage in modules.
ext4 uses ZERO_PAGE(0) to zero out blocks.  We need to export
different symbols in different arches for the usage of ZERO_PAGE
in modules.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-04-29 08:11:12 -04:00
Christoph Lameter 32b07679b4 sparc: use kbuild.h instead of defining macros in asm-offsets.c
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 08:06:29 -07:00
Benjamin Herrenschmidt b70d3a2c59 iomap: fix 64 bits resources on 32 bits
Almost all implementations of pci_iomap() in the kernel, including the generic
lib/iomap.c one, copies the content of a struct resource into unsigned long's
which will break on 32 bits platforms with 64 bits resources.

This fixes all definitions of pci_iomap() to use resource_size_t.  I also
"fixed" the 64bits arch for consistency.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
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-04-29 08:06:02 -07:00
David S. Miller d786a4a659 [SPARC]: Fix several regset and ptrace bugs.
1) ptrace should pass 'current' to task_user_regset_view()

2) When fetching general registers using a 64-bit view, and
   the target is 32-bit, we have to convert.

3) Skip the whole register window get/set code block if
   the user isn't asking to access anything in there.

   Otherwise we have problems if the user doesn't have
   an address space setup.  Fetching ptrace register is
   still valid at such a time, and ptrace does not try
   to access the register window area of the regset.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-04-09 19:39:25 -07:00
David S. Miller 2f633928cb Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-03-17 23:44:31 -07:00
Al Viro e6f1cebf71 [NET] endianness noise: INADDR_ANY
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-03-17 22:44:53 -07:00
David S. Miller f0e98c387e [SPARC]: Fix link errors with gcc-4.3
Reported by Adrian Bunk.

Just like in changeset a3f9985843
("[SPARC64]: Move kernel unaligned trap handlers into assembler
file.") we have to move the assembler bits into a seperate
asm file because as far as the compiler is concerned
these inline bits we're doing in unaligned.c are unreachable.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-03-03 15:01:05 -08:00
Harvey Harrison 74074dec4f sparc: replace remaining __FUNCTION__ occurances
__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-03-03 11:41:51 -08:00
David S. Miller 7729d74ed5 [SPARC]: Add reboot_command[] extern decl to asm/system.h
Kill off some sparse warnings.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-28 21:53:20 -08:00
David S. Miller c8edc89d24 [SPARC]: Mark linux_sparc_{fpu,chips} static.
Caught by sparse.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-28 21:46:59 -08:00
David S. Miller b80a71860d [SPARC]: Fix build in arch/sparc/kernel/led.c
CC [M]  arch/sparc/kernel/led.o
arch/sparc/kernel/led.c: In function 'led_blink':
arch/sparc/kernel/led.c:35: error: invalid use of undefined type 'struct
timer_list'
arch/sparc/kernel/led.c:35: error: 'jiffies' undeclared (first use in
this function)
arch/sparc/kernel/led.c:35: error: (Each undeclared identifier is
reported only once
arch/sparc/kernel/led.c:35: error: for each function it appears in.)
arch/sparc/kernel/led.c:36: error: 'avenrun' undeclared (first use in
this function)
arch/sparc/kernel/led.c:36: error: 'FSHIFT' undeclared (first use in
this function)
arch/sparc/kernel/led.c:36: error: 'HZ' undeclared (first use in this
function)
arch/sparc/kernel/led.c:37: error: invalid use of undefined type 'struct
timer_list'
arch/sparc/kernel/led.c:39: error: invalid use of undefined type 'struct
timer_list'
arch/sparc/kernel/led.c:40: error: invalid use of undefined type 'struct
timer_list'
arch/sparc/kernel/led.c:42: error: implicit declaration of function
'add_timer'
arch/sparc/kernel/led.c: In function 'led_write_proc':
arch/sparc/kernel/led.c:70: error: implicit declaration of function
'copy_from_user'
arch/sparc/kernel/led.c:84: error: implicit declaration of function
'del_timer_sync'
arch/sparc/kernel/led.c: In function 'led_init':
arch/sparc/kernel/led.c:109: error: implicit declaration of function
'init_timer'
arch/sparc/kernel/led.c:110: error: invalid use of undefined type
'struct timer_list'
make[1]: *** [arch/sparc/kernel/led.o] Error 1

Based upon original patch by Robert Reif.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-24 18:45:09 -08:00
Linus Torvalds b69409279c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SPARC64]: Add regs_return_value().
  [SPARC64]: Kill pcic_present().
  [SPARC]: Kill 'prom_palette'.
  [ATYFB]: Kill 'prom_palette' sparc code.
  [SPARC64]: Kill 'prom_keyboard'.
  [SPARC]: Kill extern decl of 'panic_setup'.
  [SPARC64]: Delete 'boot_flags'.
  [SPARC64]: Kill unused function 'kernel_enter_debugger'.
  [SPARC64] arch/sparc64/kernel/unaligned.c: Use time_* macros
  [SPARC64]: Always register a PROM based early console.
  [SPARC64]: Update defconfig.
  [SPARC64]: Add -mtune=ultrasparc3 if possible.
  [SPARC64]: Remove Makefile code for ancient gcc and binutils.
  [SPARC64]: Remove DEBUG_BOOTMEM.
  [SPARC64]: Use shorter "get_zeroed_page" call.
  [SPARC]: Use shorter form of "get_zeroed_page".
  [SPARC]: video/cg14.c and video/sbuslib.c build fixes
2008-02-19 07:53:28 -08:00
David S. Miller 667bc389c7 [SPARC]: Kill 'prom_palette'.
The idea of this thing is we could save/restore the firmware's
palette when breaking in and out of the firmware prompt.

Only one driver implemented this (atyfb) and it's value is
questionable.  If you're just debugging you don't really
care that the characters end up being purple or whatever.

And we can provide better debugging and firmware command
facilities with minimal in-kernel console I/O drivers.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-18 15:28:16 -08:00
David S. Miller 1d5509aa69 [SPARC]: Kill extern decl of 'panic_setup'.
This was made static in kernel/panic.c a long time ago.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-18 15:17:58 -08:00
Peter Zijlstra aa02cd2d9b xtime_lock vs update_process_times
Commit d3d74453c3 ("hrtimer: fixup the
HRTIMER_CB_IRQSAFE_NO_SOFTIRQ fallback") broke several archs, and since
only Russell bothered to merge the fix, and Greg to ACK his arch, I'm
sending this for merger.

I have confirmation that the Alpha bit results in a booting kernel.
That leaves: blackfin, frv, sh and sparc untested.

The deadlock in question was found by Russell:

  IRQ handle
    -> timer_tick() - xtime seqlock held for write
      -> update_process_times()
        -> run_local_timers()
          -> hrtimer_run_queues()
            -> hrtimer_get_softirq_time() - tries to get a read lock

Now, Thomas assures me the fix is trivial, only do_timer() needs to be
done under the xtime_lock, and update_process_times() can savely be
removed from under it.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Greg Ungerer <gerg@uclinux.org>
CC: Richard Henderson <rth@twiddle.net>
CC: Bryan Wu <bryan.wu@analog.com>
CC: David Howells <dhowells@redhat.com>
CC: Paul Mundt <lethal@linux-sh.org>
CC: William Irwin <wli@holomorphy.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-13 13:29:25 -08:00
Robert P. J. Day b3dd5b8256 [SPARC]: Use shorter form of "get_zeroed_page".
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-12 22:08:55 -08:00
Linus Torvalds bfc1de0c40 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6: (24 commits)
  [SPARC]: Add solaris/sunos binary support to feature removal schedule.
  [SPARC]: Merge asm-sparc{,64}/a.out.h
  [SPARC]: Merge asm-sparc{,64}/fb.h
  [SPARC]: Merge asm-sparc{,64}/errno.h
  [SPARC]: Merge asm-sparc{,64}/emergency-restart.h
  [SPARC]: Merge asm-sparc{,64}/div64.h
  [SPARC]: Merge asm-sparc{,64}/device.h
  [SPARC]: Merge asm-sparc{,64}/current.h
  [SPARC]: Merge asm-sparc{,64}/cputime.h
  [SPARC]: Merge asm-sparc{,64}/cache.h
  [SPARC]: Merge asm-sparc{,64}/byteorder.h
  [SPARC]: Merge asm-sparc{,64}/bugs.h
  [SPARC]: Merge asm-sparc{,64}/bug.h
  [SPARC]: Kill BSD errno translation table and header files.
  [SPARC]: Merge asm-sparc{,64}/bpp.h
  [SPARC]: Merge include/asm-sparc{,64}/auxvec.h
  [SPARC]: Merge include/asm-sparc{,64}/of_device.h
  [SPARC]: Merge include/asm-sparc{,64}/prom.h
  [SPARC]: Remove of_platform_device_create
  [SPARC64]: Add kretprobe support.
  ...
2008-02-09 23:28:26 -08:00
David S. Miller d113fcd9cf [SPARC]: Merge asm-sparc{,64}/cache.h
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-09 04:17:37 -08:00
David S. Miller c79ca3f841 [SPARC]: Kill BSD errno translation table and header files.
Completely unused.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-09 04:00:22 -08:00
Stephen Rothwell 7b98ac24ef [SPARC]: Remove of_platform_device_create
There are no callers of this on the Sparc platforms.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-09 03:49:58 -08:00
Sam Ravnborg ec7748b59e ide: introduce HAVE_IDE
To allow flexible configuration of IDE introduce HAVE_IDE.
All archs except arm, um and s390 unconditionally select it.
For arm the actual configuration determine if IDE is supported.

This is a step towards introducing drivers/Kconfig for arm.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Russell King - ARM Linux <linux@arm.linux.org.uk>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
2008-02-09 10:46:40 +01: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
David Howells 1eb1141123 aout: remove unnecessary inclusions of {asm, linux}/a.out.h
Remove now unnecessary inclusions of {asm,linux}/a.out.h.

[akpm@linux-foundation.org: fix alpha build]
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:30 -08:00
David Howells 7fa3031500 aout: suppress A.OUT library support if !CONFIG_ARCH_SUPPORTS_AOUT
Suppress A.OUT library support if CONFIG_ARCH_SUPPORTS_AOUT is not set.

Not all architectures support the A.OUT binfmt, so the ELF binfmt should not
be permitted to go looking for A.OUT libraries to load in such a case.  Not
only that, but under such conditions A.OUT core dumps are not produced either.

To make this work, this patch also does the following:

 (1) Makes the existence of the contents of linux/a.out.h contingent on
     CONFIG_ARCH_SUPPORTS_AOUT.

 (2) Renames dump_thread() to aout_dump_thread() as it's only called by A.OUT
     core dumping code.

 (3) Moves aout_dump_thread() into asm/a.out-core.h and makes it inline.  This
     is then included only where needed.  This means that this bit of arch
     code will be stored in the appropriate A.OUT binfmt module rather than
     the core kernel.

 (4) Drops A.OUT support for Blackfin (according to Mike Frysinger it's not
     needed) and FRV.

This patch depends on the previous patch to 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.

[jdike@addtoit.com: uml: re-remove accidentally restored code]
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-08 09:22:30 -08:00
David Howells b0b933c08b aout: mark arches that support A.OUT format
Mark arches that support A.OUT format by including the following in their
master Kconfig files:

	config ARCH_SUPPORTS_AOUT
		def_bool y

This should also be set if the arch provides compatibility A.OUT support for
an older arch, for instance x86_64 for i386 or sparc64 for sparc.

I've guessed at which arches don't, based on comments in the code, however I'm
sure that some of the ones I've marked as 'yes' actually should be 'no'.

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:30 -08:00
Linus Torvalds 0afc2edfad Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
  [SPARC32]: Use regsets in arch_ptrace().
  [SPARC64]: Use regsets in arch_ptrace().
  [SPARC32]: Use regsets for ELF core dumping.
  [SPARC64]: Use regsets for ELF core dumping.
  [SPARC64]: Remove unintentional ptrace debugging messages.
  [SPARC]: Move over to arch_ptrace().
  [SPARC]: Remove PTRACE_SUN* handling.
  [SPARC]: Kill DEBUG_PTRACE code.
  [SPARC32]: Add user regset support.
  [SPARC64]: Add user regsets.
  [SPARC64]: Fix booting on non-zero cpu.
2008-02-07 10:21:26 -08:00
Bernhard Walle 72a7fe3967 Introduce flags for reserve_bootmem()
This patchset adds a flags variable to reserve_bootmem() and uses the
BOOTMEM_EXCLUSIVE flag in crashkernel reservation code to detect collisions
between crashkernel area and already used memory.

This patch:

Change the reserve_bootmem() function to accept a new flag BOOTMEM_EXCLUSIVE.
If that flag is set, the function returns with -EBUSY if the memory already
has been reserved in the past.  This is to avoid conflicts.

Because that code runs before SMP initialisation, there's no race condition
inside reserve_bootmem_core().

[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix powerpc build]
Signed-off-by: Bernhard Walle <bwalle@suse.de>
Cc: <linux-arch@vger.kernel.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-07 08:42:25 -08:00
David S. Miller d256eb8db6 [SPARC32]: Use regsets in arch_ptrace().
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-07 05:06:51 -08:00
David S. Miller 9775369ec0 [SPARC]: Move over to arch_ptrace().
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-07 03:00:17 -08:00
David S. Miller 190aa9f60f [SPARC]: Remove PTRACE_SUN* handling.
Supporting SunOS ptrace() is pretty pointless and these
kinds of quirks keep us from being able to share more
code with other platforms.

Signed-off-by: David S. Miller <davem@davemloft.net>
2008-02-07 02:59:22 -08:00