Hi James,
Question: We are using HVC conduit for PSCI, do we need a check if hypercall being trapped to userspace is SMC or HVC?
File: linux/arch/arm64/kvm/hypercalls.c (your code change) int kvm_hvc_user(struct kvm_vcpu *vcpu) { [...]
run->exit_reason = KVM_EXIT_HYPERCALL; run->hypercall.nr = kvm_vcpu_hvc_get_imm(vcpu); -> this would be referred by userspace code? /* Add the first parameters for fast access. */ [...]
return 0; }
# Userspace Code Excerpt (JPB's June 2021 code reference)
In the userspace, a check similar to below might be required I guess: + /* Under KVM, the PSCI conduit is HVC */ + if (imm & KVM_ARM_EXIT_HYPERCALL_SMC) { + XXXX_log_mask("%s: unexpected SMC exit\n", __func__); + return 0; + }
+ +/* + * In kvm_run::hypercall::nr, this bit indicates that the call is a SMC. When + * the bit is not set, the call is an HVC. + */ +#define KVM_ARM_EXIT_HYPERCALL_SMC (1ULL << 63) +
I am being lazy but Could you please provide more clarification on the use of 'hypercall.nr' for this check?
[1] https://developer.arm.com/documentation/ddi0596/2021-12/Base-Instructions/HV... [HVC #0]
Thanks Salil