diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2020-06-17 06:14:53 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2020-06-17 06:14:53 +0000 |
commit | b7a82ba3056db478b632034db5299b0d0f846a65 (patch) | |
tree | f636e5ae1edf45eca8b59762443e2aa25787f097 /sys/arch/amd64/pci | |
parent | af4fb90247e8cc79347e21b2ee42373bc62a96e2 (diff) |
pci_intr_establish_cpu() for establishing an interrupt no a specific cpu.
the cpu is specified by a struct cpu_info *, which should generally
come from an intrmap.
this is adapted from a diff that patrick@ sent round a few years
ago for a pci_intr_map_msix_cpuid, where you asked for an msi vector
on a specific cpu, and then called pci_intr_establish with the
handle you get. kettenis pointed out that it's hard on some archs
to carry cpu on a pci interrupt handle, so i tweaked it to turn it
into a pci_intr_establish_cpu instead.
jmatthew@ and i (but mostly jmatthew@ to be honest) have been
experimenting with this api on multiple archs and it is working out
well. i'm putting this diff in now on amd64 so people can kick the
tyres a bit.
tested with hacked up vmx(4), ix(4), and mcx(4)
Diffstat (limited to 'sys/arch/amd64/pci')
-rw-r--r-- | sys/arch/amd64/pci/pci_machdep.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c index d0fd8d43691..cf4e835de33 100644 --- a/sys/arch/amd64/pci/pci_machdep.c +++ b/sys/arch/amd64/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.74 2020/05/14 13:07:11 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.75 2020/06/17 06:14:52 dlg Exp $ */ /* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -669,6 +669,14 @@ void * pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level, int (*func)(void *), void *arg, const char *what) { + return pci_intr_establish_cpu(pc, ih, level, NULL, func, arg, what); +} + +void * +pci_intr_establish_cpu(pci_chipset_tag_t pc, pci_intr_handle_t ih, + int level, struct cpu_info *ci, + int (*func)(void *), void *arg, const char *what) +{ int pin, irq; int bus, dev; pcitag_t tag = ih.tag; @@ -676,11 +684,11 @@ pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level, if (ih.line & APIC_INT_VIA_MSG) { return intr_establish(-1, &msi_pic, tag, IST_PULSE, level, - func, arg, what); + ci, func, arg, what); } if (ih.line & APIC_INT_VIA_MSGX) { return intr_establish(-1, &msix_pic, tag, IST_PULSE, level, - func, arg, what); + ci, func, arg, what); } pci_decompose_tag(pc, ih.tag, &bus, &dev, NULL); @@ -706,7 +714,8 @@ pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level, } #endif - return intr_establish(irq, pic, pin, IST_LEVEL, level, func, arg, what); + return intr_establish(irq, pic, pin, IST_LEVEL, level, ci, + func, arg, what); } void |