|
@@ -249,12 +249,18 @@ static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter)
|
|
static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
|
|
static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
|
|
u64 *reg)
|
|
u64 *reg)
|
|
{
|
|
{
|
|
- struct kvm_s390_float_interrupt *fi = &vcpu->kvm->arch.float_int;
|
|
|
|
- struct kvm_s390_local_interrupt *li = NULL;
|
|
|
|
|
|
+ struct kvm_s390_local_interrupt *li;
|
|
|
|
+ struct kvm_vcpu *dst_vcpu = NULL;
|
|
struct kvm_s390_interrupt_info *inti;
|
|
struct kvm_s390_interrupt_info *inti;
|
|
int rc;
|
|
int rc;
|
|
u8 tmp;
|
|
u8 tmp;
|
|
|
|
|
|
|
|
+ if (cpu_addr < KVM_MAX_VCPUS)
|
|
|
|
+ dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
|
|
|
|
+ if (!dst_vcpu)
|
|
|
|
+ return SIGP_CC_NOT_OPERATIONAL;
|
|
|
|
+ li = &dst_vcpu->arch.local_int;
|
|
|
|
+
|
|
/* make sure that the new value is valid memory */
|
|
/* make sure that the new value is valid memory */
|
|
address = address & 0x7fffe000u;
|
|
address = address & 0x7fffe000u;
|
|
if (copy_from_guest_absolute(vcpu, &tmp, address, 1) ||
|
|
if (copy_from_guest_absolute(vcpu, &tmp, address, 1) ||
|
|
@@ -268,18 +274,6 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
|
|
if (!inti)
|
|
if (!inti)
|
|
return SIGP_CC_BUSY;
|
|
return SIGP_CC_BUSY;
|
|
|
|
|
|
- spin_lock(&fi->lock);
|
|
|
|
- if (cpu_addr < KVM_MAX_VCPUS)
|
|
|
|
- li = fi->local_int[cpu_addr];
|
|
|
|
-
|
|
|
|
- if (li == NULL) {
|
|
|
|
- *reg &= 0xffffffff00000000UL;
|
|
|
|
- *reg |= SIGP_STATUS_INCORRECT_STATE;
|
|
|
|
- rc = SIGP_CC_STATUS_STORED;
|
|
|
|
- kfree(inti);
|
|
|
|
- goto out_fi;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
spin_lock_bh(&li->lock);
|
|
spin_lock_bh(&li->lock);
|
|
/* cpu must be in stopped state */
|
|
/* cpu must be in stopped state */
|
|
if (!(atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) {
|
|
if (!(atomic_read(li->cpuflags) & CPUSTAT_STOPPED)) {
|
|
@@ -302,8 +296,6 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
|
|
VCPU_EVENT(vcpu, 4, "set prefix of cpu %02x to %x", cpu_addr, address);
|
|
VCPU_EVENT(vcpu, 4, "set prefix of cpu %02x to %x", cpu_addr, address);
|
|
out_li:
|
|
out_li:
|
|
spin_unlock_bh(&li->lock);
|
|
spin_unlock_bh(&li->lock);
|
|
-out_fi:
|
|
|
|
- spin_unlock(&fi->lock);
|
|
|
|
return rc;
|
|
return rc;
|
|
}
|
|
}
|
|
|
|
|