summaryrefslogtreecommitdiff
path: root/sys/dev/pci/psp_pci.c
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-11-08 17:34:23 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-11-08 17:34:23 +0000
commit5e5560884a20c45ed0f31c208b906dca65cc38c5 (patch)
tree9391475faca61eafa1ab945520cdf241be1055f0 /sys/dev/pci/psp_pci.c
parentcf358e57108bb4994838c09b466f48e0f82342ac (diff)
Use a mutex to make psp(4) MP safe.
To avoid a race between writing PSP command, sleeping, receiving interrupt, and calling wakeup(9), protect psp(4) driver with a mutex. With that interrupt handler is MP safe and ioctl(2) can release kernel lock. from hshoexer@; OK dlg@
Diffstat (limited to 'sys/dev/pci/psp_pci.c')
-rw-r--r--sys/dev/pci/psp_pci.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/pci/psp_pci.c b/sys/dev/pci/psp_pci.c
index e1356ceeb8a..bd70866ed1c 100644
--- a/sys/dev/pci/psp_pci.c
+++ b/sys/dev/pci/psp_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: psp_pci.c,v 1.1 2024/10/24 18:52:59 bluhm Exp $ */
+/* $OpenBSD: psp_pci.c,v 1.2 2024/11/08 17:34:22 bluhm Exp $ */
/*
* Copyright (c) 2023-2024 Hans-Joerg Hoexer <hshoexer@genua.de>
@@ -50,8 +50,8 @@ psp_pci_match(struct ccp_softc *sc, struct pci_attach_args *pa)
reg_capabilities = PSP_REG_CAPABILITIES;
capabilities = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
reg_capabilities);
- if (!ISSET(capabilities, PSP_CAP_SEV))
- return (0);
+ if (!ISSET(capabilities, PSP_CAP_SEV))
+ return (0);
return (1);
}
@@ -81,8 +81,8 @@ psp_pci_intr_map(struct ccp_softc *sc, struct pci_attach_args *pa)
}
intrstr = pci_intr_string(pa->pa_pc, ih);
- sc->sc_irqh = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, psp_sev_intr,
- sc, sc->sc_dev.dv_xname);
+ sc->sc_irqh = pci_intr_establish(pa->pa_pc, ih, IPL_BIO | IPL_MPSAFE,
+ psp_sev_intr, sc, sc->sc_dev.dv_xname);
if (sc->sc_irqh != NULL)
printf(": %s", intrstr);
}