Skip to content

Commit 67d49d5

Browse files
collinwallingborntraeger
authored andcommitted
KVM: s390: set host program identifier
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 KVM vSIE, which is set for all shadow control blocks, overriding the original value of the HPID. Signed-off-by: Collin Walling <walling@linux.ibm.com> Reviewed-by: Janosch Frank <frankja@linux.ibm.com> Message-Id: <1535734279-10204-4-git-send-email-walling@linux.ibm.com> Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
1 parent 7876320 commit 67d49d5

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ struct kvm_s390_sie_block {
237237
psw_t gpsw; /* 0x0090 */
238238
__u64 gg14; /* 0x00a0 */
239239
__u64 gg15; /* 0x00a8 */
240-
__u8 reservedb0[20]; /* 0x00b0 */
240+
__u8 reservedb0[8]; /* 0x00b0 */
241+
#define HPID_KVM 0x4
242+
#define HPID_VSIE 0x5
243+
__u8 hpid; /* 0x00b8 */
244+
__u8 reservedb9[11]; /* 0x00b9 */
241245
__u16 extcpuaddr; /* 0x00c4 */
242246
__u16 eic; /* 0x00c6 */
243247
__u32 reservedc8; /* 0x00c8 */

arch/s390/kvm/kvm-s390.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2685,6 +2685,8 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
26852685
hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
26862686
vcpu->arch.ckc_timer.function = kvm_s390_idle_wakeup;
26872687

2688+
vcpu->arch.sie_block->hpid = HPID_KVM;
2689+
26882690
kvm_s390_vcpu_crypto_setup(vcpu);
26892691

26902692
return rc;

arch/s390/kvm/vsie.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
383383
if (test_kvm_facility(vcpu->kvm, 156))
384384
scb_s->ecd |= scb_o->ecd & ECD_ETOKENF;
385385

386+
scb_s->hpid = HPID_VSIE;
387+
386388
prepare_ibc(vcpu, vsie_page);
387389
rc = shadow_crycb(vcpu, vsie_page);
388390
out:

0 commit comments

Comments
 (0)