forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hvc_console: rework setup to replace irq functions with callbacks
This patch tries to change hvc_console to not use request_irq/free_irq if the backend does not use irqs. This allows virtio_console to use hvc_console without having a linker reference to request_irq/free_irq. In addition, together with patch 2/3 it improves the performance for virtio console input. (an earlier version of this patch was tested by Yajin on lguest) The irq specific code is moved to hvc_irq.c and selected by the drivers that use irqs (System p, System i, XEN). I replaced "int irq" with the opaque "int data". The request_irq and free_irq calls are replaced with notifier_add and notifier_del. I have also changed the code a bit to call the notifier_add and notifier_del inside the spinlock area as the callbacks are found via hp->ops. Changes since last version: o remove ifdef o reintroduce "irq_requested" as "notified" o cleanups, sparse.. I did not move the timer based polling into a separate polling scheme. I played with several variants, but it seems we need to sleep/schedule in a thread even for irq based consoles, as there are throttleing and buffer size constraints. I also kept hvc_struct defined in hvc_console.h so that hvc_irq.c can access the irq_requested element. Feedback is appreciated. virtio_console is currently the only available console for kvm on s390. I plan to push this change as soon as all affected parties agree on it. I would love to get test results from System p, Xen etc. Signed-off-by: Christian Borntraeger <[email protected]> Signed-off-by: Rusty Russell <[email protected]>
- Loading branch information
1 parent
066f4d8
commit 611e097
Showing
8 changed files
with
105 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright IBM Corp. 2001,2008 | ||
* | ||
* This file contains the IRQ specific code for hvc_console | ||
* | ||
*/ | ||
|
||
#include <linux/interrupt.h> | ||
|
||
#include "hvc_console.h" | ||
|
||
static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance) | ||
{ | ||
/* if hvc_poll request a repoll, then kick the hvcd thread */ | ||
if (hvc_poll(dev_instance)) | ||
hvc_kick(); | ||
return IRQ_HANDLED; | ||
} | ||
|
||
/* | ||
* For IRQ based systems these callbacks can be used | ||
*/ | ||
int notifier_add_irq(struct hvc_struct *hp, int irq) | ||
{ | ||
int rc; | ||
|
||
if (!irq) { | ||
hp->irq_requested = 0; | ||
return 0; | ||
} | ||
rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED, | ||
"hvc_console", hp); | ||
if (!rc) | ||
hp->irq_requested = 1; | ||
return rc; | ||
} | ||
|
||
void notifier_del_irq(struct hvc_struct *hp, int irq) | ||
{ | ||
if (!irq) | ||
return; | ||
free_irq(irq, hp); | ||
hp->irq_requested = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters