Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH] irqdev: search_intr with interrupt line

10 views
Skip to first unread message

Junling Ma

unread,
Aug 4, 2020, 6:16:48 PM8/4/20
to bug-...@gnu.org

In the read/write irq scheme, a program may open multiple irq devices. When wrting (acking), we
need to find the user_intr_t that both points to the device port and has the correct interrupt.
Thus the search_intr function need to match the interrupt id. For the device_intr_ack method,
the id passed to search_intr will be -1.

---
device/intr.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/device/intr.c b/device/intr.c
index ba86bc2d..359384c7 100644
--- a/device/intr.c
+++ b/device/intr.c
@@ -41,13 +41,13 @@ extern void free_irq (unsigned int irq, void *dev_id);
}

static user_intr_t *
-search_intr (struct irqdev *dev, ipc_port_t dst_port)
+search_intr (struct irqdev *dev, int id, ipc_port_t dst_port)
{
user_intr_t *e;
simple_lock(&dev->lock);
queue_iterate (&dev->intr_queue, e, user_intr_t *, chain)
{
- if (e->dst_port == dst_port)
+ if (e->dst_port == dst_port && (id == -1 || e->id == id))
{
simple_unlock(&dev->lock);
return e;
@@ -64,7 +64,7 @@ irq_acknowledge (ipc_port_t receive_port)
kern_return_t ret = 0;

spl_t s = splhigh ();
- e = search_intr (&irqtab, receive_port);
+ e = search_intr (&irqtab, -1, receive_port);

if (!e)
printf("didn't find user intr for interrupt !?\n");
@@ -118,7 +118,7 @@ insert_intr_entry (struct irqdev *dev, int id, ipc_port_t dst_port)

/* check whether the intr entry has been in the queue. */
spl_t s = splhigh ();
- e = search_intr (dev, dst_port);
+ e = search_intr (dev, id, dst_port);
if (e)
{
printf ("the interrupt entry for irq[%d] and port %p has already been inserted\n", id, dst_port);
--
2.28.0.rc1



Samuel Thibault

unread,
Aug 4, 2020, 6:27:25 PM8/4/20
to Junling Ma, bug-...@gnu.org
Junling Ma, le mar. 04 août 2020 15:16:39 -0700, a ecrit:
> In the read/write irq scheme, a program may open multiple irq devices. When wrting (acking), we
> need to find the user_intr_t that both points to the device port and has the correct interrupt.
> Thus the search_intr function need to match the interrupt id.

? AIUI you'd call device_open() for each irq line you want to monitor,
so you only need to match the corresponding port, and checking the line
id is then just redundant.

Samuel

0 new messages