Re: [PATCH v6 28/28] KVM: s390: Storage key manipulation IOCTL
From: Christoph Schlameuss
Date: Wed Jan 14 2026 - 04:33:37 EST
On Mon Dec 22, 2025 at 5:50 PM CET, Claudio Imbrenda wrote:
> Add a new IOCTL to allow userspace to manipulate storage keys directly.
>
> This will make it easier to write selftests related to storage keys.
>
> Signed-off-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
Please add some user documentation for the new IOCTL.
[...]
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index dddb781b0507..845417e56778 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -1219,6 +1219,15 @@ struct kvm_vfio_spapr_tce {
> __s32 tablefd;
> };
>
> +#define KVM_S390_KEYOP_SSKE 0x01
> +#define KVM_S390_KEYOP_ISKE 0x02
> +#define KVM_S390_KEYOP_RRBE 0x03
Just a nitpik, but why this order? In the arch the order is ISKE, SSKE, RRBE.
Would it not be more logical to keep that order?
> +struct kvm_s390_keyop {
> + __u64 user_addr;
> + __u8 key;
> + __u8 operation;
> +};
> +
> /*
> * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
> * a vcpu fd.
> @@ -1238,6 +1247,7 @@ struct kvm_vfio_spapr_tce {
> #define KVM_S390_UCAS_MAP _IOW(KVMIO, 0x50, struct kvm_s390_ucas_mapping)
> #define KVM_S390_UCAS_UNMAP _IOW(KVMIO, 0x51, struct kvm_s390_ucas_mapping)
> #define KVM_S390_VCPU_FAULT _IOW(KVMIO, 0x52, unsigned long)
> +#define KVM_S390_KEYOP _IOWR(KVMIO, 0x53, struct kvm_s390_keyop)
>
> /* Device model IOC */
> #define KVM_CREATE_IRQCHIP _IO(KVMIO, 0x60)