summaryrefslogtreecommitdiffstats
path: root/core
Commit message (Collapse)AuthorAgeFilesLines
...
* cpu: Add cpu_idle() which we call when waiting for a jobBenjamin Herrenschmidt2016-08-222-16/+22
| | | | | | | For now a simple generic implementation using cpu_relax() Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu: Add cpu_check_jobs()Benjamin Herrenschmidt2016-08-221-2/+6
| | | | | | | | Wrapper around list_empty_nocheck() to see if there's any job pending on a given CPU Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu: Remove unused cpu_free_job()Benjamin Herrenschmidt2016-08-221-9/+0
| | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* interrupts: Ack/fetch interrupts in reset_cpu_icp()Benjamin Herrenschmidt2016-08-221-1/+4
| | | | | | | | | | This does a fetch from the XIRR, thus acking any pending interrupt before we clear IPIs and EOI. This mimmics a real sequence better and works around problems on some sims (and possibly hardware) where just raising MFRR won't lower the IRQ line to the CPU. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* interrupts: Rename icp_prep_for_rvwinkle to icp_prep_for_pmBenjamin Herrenschmidt2016-08-221-3/+3
| | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Rename rvwinkle patch to reset patch and install at bootBenjamin Herrenschmidt2016-08-221-0/+16
| | | | | | | | | | 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>
* main: Copy all exception vectors downBenjamin Herrenschmidt2016-08-221-20/+38
| | | | | | | | | | | | | | 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>
* init: In debug builds, enable debug output to consoleBenjamin Herrenschmidt2016-08-181-0/+4
| | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* mem_region: Be a bit smarter about poisoningBenjamin Herrenschmidt2016-08-181-17/+28
| | | | | | | | Don't poison chunks that are already free and poison regions on first allocation. This speeds things up dramatically. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* check: Fix bugs in mem region testsBenjamin Herrenschmidt2016-08-182-2/+0
| | | | | | | | We shouldn't delete the list element after list_pop, it's already been deleted. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Build host programs (and checks) with debug enabledBenjamin Herrenschmidt2016-08-183-1/+4
| | | | | | | | This enables memory poisoning in allocations and list checking among other things. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Disable mcount on some early functionsBenjamin Herrenschmidt2016-08-182-8/+8
| | | | | | | | It doesn't work well to call it before the boot CPU structure is initialized. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add global DEBUG make flagBenjamin Herrenschmidt2016-08-181-0/+4
| | | | | | | | And use it to control the stack checker, memory poisoning and CCAN's list debugging. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* list: Use list_empty_nocheck() when checking a list racilyBenjamin Herrenschmidt2016-08-182-2/+3
| | | | | | | Otherwise we might trigger an assertion when list debug is enabled Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Use additional checks in skiboot for pointersBalbir Singh2016-08-1711-7/+120
| | | | | | | | | | | The checks validate pointers sent in using opal_addr_valid() in opal_call API's provided via the console, cpu, fdt, flash, i2c, interrupts, nvram, opal-msg, opal, opal-pci, xscom and cec modules Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Adjust top_of_ram when we know cpu_max_pir for the processor generationStewart Smith2016-08-171-0/+7
| | | | | | | | | | This allows opal_addr_valid to perform the < top_of_mem check and pass for early xscom_reads that read into cpu stack. Arguably the more correct solution is to split opal_xscom_read from xscom_read and only validate for the OPAL call. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add infrastructure for pointer validation.Balbir Singh2016-08-122-0/+52
| | | | | | | | | | | | | | If the kernel called an OPAL API with vmalloc'd address or any other address range in real mode, we would hit a problem with aliasing. Since the top 4 bits are ignored in real mode, pointers from 0xc.. and 0xd.. (and other ranges) could collide and lead to hard to solve bugs. This patch adds the infrastructure for pointer validation and a simple test case for testing the API Signed-off-by: Balbir Singh <bsingharora@gmail.com> [stewart@linux.vnet.ibm.com: move function to opal-internal.h rather than opal-api.h] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* time: Improve time_wait_poll()Benjamin Herrenschmidt2016-08-111-1/+2
| | | | | | | Call time_wait_nopoll() when period is smaller than remaining Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* lpc: Move LPC instance variables to a private structureBenjamin Herrenschmidt2016-08-111-1/+0
| | | | | | | | Take them out of struct proc_chip and into a private struct lpcm that's local to lpc.c Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* platform: Add BT to Generic platformBenjamin Herrenschmidt2016-08-111-0/+6
| | | | | | | Instantiate if if it's in the device-tree... Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* lpc: Add P9 LPC interrupts supportBenjamin Herrenschmidt2016-08-111-0/+6
| | | | | | | | We currently don't exploit the new MUX that allow to spread them around different PSI interrupts, they all go to LPC#0 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* chiptod: Enable ChipTOD in SIMICSBenjamin Herrenschmidt2016-08-111-1/+1
| | | | | | | It models it properly these days so the quirk is unnecessary Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* interrupts: Add new source ->attributes callbackBenjamin Herrenschmidt2016-08-111-3/+6
| | | | | | | | | | | | | | This allows a given source to provide per-interrupt attributes such as whether it targets OPAL or Linux and it's estimated frequency. The former allows to get rid of the double set of ops used to decide which interrupts go where on some modules like the PHBs and the latter will be eventually used to implement smart caching of the source lookups. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* hmi: Clean up NPU FIR debug messagesRussell Currey2016-08-101-3/+4
| | | | | | | | | | | With the skiboot log set to debug, the FIR (and related registers) were logged all in the same message. It was too much for one line, didn't clarify if the numbers were in hex, and didn't show leading zeroes. So, split it into two lines, with leading zeroes and a "0x" prefix. Signed-off-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* log_level: Reduce the in memory console log_level to lower priorityPridhiviraj Paidipeddi2016-08-023-3/+3
| | | | | | | | | | | | | | | | | | | | | | Below are the in-memory console log messages observed with error level(PR_ERROR) [54460318,3] HBRT: Mem region 'ibm,homer-image' not found ! [54465404,3] HBRT: Mem region 'ibm,homer-image' not found ! [54470372,3] HBRT: Mem region 'ibm,homer-image' not found ! [54475369,3] HBRT: Mem region 'ibm,homer-image' not found ! [11540917382,3] NVRAM: Layout appears sane [11694529822,3] OPAL: Trying a CPU re-init with flags: 0x2 [61291003267,3] OPAL: Trying a CPU re-init with flags: 0x1 [61394005956,3] OPAL: Trying a CPU re-init with flags: 0x2 Lowering the log level of mem region not found messages to PR_WARNING and remaining messages to PR_INFO level [54811683,4] HBRT: Mem region 'ibm,homer-image' not found ! [10923382751,6] NVRAM: Layout appears sane [55533988976,6] OPAL: Trying a CPU re-init with flags: 0x1 Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* flash: Make size 64 bit safeMichael Neuling2016-08-021-4/+5
| | | | | | | | | | | | | | | | This makes the size of flash 64 bit safe so that we can have flash devices greater than 4GB. This is especially useful for mambo disks passed through to Linux. Fortunately the device tree interface and the linux device driver are 64bit safe so no changes are required there. Userspace gard and flash tools are also updated to ensure "make check" still passes. Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/flash: Fix passing pointer instead of valueCyril Bur2016-07-281-1/+1
| | | | | | | | | | | | | | flash_find_subpartition() accepts a pointer to a boolean variable indicating ecc for a region of flash and passes the pointer directly to flash_read_corrected() which actually only wants the value. This has always worked probably because there has always been ECC on sub partitions. How there aren't any warnings triggered by this condition escapes me. Fixes: 6c26bc7 ("libflash: move ffs_flash_read into libflash") Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* nvram: Add extra debug printing when NVRAM needs formattingCyril Bur2016-07-272-4/+11
| | | | | | | | Be more verbose (at debug level) when formatting the NVRAM, this can help catch errors at other levels of the stack. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/console: use char literals instead of numericOliver O'Halloran2016-07-251-2/+2
| | | | | | | | | Save everyone a trip to asciitable.com. I realise everyone has probably memorised \n and friends, but THAT'S NOT THE POINT. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/timer: Add support for platform specific heartbeatChris Smart2016-07-221-6/+10
| | | | | | | | | | | | The timer code currently has a default and a special check for FSP machines or those with SLW timer facility. This patch adds support for platform quirk to set the timer. Signed-off-by: Chris Smart <chris@distroguy.com> Acked-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: fix whitespace issue] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/timer: Actually use default heartbeat valueChris Smart2016-07-221-3/+3
| | | | | | | | | | | | | | | | | HEARTBEAT_DEFAULT_MS sets the default heartbeat timeout, however this was not actually used as the default. The default was ten times quicker than this (HEARTBEAT_DEFAULT_MS / 10) while HEARTBEAT_DEFAULT_MS was actually used as a special case for FSP machines or those with SLW timer facility. This patch makes the default use HEARTBEAT_DEFAULT_MS and changes FSP or machines with SLW timer facility run 10 times slower (HEARTBEAT_DEFAULT_MS * 10). This will also now match the existing in-line comment. Signed-off-by: Chris Smart <chris@distroguy.com> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* device-tree: Only advertise ibm, opal-v3 (not v2) on POWER9 and aboveStewart Smith2016-07-201-2/+7
| | | | Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Stop adding legacy linux, phandle to device tree, just add phandleStewart Smith2016-07-201-5/+0
| | | | | | | | | | | | | Since the very first commit of a skeleton powernv platform in Linux, the kernel has been able to deal with phandle rather than linux,phandle. Thus, every kernel in the real world that has a hope of even getting to a twinkle in the eye of booting knows about phandle. So, we don't need to add linux,phandle along with phandle as it's just redundantly redundant. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* flash: Allocate flashes dynamicallyMichael Neuling2016-07-201-34/+35
| | | | | | | Convert flashes from a static array which wastes memory and limits us. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* OPAL_REINIT_CPUS: clarify that for P9 and above, we can have other flagsStewart Smith2016-07-141-1/+3
| | | | | | | | On P8 we got it a bit wrong and would fall into a workaround for P8 DD1 HILE setting if other bits were set in the flags to OPAL_REINIT_CPUS, limiting our opportunity to extend it in the future. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* cpu: Don't call time_wait with lock heldBenjamin Herrenschmidt2016-07-131-7/+17
| | | | | | | | | Also make the locking around re-init safer, properly block the OS from restarting a thread that was caught for re-init. 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>
* interrupts: Expose irq_source and change prototypes of all opsBenjamin Herrenschmidt2016-07-131-41/+64
| | | | | | | | | | | | This makes irq_source public, and change all irq_source_ops to take the source pointer as a first argument (they can still dig the void * data out of that). This will allow us to embed/wrap it for XIVE later on. 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>
* interrupts: Use a #interrupt-cells of 2 for XICS interruptsBenjamin Herrenschmidt2016-07-122-7/+11
| | | | | | | | This is more compliant with PAPR, it will also allow us to use the second cell for other attributes on P9. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* make check: make test runs less noisyStewart Smith2016-07-121-4/+4
| | | | | | | | | | | Run a small wrapper around some unit tests with the QTEST makefile macro (QTEST=Quiet TEST). Also, wrap boot tests in mambo and qemu to be quiet by default. Both ./test/run.sh and the modified mambo/qemu test runner scripts output full stdout and stderr in the event of error. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* nvram-format: fix inconsistent indentingStewart Smith2016-07-111-3/+3
| | | | | | | | Found by smatch static analysis (http://smatch.sourceforge.net/): core/nvram-format.c:146 nvram_check() warn: inconsistent indenting core/nvram-format.c:151 nvram_check() warn: inconsistent indenting Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* mem_region: fix inconsistent indentingStewart Smith2016-07-111-3/+3
| | | | | | | | Found by smatch static analysis (http://smatch.sourceforge.net/): core/mem_region.c:561 mem_check() warn: inconsistent indenting core/mem_region.c:569 mem_check() warn: inconsistent indenting Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* hw/phb4: Add initial supportBenjamin Herrenschmidt2016-07-082-0/+24
| | | | | | | | | | This adds the base support for the PHB4. It currently only support the M32 window, EEH or in general error recovery aren't supported yet. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [stewart@linux.vnet.ibm.com: update (C) year, fix indenting] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* pci: When restoring bus numbers after a reset, also restore device cacheBenjamin Herrenschmidt2016-07-081-1/+7
| | | | | | | | | PCIe devices cache the bus number on the first config write, make sure we restore them when at the same time 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>
* pci: get_reserved_pe_number() needs to take the PHB as argumentBenjamin Herrenschmidt2016-07-081-1/+1
| | | | | | | | The value might be different for different PHB instances 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>
* XIVE: Base XIVE support for OPAL XICS emulation callsBenjamin Herrenschmidt2016-07-081-1/+8
| | | | | | | | | | | | | This provides basic initialization of the XIVE along with some OPAL calls to emulate an old-style XICS which will initially be used by Linux for backward compatibility. The current implementation is limited to one priority and doesn't expose much to Linux for future exploitation mode yet. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [stewart@linux.vnet.ibm.com: add (C) header, fix whitespace, missing breaks] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* interrupts: Add eoi() callback in preparation for XIVE supportBenjamin Herrenschmidt2016-07-081-4/+19
| | | | | | | | This will be used by the XICS emulation in order to EOI the sources themselves. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Timebase quirk for slow simulators like AWAN and SIMICSBenjamin Herrenschmidt2016-07-064-2/+23
| | | | | | | | | | | This will internally pretend the timebase is running 1000 times slower, which reduces some otherwise really terrible delays in some simulators. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: move cfam_chipid cleanup into own patch] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* devicetree: Add dt_node_is_enabled()Benjamin Herrenschmidt2016-07-061-0/+10
| | | | | | | | | | This accessor tests the "status" property allowing us to represent disabled devices in the device-tree. It will be used by PHB4 initially but its usage could be made more widespread. 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>
* uart: Cleanup initialization and remove simulator hackBenjamin Herrenschmidt2016-07-062-3/+12
| | | | | | | | | | Add more generic support for MMIO based UARTs, simplify code, use common initialization, and clean up the device-tree representation as well. 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>
* Revert "flash: Use blocklevel to do ECC reads"Stewart Smith2016-07-061-2/+2
| | | | | | | | | Was causing boot failures on Garrison and Firestone (likely other OpenPower platforms) This reverts commit 74ba83462c64d6a987ed4785aee55309daf9ffb6. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud