aboutsummaryrefslogtreecommitdiff
path: root/hw/phb4.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2016-08-09 16:38:05 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-08-11 19:54:22 +1000
commit8b6d05d9b2cd187e05ff0aa27942f07d04c8d4d6 (patch)
tree5a3dad0ac8c8fcdb0f72d9a2b82ff51af0e0fdb5 /hw/phb4.c
parentc6a6391892539450a84d3dd69f4d83ea1a1b04d6 (diff)
downloadskiboot-8b6d05d9b2cd187e05ff0aa27942f07d04c8d4d6.zip
skiboot-8b6d05d9b2cd187e05ff0aa27942f07d04c8d4d6.tar.gz
skiboot-8b6d05d9b2cd187e05ff0aa27942f07d04c8d4d6.tar.bz2
interrupts: Add new source ->attributes callback
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>
Diffstat (limited to 'hw/phb4.c')
-rw-r--r--hw/phb4.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/hw/phb4.c b/hw/phb4.c
index 734146c..e1e8d3f 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -55,7 +55,7 @@
#include <xive.h>
/* Enable this to disable error interrupts for debug purposes */
-#undef DISABLE_ERR_INTS
+#define DISABLE_ERR_INTS
static void phb4_init_hw(struct phb4 *p, bool first_init);
@@ -3048,12 +3048,32 @@ static void phb4_eoi(struct irq_source *is, uint32_t isn)
}
}
-static const struct irq_source_ops phb4_irq_ops = {
+static const struct irq_source_ops phb4_msi_ops = {
.get_xive = phb4_get_xive,
.set_xive = phb4_set_xive,
.eoi = phb4_eoi
};
+static uint64_t phb4_lsi_attributes(struct irq_source *is __unused,
+ uint32_t isn __unused)
+{
+#ifndef DISABLE_ERR_INTS
+ struct phb3 *p = is->data;
+ uint32_t idx = isn - p->base_lsi;
+
+ if (idx == PHB3_LSI_PCIE_INF || idx == PHB3_LSI_PCIE_ER)
+ return IRQ_ATTR_TARGET_OPAL | IRQ_ATTR_TARGET_RARE;
+#endif
+ return IRQ_ATTR_TARGET_LINUX;
+}
+
+static const struct irq_source_ops phb4_lsi_ops = {
+ .get_xive = phb4_get_xive,
+ .set_xive = phb4_set_xive,
+ .attributes = phb4_lsi_attributes,
+ .eoi = phb4_eoi
+};
+
/* Error LSIs (skiboot owned) */
//static const struct irq_source_ops phb3_err_lsi_irq_ops = {
// .get_xive = phb3_lsi_get_xive,
@@ -3209,12 +3229,9 @@ static void phb4_create(struct dt_node *np)
phb4_init_ioda_cache(p);
/* Register interrupt sources */
- register_irq_source(&phb4_irq_ops, p, p->base_msi, p->num_irqs);
+ register_irq_source(&phb4_msi_ops, p, p->base_msi, p->num_irqs - 8);
+ register_irq_source(&phb4_lsi_ops, p, p->base_lsi, 8);
-#ifndef DISABLE_ERR_INTS
- // register_irq_source(&phb4_err_lsi_irq_ops, p,
- // p->base_lsi + PHB4_LSI_PCIE_INF, 2);
-#endif
/* Get the HW up and running */
phb4_init_hw(p, true);