aboutsummaryrefslogtreecommitdiff
path: root/asm
AgeCommit message (Collapse)AuthorFilesLines
2017-03-09asm: Add POWER9 case to init_shared_sprsBenjamin Herrenschmidt1-0/+24
For now, setup the HID and HMEER. We'll add more as we get good default values from HW. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-09asm: Don't try to set LPCR:LPES1 on P8 and P9Benjamin Herrenschmidt1-2/+28
The bit doesn't exist Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-09asm: Fix setting of LPCR:DPFDBenjamin Herrenschmidt1-8/+2
We have code to set DPFD to 4 in init_shared_sprs, from the original commit, based on recommendations from HW. However, we immediately override this in init_replicated_sprs with the value 7. So let's remove the former and update the latter to set the value to 4. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-02-06Initial support for the ELFv2 ABINicholas Piggin1-0/+1
Provide an experimental option to compile using ELFv2 ABI even on big endian builds. ELFv2 + BE is not officially supported by the toolchain, but it works quite well. It may be useful as a small step toward a little-endian build. This saves about 200kB of text/data. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-01-16head: add new OPAL entry points to the NACAOliver O'Halloran1-1/+4
The NACA now incorporates the entry points for the primary and secondary threads. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-12-20Stop using 3-operand cmp[l][i] for latest binutilsAlexey Kardashevskiy1-2/+2
Since a5721ba270, binutils does not support 3-operand cmp[l][i]. This adds (previously optional) parameter L. Hre is the binutils commit: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=a5721ba270ddf860e0e5a45bba456214e8eac2be;hp=b82317dd347991288e4cca4772e951c672fca8cc Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-02mambo: Convert RTC read from asm to CMichael Neuling1-8/+0
Also moves some code around to ensure things are defined before they are used. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-02mambo: Convert console read/write from asm to CMichael Neuling1-18/+0
Also changes the function name: mambo_read/write() -> mambo_console_read/write() Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-02mambo: Convert sim exit from asm to CMichael Neuling1-6/+0
Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-17Fast reboot for P8Benjamin Herrenschmidt1-61/+61
This is an experimental patch that implements "Fast reboot" on P8 machines. The basic idea is that when the OS calls OPAL reboot, we gather all the threads in the system using a combination of patching the reset vector and soft-resetting them, then cleanup a few bits of hardware (we do re-probe PCIe for example), and reload & restart the bootloader. For Trusted Boot, this means we *add* measurements to the TPM, so you will get *different* PCR values as compared to a full IPL. This makes sense as if you want to be sure you are running something known then, well, do a full IPL as soft reset should never be trusted to clear any malicious code. This is very experimental and needs a lot of testing and also auditing code for other bits of HW that might need to be cleaned up. BenH TODO: I also need to check if we are properly PERST'ing PCI devices. This is partially based on old code I had to do that on P7. I only support it on P8 though as there are issues with the PSI interrupts on P7 that cannot be reliably solved. Even though this should be considered somewhat experimental, we've had a lot of success on a variety of machines. Dozens/hundreds of reboots across Tuleta, Garrison and Habanero. Currently, we've hidden it behind a NVRAM config option, which *is* liable to change in the future (to ensure that only those who know what they're doing enable it) You can enable the experimental support via nvram option: nvram -p ibm,skiboot --update-config experimental-fast-reset=feeling-lucky Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [stewart@linux.vnet.ibm.com: hide behind nvram option, include Mambo fixes from Mikey] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-05asm: add rom_entry.S to Makefile.incClaudio Carvalho1-1/+1
Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-05asm/rom_entry.S: fix parameters syntaxClaudio Carvalho1-17/+18
This fixes the syntax of the parameters in rom_entry.S. Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-10-05asm: add Hostboot rom_entry.SClaudio Carvalho1-0/+51
This adds the Hostboot rom_entry.S used to jump into the verification code copied to RAM. https://github.com/open-power/hostboot/blob/master/src/usr/secureboot/base/rom_entry.S Signed-off-by: Claudio Carvalho <cclaudio@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-09-27core/init: remove master_cpu parameterOliver O'Halloran1-5/+0
master_cpu is used to determine the ChipTOD master if no ChipTOD information is available in the HDAT. However, it is set to zero at every skiboot entry point (fdt_entry, the 0x180 FSP entry and opal_boot_trampoline) and is otherwise unused. This patch removes this passing around and uses the boot CPU PIR to find the ChipTOD master rather than zero. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-22Rename rvwinkle_restore to reset_wakeupBenjamin Herrenschmidt1-2/+2
Make it clearer that it's suitable for all forms of wakeup from a reset handler. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-22slw: Move SPR setup calls away from assemblyBenjamin Herrenschmidt1-9/+0
Move them to the C code so that rvwinkle_restore() is more generic and suitable for use for nap mode wakeup as well Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-22Rename rvwinkle patch to reset patch and install at bootBenjamin Herrenschmidt1-5/+5
The patch code itself is unchanged (for now...). Install it during boot so we will be able to use power management instructions. We can't just have a proper exception code built at 0x100 as this is otherwise one of our entry points. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-22Rename enter_rvwinkle to enter_pm_stateBenjamin Herrenschmidt1-12/+29
And add an argument to specify whether to enter nap or rvwinkle Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-22main: Copy all exception vectors downBenjamin Herrenschmidt1-0/+5
If we aren't loaded at 0 before relocation, we have no exception handlers. This is annoying when debugging, but will be deadly when we start using NAP mode which wakes up via the system reset interrupt at 0x100. So instead, let's copy the whole vectors block down. We are careful to avoid 0..0x100 since that contains the boot flags which are still "hot" as secondaries might still be entering skiboot. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-18head: Whitespace fixesBenjamin Herrenschmidt1-5/+5
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-11head.S: document opal_nacaOliver O'Halloran1-3/+4
On P7 machines OPAL can be loaded as a replacement for PHYP or in an OPAL specific mode. In OPAL mode 0x0 contains a pointer to the OPAL specific variant of the NACA which defines the entrypoint to OPAL, etc. Later machines use the same load method for for PHYP and OPAL and do not need the OPAL specific NACA, but this needs to be kept around for backwards compatibility. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-08asm: Fix backtrace for unexpected exceptionMichael Neuling1-1/+0
If we take an unknown exception at boot time we attempt to put the exception vector in the back trace, The result looks like this (when we take an 0x700): S: 0000000031e838a0 R: 000000003001365c .backtrace+0x38 S: 0000000031e83930 R: 00000000300186cc ._abort+0x4c S: 0000000031e839b0 R: 0000000030023a78 .exception_entry+0x114 S: 0000000031e83a40 R: 0000000000001f04 * +0x1f04 S: 0000000031e83c10 R: 0000000000000700 * +0x700 S: 0000000031e83e30 R: 0000000030014444 .main_cpu_entry+0x444 S: 0000000031e83f00 R: 000000003000259c boot_entry+0x19c We overwrite link address in the current stack frame with the exception vector (ie. 0x700 in the above example). Unfortunately this overrides the location that caused the exception, which is much more useful information in debugging the problem. This patch removes the writing link register in the current stack frame, so the back trace now looks like this: S: 0000000031da38a0 R: 000000003001365c .backtrace+0x38 S: 0000000031da3930 R: 00000000300186cc ._abort+0x4c S: 0000000031da39b0 R: 0000000030023a78 .exception_entry+0x114 S: 0000000031da3a40 R: 0000000000001f00 * +0x1f00 S: 0000000031da3c10 R: 00000000300323f8 .psi_init+0x1f4 S: 0000000031da3e30 R: 0000000030014444 .main_cpu_entry+0x444 S: 0000000031da3f00 R: 000000003000259c boot_entry+0x19c This loses the exception vector from the back trace, but this information is already available in the exception dump just above it Suggestion by benh. Signed-off-by: Michael Neuling <mikey@neuling.org> Acked-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-07-13head: Update list of exception stubsBenjamin Herrenschmidt1-0/+3
Some were missing Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-05-10Add base POWER9 supportMichael Neuling1-0/+2
Add PVR detection, chip id and other misc bits for POWER9. POWER9 changes the location of the HILE and attn enable bits in the HID0 register, so add these definitions also. Signed-off-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: Fix Numbus typo, hdata_to_dt build fixes] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-05-10Make trigger_attn() enable attn alsoMichael Neuling1-2/+2
This changes trigger_attn() to also enable attn via HID0, so callers don't have to do it themselves. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-04-01hdata: Enable SPIRA-HVasant Hegde1-1/+1
Update the SPIRA-H pointer in the NACA so that the FSP can build and pass the SPIRA-S structure to OPAL instead of the legacy SPIRA. Older systems (which does not support SPIRA-H) ignores SPIRA-H pointer and continue to pass legacy SPIRA. "spira" is a global structure and referred everywhere inside hdata dir. Once we enable SPIRA-H we get data in SPIRA-S area, not in legacy spira. Hence fixup spira structure, so that we don't break building device tree. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-03-07asm/head.S: fix hang in multi-threaded mamboOliver O'Halloran1-1/+9
In very early boot, skiboot places secondary threads in holding loop until the primary thread has finished relocating skiboot. The secondary threads wait until a flag at INITAL_OFFSET + offsetof(boot_flag) is set to one before continuing. After relocating the skiboot image and applying ELF relocations the sets this flag and continues booting. To avoid having to copy skiboot at runtime within the simulation e605691e introduced a change to have the skiboot.tcl mambo script load skiboot at it's preferred location of 0x30000000 rather than 0x00000000. Unfortunately, the relocation code path is also responsible for saving the inital offset pointer (into r15). When not taken this results in the main thread writing to r15 + offsetof(boot_flag) instead, which leaves the secondary threads stuck waiting for boot_flag and the main thread stuck when trying to call-in the secondary threads during CPU initialisation. This patch fixes the bug by saving the inital offset before checking if relocation is necessary and adds a few comments to better document the relocation process. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-08-13Add prototype in asm-offsets to silence clangJoel Stanley1-0/+2
asm/asm-offsets.c:31:5: error: no previous prototype for function 'main' [-Werror,-Wmissing-prototypes] int main(void) Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-06-18Merge branch 'stable'Stewart Smith1-0/+3
2015-06-18Set proper value for RPR registerskiboot-5.0.4Benjamin Herrenschmidt1-0/+3
The value was provided by Dave Larson and is what pHyp uses Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-27Add Mambo platformStewart Smith1-0/+8
By adding an explicit mambo platform we can do tricks like a fake NVRAM, actually get RTC from mambo and generally be a bit better in a simulator Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-15Make relocate() return specific error as to what went wrongStewart Smith1-1/+1
Useful in debugging odd problems, such as skiboot > 1MB. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-13Clarify documentation on OPAL parameters (up to 8), fix opal_entryStewart Smith1-3/+1
OpenPower ABI mentions (2.2.1.1 Register Roles) that r11 is not used for parameter passing, and again in 2.2.3 (Parameter Passing in Registers) that only 8 registers are available, with the rest spilling to stack. Incorrectly, we had documented that we use r11 for a 9th parameter and we were storing and loading r11 as part of OPAL_TRACE_ENTRY. Github-issue: https://github.com/open-power/skiboot/issues/12 Reported-by: Andrei Warkentin <andrey.warkentin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> Reviewed-by: Andrei Warkentin <andrey.warkentin@gmail.com>
2015-04-09Add Naples chip supportBenjamin Herrenschmidt1-0/+4
This adds the PVR and CFAM ID for the Naples chip. Otherwise treated as a Venice. This doesn't add the definitions for the new PHB revision yet Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-04-01Move contents of opal.h to opal-api.hMichael Ellerman1-1/+1
Move the contents of opal.h, which is the definition of the OPAL API shared with Linux, into opal-api.h. Recreate opal.h, containing just the include of types.h as well as including opal-api.h and opal-internal.h. We can also remove the #ifdef SKIBOOT, because opal.h is no longer shared with Linux. This gets us to an opal-api.h that is purely a superset of Linux's opal-api.h, ie. the only differences are things that are new in skiboot and haven't yet been added to Linux. Finally update head.S to only include opal-api.h, which is all it needs, and avoids the need for ASSEMBLY guards in opal.h. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-04-01core: Add support for cec_power_down() on mamboMichael Ellerman1-0/+5
Currently when running on mambo OPAL_CEC_POWER_DOWN doesn't work, the simulator keeps running. We can use the magic mambo support instruction with the right opcode to ask mambo to stop the simulation. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-31exceptions: Catch exceptions at boot timeBenjamin Herrenschmidt2-17/+76
And print some informations about GPR state, backtrace, etc... Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-03-31exceptions: Remove deprecated exception patching stuffBenjamin Herrenschmidt1-125/+0
Linux no longer calls it, it never worked on LE and generally speaking never really did anything useful anyway. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-18replace infinite loop on relocation failure with attnStewart Smith1-1/+1
Aids in debugging relocation failure as you get an immediate error. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-01Add tweaks to work in Mambo simulatorBenjamin Herrenschmidt1-0/+19
Mambo doesn't implement various things such as PBA SCOMs, LPC, ChipTOD, etc... It also provides a special console hook. This adds detection of Mambo via the /mambo node, and enables us to boot all the way to Linux. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-11-22opal: Remove MCE handling code.Mahesh Salgaonkar1-5/+0
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>
2014-11-18Add symbolic backtraces and expose skiboot map to LinuxBenjamin Herrenschmidt2-0/+23
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>
2014-11-18Capture backtraces when measuring stack depthBenjamin Herrenschmidt2-2/+4
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-11-17Stack checking extensionsBenjamin Herrenschmidt3-1/+20
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>
2014-11-17Quote built-in kernel path from MakefileBenjamin Herrenschmidt1-5/+1
Otherwise, if your path contains something like "linux-foo" then the "linux" part gets replaced by the preprocessor due to stupid built-ins. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-24irq/occ/opal: Add self-sent dummy interruptBenjamin Herrenschmidt2-0/+4
This makes OPAL use the OCC interrupt facility to send itself an interrupt whenever the OPAL event bit is set as a result of an OPAL call that wasn't itself opal_handle_interrupt() or opal_handle_hmi() (both of which we know the OS will already deal with appropriately). This ensures that OPAL event changes are notified to Linux via its interrupt path which is necessary for it to properly broadcast the state change to its various clients. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-07-02Initial commit of Open Source releaseBenjamin Herrenschmidt6-0/+1204
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>