diff mbox series

target/loongarch/kvm: fpu save the vreg registers high 192bit

Message ID 20240514110752.989572-1-gaosong@loongson.cn
State New
Headers show
Series target/loongarch/kvm: fpu save the vreg registers high 192bit | expand

Commit Message

Song Gao May 14, 2024, 11:07 a.m. UTC
On kvm side, get_fpu/set_fpu save the vreg registers high 192bits,
but QEMU missing.

Signed-off-by: Song Gao <gaosong@loongson.cn>
---
 target/loongarch/kvm/kvm.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

maobibo May 14, 2024, 12:14 p.m. UTC | #1
Reviewed-by: Bibo Mao <maobibo@loongson.cn>

On 2024/5/14 下午7:07, Song Gao wrote:
> On kvm side, get_fpu/set_fpu save the vreg registers high 192bits,
> but QEMU missing.
> 
> Signed-off-by: Song Gao <gaosong@loongson.cn>
> ---
>   target/loongarch/kvm/kvm.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
> index a9f9020071..0b5dbb7ed8 100644
> --- a/target/loongarch/kvm/kvm.c
> +++ b/target/loongarch/kvm/kvm.c
> @@ -436,6 +436,9 @@ static int kvm_loongarch_get_regs_fp(CPUState *cs)
>       env->fcsr0 = fpu.fcsr;
>       for (i = 0; i < 32; i++) {
>           env->fpr[i].vreg.UD[0] = fpu.fpr[i].val64[0];
> +        env->fpr[i].vreg.UD[1] = fpu.fpr[i].val64[1];
> +        env->fpr[i].vreg.UD[2] = fpu.fpr[i].val64[2];
> +        env->fpr[i].vreg.UD[3] = fpu.fpr[i].val64[3];
>       }
>       for (i = 0; i < 8; i++) {
>           env->cf[i] = fpu.fcc & 0xFF;
> @@ -455,6 +458,9 @@ static int kvm_loongarch_put_regs_fp(CPUState *cs)
>       fpu.fcc = 0;
>       for (i = 0; i < 32; i++) {
>           fpu.fpr[i].val64[0] = env->fpr[i].vreg.UD[0];
> +        fpu.fpr[i].val64[1] = env->fpr[i].vreg.UD[1];
> +        fpu.fpr[i].val64[2] = env->fpr[i].vreg.UD[2];
> +        fpu.fpr[i].val64[3] = env->fpr[i].vreg.UD[3];
>       }
>   
>       for (i = 0; i < 8; i++) {
>
diff mbox series

Patch

diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index a9f9020071..0b5dbb7ed8 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -436,6 +436,9 @@  static int kvm_loongarch_get_regs_fp(CPUState *cs)
     env->fcsr0 = fpu.fcsr;
     for (i = 0; i < 32; i++) {
         env->fpr[i].vreg.UD[0] = fpu.fpr[i].val64[0];
+        env->fpr[i].vreg.UD[1] = fpu.fpr[i].val64[1];
+        env->fpr[i].vreg.UD[2] = fpu.fpr[i].val64[2];
+        env->fpr[i].vreg.UD[3] = fpu.fpr[i].val64[3];
     }
     for (i = 0; i < 8; i++) {
         env->cf[i] = fpu.fcc & 0xFF;
@@ -455,6 +458,9 @@  static int kvm_loongarch_put_regs_fp(CPUState *cs)
     fpu.fcc = 0;
     for (i = 0; i < 32; i++) {
         fpu.fpr[i].val64[0] = env->fpr[i].vreg.UD[0];
+        fpu.fpr[i].val64[1] = env->fpr[i].vreg.UD[1];
+        fpu.fpr[i].val64[2] = env->fpr[i].vreg.UD[2];
+        fpu.fpr[i].val64[3] = env->fpr[i].vreg.UD[3];
     }
 
     for (i = 0; i < 8; i++) {