mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
ANDROID: KVM: arm64: Advertise KVM vendor hypercalls to protected guests
Advertise KVM vendor hypercalls (i.e. those hypercalls residing in the "vendor specific" service range of the SMCCC specification and identified with KVM's UID) to protected guests from EL2 so that memory sharing hypercalls can later be probed and utilised without involving the host. Signed-off-by: Will Deacon <will@kernel.org> Bug: 209580772 Change-Id: Ic80c2aaeba236f0cbcc515d5787a1a4ad230d1d6 Signed-off-by: Will Deacon <willdeacon@google.com>
This commit is contained in:
@@ -960,14 +960,26 @@ static bool pkvm_handle_psci(struct kvm_vcpu *vcpu)
|
||||
bool pkvm_handle_hvc64(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
u32 fn = smccc_get_function(vcpu);
|
||||
u64 val[4] = { SMCCC_RET_NOT_SUPPORTED };
|
||||
|
||||
switch (fn) {
|
||||
case ARM_SMCCC_VERSION_FUNC_ID:
|
||||
/* Nothing to be handled by the host. Go back to the guest. */
|
||||
smccc_set_retval(vcpu, ARM_SMCCC_VERSION_1_1, 0, 0, 0);
|
||||
return true;
|
||||
|
||||
val[0] = ARM_SMCCC_VERSION_1_1;
|
||||
break;
|
||||
case ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID:
|
||||
val[0] = ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_0;
|
||||
val[1] = ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_1;
|
||||
val[2] = ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_2;
|
||||
val[3] = ARM_SMCCC_VENDOR_HYP_UID_KVM_REG_3;
|
||||
break;
|
||||
case ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID:
|
||||
val[0] = BIT(ARM_SMCCC_KVM_FUNC_FEATURES);
|
||||
break;
|
||||
default:
|
||||
return pkvm_handle_psci(vcpu);
|
||||
}
|
||||
|
||||
smccc_set_retval(vcpu, val[0], val[1], val[2], val[3]);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user