Commit 1a03b764 authored by Jens Freimann's avatar Jens Freimann Committed by Christian Borntraeger

KVM: s390: convert local irqs in __do_deliver_interrupt()

Convert local irqs in __do_deliver_interrupt() to new guest
access functions.
Signed-off-by: default avatarJens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
parent 7988276d
...@@ -186,26 +186,28 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, ...@@ -186,26 +186,28 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
vcpu->stat.deliver_emergency_signal++; vcpu->stat.deliver_emergency_signal++;
trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
inti->emerg.code, 0); inti->emerg.code, 0);
rc = put_guest(vcpu, 0x1201, (u16 __user *)__LC_EXT_INT_CODE); rc = put_guest_lc(vcpu, 0x1201, (u16 *)__LC_EXT_INT_CODE);
rc |= put_guest(vcpu, inti->emerg.code, rc |= put_guest_lc(vcpu, inti->emerg.code,
(u16 __user *)__LC_EXT_CPU_ADDR); (u16 *)__LC_EXT_CPU_ADDR);
rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW, rc |= write_guest_lc(vcpu, __LC_EXT_OLD_PSW,
&vcpu->arch.sie_block->gpsw, sizeof(psw_t));
rc |= read_guest_lc(vcpu, __LC_EXT_NEW_PSW,
&vcpu->arch.sie_block->gpsw, sizeof(psw_t)); &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw,
__LC_EXT_NEW_PSW, sizeof(psw_t));
break; break;
case KVM_S390_INT_EXTERNAL_CALL: case KVM_S390_INT_EXTERNAL_CALL:
VCPU_EVENT(vcpu, 4, "%s", "interrupt: sigp ext call"); VCPU_EVENT(vcpu, 4, "%s", "interrupt: sigp ext call");
vcpu->stat.deliver_external_call++; vcpu->stat.deliver_external_call++;
trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
inti->extcall.code, 0); inti->extcall.code, 0);
rc = put_guest(vcpu, 0x1202, (u16 __user *)__LC_EXT_INT_CODE); rc = put_guest_lc(vcpu, 0x1202, (u16 *)__LC_EXT_INT_CODE);
rc |= put_guest(vcpu, inti->extcall.code, rc |= put_guest_lc(vcpu, inti->extcall.code,
(u16 __user *)__LC_EXT_CPU_ADDR); (u16 *)__LC_EXT_CPU_ADDR);
rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW, rc |= write_guest_lc(vcpu, __LC_EXT_OLD_PSW,
&vcpu->arch.sie_block->gpsw, sizeof(psw_t)); &vcpu->arch.sie_block->gpsw,
rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
__LC_EXT_NEW_PSW, sizeof(psw_t)); rc |= read_guest_lc(vcpu, __LC_EXT_NEW_PSW,
&vcpu->arch.sie_block->gpsw,
sizeof(psw_t));
break; break;
case KVM_S390_INT_SERVICE: case KVM_S390_INT_SERVICE:
VCPU_EVENT(vcpu, 4, "interrupt: sclp parm:%x", VCPU_EVENT(vcpu, 4, "interrupt: sclp parm:%x",
...@@ -225,14 +227,14 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, ...@@ -225,14 +227,14 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
case KVM_S390_INT_PFAULT_INIT: case KVM_S390_INT_PFAULT_INIT:
trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 0, trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 0,
inti->ext.ext_params2); inti->ext.ext_params2);
rc = put_guest(vcpu, 0x2603, (u16 __user *) __LC_EXT_INT_CODE); rc = put_guest_lc(vcpu, 0x2603, (u16 *) __LC_EXT_INT_CODE);
rc |= put_guest(vcpu, 0x0600, (u16 __user *) __LC_EXT_CPU_ADDR); rc |= put_guest_lc(vcpu, 0x0600, (u16 *) __LC_EXT_CPU_ADDR);
rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW, rc |= write_guest_lc(vcpu, __LC_EXT_OLD_PSW,
&vcpu->arch.sie_block->gpsw, sizeof(psw_t));
rc |= read_guest_lc(vcpu, __LC_EXT_NEW_PSW,
&vcpu->arch.sie_block->gpsw, sizeof(psw_t)); &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw, rc |= put_guest_lc(vcpu, inti->ext.ext_params2,
__LC_EXT_NEW_PSW, sizeof(psw_t)); (u64 *) __LC_EXT_PARAMS2);
rc |= put_guest(vcpu, inti->ext.ext_params2,
(u64 __user *) __LC_EXT_PARAMS2);
break; break;
case KVM_S390_INT_PFAULT_DONE: case KVM_S390_INT_PFAULT_DONE:
trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 0, trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, 0,
...@@ -288,12 +290,12 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, ...@@ -288,12 +290,12 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
vcpu->stat.deliver_restart_signal++; vcpu->stat.deliver_restart_signal++;
trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
0, 0); 0, 0);
rc = copy_to_guest(vcpu, rc = write_guest_lc(vcpu,
offsetof(struct _lowcore, restart_old_psw), offsetof(struct _lowcore, restart_old_psw),
&vcpu->arch.sie_block->gpsw, sizeof(psw_t)); &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw, rc |= read_guest_lc(vcpu, offsetof(struct _lowcore, restart_psw),
offsetof(struct _lowcore, restart_psw), &vcpu->arch.sie_block->gpsw,
sizeof(psw_t)); sizeof(psw_t));
atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags); atomic_clear_mask(CPUSTAT_STOPPED, &vcpu->arch.sie_block->cpuflags);
break; break;
case KVM_S390_PROGRAM_INT: case KVM_S390_PROGRAM_INT:
...@@ -303,13 +305,15 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu, ...@@ -303,13 +305,15 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
vcpu->stat.deliver_program_int++; vcpu->stat.deliver_program_int++;
trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type, trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, inti->type,
inti->pgm.code, 0); inti->pgm.code, 0);
rc = put_guest(vcpu, inti->pgm.code, (u16 __user *)__LC_PGM_INT_CODE); rc = put_guest_lc(vcpu, inti->pgm.code,
rc |= put_guest(vcpu, table[vcpu->arch.sie_block->ipa >> 14], (u16 __user *)__LC_PGM_INT_CODE);
(u16 __user *)__LC_PGM_ILC); rc |= put_guest_lc(vcpu, table[vcpu->arch.sie_block->ipa >> 14],
rc |= copy_to_guest(vcpu, __LC_PGM_OLD_PSW, (u16 __user *)__LC_PGM_ILC);
&vcpu->arch.sie_block->gpsw, sizeof(psw_t)); rc |= write_guest_lc(vcpu, __LC_PGM_OLD_PSW,
rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw, &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
__LC_PGM_NEW_PSW, sizeof(psw_t)); rc |= read_guest_lc(vcpu, __LC_PGM_NEW_PSW,
&vcpu->arch.sie_block->gpsw,
sizeof(psw_t));
break; break;
case KVM_S390_MCHK: case KVM_S390_MCHK:
...@@ -372,11 +376,12 @@ static int __try_deliver_ckc_interrupt(struct kvm_vcpu *vcpu) ...@@ -372,11 +376,12 @@ static int __try_deliver_ckc_interrupt(struct kvm_vcpu *vcpu)
return 0; return 0;
if (!(vcpu->arch.sie_block->gcr[0] & 0x800ul)) if (!(vcpu->arch.sie_block->gcr[0] & 0x800ul))
return 0; return 0;
rc = put_guest(vcpu, 0x1004, (u16 __user *)__LC_EXT_INT_CODE); rc = put_guest_lc(vcpu, 0x1004, (u16 __user *)__LC_EXT_INT_CODE);
rc |= copy_to_guest(vcpu, __LC_EXT_OLD_PSW, rc |= write_guest_lc(vcpu, __LC_EXT_OLD_PSW,
&vcpu->arch.sie_block->gpsw, sizeof(psw_t)); &vcpu->arch.sie_block->gpsw, sizeof(psw_t));
rc |= copy_from_guest(vcpu, &vcpu->arch.sie_block->gpsw, rc |= read_guest_lc(vcpu, __LC_EXT_NEW_PSW,
__LC_EXT_NEW_PSW, sizeof(psw_t)); &vcpu->arch.sie_block->gpsw,
sizeof(psw_t));
if (rc) { if (rc) {
printk("kvm: The guest lowcore is not mapped during interrupt " printk("kvm: The guest lowcore is not mapped during interrupt "
"delivery, killing userspace\n"); "delivery, killing userspace\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment