Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 20b8f9e2 authored by Paolo Bonzini's avatar Paolo Bonzini
Browse files

Merge tag 'kvm-s390-master-4.8-2' of...

Merge tag 'kvm-s390-master-4.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into kvm-master

KVM: s390: Fix for fpu register errors since 4.7

This fixes a regression that was introduced by a semantic
change in commit 3f6813b9 ("s390/fpu: allocate 'struct
fpu' with the task_struct"). Symptoms are broken host userspace
fpu registers if the old FPU set/get ioctls are used.
parents 3eab887a a7d4b8f2
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -2231,9 +2231,10 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
		return -EINVAL;
		return -EINVAL;
	current->thread.fpu.fpc = fpu->fpc;
	current->thread.fpu.fpc = fpu->fpc;
	if (MACHINE_HAS_VX)
	if (MACHINE_HAS_VX)
		convert_fp_to_vx(current->thread.fpu.vxrs, (freg_t *)fpu->fprs);
		convert_fp_to_vx((__vector128 *) vcpu->run->s.regs.vrs,
				 (freg_t *) fpu->fprs);
	else
	else
		memcpy(current->thread.fpu.fprs, &fpu->fprs, sizeof(fpu->fprs));
		memcpy(vcpu->run->s.regs.fprs, &fpu->fprs, sizeof(fpu->fprs));
	return 0;
	return 0;
}
}


@@ -2242,9 +2243,10 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
	/* make sure we have the latest values */
	/* make sure we have the latest values */
	save_fpu_regs();
	save_fpu_regs();
	if (MACHINE_HAS_VX)
	if (MACHINE_HAS_VX)
		convert_vx_to_fp((freg_t *)fpu->fprs, current->thread.fpu.vxrs);
		convert_vx_to_fp((freg_t *) fpu->fprs,
				 (__vector128 *) vcpu->run->s.regs.vrs);
	else
	else
		memcpy(fpu->fprs, current->thread.fpu.fprs, sizeof(fpu->fprs));
		memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs));
	fpu->fpc = current->thread.fpu.fpc;
	fpu->fpc = current->thread.fpu.fpc;
	return 0;
	return 0;
}
}