Skip to content

Commit 7119dec

Browse files
Janis Schoetterl-Glauschborntraeger
authored andcommitted
KVM: s390: Enable specification exception interpretation
When this feature is enabled the hardware is free to interpret specification exceptions generated by the guest, instead of causing program interruption interceptions. This benefits (test) programs that generate a lot of specification exceptions (roughly 4x increase in exceptions/sec). Interceptions will occur as before if ICTL_PINT is set, i.e. if guest debug is enabled. There is no indication if this feature is available or not and the hardware is free to interpret or not. So we can simply set this bit and if the hardware ignores it we fall back to intercept 8 handling. Signed-off-by: Janis Schoetterl-Glausch <[email protected]> Link: https://lore.kernel.org/linux-s390/[email protected]/ Reviewed-by: David Hildenbrand <[email protected]> Reviewed-by: Christian Borntraeger <[email protected]> Signed-off-by: Christian Borntraeger <[email protected]>
1 parent 1f703d2 commit 7119dec

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ struct kvm_s390_sie_block {
244244
__u8 fpf; /* 0x0060 */
245245
#define ECB_GS 0x40
246246
#define ECB_TE 0x10
247+
#define ECB_SPECI 0x08
247248
#define ECB_SRSI 0x04
248249
#define ECB_HOSTPROTINT 0x02
249250
__u8 ecb; /* 0x0061 */

arch/s390/kvm/kvm-s390.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3180,6 +3180,8 @@ static int kvm_s390_vcpu_setup(struct kvm_vcpu *vcpu)
31803180
vcpu->arch.sie_block->ecb |= ECB_SRSI;
31813181
if (test_kvm_facility(vcpu->kvm, 73))
31823182
vcpu->arch.sie_block->ecb |= ECB_TE;
3183+
if (!kvm_is_ucontrol(vcpu->kvm))
3184+
vcpu->arch.sie_block->ecb |= ECB_SPECI;
31833185

31843186
if (test_kvm_facility(vcpu->kvm, 8) && vcpu->kvm->arch.use_pfmfi)
31853187
vcpu->arch.sie_block->ecb2 |= ECB2_PFMFI;

arch/s390/kvm/vsie.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,8 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
510510
prefix_unmapped(vsie_page);
511511
scb_s->ecb |= ECB_TE;
512512
}
513+
/* specification exception interpretation */
514+
scb_s->ecb |= scb_o->ecb & ECB_SPECI;
513515
/* branch prediction */
514516
if (test_kvm_facility(vcpu->kvm, 82))
515517
scb_s->fpf |= scb_o->fpf & FPF_BPBC;

0 commit comments

Comments
 (0)