Re: [PATCH v6 28/28] KVM: s390: Storage key manipulation IOCTL

Claudio Imbrenda
2026-01-14T09:53:59Z

On Wed, 14 Jan 2026 10:33:22 +0100
"Christoph Schlameuss" <schlameuss@linux.ibm.com> wrote:

> 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@linux.ibm.com>
>
> Please add some user documentation for the new IOCTL.

already done, it will be in the next iteration.
and also a capability 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?

I don't know why I chose that order, I guess I can reorder it. It
doesn't really make a difference, but I guess consistency is good

>
> > +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)
>