Re: [PATCH v7 5/9] x86: spp: Introduce user-space SPP IOCTLs

From: Paolo Bonzini
Date: Thu Nov 21 2019 - 05:03:59 EST


On 19/11/19 09:49, Yang Weijiang wrote:
> + case KVM_INIT_SPP: {
> + r = kvm_vm_ioctl_init_spp(kvm);
> + break;
> + }
> default:
> r = -ENOTTY;
> }
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index 9460830de536..700f0825336d 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -1257,6 +1257,9 @@ struct kvm_vfio_spapr_tce {
> struct kvm_userspace_memory_region)
> #define KVM_SET_TSS_ADDR _IO(KVMIO, 0x47)
> #define KVM_SET_IDENTITY_MAP_ADDR _IOW(KVMIO, 0x48, __u64)
> +#define KVM_SUBPAGES_GET_ACCESS _IOR(KVMIO, 0x49, __u64)
> +#define KVM_SUBPAGES_SET_ACCESS _IOW(KVMIO, 0x4a, __u64)
> +#define KVM_INIT_SPP _IOW(KVMIO, 0x4b, __u64)

You also need to define a capability and return a value for it in
kvm_vm_ioctl_check_extension. We could return SUBPAGE_MAX_BITMAP (now
KVM_SUBPAGE_MAX_PAGES). And instead of introducing KVM_INIT_SPP, you
can then use KVM_ENABLE_CAP on the new capability.

Paolo