Re: [PATCH 24/30] KVM: arm64: Implement the MEM_SHARE hypercall for protected VMs

Vincent Donnefort
2026-01-06T15:45:46Z

[...]

> @@ -952,6 +1004,7 @@ bool kvm_handle_pvm_hvc64(struct kvm_vcpu *vcpu, u64 *exit_code)
> case ARM_SMCCC_VENDOR_HYP_KVM_FEATURES_FUNC_ID:
> val[0] = BIT(ARM_SMCCC_KVM_FUNC_FEATURES);
> val[0] |= BIT(ARM_SMCCC_KVM_FUNC_HYP_MEMINFO);
> + val[0] |= BIT(ARM_SMCCC_KVM_FUNC_MEM_SHARE);
> break;
> case ARM_SMCCC_VENDOR_HYP_KVM_HYP_MEMINFO_FUNC_ID:
> if (smccc_get_arg1(vcpu) ||
> @@ -962,6 +1015,14 @@ bool kvm_handle_pvm_hvc64(struct kvm_vcpu *vcpu, u64 *exit_code)
>
> val[0] = PAGE_SIZE;
> break;
> + case ARM_SMCCC_VENDOR_HYP_KVM_MEM_SHARE_FUNC_ID:
> + if (smccc_get_arg2(vcpu) ||
> + smccc_get_arg3(vcpu)) {
> + break;
> + }

I wonder if that shouldn't go into pkvm_memshare_call(): that function has the
knowledge of the argument content since we pass vcpu.

Otherwise:

Reviewed-by: Vincent Donnefort <vdonnefort@google.com>

> +
> + handled = pkvm_memshare_call(val, vcpu, exit_code);
> + break;
> default:
> /* Punt everything else back to the host, for now. */
> handled = false;
> --
> 2.52.0.351.gbe84eed79e-goog
>