aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2017-02-03 20:51:58 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-02-07 14:16:03 +1100
commit7d252cdeb5f5f85d4a386859e0c87613162bcf31 (patch)
treeb0defc9d54750cdc509171eb2b5f3db3bc8bb77d /hw
parentdcffe14d4075ac9e8bfce6eb1c53401630a6582f (diff)
downloadskiboot-7d252cdeb5f5f85d4a386859e0c87613162bcf31.zip
skiboot-7d252cdeb5f5f85d4a386859e0c87613162bcf31.tar.gz
skiboot-7d252cdeb5f5f85d4a386859e0c87613162bcf31.tar.bz2
xive/psi/lpc: Handle proper clearing of LPC SerIRQ latch on DD1
On DD1, the LPC SerIRQ are latched to 1 in HW but never back to 0, we need an explicit clear after running the handler. (Not before as they are level interrupts, they will be latched again if they are still pending). For now we do that in lpc_dispatch_ser_irqs() but that only works for interrupts routed to OPAL. In order to support routing LPC interrutps to Linux, we need a custom EOI handler that does the clearing of the latch before we do the EOI in the ESB. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/lpc.c25
-rw-r--r--hw/psi.c41
-rw-r--r--hw/xive.c12
3 files changed, 72 insertions, 6 deletions
diff --git a/hw/lpc.c b/hw/lpc.c
index c5ecc60..e86c9a3 100644
--- a/hw/lpc.c
+++ b/hw/lpc.c
@@ -944,14 +944,35 @@ void lpc_serirq(uint32_t chip_id, uint32_t index)
chip_id, irqs, rmask);
irqs &= rmask;
- /* Handle SerIRQ interrupts */
+ /*
+ * Handle SerIRQ interrupts. Don't clear the latch,
+ * it will be done in our special EOI callback if
+ * necessary on DD1
+ */
if (irqs)
- lpc_dispatch_ser_irqs(lpc, irqs, true);
+ lpc_dispatch_ser_irqs(lpc, irqs, false);
bail:
unlock(&lpc->lock);
}
+void lpc_p9_sirq_eoi(uint32_t chip_id, uint32_t index)
+{
+ struct proc_chip *chip = get_chip(chip_id);
+ struct lpcm *lpc;
+ uint32_t rmask;
+
+ /* No initialized LPC controller on that chip */
+ if (!chip || !chip->lpc)
+ return;
+ lpc = chip->lpc;
+
+ lock(&lpc->lock);
+ rmask = lpc->sirq_rmasks[index];
+ opb_write(lpc, lpc_reg_opb_base + LPC_HC_IRQSTAT, rmask, 4);
+ unlock(&lpc->lock);
+}
+
void lpc_all_interrupts(uint32_t chip_id)
{
struct proc_chip *chip = get_chip(chip_id);
diff --git a/hw/psi.c b/hw/psi.c
index 5d97fbb..93b5a75 100644
--- a/hw/psi.c
+++ b/hw/psi.c
@@ -657,6 +657,24 @@ static char *psi_p9_irq_name(struct irq_source *is, uint32_t isn)
return strdup(names[idx]);
}
+static void psi_p9_irq_dd1_eoi(struct irq_source *is, uint32_t isn)
+{
+ struct psi *psi = is->data;
+ unsigned int idx = isn & 0xf;
+
+ if (idx >= P9_PSI_IRQ_LPC_SIRQ0 &&
+ idx <= P9_PSI_IRQ_LPC_SIRQ3)
+ lpc_p9_sirq_eoi(psi->chip_id, idx - P9_PSI_IRQ_LPC_SIRQ0);
+ __xive_source_eoi(is, isn);
+}
+
+static const struct irq_source_ops psi_p9_dd1_irq_ops = {
+ .interrupt = psihb_p9_interrupt,
+ .attributes = psi_p9_irq_attributes,
+ .name = psi_p9_irq_name,
+ .eoi = psi_p9_irq_dd1_eoi,
+};
+
static const struct irq_source_ops psi_p9_irq_ops = {
.interrupt = psihb_p9_interrupt,
.attributes = psi_p9_irq_attributes,
@@ -797,6 +815,8 @@ static void psi_init_p8_interrupts(struct psi *psi)
static void psi_init_p9_interrupts(struct psi *psi)
{
+ struct proc_chip *c;
+ bool is_dd2;
u64 val;
/* Reset irq handling and switch to ESB mode */
@@ -829,9 +849,24 @@ static void psi_init_p9_interrupts(struct psi *psi)
out_be64(psi->regs + PSIHB_IVT_OFFSET, val);
/* Register sources */
- xive_register_hw_source(psi->interrupt, P9_PSI_NUM_IRQS,
- 12, psi->esb_mmio, XIVE_SRC_LSI,
- psi, &psi_p9_irq_ops);
+ c = next_chip(NULL);
+ is_dd2 = (c && c->ec_level >= 0x20);
+
+ if (is_dd2) {
+ prlog(PR_DEBUG,
+ "PSI[0x%03x]: Interrupts sources registered for P9 DD2.x\n",
+ psi->chip_id);
+ xive_register_hw_source(psi->interrupt, P9_PSI_NUM_IRQS,
+ 12, psi->esb_mmio, XIVE_SRC_LSI,
+ psi, &psi_p9_irq_ops);
+ } else {
+ prlog(PR_DEBUG,
+ "PSI[0x%03x]: Interrupts sources registered for P9 DD1.x\n",
+ psi->chip_id);
+ xive_register_hw_source(psi->interrupt, P9_PSI_NUM_IRQS,
+ 12, psi->esb_mmio, XIVE_SRC_LSI,
+ psi, &psi_p9_dd1_irq_ops);
+ }
}
static void psi_init_interrupts(struct psi *psi)
diff --git a/hw/xive.c b/hw/xive.c
index 784833b..909ef21 100644
--- a/hw/xive.c
+++ b/hw/xive.c
@@ -2371,7 +2371,7 @@ static int64_t xive_source_set_xive(struct irq_source *is, uint32_t isn,
return OPAL_SUCCESS;
}
-static void xive_source_eoi(struct irq_source *is, uint32_t isn)
+void __xive_source_eoi(struct irq_source *is, uint32_t isn)
{
struct xive_src *s = container_of(is, struct xive_src, is);
uint32_t idx = isn - s->esb_base;
@@ -2431,6 +2431,16 @@ static void xive_source_eoi(struct irq_source *is, uint32_t isn)
}
}
+static void xive_source_eoi(struct irq_source *is, uint32_t isn)
+{
+ struct xive_src *s = container_of(is, struct xive_src, is);
+
+ if (s->orig_ops && s->orig_ops->eoi)
+ s->orig_ops->eoi(is, isn);
+
+ __xive_source_eoi(is, isn);
+}
+
static void xive_source_interrupt(struct irq_source *is, uint32_t isn)
{
struct xive_src *s = container_of(is, struct xive_src, is);