mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-17 07:14:25 +00:00
sbi_ecall() isn't ucall specific and its prototype is already in processor.h. Move its implementation to processor.c. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Andrew Jones <ajones@ventanamicro.com> Signed-off-by: Anup Patel <anup@brainfault.org>
32 lines
740 B
C
32 lines
740 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"
|
|
|
|
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;
|
|
}
|