-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API for registering passthrough IRQs
This API is mainly for convenience, it does not do anything that people could not already do but makes the implementations of VMMs simpler. See the comments in the header file for details. Co-authored-by: Jingyao Zhou <[email protected]>
- Loading branch information
1 parent
b123a21
commit 414b41c
Showing
2 changed files
with
62 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,26 @@ | ||
#include <stddef.h> | ||
#include <stdbool.h> | ||
#include <microkit.h> | ||
|
||
#ifndef MAX_PASSTHROUGH_IRQ | ||
#define MAX_PASSTHROUGH_IRQ MICROKIT_MAX_CHANNELS | ||
#endif | ||
|
||
typedef void (*virq_ack_fn_t)(size_t vcpu_id, int irq, void *cookie); | ||
|
||
bool virq_controller_init(size_t boot_vcpu_id); | ||
bool virq_register(size_t vcpu_id, size_t virq_num, virq_ack_fn_t ack_fn, void *ack_data); | ||
bool virq_inject(size_t vcpu_id, int irq); | ||
|
||
/* | ||
* These two APIs are convenient for when you want to directly passthrough an IRQ from | ||
* the hardware to the guest as the same vIRQ. This is useful when the guest has direct | ||
* passthrough access to a particular device on the hardware. | ||
* After registering the passthrough IRQ, call `virq_handle_passthrough` when | ||
* the IRQ has come through from seL4. | ||
* | ||
* @ivanv: currently this API assumes a Microkit environment. This should be changed | ||
* if/when we make libvmm agnostic to the seL4 environment it is running in. | ||
*/ | ||
bool virq_register_passthrough(size_t vcpu_id, size_t irq, microkit_channel irq_ch); | ||
bool virq_handle_passthrough(microkit_channel irq_ch); |