Due to commit2b7deea3ec
("Revert "kvm: selftests: move base kvm_util.h declarations to kvm_util_base.h"") kvm selftests now requires explicitly including ucall_common.h when needed. The commit added the directives everywhere they were needed at the time, but, by merge time, new places had been merged for RISC-V. Add those now to fix RISC-V's compilation. Fixes:dee7ea42a1
("Merge tag 'kvm-x86-selftests_utils-6.10' of https://github.com/kvm-x86/linux into HEAD") Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Link: https://lore.kernel.org/r/20240603122045.323064-2-ajones@ventanamicro.com Signed-off-by: Anup Patel <anup@brainfault.org>
32 lines
757 B
C
32 lines
757 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* ucall support. A ucall is a "hypercall to userspace".
|
|
*
|
|
* Copyright (C) 2021 Western Digital Corporation or its affiliates.
|
|
*/
|
|
|
|
#include <linux/kvm.h>
|
|
|
|
#include "kvm_util.h"
|
|
#include "processor.h"
|
|
#include "sbi.h"
|
|
|
|
void *ucall_arch_get_ucall(struct kvm_vcpu *vcpu)
|
|
{
|
|
struct kvm_run *run = vcpu->run;
|
|
|
|
if (run->exit_reason == KVM_EXIT_RISCV_SBI &&
|
|
run->riscv_sbi.extension_id == KVM_RISCV_SELFTESTS_SBI_EXT) {
|
|
switch (run->riscv_sbi.function_id) {
|
|
case KVM_RISCV_SELFTESTS_SBI_UCALL:
|
|
return (void *)run->riscv_sbi.args[0];
|
|
case KVM_RISCV_SELFTESTS_SBI_UNEXP:
|
|
vcpu_dump(stderr, vcpu, 2);
|
|
TEST_ASSERT(0, "Unexpected trap taken by guest");
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|