From 55af871041a4b09e53013671450980bdb36f91e3 Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Wed, 21 Dec 2016 14:02:15 +1100 Subject: 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 --- hw/phb3.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'hw') 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; } -- cgit v1.1