mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
LoongArch: KVM: Fix FPU register width with user access API
At the beginning, only 64 bit FPU is supported. With FPU register get
interface, 64 bit FPU data is copied to user space, the same with FPU
register set API. However with LSX and LASX supported in later, there
should be FPU data copied with bigger width. So here fixes this issue,
copy the whole 256 bit FPU data from/to user space.
Cc: stable@vger.kernel.org
Fixes: db1ecca22e ("LoongArch: KVM: Add LSX (128bit SIMD) support")
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
848c55a2c9
commit
f4caaac763
|
|
@ -1303,7 +1303,7 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
|||
fpu->fcc = vcpu->arch.fpu.fcc;
|
||||
fpu->fcsr = vcpu->arch.fpu.fcsr;
|
||||
for (i = 0; i < NUM_FPU_REGS; i++)
|
||||
memcpy(&fpu->fpr[i], &vcpu->arch.fpu.fpr[i], FPU_REG_WIDTH / 64);
|
||||
memcpy(&fpu->fpr[i], &vcpu->arch.fpu.fpr[i], sizeof(union fpureg));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1315,7 +1315,7 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
|
|||
vcpu->arch.fpu.fcc = fpu->fcc;
|
||||
vcpu->arch.fpu.fcsr = fpu->fcsr;
|
||||
for (i = 0; i < NUM_FPU_REGS; i++)
|
||||
memcpy(&vcpu->arch.fpu.fpr[i], &fpu->fpr[i], FPU_REG_WIDTH / 64);
|
||||
memcpy(&vcpu->arch.fpu.fpr[i], &fpu->fpr[i], sizeof(union fpureg));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user