[Skiboot] [PATCH 02/16] core/pci: Add missing lock in set_power_timer
Frederic Barrat
fbarrat at linux.ibm.com
Mon Sep 9 22:31:37 AEST 2019
set_power_timer() was not using any lock, though it alters the slot
state and devices found under it. So lock the PHB under which the slot
is found to avoid concurrent operations.
Signed-off-by: Frederic Barrat <fbarrat at linux.ibm.com>
---
core/pci-opal.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/core/pci-opal.c b/core/pci-opal.c
index d5209600..175810d0 100644
--- a/core/pci-opal.c
+++ b/core/pci-opal.c
@@ -674,7 +674,9 @@ static void set_power_timer(struct timer *t __unused, void *data,
struct pci_device *pd = slot->pd;
struct dt_node *dn = pd->dn;
uint8_t link;
+ struct phb *phb = slot->phb;
+ phb_lock(phb);
switch (slot->state) {
case PCI_SLOT_STATE_SPOWER_START:
if (slot->retries-- == 0) {
@@ -720,6 +722,7 @@ static void set_power_timer(struct timer *t __unused, void *data,
prlog(PR_ERR, "PCI SLOT %016llx: Unexpected state 0x%08x\n",
slot->id, slot->state);
}
+ phb_unlock(phb);
}
static int64_t opal_pci_set_power_state(uint64_t async_token,
--
2.21.0
More information about the Skiboot
mailing list