Stack checking extensions

This patch adds:

 - Normal builds are done with -fstack-protector (we want to investigate
using -fstack-protector-strong on gcc4.9 but for now we just use that

 - Build with STACK_CHECK=1 will use -fstack-protector-all and -pg and
will check the stack in mcount

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Add functions to backtrace into a non-text buffer

Separate text translation from capture of the backtrace

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Rename backtrace.c to stack.c and move stack related bits

 ... from util.c to stack.c

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Capture backtraces when measuring stack depth

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Fix backtraces

__builtin_frame_address really wants constants

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Remove useless global include memory.h

It only exposed one function that is local to the hdat stuff

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Add symbolic backtraces and expose skiboot map to Linux

We use a double link technique, doing a first pass with a .o containing
a dummy symbol map, then re-linking with a new .o

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
core/test: Fix timer test case

Commit b54d1a8 broke timer test case.

core/test/run-timer.c: In function ‘main’:
core/test/run-timer.c:52:3: error: too few arguments to function ‘check_timers’
check_timers();
      ^
In file included from core/test/run-timer.c:16:0:
core/test/../timer.c:201:6: note: declared here
void check_timers(bool from_interrupt)
      ^
make: *** [core/test/run-timer] Error 1

This patch fixes above compilation issue.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
opal: Remove machine check interrupt patching in OPAL.

Now that we catch/handle machine check interrupt directly in Linux host
PowerNV kernel, we are not anymore dependent on OPAL firmware to do MCE
handling job for us. The MCE handling code in OPAL has exclusive stack
space (4k size) reserved and remains unused with Linux host not being
dependent on it anymore. Hence, this patch removes the code that allows
machine check interrupt patching in OPAL and reclaims back 4k of stack
space for use of normal stack. For older kernel the patching request
will result into an error.

The subsequent patch will remove the rest of MCE handling code from OPAL.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
opal: Remove MCE handling code.

Removed following:
- Machine check handle and other related routines.
- per-cpu MCE event used to record machine check data
	cpu_thread->mc_event;
- Machine check related definition including mce event structure from
  include/opal.h
- A comment above GET_STACK() #define that warns about runtime modification
  made to GET_STACK macro by MC patching code.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Merge remote-tracking branch 'ltcgit/master'
use $(wildcard ) in test Makefiles

The core/test/ and libc/test/ Makefile.check files both contain:

-include core/test/*.d  (or libc/test/*d)

which is incorrect, since that evaluates literally to a *.d file.
This results in each build trying to find that file, and creating
it when not found (in an incorrect way because of other problems in
the Makefile).

The correct way to specify it is:

-include $(wildcard core/test/*.d)

Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
palmetto: Use the right model of VPD eeprom

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Add Travis configuration

This will allow Travis CI to build the firmware and run the test suite.

Travis build environments are stuck back on 12.04, so we don't have a
powerpc cross compiler as part of the archive. Instead download one from
kernel.org and use that.

The 'make check' tests rely on newer -Wstack-usage flags that are not
present on the old version of gcc shipped with 12.04. Install 4.8 from
the toolchain ppa and set it to be the system default.

The tests also require valgrind, so include that in the VM environment.

Signed-off-by: Joel Stanley <joel@jms.id.au>