Skip to content

Commit

Permalink
virtio-snd: add WFI fault handling
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Brown <[email protected]>
  • Loading branch information
alexandermbrown committed Apr 29, 2024
1 parent 73e198a commit 0339540
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/arch/aarch64/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ bool fault_advance(size_t vcpu_id, seL4_UserContext *regs, uint64_t addr, uint64
return fault_advance_vcpu(vcpu_id, regs);
}

bool fault_handle_vcpu_exception(size_t vcpu_id)
bool fault_handle_vcpu_exception(size_t vcpu_id, bool *wfi)
{
uint32_t hsr = microkit_mr_get(seL4_VCPUFault_HSR);
uint64_t hsr_ec_class = HSR_EXCEPTION_CLASS(hsr);
Expand All @@ -223,6 +223,7 @@ bool fault_handle_vcpu_exception(size_t vcpu_id)
return handle_smc(vcpu_id, hsr);
case HSR_WFx_EXCEPTION:
// If we get a WFI exception, we just do nothing in the VMM.
*wfi = true;
return true;
default:
LOG_VMM_ERR("unknown SMC exception, EC class: 0x%lx, HSR: 0x%lx\n", hsr_ec_class, hsr);
Expand Down Expand Up @@ -394,7 +395,7 @@ bool fault_handle_vm_exception(size_t vcpu_id)
}
}

bool fault_handle(size_t vcpu_id, microkit_msginfo msginfo) {
bool fault_handle(size_t vcpu_id, microkit_msginfo msginfo, bool *wfi) {
size_t label = microkit_msginfo_get_label(msginfo);
bool success = false;
switch (label) {
Expand All @@ -411,7 +412,7 @@ bool fault_handle(size_t vcpu_id, microkit_msginfo msginfo) {
success = fault_handle_vgic_maintenance(vcpu_id);
break;
case seL4_Fault_VCPUFault:
success = fault_handle_vcpu_exception(vcpu_id);
success = fault_handle_vcpu_exception(vcpu_id, wfi);
break;
case seL4_Fault_VPPIEvent:
success = fault_handle_vppi_event(vcpu_id);
Expand Down
4 changes: 2 additions & 2 deletions src/arch/aarch64/fault.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#include <microkit.h>

/* Fault-handling functions */
bool fault_handle(size_t vcpu_id, microkit_msginfo msginfo);
bool fault_handle(size_t vcpu_id, microkit_msginfo msginfo, bool *wfi);

bool fault_handle_vcpu_exception(size_t vcpu_id);
bool fault_handle_vcpu_exception(size_t vcpu_id, bool *wfi);
bool fault_handle_vppi_event(size_t vcpu_id);
bool fault_handle_user_exception(size_t vcpu_id);
bool fault_handle_unknown_syscall(size_t vcpu_id);
Expand Down

0 comments on commit 0339540

Please sign in to comment.