On 05.02.20 13:22, Cornelia Huck wrote: > On Mon, 3 Feb 2020 08:19:36 -0500 > Christian Borntraeger <borntraeger@xxxxxxxxxx> wrote: > >> The sclp interrupt is kind of special. The ultravisor polices that we >> do not inject and sclp interrupt with payload if no sccb is outstanding. >> On the other hand we have "asynchronous" event interrupts, e.g. for >> console input. >> We separate both variants into sclp interrupt and sclp event interrupt. >> The sclp interrupt is masked until a previous servc instruction has >> finished (sie exit 108). >> >> Signed-off-by: Christian Borntraeger <borntraeger@xxxxxxxxxx> >> --- >> arch/s390/include/asm/kvm_host.h | 6 ++- >> arch/s390/kvm/intercept.c | 25 +++++++++ >> arch/s390/kvm/interrupt.c | 92 ++++++++++++++++++++++++++------ >> arch/s390/kvm/kvm-s390.c | 2 + >> 4 files changed, 108 insertions(+), 17 deletions(-) >> > >> diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c >> index 4b3fbbde1674..c22214967214 100644 >> --- a/arch/s390/kvm/intercept.c >> +++ b/arch/s390/kvm/intercept.c >> @@ -444,8 +444,33 @@ static int handle_operexc(struct kvm_vcpu *vcpu) >> return kvm_s390_inject_program_int(vcpu, PGM_OPERATION); >> } >> >> +static int handle_pv_sclp(struct kvm_vcpu *vcpu) >> +{ >> + struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int; >> + >> + spin_lock(&fi->lock); >> + /* >> + * 2 cases: >> + * a: an sccb answering interrupt was already pending or in flight. >> + * As the sccb value is not used we can simply set some more bits >> + * and make sure that we deliver something > > The sccb value is not used because the firmware handles this? Yes, the firmware will use its copy of the sccb value when we have something !=0 > >> + * b: an error sccb interrupt needs to be injected so we also inject >> + * something and let firmware do the right thing. >> + * This makes sure, that both errors and real sccb returns will only >> + * be delivered when we are unmasked. > > What makes this sure? That we only unmask here? Yes, we unmask here at a notification intercept (instruction is complete).. I will use: /* * 2 cases: * a: an sccb answering interrupt was already pending or in flight. * As the sccb value is not known we can simply set some value to * trigger delivery of a saved SCCB. UV will then use its saved * copy of the SCCB value. * b: an error SCCB interrupt needs to be injected so we also inject * a fake SCCB address. Firmware will use the proper one. * This makes sure, that both errors and real sccb returns will only * be delivered after a notification intercept (instruction has * finished) but not after others. */