Contributors: 9
Author |
Tokens |
Token Proportion |
Commits |
Commit Proportion |
Andrew Jones |
66 |
43.14% |
1 |
7.14% |
Sean Christopherson |
30 |
19.61% |
6 |
42.86% |
Oliver Upton |
19 |
12.42% |
1 |
7.14% |
Peter Gonda |
18 |
11.76% |
1 |
7.14% |
Paolo Bonzini |
10 |
6.54% |
1 |
7.14% |
Wei Huang |
6 |
3.92% |
1 |
7.14% |
Aaron Lewis |
2 |
1.31% |
1 |
7.14% |
Drew Schmitt |
1 |
0.65% |
1 |
7.14% |
Peter Xu |
1 |
0.65% |
1 |
7.14% |
Total |
153 |
|
14 |
|
// SPDX-License-Identifier: GPL-2.0
/*
* ucall support. A ucall is a "hypercall to userspace".
*
* Copyright (C) 2018, Red Hat, Inc.
*/
#include "kvm_util.h"
vm_vaddr_t *ucall_exit_mmio_addr;
void ucall_arch_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa)
{
vm_vaddr_t mmio_gva = vm_vaddr_unused_gap(vm, vm->page_size, KVM_UTIL_MIN_VADDR);
virt_map(vm, mmio_gva, mmio_gpa, 1);
vm->ucall_mmio_addr = mmio_gpa;
write_guest_global(vm, ucall_exit_mmio_addr, (vm_vaddr_t *)mmio_gva);
}
void *ucall_arch_get_ucall(struct kvm_vcpu *vcpu)
{
struct kvm_run *run = vcpu->run;
if (run->exit_reason == KVM_EXIT_MMIO &&
run->mmio.phys_addr == vcpu->vm->ucall_mmio_addr) {
TEST_ASSERT(run->mmio.is_write && run->mmio.len == sizeof(uint64_t),
"Unexpected ucall exit mmio address access");
return (void *)(*((uint64_t *)run->mmio.data));
}
return NULL;
}