summaryrefslogtreecommitdiffstats
path: root/core/interrupts.c
Commit message (Collapse)AuthorAgeFilesLines
* SBE: Add timer supportVasant Hegde2018-04-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SBE on P9 provides one shot programmable timer facility. We can use this to implement OPAL timers and hence limit the reliance on the Linux heartbeat (similar to HW timer facility provided by SLW on P8). Design: - We will continue to run Linux heartbeat. - Each chip has SBE. This patch always schedules timer on SBE on master chip. - Start timer option starts new timer or modifies an active timer for the specified timeout. - SBE expects timeout value in microseconds. We track timeout value in TB. Hence we convert tb to microseconds before sending request to SBE. - We are requesting ack from SBE for timer message. It gaurantees that SBE has scheduled timer. - Disabling SBE timer We expect SBE to send timer expiry interrupt whenever timer expires. We wait for 10 more ms before disabling timer. In future we can consider below alternative approaches: - Presently SBE timer disable is permanent (until we reboot system). SBE sends "I'm back" interrupt after reset. We can consider restarting timer after SBE reset. - Reset SBE and start timer again. - Each chip has SBE. On multi chip system we can try to schedule timer on different chip. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* Move P8 timer code to separate fileVasant Hegde2018-04-301-2/+3
| | | | | | | | | | | | | Lets move P8 timer support code from slw.c to sbe-p8.c (as suggested by BenH). There is a difference between timer support in P8 and P9. Hence I think it makes sense to name it as sbe-p8.c. Note that this is pure code movement and renaming functions/variables. No functionality changes. Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* interrupts: Create an "interrupts" property in the OPAL nodeBenjamin Herrenschmidt2018-04-111-7/+26
| | | | | | | | | | | | Deprecate the old "opal-interrupts", it's still there, but the new property follows the standard and allow us to specify whether an interrupt is level or edge sensitive. Similarly create "interrupt-names" whose content is identical to "opal-interrupts-names". Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* Big log level reduction...Benjamin Herrenschmidt2017-06-261-2/+2
| | | | | | | | | | | | | 90% of what we print isn't useful to a normal user. This dramatically reduces the amount of messages printed by OPAL in normal circumstances. We still need to add a way to bump the log level at boot based on a BMC scratch register or some HDAT property. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* interrupts: Add an "irq_for_each_source" iteratorBenjamin Herrenschmidt2017-04-191-0/+12
| | | | | | | This will be used by subsequent XIVE reset improvements Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Neuling <mikey@neuling.org>
* core/interrupts: free interrupt names after adding to DTStewart Smith2017-02-031-0/+1
| | | | | Fixes: 539487bae4b77 Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* xive/phb4: Work around broken LSI control on P9 DD1Benjamin Herrenschmidt2017-01-051-3/+11
| | | | | | | | | Exposes a new flag to the OS to indicate that OPAL calls are needed for masking and unmasking and forward the calls to the source so that PHB4 can do the right thing Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* interrupts: Add optional name for OPAL interruptsBenjamin Herrenschmidt2017-01-051-1/+16
| | | | | | | | | | | This adds the infrastructure for an interrupt source to provide a name for an interrupt directed toward OPAL. Those names will be put into an "opal-interrupts-names" property which is a standard DT string list corresponding 1:1 with the "opal-interrupts" property. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* xive: Expose exploitation mode DT propertiesBenjamin Herrenschmidt2017-01-051-1/+6
| | | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* interrutps: Export irq_find_source()Benjamin Herrenschmidt2017-01-051-1/+1
| | | | | | | It will be used by xive Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* xive: Provide a way to override some IPI sourcesBenjamin Herrenschmidt2016-11-151-31/+19
| | | | | | | | | | | | | | | | | | | | | | Some devices such as NX or the NPU will use some of the XIVE provided IPIs for their own interrupts. Thus we need a way for those to provide a custom irq_source_ops for portions of the IPI space in order for them to provide their own attributes() and if needed, interrutps() callbacks. We achieve that by creating a second list of sources which can overlap the primary. The global stock of IPIs is registered by XIVE in the secondary list which is searched when no match is found in the primary. A new API xive_register_ipi_source() is provided for those devices to create an overlapping source structure in the primary list for a subset of the IPIs. Those IPIs must have been previously allocated using xive_alloc_ipi_irqs() 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>
* Use additional checks in skiboot for pointersBalbir Singh2016-08-171-0/+6
| | | | | | | | | | | 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>
* 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>
* 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-121-1/+1
| | | | | | | | 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>
* 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>
* Fixup sparse endian annotations for opal events and masksStewart Smith2015-11-091-2/+2
| | | | | | This fixes many spurious sparse warnings Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* interrupts: Convert P8 IRQ assignment to functionsAlistair Popple2015-10-081-1/+85
| | | | | | | | | | | | | | | | | | Interrupts on P8 are currently hard-coded using macros in include/interrupts.h. The new P8NVL processor has an extra PHB meaning it supports 4 PHBs in total which leads to the following assert fail when booting P8NVL based systems: [6614913194,3] register IRQ source overlap ! [6620562844,3] new: 2000..27f7 old: 2000..27f7 [6870377440,0] Assert fail: core/interrupts.c:67:0 This patch converts the existing macros to function calls so that different platforms can support extra PHBs at the expense of a reduced maximum number of chips. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* slw/timer: SBE based timer supportBenjamin Herrenschmidt2015-09-111-3/+4
| | | | | | | | | | | | | Recent HostBoot & SBE firmware provide a HW timer facility that can be used to implement OPAL timers and thus limit the reliance on the Linux heartbeat. This implements support for it. The side effect is that i2c from Centaurs is now usable. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [stewart@linux.vnet.ibm.com: fix run-timer unit test] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* core/interrupts: Fix resource leak in add_opal_interrupts()Kamalesh Babulal2015-07-071-0/+2
| | | | | | | | | | | In add_opal_interrupts(), we allocate memory for irqs property. Which is not freed, after property is added. There are chances of irqs begin NULL, as free(NULL) is nop. It's harmless. Fixes Coverity defect#98849. Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Remove redundant includes of opal-api.hMichael Ellerman2015-04-011-1/+0
| | | | | | | | Now that opal.h includes opal-api.h, there are a bunch of files that include both but don't need to. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Always create opal-interrupts propertyBenjamin Herrenschmidt2015-02-181-3/+5
| | | | | | | | | | Even if empty. The existing Linux code doesn't properly NULL check the result of of_get_property() and will allocate an array of an undefined size if the property is missing, while an empty property is harmless. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Move skiboot internal things from opal.h to opal-api.hStewart Smith2015-02-061-0/+1
| | | | | | | | | | This is probably not the best collection of things in the world, but it means that opal.h is much closer to being directly usable by an OS. This triggers a bunch of #include fixes throughout the tree. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* timer: Only check "poll" timers on actual poll, not any interruptBenjamin Herrenschmidt2014-11-121-1/+1
| | | | | | | | Due to the lack of SLW timed interrupt support, we take the opportunity to check out timers on any incoming interrupt. However we really don't want to do that for the background pollers. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* timer: Add scheduled timer facilityBenjamin Herrenschmidt2014-11-071-0/+6
| | | | | | | For now running off the event pollers, that will improve once we get delayed interrupts from the SLW Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* Quieten a couple more thingsBenjamin Herrenschmidt2014-10-151-3/+3
| | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* Initial commit of Open Source releaseBenjamin Herrenschmidt2014-07-021-0/+332
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
OpenPOWER on IntegriCloud