Skip to content

Commit

Permalink
Add sound interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermbrown committed Dec 5, 2023
1 parent 01a98c6 commit 66d4e01
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/audio/board/qemu_arm_virt/audio.system
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@

<!-- For the pass-through UART -->
<irq irq="33" id="1" />
<irq irq="37" id="2" />
</protection_domain>
</system>
18 changes: 18 additions & 0 deletions examples/audio/vmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
/* For simplicity we just enforce the serial IRQ channel number to be the same
* across platforms. */
#define SERIAL_IRQ_CH 1
#define SOUND_IRQ_CH 2

#if defined(BOARD_qemu_arm_virt)
#define SERIAL_IRQ 33
Expand All @@ -65,6 +66,12 @@
#error Need to define serial interrupt
#endif

#if defined(BOARD_qemu_arm_virt)
#define SOUND_IRQ 37
#else
#error Need to define sound interrupt
#endif

/* Data for the guest's kernel image. */
extern char _guest_kernel_image[];
extern char _guest_kernel_image_end[];
Expand Down Expand Up @@ -117,6 +124,10 @@ void init(void) {
success = virq_register(GUEST_VCPU_ID, SERIAL_IRQ, &serial_ack, NULL);
/* Just in case there is already an interrupt available to handle, we ack it here. */
microkit_irq_ack(SERIAL_IRQ_CH);

success = virq_register(GUEST_VCPU_ID, SOUND_IRQ, &serial_ack, NULL);
microkit_irq_ack(SOUND_IRQ_CH);

/* Finally start the guest */
guest_start(GUEST_VCPU_ID, kernel_pc, GUEST_DTB_VADDR, GUEST_INIT_RAM_DISK_VADDR);
}
Expand All @@ -130,6 +141,13 @@ void notified(microkit_channel ch) {
}
break;
}
case SOUND_IRQ_CH: {
bool success = virq_inject(GUEST_VCPU_ID, SOUND_IRQ);
if (!success) {
LOG_VMM_ERR("IRQ %d dropped on vCPU %d\n", SOUND_IRQ, GUEST_VCPU_ID);
}
break;
}
default:
printf("Unexpected channel, ch: 0x%lx\n", ch);
}
Expand Down

0 comments on commit 66d4e01

Please sign in to comment.