Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/src/linux_compat.c
| Show First 20 Lines • Show All 2,458 Lines • ▼ Show 20 Lines | list_sort(void *priv, struct list_head *head, int (*cmp)(void *priv, | ||||
| qsort_r(ar, count, sizeof(struct list_head *), &thunk, linux_le_cmp); | qsort_r(ar, count, sizeof(struct list_head *), &thunk, linux_le_cmp); | ||||
| INIT_LIST_HEAD(head); | INIT_LIST_HEAD(head); | ||||
| for (i = 0; i < count; i++) | for (i = 0; i < count; i++) | ||||
| list_add_tail(ar[i], head); | list_add_tail(ar[i], head); | ||||
| free(ar, M_KMALLOC); | free(ar, M_KMALLOC); | ||||
| } | } | ||||
| void | void | ||||
| lkpi_irq_release(struct device *dev, struct irq_ent *irqe) | |||||
| { | |||||
| if (irqe->tag != NULL) | |||||
| bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag); | |||||
| if (irqe->res != NULL) | |||||
| bus_release_resource(dev->bsddev, SYS_RES_IRQ, | |||||
| rman_get_rid(irqe->res), irqe->res); | |||||
| list_del(&irqe->links); | |||||
| } | |||||
| void | |||||
| lkpi_devm_irq_release(struct device *dev, void *p) | |||||
| { | |||||
| struct irq_ent *irqe; | |||||
| if (dev == NULL || p == NULL) | |||||
| return; | |||||
| irqe = p; | |||||
| lkpi_irq_release(dev, irqe); | |||||
| } | |||||
| void | |||||
| linux_irq_handler(void *ent) | linux_irq_handler(void *ent) | ||||
| { | { | ||||
| struct irq_ent *irqe; | struct irq_ent *irqe; | ||||
| if (linux_set_current_flags(curthread, M_NOWAIT)) | if (linux_set_current_flags(curthread, M_NOWAIT)) | ||||
| return; | return; | ||||
| irqe = ent; | irqe = ent; | ||||
| irqe->handler(irqe->irq, irqe->arg); | if (irqe->handler(irqe->irq, irqe->arg) == IRQ_WAKE_THREAD && | ||||
| irqe->thread_handler != NULL) { | |||||
| THREAD_SLEEPING_OK(); | |||||
bz: This does not work; I kept running into panics with it and switched back locally to actually… | |||||
hselaskyUnsubmitted Not Done Inline ActionsI see. How will you disable the device interrupts during the execution of that worker thread? Right now while the linux_irq_handler() function is executing the device IRQ is masked. When this function returns the device IRQ is unmasked. Are you sure those panics can't be fixed? hselasky: I see.
How will you disable the device interrupts during the execution of that worker thread? | |||||
| irqe->thread_handler(irqe->irq, irqe->arg); | |||||
| THREAD_NO_SLEEPING(); | |||||
| } | } | ||||
| } | |||||
| #if defined(__i386__) || defined(__amd64__) | #if defined(__i386__) || defined(__amd64__) | ||||
| int | int | ||||
| linux_wbinvd_on_all_cpus(void) | linux_wbinvd_on_all_cpus(void) | ||||
| { | { | ||||
| pmap_invalidate_cache(); | pmap_invalidate_cache(); | ||||
| return (0); | return (0); | ||||
| ▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines | |||||
This does not work; I kept running into panics with it and switched back locally to actually running it in a thread. Could do other ways than starting a thread as well but it seems we will need a deferred context.