diff mbox series

[3/3] s390/kvm: set host program identifier

Message ID 1535734279-10204-4-git-send-email-walling@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series Use DIAG318 to set Control Program Name & Version Codes | expand

Commit Message

Collin Walling Aug. 31, 2018, 4:51 p.m. UTC
A host program identifier (HPID) provides information regarding the underlying
host environment. A level-2 (VM) guest will have an HPID denoting Linux/KVM,
which is set during VCPU setup. A level-3 (VM on a VM) and beyond guest will
have an HPID denoting VSIE, which is set (and is overwritten) during shadowing
of the SCB.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
---
 arch/s390/include/asm/kvm_host.h | 6 +++++-
 arch/s390/kvm/kvm-s390.c         | 2 ++
 arch/s390/kvm/vsie.c             | 2 ++
 3 files changed, 9 insertions(+), 1 deletion(-)

Comments

Christian Borntraeger Sept. 3, 2018, 7:55 a.m. UTC | #1
This is independent from the diag 318 discussion and it seems good to go.

On 08/31/2018 06:51 PM, Collin Walling wrote:
> A host program identifier (HPID) provides information regarding the underlying
> host environment. A level-2 (VM) guest will have an HPID denoting Linux/KVM,
> which is set during VCPU setup. A level-3 (VM on a VM) and beyond guest will
> have an HPID denoting VSIE, which is set (and is overwritten) during shadowing
> of the SCB.

I find the last paragraph hard to parse. What about

> have an HPID denoting..
		      .. KVM vSIE, which is set for all shadow control blocks,
overriding the original value of the HPID.

With that
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>


> 
> Signed-off-by: Collin Walling <walling@linux.ibm.com>
> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  arch/s390/include/asm/kvm_host.h | 6 +++++-
>  arch/s390/kvm/kvm-s390.c         | 2 ++
>  arch/s390/kvm/vsie.c             | 2 ++
>  3 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index fabeb32..8c877f5 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -238,7 +238,11 @@ struct kvm_s390_sie_block {
>  	psw_t	gpsw;			/* 0x0090 */
>  	__u64	gg14;			/* 0x00a0 */
>  	__u64	gg15;			/* 0x00a8 */
> -	__u8	reservedb0[20];		/* 0x00b0 */
> +	__u8	reservedb0[8];		/* 0x00b0 */
> +#define HPID_KVM	0x4
> +#define HPID_VSIE	0x5
> +	__u8	hpid;			/* 0x00b8 */
> +	__u8	reservedb9[11];		/* 0x00b9 */
>  	__u16	extcpuaddr;		/* 0x00c4 */
>  	__u16	eic;			/* 0x00c6 */
>  	__u32	reservedc8;		/* 0x00c8 */
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 678c9cb..aac8a22 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -2773,6 +2773,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
>  	hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>  	vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup;
> 
> +	vcpu->arch.sie_block->hpid = HPID_KVM;
> +
>  	kvm_s390_vcpu_crypto_setup(vcpu);
> 
>  	return rc;
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index 63844b9..2b701b4 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -382,6 +382,8 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  	if (test_kvm_facility(vcpu->kvm, 156))
>  		scb_s->ecd |= scb_o->ecd & ECD_ETOKENF;
> 
> +	scb_s->hpid = HPID_VSIE;
> +
>  	prepare_ibc(vcpu, vsie_page);
>  	rc = shadow_crycb(vcpu, vsie_page);
>  out:
>
Christian Borntraeger Sept. 4, 2018, 11:16 a.m. UTC | #2
Changed subject to KVM: s390: .... and modified the commit message.

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>

Patch 3 applied and scheduled for >4.19 (kvm/next).

 

On 08/31/2018 06:51 PM, Collin Walling wrote:
> A host program identifier (HPID) provides information regarding the underlying
> host environment. A level-2 (VM) guest will have an HPID denoting Linux/KVM,
> which is set during VCPU setup. A level-3 (VM on a VM) and beyond guest will
> have an HPID denoting VSIE, which is set (and is overwritten) during shadowing
> of the SCB.
> 
> Signed-off-by: Collin Walling <walling@linux.ibm.com>
> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
> ---
>  arch/s390/include/asm/kvm_host.h | 6 +++++-
>  arch/s390/kvm/kvm-s390.c         | 2 ++
>  arch/s390/kvm/vsie.c             | 2 ++
>  3 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index fabeb32..8c877f5 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -238,7 +238,11 @@ struct kvm_s390_sie_block {
>  	psw_t	gpsw;			/* 0x0090 */
>  	__u64	gg14;			/* 0x00a0 */
>  	__u64	gg15;			/* 0x00a8 */
> -	__u8	reservedb0[20];		/* 0x00b0 */
> +	__u8	reservedb0[8];		/* 0x00b0 */
> +#define HPID_KVM	0x4
> +#define HPID_VSIE	0x5
> +	__u8	hpid;			/* 0x00b8 */
> +	__u8	reservedb9[11];		/* 0x00b9 */
>  	__u16	extcpuaddr;		/* 0x00c4 */
>  	__u16	eic;			/* 0x00c6 */
>  	__u32	reservedc8;		/* 0x00c8 */
> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
> index 678c9cb..aac8a22 100644
> --- a/arch/s390/kvm/kvm-s390.c
> +++ b/arch/s390/kvm/kvm-s390.c
> @@ -2773,6 +2773,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
>  	hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>  	vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup;
>  
> +	vcpu->arch.sie_block->hpid = HPID_KVM;
> +
>  	kvm_s390_vcpu_crypto_setup(vcpu);
>  
>  	return rc;
> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
> index 63844b9..2b701b4 100644
> --- a/arch/s390/kvm/vsie.c
> +++ b/arch/s390/kvm/vsie.c
> @@ -382,6 +382,8 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>  	if (test_kvm_facility(vcpu->kvm, 156))
>  		scb_s->ecd |= scb_o->ecd & ECD_ETOKENF;
>  
> +	scb_s->hpid = HPID_VSIE;
> +
>  	prepare_ibc(vcpu, vsie_page);
>  	rc = shadow_crycb(vcpu, vsie_page);
>  out:
>
Collin Walling Sept. 6, 2018, 1:42 p.m. UTC | #3
On 09/04/2018 07:16 AM, Christian Borntraeger wrote:
> Changed subject to KVM: s390: .... and modified the commit message.
> 
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> 
> Patch 3 applied and scheduled for >4.19 (kvm/next).
> 
>  
> 

Thanks for taking care of this.

> On 08/31/2018 06:51 PM, Collin Walling wrote:
>> A host program identifier (HPID) provides information regarding the underlying
>> host environment. A level-2 (VM) guest will have an HPID denoting Linux/KVM,
>> which is set during VCPU setup. A level-3 (VM on a VM) and beyond guest will
>> have an HPID denoting VSIE, which is set (and is overwritten) during shadowing
>> of the SCB.
>>
>> Signed-off-by: Collin Walling <walling@linux.ibm.com>
>> Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
>> ---
>>  arch/s390/include/asm/kvm_host.h | 6 +++++-
>>  arch/s390/kvm/kvm-s390.c         | 2 ++
>>  arch/s390/kvm/vsie.c             | 2 ++
>>  3 files changed, 9 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
>> index fabeb32..8c877f5 100644
>> --- a/arch/s390/include/asm/kvm_host.h
>> +++ b/arch/s390/include/asm/kvm_host.h
>> @@ -238,7 +238,11 @@ struct kvm_s390_sie_block {
>>  	psw_t	gpsw;			/* 0x0090 */
>>  	__u64	gg14;			/* 0x00a0 */
>>  	__u64	gg15;			/* 0x00a8 */
>> -	__u8	reservedb0[20];		/* 0x00b0 */
>> +	__u8	reservedb0[8];		/* 0x00b0 */
>> +#define HPID_KVM	0x4
>> +#define HPID_VSIE	0x5
>> +	__u8	hpid;			/* 0x00b8 */
>> +	__u8	reservedb9[11];		/* 0x00b9 */
>>  	__u16	extcpuaddr;		/* 0x00c4 */
>>  	__u16	eic;			/* 0x00c6 */
>>  	__u32	reservedc8;		/* 0x00c8 */
>> diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
>> index 678c9cb..aac8a22 100644
>> --- a/arch/s390/kvm/kvm-s390.c
>> +++ b/arch/s390/kvm/kvm-s390.c
>> @@ -2773,6 +2773,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
>>  	hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
>>  	vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup;
>>  
>> +	vcpu->arch.sie_block->hpid = HPID_KVM;
>> +
>>  	kvm_s390_vcpu_crypto_setup(vcpu);
>>  
>>  	return rc;
>> diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
>> index 63844b9..2b701b4 100644
>> --- a/arch/s390/kvm/vsie.c
>> +++ b/arch/s390/kvm/vsie.c
>> @@ -382,6 +382,8 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
>>  	if (test_kvm_facility(vcpu->kvm, 156))
>>  		scb_s->ecd |= scb_o->ecd & ECD_ETOKENF;
>>  
>> +	scb_s->hpid = HPID_VSIE;
>> +
>>  	prepare_ibc(vcpu, vsie_page);
>>  	rc = shadow_crycb(vcpu, vsie_page);
>>  out:
>>
>
David Hildenbrand Sept. 17, 2018, 7:46 a.m. UTC | #4
Am 04.09.18 um 13:16 schrieb Christian Borntraeger:
> Changed subject to KVM: s390: .... and modified the commit message.
> 
> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
> 
> Patch 3 applied and scheduled for >4.19 (kvm/next).
> 

Christian, is it okay to set this field even without HW support?

(I slightly remember that certain reserved fields should remain
untouched if there is no HW support for them, maybe I am wrong or this
does not apply here)
Christian Borntraeger Sept. 17, 2018, 7:54 a.m. UTC | #5
On 09/17/2018 09:46 AM, David Hildenbrand wrote:
> Am 04.09.18 um 13:16 schrieb Christian Borntraeger:
>> Changed subject to KVM: s390: .... and modified the commit message.
>>
>> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>
>> Patch 3 applied and scheduled for >4.19 (kvm/next).
>>
> 
> Christian, is it okay to set this field even without HW support?
> 
> (I slightly remember that certain reserved fields should remain
> untouched if there is no HW support for them, maybe I am wrong or this
> does not apply here)

Yes, there is no scp bit for this, it can be set unconditionally.
David Hildenbrand Sept. 17, 2018, 7:58 a.m. UTC | #6
Am 17.09.18 um 09:54 schrieb Christian Borntraeger:
> 
> 
> On 09/17/2018 09:46 AM, David Hildenbrand wrote:
>> Am 04.09.18 um 13:16 schrieb Christian Borntraeger:
>>> Changed subject to KVM: s390: .... and modified the commit message.
>>>
>>> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
>>>
>>> Patch 3 applied and scheduled for >4.19 (kvm/next).
>>>
>>
>> Christian, is it okay to set this field even without HW support?
>>
>> (I slightly remember that certain reserved fields should remain
>> untouched if there is no HW support for them, maybe I am wrong or this
>> does not apply here)
> 
> Yes, there is no scp bit for this, it can be set unconditionally.
> 

Thanks, feel free to add

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index fabeb32..8c877f5 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -238,7 +238,11 @@  struct kvm_s390_sie_block {
 	psw_t	gpsw;			/* 0x0090 */
 	__u64	gg14;			/* 0x00a0 */
 	__u64	gg15;			/* 0x00a8 */
-	__u8	reservedb0[20];		/* 0x00b0 */
+	__u8	reservedb0[8];		/* 0x00b0 */
+#define HPID_KVM	0x4
+#define HPID_VSIE	0x5
+	__u8	hpid;			/* 0x00b8 */
+	__u8	reservedb9[11];		/* 0x00b9 */
 	__u16	extcpuaddr;		/* 0x00c4 */
 	__u16	eic;			/* 0x00c6 */
 	__u32	reservedc8;		/* 0x00c8 */
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 678c9cb..aac8a22 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -2773,6 +2773,8 @@  int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 	hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
 	vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup;
 
+	vcpu->arch.sie_block->hpid = HPID_KVM;
+
 	kvm_s390_vcpu_crypto_setup(vcpu);
 
 	return rc;
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index 63844b9..2b701b4 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -382,6 +382,8 @@  static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 	if (test_kvm_facility(vcpu->kvm, 156))
 		scb_s->ecd |= scb_o->ecd & ECD_ETOKENF;
 
+	scb_s->hpid = HPID_VSIE;
+
 	prepare_ibc(vcpu, vsie_page);
 	rc = shadow_crycb(vcpu, vsie_page);
 out: