aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2016-12-21 14:02:15 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-12-22 13:52:36 +1100
commit19afa4d895317420edc76ffd1e4f109f24aba5c5 (patch)
tree3db226fc3ace375dcbb2ad06873e8932724f4db6
parentbb3ec494f09c61d16048bee7e77d285a28b363e2 (diff)
downloadskiboot-19afa4d895317420edc76ffd1e4f109f24aba5c5.zip
skiboot-19afa4d895317420edc76ffd1e4f109f24aba5c5.tar.gz
skiboot-19afa4d895317420edc76ffd1e4f109f24aba5c5.tar.bz2
phb3: Lock the PHB on set_xive callbacks
Those are called by the interrupts core and thus skip the locking implicit in the PCI opal calls. However IODA table access can be racy, so make sure we lock the PHB. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com> (cherry picked from commit 55af871041a4b09e53013671450980bdb36f91e3) Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/phb3.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/phb3.c b/hw/phb3.c
index 953e2a5..9a5ebcc 100644
--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -1703,6 +1703,8 @@ static int64_t phb3_msi_set_xive(struct irq_source *is, uint32_t isn,
ive_num > PHB3_MSI_IRQ_MAX)
return OPAL_PARAMETER;
+ phb_lock(&p->phb);
+
/*
* We need strip the link from server. As Milton told
* me, the server is assigned as follows and the left
@@ -1764,6 +1766,8 @@ static int64_t phb3_msi_set_xive(struct irq_source *is, uint32_t isn,
out_be64(p->regs + PHB_IVC_UPDATE, ivc);
}
+ phb_unlock(&p->phb);
+
return OPAL_SUCCESS;
}
@@ -1814,6 +1818,8 @@ static int64_t phb3_lsi_set_xive(struct irq_source *is, uint32_t isn,
lxive = SETFIELD(IODA2_LXIVT_SERVER, 0ul, server);
lxive = SETFIELD(IODA2_LXIVT_PRIORITY, lxive, prio);
+ phb_lock(&p->phb);
+
/*
* We cache the arguments because we have to mangle
* it in order to hijack 3 bits of priority to extend
@@ -1829,6 +1835,8 @@ static int64_t phb3_lsi_set_xive(struct irq_source *is, uint32_t isn,
lxive = SETFIELD(IODA2_LXIVT_PRIORITY, lxive, prio);
out_be64(p->regs + PHB_IODA_DATA0, lxive);
+ phb_unlock(&p->phb);
+
return OPAL_SUCCESS;
}