KVM: s390: Fix z16 support
The z16 support might fail with the lpswey instruction. Provide a handler. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEE+SKTgaM0CPnbq/vKEXu8gLWmHHwFAmaGXwoACgkQEXu8gLWm HHwLxQ/8CRfHozlka2OzT/aYNVWlo2+bSFBnLeCKr1gqN0zvKrkl9YMCgrk9D5Qc JOMVEGFvfFduDdkK4Jyi9WCRlph837BOEknQQpwB4T684eHagPWrLyRao4vWkqjT lpdJ+HdzPhtbStOho0/V1SzgcASYNODTDcBCJ2y2PngzGY4m8GmsYhVVGCFtFcco U+KfgXN1QA5AyGMgPYsJGQjvCAr43EPL9wpQNqaykYLOMj0X71NZQxoqWKw2SFB2 MazKo7zzWiP7BlpY4Ed3LfRpzcNzVNc17OIbmItSTOaDrh1GHiSTjAj/iP6N321/ ggwIg9McLo63WFB8lVKnQcE/i6qCSFZ9xqxRUWBMD28ksuCBuecwqeSlP7IllTpY Y6QHgQiDjqhlPDC2Ts5ikJVbmDX8ljfQ87P+YnePY9G0TIqFf3+2iBNqCML0nzYp 8xn/3osotzO3D18scxueiTm0HGXrQVJ5wqxSApOu7gxG6gwmFJSpAVvM9My3YRPx Mrc+zRqoSrpKFOD9aAuzOIiBSI/jslG7fNeFRcpIiKTNPcy1Jlyw9RKN+ePku3n/ 4rZKOAiEhoavIXQ/SBwXX0BsaXo8oONRNBaAJ0iqGLAnNOTa6lwpVeBSgfzKYi5q H0vUcyeKNfsuX1S+6o7+y3zjV6kZ3OAsW1ojCSZXdyoQvfjGQ5s= =di1S -----END PGP SIGNATURE----- Merge tag 'kvm-s390-master-6.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD KVM: s390: Fix z16 support The z16 support might fail with the lpswey instruction. Provide a handler.
This commit is contained in:
commit
8ad209fc64
@ -427,6 +427,7 @@ struct kvm_vcpu_stat {
|
||||
u64 instruction_io_other;
|
||||
u64 instruction_lpsw;
|
||||
u64 instruction_lpswe;
|
||||
u64 instruction_lpswey;
|
||||
u64 instruction_pfmf;
|
||||
u64 instruction_ptff;
|
||||
u64 instruction_sck;
|
||||
|
@ -132,6 +132,7 @@ const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = {
|
||||
STATS_DESC_COUNTER(VCPU, instruction_io_other),
|
||||
STATS_DESC_COUNTER(VCPU, instruction_lpsw),
|
||||
STATS_DESC_COUNTER(VCPU, instruction_lpswe),
|
||||
STATS_DESC_COUNTER(VCPU, instruction_lpswey),
|
||||
STATS_DESC_COUNTER(VCPU, instruction_pfmf),
|
||||
STATS_DESC_COUNTER(VCPU, instruction_ptff),
|
||||
STATS_DESC_COUNTER(VCPU, instruction_sck),
|
||||
|
@ -138,6 +138,21 @@ static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu, u8 *ar)
|
||||
return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2;
|
||||
}
|
||||
|
||||
static inline u64 kvm_s390_get_base_disp_siy(struct kvm_vcpu *vcpu, u8 *ar)
|
||||
{
|
||||
u32 base1 = vcpu->arch.sie_block->ipb >> 28;
|
||||
s64 disp1;
|
||||
|
||||
/* The displacement is a 20bit _SIGNED_ value */
|
||||
disp1 = sign_extend64(((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) +
|
||||
((vcpu->arch.sie_block->ipb & 0xff00) << 4), 19);
|
||||
|
||||
if (ar)
|
||||
*ar = base1;
|
||||
|
||||
return (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + disp1;
|
||||
}
|
||||
|
||||
static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu,
|
||||
u64 *address1, u64 *address2,
|
||||
u8 *ar_b1, u8 *ar_b2)
|
||||
|
@ -797,6 +797,36 @@ static int handle_lpswe(struct kvm_vcpu *vcpu)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_lpswey(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
psw_t new_psw;
|
||||
u64 addr;
|
||||
int rc;
|
||||
u8 ar;
|
||||
|
||||
vcpu->stat.instruction_lpswey++;
|
||||
|
||||
if (!test_kvm_facility(vcpu->kvm, 193))
|
||||
return kvm_s390_inject_program_int(vcpu, PGM_OPERATION);
|
||||
|
||||
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
|
||||
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
|
||||
|
||||
addr = kvm_s390_get_base_disp_siy(vcpu, &ar);
|
||||
if (addr & 7)
|
||||
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
|
||||
|
||||
rc = read_guest(vcpu, addr, ar, &new_psw, sizeof(new_psw));
|
||||
if (rc)
|
||||
return kvm_s390_inject_prog_cond(vcpu, rc);
|
||||
|
||||
vcpu->arch.sie_block->gpsw = new_psw;
|
||||
if (!is_valid_psw(&vcpu->arch.sie_block->gpsw))
|
||||
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_stidp(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
u64 stidp_data = vcpu->kvm->arch.model.cpuid;
|
||||
@ -1462,6 +1492,8 @@ int kvm_s390_handle_eb(struct kvm_vcpu *vcpu)
|
||||
case 0x61:
|
||||
case 0x62:
|
||||
return handle_ri(vcpu);
|
||||
case 0x71:
|
||||
return handle_lpswey(vcpu);
|
||||
default:
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user