aboutsummaryrefslogtreecommitdiff
path: root/hw/phb3.c
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:14:01 +1100
commit55af871041a4b09e53013671450980bdb36f91e3 (patch)
tree39f739ceffd357bea89e90ae213e32f6371abea7 /hw/phb3.c
parent4243ff4e752f5a591f75b8a2a3bb78519e05d221 (diff)
downloadskiboot-55af871041a4b09e53013671450980bdb36f91e3.zip
skiboot-55af871041a4b09e53013671450980bdb36f91e3.tar.gz
skiboot-55af871041a4b09e53013671450980bdb36f91e3.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>
Diffstat (limited to 'hw/phb3.c')
-rw-r--r--hw/phb3.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/phb3.c b/hw/phb3.c
index 33ceee8..e246e46 100644
--- a/hw/phb3.c
+++ b/hw/phb3.c
@@ -1789,6 +1789,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
@@ -1850,6 +1852,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;
}
@@ -1900,6 +1904,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
@@ -1915,6 +1921,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;
}