Re: [PATCH 2/2] KVM: s390: selftests: Add load psw bear test

Christian Borntraeger
2026-03-25T10:30:04Z

Had a 2nd look.
Just wanted to test that lpswe does indeed leaves the BEAR unchanged and then I
realized that lpswey does not work in our guest due to missing cpu model.
So either remove the lpswey test for now or fix it.
Something like this on top

--- a/tools/testing/selftests/kvm/s390/bear.c
+++ b/tools/testing/selftests/kvm/s390/bear.c
@@ -22,7 +22,10 @@ static void guest_lpswey(void)
u64 bear;

asm volatile (
- " larl %%r3,lpswey_addr\n"
+ " larl %%r3,jump_addr\n"
+ "jump_addr:\n"
+ " j lpswey_addr\n"
+ " nop\n"
"lpswey_addr:\n"
" .insn siy,0xeb0000000071,%[psw],0\n"
" nop\n"
@@ -107,21 +110,30 @@ static void test_lpswey(void)
struct kvm_vcpu *vcpu;
struct kvm_run *run;
struct kvm_vm *vm;
+ struct kvm_s390_vm_cpu_processor proc;
+ int r;
+
+ vm = vm_create(1);
+ __kvm_device_attr_get(vm->fd, KVM_S390_VM_CPU_MODEL,
+ KVM_S390_VM_CPU_PROCESSOR, &proc);
+ proc.fac_list[3] |= 0x4000000000000000UL;
+ r = __kvm_device_attr_set(vm->fd, KVM_S390_VM_CPU_MODEL,
+ KVM_S390_VM_CPU_PROCESSOR, &proc);
+ vcpu = vm_vcpu_add(vm, 0, guest_lpswey);

- vm = vm_create_with_one_vcpu(&vcpu, guest_lpswey);
inject_mcheck(vcpu);
run = vcpu->run;
vcpu_run(vcpu);
- ksft_test_result(run->s.regs.gprs[3] != run->s.regs.gprs[4],
- "emulation: lpswey bear does not match\n");
+ ksft_test_result(run->s.regs.gprs[3] == run->s.regs.gprs[4],
+ "emulation: lpswey bear does match previous\n");
kvm_vm_free(vm);

vm = vm_create_with_one_vcpu(&vcpu, guest_lpswey);
run = vcpu->run;
vcpu_run(vcpu);
ksft_test_result(run->s.regs.gprs[3] &&
- run->s.regs.gprs[3] != run->s.regs.gprs[4],
- "interpretation: lpswey bear does not match\n");
+ run->s.regs.gprs[3] == run->s.regs.gprs[4],
+ "interpretation: lpswey bear does match previous\n");
kvm_vm_free(vm);
}