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

Will Deacon will at kernel.org
Fri Jan 9 07:01:43 PST 2026


On Tue, Jan 06, 2026 at 03:45:40PM +0000, Vincent Donnefort wrote:
> [...]
> 
> > @@ -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.

I decided to keep all the zero-arg checking in the top-level switch so
that people adding new hypercalls are encouraged to add those checks as
well :p

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

Thanks,

Will



More information about the linux-arm-kernel mailing list