diff options
author | Frederic Barrat <fbarrat@linux.ibm.com> | 2022-06-15 16:21:41 +0200 |
---|---|---|
committer | Reza Arbab <arbab@linux.ibm.com> | 2022-07-05 09:22:14 -0500 |
commit | 4d27f0375de64645194a5ca6a5b85cef42524d0e (patch) | |
tree | d17dd1f677841f1c2f352019508861690430dfa6 /core | |
parent | d9772c6108db42dc7b186cc699fe597d3f40c302 (diff) | |
download | skiboot-4d27f0375de64645194a5ca6a5b85cef42524d0e.zip skiboot-4d27f0375de64645194a5ca6a5b85cef42524d0e.tar.gz skiboot-4d27f0375de64645194a5ca6a5b85cef42524d0e.tar.bz2 |
interrupts: Speed up opal interrupts scanning
When looking for which interrupts are serviced by opal, we scan all
sources and query every single interrupt to know if it's for linux or
opal. An optimization was made so that if the source doesn't have an
'interrupt' op (=the handler) or an 'attributes' op (to do the
query), then we can skip the source. That's all good.
However, when xive was introduced, the 'irq_source' defining those ops
was wrapped in a 'xive_src' source which adds a level of indirection
for those 'attributes' and 'interrupt' ops. So the previous
optimization no longer works: the 'attributes' and 'interrupt' ops are
defined from the wrapper, but if we could look past the indirection,
we would realize they are not.
That is getting problematic for the rather large generic IPIs
source. We have 8 million such interrupts defined per chip on P10 and
because the above optimization is no longer kicking in, we are now
querying every single one of them to know if it is for opal. Real
hardware swallows it without much difficulty, but simulators
don't. Running qemu on my laptop, the full scan takes ~12 seconds per
chip!
This patch adds a callback for an interrupt source to report whether
it has opal interrupts. If the source doesn't define it, then we
fallback to looking at the 'interrupt' and 'attributes' ops, like
before, as it is still useful on P8. We can then define that new
callback on the xive sources, allowing to look past the indirection
level and skip scanning the source when appropriate.
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/interrupts.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/core/interrupts.c b/core/interrupts.c index 35571f2..03a37b2 100644 --- a/core/interrupts.c +++ b/core/interrupts.c @@ -199,6 +199,21 @@ uint32_t get_ics_phandle(void) abort(); } +static bool source_has_opal_interrupts(struct irq_source *is) +{ + /* check with the source first */ + if (is->ops->has_opal_interrupts) + return is->ops->has_opal_interrupts(is); + /* + * Default case: to handle an interrupt in opal, a source + * needs at least an attribute callback to declare it and a + * handler + */ + if (!is->ops->interrupt || !is->ops->attributes) + return false; + return true; +} + void add_opal_interrupts(void) { struct irq_source *is; @@ -214,11 +229,8 @@ void add_opal_interrupts(void) lock(&irq_lock); list_for_each(&irq_sources, is, link) { - /* - * Don't even consider sources that don't have an interrupts - * callback or don't have an attributes one. - */ - if (!is->ops->interrupt || !is->ops->attributes) + + if (!source_has_opal_interrupts(is)) continue; for (isn = is->start; isn < is->end; isn++) { uint64_t attr = is->ops->attributes(is, isn); |