[04/15] Header sync protvirt
diff mbox series

Message ID 20191120114334.2287-5-frankja@linux.ibm.com
State New
Headers show
Series
  • s390x: Protected Virtualization support
Related show

Commit Message

Janosch Frank Nov. 20, 2019, 11:43 a.m. UTC
Let's sync all the protvirt header changes

Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 linux-headers/asm-s390/kvm.h |  3 ++-
 linux-headers/linux/kvm.h    | 42 ++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)

Comments

Cornelia Huck Nov. 21, 2019, 12:59 p.m. UTC | #1
On Wed, 20 Nov 2019 06:43:23 -0500
Janosch Frank <frankja@linux.ibm.com> wrote:

> Let's sync all the protvirt header changes
> 
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  linux-headers/asm-s390/kvm.h |  3 ++-
>  linux-headers/linux/kvm.h    | 42 ++++++++++++++++++++++++++++++++++++
>  2 files changed, 44 insertions(+), 1 deletion(-)
> 

> diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
> index 18892d6541..d031051601 100644
> --- a/linux-headers/linux/kvm.h
> +++ b/linux-headers/linux/kvm.h
> @@ -995,6 +995,8 @@ struct kvm_ppc_resize_hpt {
>  #define KVM_CAP_ARM_SVE 170
>  #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
>  #define KVM_CAP_ARM_PTRAUTH_GENERIC 172
> +#define KVM_CAP_S390_PROTECTED 180
> +#define KVM_CAP_S390_VCPU_RESETS 181

Hm, where does this cap come from? I did not see it in the kernel
patches.

>  
>  #ifdef KVM_CAP_IRQ_ROUTING
>
Janosch Frank Nov. 21, 2019, 1:12 p.m. UTC | #2
On 11/21/19 1:59 PM, Cornelia Huck wrote:
> On Wed, 20 Nov 2019 06:43:23 -0500
> Janosch Frank <frankja@linux.ibm.com> wrote:
> 
>> Let's sync all the protvirt header changes
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  linux-headers/asm-s390/kvm.h |  3 ++-
>>  linux-headers/linux/kvm.h    | 42 ++++++++++++++++++++++++++++++++++++
>>  2 files changed, 44 insertions(+), 1 deletion(-)
>>
> 
>> diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
>> index 18892d6541..d031051601 100644
>> --- a/linux-headers/linux/kvm.h
>> +++ b/linux-headers/linux/kvm.h
>> @@ -995,6 +995,8 @@ struct kvm_ppc_resize_hpt {
>>  #define KVM_CAP_ARM_SVE 170
>>  #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
>>  #define KVM_CAP_ARM_PTRAUTH_GENERIC 172
>> +#define KVM_CAP_S390_PROTECTED 180
>> +#define KVM_CAP_S390_VCPU_RESETS 181
> 
> Hm, where does this cap come from? I did not see it in the kernel
> patches.

It'll be part of the V1 once I send it out.
Pierre found the problem while reviewing QEMU, so I fixed it in both repos.

> 
>>  
>>  #ifdef KVM_CAP_IRQ_ROUTING
>>  
>
Cornelia Huck Nov. 21, 2019, 1:17 p.m. UTC | #3
On Thu, 21 Nov 2019 14:12:21 +0100
Janosch Frank <frankja@linux.ibm.com> wrote:

> On 11/21/19 1:59 PM, Cornelia Huck wrote:
> > On Wed, 20 Nov 2019 06:43:23 -0500
> > Janosch Frank <frankja@linux.ibm.com> wrote:
> >   
> >> Let's sync all the protvirt header changes
> >>
> >> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> >> ---
> >>  linux-headers/asm-s390/kvm.h |  3 ++-
> >>  linux-headers/linux/kvm.h    | 42 ++++++++++++++++++++++++++++++++++++
> >>  2 files changed, 44 insertions(+), 1 deletion(-)
> >>  
> >   
> >> diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
> >> index 18892d6541..d031051601 100644
> >> --- a/linux-headers/linux/kvm.h
> >> +++ b/linux-headers/linux/kvm.h
> >> @@ -995,6 +995,8 @@ struct kvm_ppc_resize_hpt {
> >>  #define KVM_CAP_ARM_SVE 170
> >>  #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
> >>  #define KVM_CAP_ARM_PTRAUTH_GENERIC 172
> >> +#define KVM_CAP_S390_PROTECTED 180
> >> +#define KVM_CAP_S390_VCPU_RESETS 181  
> > 
> > Hm, where does this cap come from? I did not see it in the kernel
> > patches.  
> 
> It'll be part of the V1 once I send it out.
> Pierre found the problem while reviewing QEMU, so I fixed it in both repos.

Ok, that cap probably makes sense. It was just surprising to find :)

Patch
diff mbox series

diff --git a/linux-headers/asm-s390/kvm.h b/linux-headers/asm-s390/kvm.h
index 03ab5968c7..41976d33f0 100644
--- a/linux-headers/asm-s390/kvm.h
+++ b/linux-headers/asm-s390/kvm.h
@@ -255,7 +255,8 @@  struct kvm_sync_regs {
 	__u8  reserved[512];	/* for future vector expansion */
 	__u32 fpc;		/* valid on KVM_SYNC_VRS or KVM_SYNC_FPRS */
 	__u8 bpbc : 1;		/* bp mode */
-	__u8 reserved2 : 7;
+	__u8 pv : 1;		/* pv mode */
+	__u8 reserved2 : 6;
 	__u8 padding1[51];	/* riccb needs to be 64byte aligned */
 	__u8 riccb[64];		/* runtime instrumentation controls block */
 	__u8 padding2[192];	/* sdnx needs to be 256byte aligned */
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 18892d6541..d031051601 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -995,6 +995,8 @@  struct kvm_ppc_resize_hpt {
 #define KVM_CAP_ARM_SVE 170
 #define KVM_CAP_ARM_PTRAUTH_ADDRESS 171
 #define KVM_CAP_ARM_PTRAUTH_GENERIC 172
+#define KVM_CAP_S390_PROTECTED 180
+#define KVM_CAP_S390_VCPU_RESETS 181
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -1453,6 +1455,46 @@  struct kvm_enc_region {
 /* Available with KVM_CAP_ARM_SVE */
 #define KVM_ARM_VCPU_FINALIZE	  _IOW(KVMIO,  0xc2, int)
 
+struct kvm_s390_pv_sec_parm {
+	__u64	origin;
+	__u64	length;
+};
+
+struct kvm_s390_pv_unp {
+	__u64 addr;
+	__u64 size;
+	__u64 tweak;
+};
+
+enum pv_cmd_id {
+	KVM_PV_VM_CREATE,
+	KVM_PV_VM_DESTROY,
+	KVM_PV_VM_SET_SEC_PARMS,
+	KVM_PV_VM_UNPACK,
+	KVM_PV_VM_VERIFY,
+	KVM_PV_VM_PERF_CLEAR_RESET,
+	KVM_PV_VM_UNSHARE,
+	KVM_PV_VCPU_CREATE,
+	KVM_PV_VCPU_DESTROY,
+};
+
+struct kvm_pv_cmd {
+	__u32	cmd;
+	__u16	rc;
+	__u16	rrc;
+	__u64	data;
+};
+
+/* Available with KVM_CAP_S390_PROTECTED */
+#define KVM_S390_PV_COMMAND		_IOW(KVMIO, 0xc3, struct kvm_pv_cmd)
+#define KVM_S390_PV_COMMAND_VCPU	_IOW(KVMIO, 0xc4, struct kvm_pv_cmd)
+
+#define KVM_S390_VCPU_RESET_NORMAL	0
+#define KVM_S390_VCPU_RESET_INITIAL	1
+#define KVM_S390_VCPU_RESET_CLEAR	2
+
+#define KVM_S390_VCPU_RESET    _IO(KVMIO,   0xc5)
+
 /* Secure Encrypted Virtualization command */
 enum sev_cmd_id {
 	/* Guest initialization commands */