Skip to contentSkip to conversation

s390/kvm: handle diagnose 318 instruction call

PATCH Cornelia Huck 1 participant 1 message Sep 19, 2018 1 message not in the archive s390

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 34 lines · On Wed, 19 Sep 2018 12:56:53 -0400 Collin Walling <[email protected]> wrote:
Quoted 23 lines · Cornelia Huck
Quoted 19 lines · On Fri, 31 Aug 2018 12:51:18 -0400 Collin Walling <[email protected]> wrote:

The diagnose 318 instruction is a privileged instruction that must be interpreted by SIE and handled via KVM.

The control program name and version codes (CPNC and CPVC) set by this instruction are saved to the kvm->arch struct. The CPNC is also set in the SIE control block of all VCPUs. The new kvm_s390_set_misc interface is introduced for migration.

---
 arch/s390/include/asm/kvm_host.h       |  6 ++-
 arch/s390/include/uapi/asm/kvm.h       |  5 ++
 arch/s390/kvm/diag.c                   | 16 ++++++
 arch/s390/kvm/kvm-s390.c               | 90 ++++++++++++++++++++++++++++++++++
 arch/s390/kvm/kvm-s390.h               |  1 +
 tools/arch/s390/include/uapi/asm/kvm.h |  1 +
 6 files changed, 118 insertions(+), 1 deletion(-)
Quoted 9 lines

Review void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) · line 2659

Quoted 6 lines
(quoted diff) +2 -0
@@ -2568,6 +2655,9 @@ void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
 	vcpu->arch.sie_block->epoch = vcpu->kvm->arch.epoch;
 	vcpu->arch.sie_block->epdx = vcpu->kvm->arch.epdx;
 	preempt_enable();
+
+	vcpu->arch.sie_block->cpnc = vcpu->kvm->arch.cpnc;  

Any reason why you set this _after_ the preempt_enable()?

Quoted 2 lines

I didn't consider setting this value as time-critical as the TOD-Clock values. I guess it doesn't hurt to throw the cpnc in there, too?

_postcreate is probably not time-critical at all... just keep setting up all of the fields in one place?

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines
(quoted diff) +1 -0
+
 	mutex_unlock(&vcpu->kvm->lock);
 	if (!kvm_is_ucontrol(vcpu->kvm)) {
 		vcpu->arch.gmap = vcpu->kvm->arch.gmap;