Commit graph

311 commits

Author SHA1 Message Date
Gautham R Shenoy 86ef5c9a8e cpu-hotplug: replace lock_cpu_hotplug() with get_online_cpus()
Replace all lock_cpu_hotplug/unlock_cpu_hotplug from the kernel and use
get_online_cpus and put_online_cpus instead as it highlights the
refcount semantics in these operations.

The new API guarantees protection against the cpu-hotplug operation, but
it doesn't guarantee serialized access to any of the local data
structures. Hence the changes needs to be reviewed.

In case of pseries_add_processor/pseries_remove_processor, use
cpu_maps_update_begin()/cpu_maps_update_done() as we're modifying the
cpu_present_map there.

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-01-25 21:08:02 +01:00
Greg Kroah-Hartman d76e15fb20 driver core: make /sys/power a kobject
/sys/power should not be a kset, that's overkill.  This patch renames it
to power_kset and fixes up all usages of it in the tree.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24 20:40:25 -08:00
Greg Kroah-Hartman 79393fc46e kobject: convert pseries/power.c to kobj_attr interface
This makes the code a bit simpler and and gets us one step closer to
deleting the deprecated subsys_attr code.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Manish Ahuja <mahuja@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24 20:40:20 -08:00
Greg Kroah-Hartman 039a5dcd2f kset: convert /sys/power to use kset_create
Dynamically create the kset instead of declaring it statically.  We also
rename power_subsys to power_kset to catch all users of the variable and
we properly export it so that people don't have to guess that it really
is present in the system.

The pseries code is wierd, why is it createing /sys/power if CONFIG_PM
is disabled?  Oh well, stupid big boxes ignoring config options...

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24 20:40:16 -08:00
Greg Kroah-Hartman 3514faca19 kobject: remove struct kobj_type from struct kset
We don't need a "default" ktype for a kset.  We should set this
explicitly every time for each kset.  This change is needed so that we
can make ksets dynamic, and cleans up one of the odd, undocumented
assumption that the kset/kobject/ktype model has.

This patch is based on a lot of help from Kay Sievers.

Nasty bug in the block code was found by Dave Young
<hidave.darkstar@gmail.com>

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Dave Young <hidave.darkstar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-24 20:40:10 -08:00
Paul Mackerras dfbe0d3b6b [POWERPC] Fix boot failure on POWER6
Commit 473980a993 added a call to clear
the SLB shadow buffer before registering it.  Unfortunately this means
that we clear out the entries that slb_initialize has previously set in
there.  On POWER6, the hypervisor uses the SLB shadow buffer when doing
partition switches, and that means that after the next partition switch,
each non-boot CPU has no SLB entries to map the kernel text and data,
which causes it to crash.

This fixes it by reverting most of 473980a9 and instead clearing the
3rd entry explicitly in slb_initialize.  This fixes the problem that
473980a9 was trying to solve, but without breaking POWER6.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-01-15 17:30:58 +11:00
Michael Neuling 473980a993 [POWERPC] Fix CPU hotplug when using the SLB shadow buffer
Before we register the SLB shadow buffer, we need to invalidate the
entries in the buffer, otherwise we can end up stale entries from when
we previously offlined the CPU.

This does this invalidate as well as unregistering the buffer with
PHYP before we offline the cpu.  Tested and fixes crashes seen on
970MP (thanks to tonyb) and POWER5.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2008-01-11 16:33:55 +11:00
Paul Mackerras 8f51506164 Revert "[POWERPC] Fix RTAS os-term usage on kernel panic"
This reverts commit a2b51812a4.

It turns out that this change caused some machines to fail to come
back up when being rebooted, and generated an error in the hypervisor
error log on some machines.  The platform architecture (PAPR) is a
little unclear on exactly when the RTAS ibm,os-term function should be
called.  Until that is clarified I'm reverting this commit.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-12-03 09:39:45 +11:00
Linas Vepstas a2b51812a4 [POWERPC] Fix RTAS os-term usage on kernel panic
The rtas_os_term() routine was being called at the wrong time.
The actual rtas call "os-term" will not ever return, and so
calling it from the panic notifier is too early.  Instead,
call it from the machine_reset() call.

This splits the rtas_os_term() routine into two: one part to capture
the kernel panic message, invoked during the panic notifier, and
another part that is invoked during machine_reset().

Prior to this patch, the os-term call was never being made,
because panic_timeout was always non-zero.  Calling os-term
helps keep the hypervisor happy!  We have to keep the hypervisor
happy to avoid service, dump and error reporting problems.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-11-20 16:10:09 +11:00
Stephen Rothwell 8693208254 [POWERPC] pSeries: make pseries_defconfig minus PCI build again
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-11-19 15:11:30 +11:00
Linas Vepstas 2c84b4076c [POWERPC] EEH: Make sure warning message is printed
Fix old buglet; a warning message should have been printed
when a hardware reset takes too long.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-11-08 14:15:34 +11:00
Linas Vepstas b37ceefe7c [POWERPC] EEH: Avoid crash on null device
Bugfix: avoid crash if there's no PCI device for a given
openfirmware node.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-11-08 14:15:32 +11:00
Linas Vepstas 2a50f144fc [POWERPC] EEH: Drivers that need reset trump others
Bugfix: if a driver controlling one part of a multi-function PCI card
has asked for a reset, honor that request above all others.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-11-08 14:15:32 +11:00
Linas Vepstas 638799b335 [POWERPC] EEH: Clean up comments
Clean up commentary, remove dead code.

Signed-off-by Linas Vepstas <linas@austin.ibm.com>

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-11-08 14:15:32 +11:00
will schmidt aa39be09df [POWERPC] Include udbg.h when using udbg_printf
This fixes the error
	error: implicit declaration of function "udbg_printf"

We have a few spots where we reference udbg_printf() without #including
udbg.h.  These are within #ifdef DEBUG blocks, so unnoticed until we do
a #define DEBUG or #define DEBUG_LOW nearby.

Signed-off-by: Will Schmidt <will_schmidt@vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-11-08 14:15:31 +11:00
Michael Ellerman 1db3e890ae [POWERPC] Read back MSI message in rtas_setup_msi_irqs() so restore works
There are plans afoot to use pci_restore_msi_state() to restore MSI
state after a device reset.  In order for this to work for the RTAS MSI
backend, we need to read back the MSI message from config space after
it has been setup by firmware.

This should be sufficient for restoring the MSI state after a device
reset, however we will need to revisit this for suspend to disk if that
is ever implemented on pseries.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-11-08 14:15:29 +11:00
Serge E. Hallyn b460cbc581 pid namespaces: define is_global_init() and is_container_init()
is_init() is an ambiguous name for the pid==1 check.  Split it into
is_global_init() and is_container_init().

A cgroup init has it's tsk->pid == 1.

A global init also has it's tsk->pid == 1 and it's active pid namespace
is the init_pid_ns.  But rather than check the active pid namespace,
compare the task structure with 'init_pid_ns.child_reaper', which is
initialized during boot to the /sbin/init process and never changes.

Changelog:

	2.6.22-rc4-mm2-pidns1:
	- Use 'init_pid_ns.child_reaper' to determine if a given task is the
	  global init (/sbin/init) process. This would improve performance
	  and remove dependence on the task_pid().

	2.6.21-mm2-pidns2:

	- [Sukadev Bhattiprolu] Changed is_container_init() calls in {powerpc,
	  ppc,avr32}/traps.c for the _exception() call to is_global_init().
	  This way, we kill only the cgroup if the cgroup's init has a
	  bug rather than force a kernel panic.

[akpm@linux-foundation.org: fix comment]
[sukadev@us.ibm.com: Use is_global_init() in arch/m32r/mm/fault.c]
[bunk@stusta.de: kernel/pid.c: remove unused exports]
[sukadev@us.ibm.com: Fix capability.c to work with threaded init]
Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@us.ibm.com>
Acked-by: Pavel Emelianov <xemul@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: Dave Hansen <haveblue@us.ibm.com>
Cc: Herbert Poetzel <herbert@13thfloor.at>
Cc: Kirill Korotaev <dev@sw.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-19 11:53:37 -07:00
Paul Mackerras 1189be6508 [POWERPC] Use 1TB segments
This makes the kernel use 1TB segments for all kernel mappings and for
user addresses of 1TB and above, on machines which support them
(currently POWER5+, POWER6 and PA6T).

We detect that the machine supports 1TB segments by looking at the
ibm,processor-segment-sizes property in the device tree.

We don't currently use 1TB segments for user addresses < 1T, since
that would effectively prevent 32-bit processes from using huge pages
unless we also had a way to revert to using 256MB segments.  That
would be possible but would involve extra complications (such as
keeping track of which segment size was used when HPTEs were inserted)
and is not addressed here.

Parts of this patch were originally written by Ben Herrenschmidt.

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-12 14:05:17 +10:00
Olof Johansson 64f2758514 [POWERPC] Don't enable cpu hotplug on pSeries machines with MPIC
Don't allow cpu hotplug on systems lacking XICS interrupt controller
(i.e. with an MPIC interrupt controller), since the current pSeries
platform code is hardcoded for XICS.

This works around the bug reported by Paul Mackerras where the
disable_nonboot_cpus() call recently added to the shutdown path will
cause an oops on older pSeries machines.

Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-11 21:06:06 +10:00
Grant Likely 745e102775 [POWERPC] Platforms shouldn't mess with ROOT_DEV
There is no good reason for board platform code to mess with the
ROOT_DEV.  Remove it from all in-tree platforms except powermac.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-11 20:40:43 +10:00
Paul Mackerras 70f227d884 Merge branch 'linux-2.6' into for-2.6.24 2007-10-03 15:33:17 +10:00
Tony Breeds a0c7ce9c87 [POWERPC] Fix panic in RTAS code
Some older pSeries machines were panicking in pSeries_log_error
because it was getting called before it was ready.  This is a result
of commit "[POWERPC] pseries: Fix jumbled no_logging flag."
(79c0108d1b).

This fixes it by explicitly enabling RTAS error logging when it has
been initialized, and also makes the code clearer by renaming the
"no_more_logging" variable to "logging_enabled".

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-03 15:31:37 +10:00
Michael Ellerman d385366a9b [POWERPC] Simplify rtas_change_msi() error semantics
Currently rtas_change_msi() returns either the error code from RTAS, or if
the RTAS call succeeded the number of irqs that were configured by RTAS.
This makes checking the return value more complicated than it needs to be.

Instead, have rtas_change_msi() check that the number of irqs configured by
RTAS is equal to what we requested - and return an error otherwise. This makes
the return semantics match the usual 0 for success, something else for error.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-03 09:11:39 +10:00
Michael Ellerman fcbe8090a0 [POWERPC] Simplify error logic in rtas_setup_msi_irqs()
rtas_setup_msi_irqs() doesn't need to call teardown() itself, the
generic code will do this for us as long as we return a non-zero
value.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-03 09:11:35 +10:00
Linas Vepstas a7fb7ea76e [POWERPC] pseries: device node status can be "ok" or "okay"
It seems that some versions of firmware will report a device
node status as the string "okay". As we are not expecting this
string, the device node will be ignored by the EEH subsystem.
Which means EEH will not be enabled.

When EEH is not enabled, PCI errors will be converted into
Machine Check exceptions, and we'll have a very unhappy system.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-02 22:09:56 +10:00
Anton Blanchard e48395f175 [POWERPC] Fix xics set_affinity code
On a POWER6 machine running 2.6.23-rc8 I sometimes see the following error:

xics_set_affinity: No online cpus in the mask 00000000,00000000,00000000,00000001 for irq 20

In a desperate attempt to get a changelog entry in 2.6.23, I took a look
into it.

It turns out we are passing a real and not a virtual irq into
get_irq_server.  This works for the case where hwirq < NR_IRQS and we
set virq = hwirq.  In my case however hwirq = 590082 and we try and
access irq_desc[590082], slightly past the end at 512 entries.

Lucky we ship lots of memory with our machines.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-10-02 11:48:14 +10:00
Michael Ellerman 52964f87c6 [POWERPC] Add an optional device_node pointer to the irq_host
The majority of irq_host implementations (3 out of 4) are associated
with a device_node, and need to stash it somewhere. Rather than having
it somewhere different for each host, add an optional device_node pointer
to the irq_host structure.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-09-14 01:33:20 +10:00
Linas Vepstas 09a54101e1 [POWERPC] pseries: Remove dead EEH video code
Remove dead code, and a misleading comment about EEH checking
for video devices.  The removed code is a left-over from the
olden days where there was concern over how video devices
worked in Linux. We are never going to go that way again,
so kill this.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/eeh.c |   17 -----------------
 1 file changed, 17 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:54 +10:00
Linas Vepstas 0f2342c85d [POWERPC] pseries: Eliminate global error_log_cnt variable
Eliminate the use of error_log_cnt as a global var shared across
different directories.  Pass it as a parameter instead.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----

Respin of earlier patch, with the CONFIG_PSERIES junk removed from the
header file.

 arch/powerpc/kernel/nvram_64.c         |   10 +++++-----
 arch/powerpc/platforms/pseries/rtasd.c |    7 ++++---
 include/asm-powerpc/nvram.h            |    6 ++++--
 3 files changed, 13 insertions(+), 10 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:52 +10:00
Linas Vepstas 79c0108d1b [POWERPC] pseries: Fix jumbled no_logging flag
Get rid of the jumbled usage of the no_logging flag. Its use
spans several directories, and is incorrectly/misleadingly
documented. Instead, two changes:
1) nvram will accept error log as soon as its ready.
2) logging to nvram stops on the first fatal error reported.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/kernel/nvram_64.c         |    8 --------
 arch/powerpc/platforms/pseries/rtasd.c |   14 ++++++--------
 2 files changed, 6 insertions(+), 16 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:52 +10:00
Linas Vepstas 4511dad42a [POWERPC] pseries: Simplify rtasd initialization
Simplify rtasd initialization code; this also fixes a buglet,
where the /proc entries weren't being cleaned up in case of
failure.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/rtasd.c |   53 +++++++++++----------------------
 1 file changed, 19 insertions(+), 34 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:52 +10:00
Linas Vepstas ba28cc0931 [POWERPC] pseries: Use rtas_token instead of hand-rolled code
The rtas_token() call does the same thing as this hand-rolled code.
This makes the code easier to read.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/rtasd.c |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:52 +10:00
Linas Vepstas a4fc3a3cea [POWERPC] pseries: Avoid excess rtas_token calls
We don't need to look up the rtas event token once per
cpu per second.  This avoids some misc device-tree lookups
and string ops and so provides some minor performance
improvement.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
Revised commit-log message.

 arch/powerpc/platforms/pseries/rtasd.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:52 +10:00
Jesper Juhl 9420dc65ff [POWERPC] Clean out a bunch of duplicate includes
This removes several duplicate includes from arch/powerpc/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:51 +10:00
Linas Vepstas 0b9369f493 [POWERPC] EEH: Dump PCI bridge status on event
Gather bridge-specific data on EEH events.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
----
 arch/powerpc/platforms/pseries/eeh.c |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:50 +10:00
Linas Vepstas 093eda3ce5 [POWERPC] EEH: Fix PCI bridge handling bug
The EEH code needs to ignore PCI bridges; sort-of.  It was ignoring
them in the wrong place, and thus failing to set up the
PCI_DN(dn)->pcidev pointer.  Imprudent dereferencing of this pointer
would lead to a crash on cards with bridges.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/eeh_cache.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:50 +10:00
Linas Vepstas 12588da7cb [POWERPC] EEH: Tweak printk message
Print return code to print message.  Also fix whitespace.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/eeh.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-17 11:01:50 +10:00
Michael Neuling ca8ffc974d [POWERPC] Fix future firmware feature fixups function failure
Move firmware feature initialisation from pSeries_init_early to the
earlier pSeries_probe_hypertas so they are initialised before firmware
feature fixups are applied.

Currently firmware feature sections are only used for iSeries which
initialises the these features much earlier.  This is a bug in waiting
on pSeries.

Also adds some whitespace fixups.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-07-22 21:30:58 +10:00
Linus Torvalds 489de30259 Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (209 commits)
  [POWERPC] Create add_rtc() function to enable the RTC CMOS driver
  [POWERPC] Add H_ILLAN_ATTRIBUTES hcall number
  [POWERPC] xilinxfb: Parameterize xilinxfb platform device registration
  [POWERPC] Oprofile support for Power 5++
  [POWERPC] Enable arbitary speed tty ioctls and split input/output speed
  [POWERPC] Make drivers/char/hvc_console.c:khvcd() static
  [POWERPC] Remove dead code for preventing pread() and pwrite() calls
  [POWERPC] Remove unnecessary #undef printk from prom.c
  [POWERPC] Fix typo in Ebony default DTS
  [POWERPC] Check for NULL ppc_md.init_IRQ() before calling
  [POWERPC] Remove extra return statement
  [POWERPC] pasemi: Don't auto-select CONFIG_EMBEDDED
  [POWERPC] pasemi: Rename platform
  [POWERPC] arch/powerpc/kernel/sysfs.c: Move NUMA exports
  [POWERPC] Add __read_mostly support for powerpc
  [POWERPC] Modify sched_clock() to make CONFIG_PRINTK_TIME more sane
  [POWERPC] Create a dummy zImage if no valid platform has been selected
  [POWERPC] PS3: Bootwrapper support.
  [POWERPC] powermac i2c: Use mutex
  [POWERPC] Schedule removal of arch/ppc
  ...

Fixed up conflicts manually in:

	Documentation/feature-removal-schedule.txt
	arch/powerpc/kernel/pci_32.c
	arch/powerpc/kernel/pci_64.c
	include/asm-powerpc/pci.h

and asked the powerpc people to double-check the result..
2007-07-16 17:58:08 -07:00
Al Viro 0e81c666db the wrong variable checked after request_irq()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-15 16:40:51 -07:00
Michael Ellerman d3b814bb1e [POWERPC] Generalise device_node flag interface
The struct device_node currently has a _flags variable, although
it's only used for one flag - OF_DYNAMIC.  Generalise the flag
accessors so we can use them with other flags in future.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-07-10 21:53:46 +10:00
Sachin P. Sant b7abc5c53e [POWERPC] Fix Kexec/Kdump for power6
On Power machines supporting VRMA, Kexec/Kdump does not work.
VRMA (virtual real-mode area) means that accesses with IR/DR = 0
(i.e. the MMU "off") actually still go through the hash table,
using entries put there by the hypervisor.

This means that when we clear out the hash table on kexec, we need to
make sure these entries are left untouched.

This also adds plpar_pte_read_raw() on the lines of
plpar_pte_remove_raw().

Signed-off-by : Sachin Sant <sachinp@in.ibm.com>
Signed-off-by : Mohan Kumar M <mohan@in.ibm.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Olof Johansson <olof@lixom.net>

Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-25 17:03:33 +10:00
Mohan Kumar M 7ccb4a6624 [POWERPC] Fix interrupt distribution in ppc970
In some of the PPC970 based systems, interrupt would be distributed to
offline cpus also even when booted with "maxcpus=1".  So check whether
cpu online map and cpu present map are equal or not.  If they are equal
default_distrib_server is used as interrupt server otherwise boot cpu
(default_server) used as interrupt server.

In addition to this, if an interrupt is assigned to a specific cpu (ie
smp affinity) and if that cpu is not online, the earlier code used to
return the default_distrib_server as interrupt server.  This
introduces an additional parameter to the get_irq function, called
strict_check.  Based on this parameter, if the cpu is not online
either default_distrib_server or -1 is returned.

Signed-off-by: Mohan Kumar M <mohan@in.ibm.com>
Cc: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-25 17:03:31 +10:00
Jake Moilanen d8c391a559 [POWERPC] Donate idle CPU cycles on dedicated partitions
A Power6 can give up CPU cycles on a dedicated CPU (as opposed to a
shared CPU) to other shared processors if the administrator asks for it
(via the HMC).

This enables that to work properly on P6.

This just involves setting a bit in the CAS structure as well as the
VPA.  To donate cycles, a CPU has to have all SMT threads idle and
have the donate bit set in the VPA.  Then call H_CEDE.

The reason why shared processors just aren't used is because dedicated
CPUs are guaranteed an actual processor, yet the system is still able to
increase the capacity of the shared CPU pool.

Also rename the VPA's cpuctls_task_attrs field to a more accurate name.

Signed-off-by: Jake Moilanen <moilanen@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-14 22:29:58 +10:00
Benjamin Herrenschmidt 3d5134ee83 [POWERPC] Rewrite IO allocation & mapping on powerpc64
This rewrites pretty much from scratch the handling of MMIO and PIO
space allocations on powerpc64.  The main goals are:

 - Get rid of imalloc and use more common code where possible
 - Simplify the current mess so that PIO space is allocated and
   mapped in a single place for PCI bridges
 - Handle allocation constraints of PIO for all bridges including
   hot plugged ones within the 2GB space reserved for IO ports,
   so that devices on hotplugged busses will now work with drivers
   that assume IO ports fit in an int.
 - Cleanup and separate tracking of the ISA space in the reserved
   low 64K of IO space. No ISA -> Nothing mapped there.

I booted a cell blade with IDE on PIO and MMIO and a dual G5 so
far, that's it :-)

With this patch, all allocations are done using the code in
mm/vmalloc.c, though we use the low level __get_vm_area with
explicit start/stop constraints in order to manage separate
areas for vmalloc/vmap, ioremap, and PCI IOs.

This greatly simplifies a lot of things, as you can see in the
diffstat of that patch :-)

A new pair of functions pcibios_map/unmap_io_space() now replace
all of the previous code that used to manipulate PCI IOs space.
The allocation is done at mapping time, which is now called from
scan_phb's, just before the devices are probed (instead of after,
which is by itself a bug fix). The only other caller is the PCI
hotplug code for hot adding PCI-PCI bridges (slots).

imalloc is gone, as is the "sub-allocation" thing, but I do beleive
that hotplug should still work in the sense that the space allocation
is always done by the PHB, but if you unmap a child bus of this PHB
(which seems to be possible), then the code should properly tear
down all the HPTE mappings for that area of the PHB allocated IO space.

I now always reserve the first 64K of IO space for the bridge with
the ISA bus on it. I have moved the code for tracking ISA in a separate
file which should also make it smarter if we ever are capable of
hot unplugging or re-plugging an ISA bridge.

This should have a side effect on platforms like powermac where VGA IOs
will no longer work. This is done on purpose though as they would have
worked semi-randomly before. The idea at this point is to isolate drivers
that might need to access those and fix them by providing a proper
function to obtain an offset to the legacy IOs of a given bus.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-14 22:29:56 +10:00
Linas Vepstas 3c8c90ab88 [POWERPC] Tweak EEH copyright info
Twiddle the copyright notices. Per current guidelines, the use
of the (C) or (c) in source code is deprecated.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/eeh.c        |    6 +++++-
 arch/powerpc/platforms/pseries/eeh_cache.c  |    3 ++-
 arch/powerpc/platforms/pseries/eeh_driver.c |    6 +++---
 3 files changed, 10 insertions(+), 5 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-14 22:29:56 +10:00
Linas Vepstas 42253a68a8 [POWERPC] Remove dead EEH code
Remove some dead code.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/eeh.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-14 22:29:55 +10:00
Linas Vepstas 858955bd57 [POWERPC] Show EEH per-device false positives
Track and report the number of times we read an all-1s value (0xff,
0xffff or 0xffffffff) from each device which is valid data, not
indicating EEH isolation.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/eeh.c       |    5 +++++
 arch/powerpc/platforms/pseries/eeh_sysfs.c |    3 +++
 include/asm-powerpc/pci-bridge.h           |    1 +
 3 files changed, 9 insertions(+)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-14 22:29:55 +10:00
Linas Vepstas e1d04c9769 [POWERPC] Add EEH sysfs blinkenlights
Add sysfs blinkenlights for EEH statistics.  Shuffle the
eeh_add_device_tree() call so that it appears in the correct
sequence.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 arch/powerpc/platforms/pseries/Makefile    |    2
 arch/powerpc/platforms/pseries/eeh.c       |    4 +
 arch/powerpc/platforms/pseries/eeh_cache.c |    2
 arch/powerpc/platforms/pseries/eeh_sysfs.c |   84 +++++++++++++++++++++++++++++
 arch/powerpc/platforms/pseries/pci_dlpar.c |    7 +-
 include/asm-powerpc/ppc-pci.h              |    3 +
 6 files changed, 98 insertions(+), 4 deletions(-)
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-14 22:29:55 +10:00
Michael Neuling 66b30922c8 [POWERPC] Fix compile warning in pseries xics code
In 616883df78 request_irq was marked as
__must_check so we must... er... check it.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-06-02 21:01:56 +10:00