All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Alrae <leon.alrae@imgtec.com>
To: James Hogan <james.hogan@imgtec.com>, <qemu-devel@nongnu.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Cc: <kvm@vger.kernel.org>, Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH v4 7/7] mips/kvm: Support MSA in MIPS KVM guests
Date: Tue, 2 Feb 2016 09:58:46 +0000	[thread overview]
Message-ID: <56B07DD6.8070203@imgtec.com> (raw)
In-Reply-To: <1450435564-30720-8-git-send-email-james.hogan@imgtec.com>

Hi James,

On 18/12/15 10:46, James Hogan wrote:
> @@ -611,17 +664,51 @@ static int kvm_mips_get_fpu_registers(CPUState *cs)
>              restore_flush_mode(env);
>          }
>  
> -        /* Floating point registers */
> -        for (i = 0; i < 32; ++i) {
> -            if (env->CP0_Status & (1 << CP0St_FR)) {
> -                err = kvm_mips_get_one_ureg64(cs, KVM_REG_MIPS_FPR_64(i),
> -                                              &env->active_fpu.fpr[i].d);
> -            } else {
> -                err = kvm_mips_get_one_ureg(cs, KVM_REG_MIPS_FPR_32(i),
> -                                      &env->active_fpu.fpr[i].w[FP_ENDIAN_IDX]);
> +        /*
> +         * FPU register state is a subset of MSA vector state, so don't save FPU
> +         * registers if we're emulating a CPU with MSA.
> +         */
> +        if (!(env->CP0_Config3 & (1 << CP0C3_MSAP))) {
> +            /* Floating point registers */
> +            for (i = 0; i < 32; ++i) {
> +                if (env->CP0_Status & (1 << CP0St_FR)) {
> +                    err = kvm_mips_get_one_ureg64(cs, KVM_REG_MIPS_FPR_64(i),
> +                                                  &env->active_fpu.fpr[i].d);
> +                } else {
> +                    err = kvm_mips_get_one_ureg(cs, KVM_REG_MIPS_FPR_32(i),
> +                                    &env->active_fpu.fpr[i].w[FP_ENDIAN_IDX]);
> +                }
> +                if (err < 0) {
> +                    DPRINTF("%s: Failed to get FPR%u (%d)\n", __func__, i, err);
> +                    ret = err;
> +                }
>              }
> +        }
> +    }
> +
> +    /* Only get MSA state if we're emulating a CPU with MSA */
> +    if (env->CP0_Config3 & (1 << CP0C3_MSAP)) {
> +        /* MSA Control Registers */
> +        err = kvm_mips_get_one_reg(cs, KVM_REG_MIPS_MSA_IR,
> +                                   &env->msair);
> +        if (err < 0) {
> +            DPRINTF("%s: Failed to get MSA_IR (%d)\n", __func__, err);
> +            ret = err;
> +        }
> +        err = kvm_mips_get_one_reg(cs, KVM_REG_MIPS_MSA_CSR,
> +                                   &env->active_tc.msacsr);
> +        if (err < 0) {
> +            DPRINTF("%s: Failed to get MSA_CSR (%d)\n", __func__, err);
> +            ret = err;
> +        }

Shouldn't MSA's float_status (i.e. msa_fp_status) be restored to reflect
MSACSR?

Thanks,
Leon

> +        /* Vector registers (includes FP registers) */
> +        for (i = 0; i < 32; ++i) {
> +            /* Big endian MSA not supported by QEMU yet anyway */
> +            err = kvm_mips_get_one_reg64(cs, KVM_REG_MIPS_VEC_128(i),
> +                                         env->active_fpu.fpr[i].wr.d);
>              if (err < 0) {
> -                DPRINTF("%s: Failed to get FPR%u (%d)\n", __func__, i, err);
> +                DPRINTF("%s: Failed to get VEC%u (%d)\n", __func__, i, err);
>                  ret = err;
>              }
>          }
> 


WARNING: multiple messages have this Message-ID (diff)
From: Leon Alrae <leon.alrae@imgtec.com>
To: James Hogan <james.hogan@imgtec.com>,
	qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH v4 7/7] mips/kvm: Support MSA in MIPS KVM guests
Date: Tue, 2 Feb 2016 09:58:46 +0000	[thread overview]
Message-ID: <56B07DD6.8070203@imgtec.com> (raw)
In-Reply-To: <1450435564-30720-8-git-send-email-james.hogan@imgtec.com>

Hi James,

On 18/12/15 10:46, James Hogan wrote:
> @@ -611,17 +664,51 @@ static int kvm_mips_get_fpu_registers(CPUState *cs)
>              restore_flush_mode(env);
>          }
>  
> -        /* Floating point registers */
> -        for (i = 0; i < 32; ++i) {
> -            if (env->CP0_Status & (1 << CP0St_FR)) {
> -                err = kvm_mips_get_one_ureg64(cs, KVM_REG_MIPS_FPR_64(i),
> -                                              &env->active_fpu.fpr[i].d);
> -            } else {
> -                err = kvm_mips_get_one_ureg(cs, KVM_REG_MIPS_FPR_32(i),
> -                                      &env->active_fpu.fpr[i].w[FP_ENDIAN_IDX]);
> +        /*
> +         * FPU register state is a subset of MSA vector state, so don't save FPU
> +         * registers if we're emulating a CPU with MSA.
> +         */
> +        if (!(env->CP0_Config3 & (1 << CP0C3_MSAP))) {
> +            /* Floating point registers */
> +            for (i = 0; i < 32; ++i) {
> +                if (env->CP0_Status & (1 << CP0St_FR)) {
> +                    err = kvm_mips_get_one_ureg64(cs, KVM_REG_MIPS_FPR_64(i),
> +                                                  &env->active_fpu.fpr[i].d);
> +                } else {
> +                    err = kvm_mips_get_one_ureg(cs, KVM_REG_MIPS_FPR_32(i),
> +                                    &env->active_fpu.fpr[i].w[FP_ENDIAN_IDX]);
> +                }
> +                if (err < 0) {
> +                    DPRINTF("%s: Failed to get FPR%u (%d)\n", __func__, i, err);
> +                    ret = err;
> +                }
>              }
> +        }
> +    }
> +
> +    /* Only get MSA state if we're emulating a CPU with MSA */
> +    if (env->CP0_Config3 & (1 << CP0C3_MSAP)) {
> +        /* MSA Control Registers */
> +        err = kvm_mips_get_one_reg(cs, KVM_REG_MIPS_MSA_IR,
> +                                   &env->msair);
> +        if (err < 0) {
> +            DPRINTF("%s: Failed to get MSA_IR (%d)\n", __func__, err);
> +            ret = err;
> +        }
> +        err = kvm_mips_get_one_reg(cs, KVM_REG_MIPS_MSA_CSR,
> +                                   &env->active_tc.msacsr);
> +        if (err < 0) {
> +            DPRINTF("%s: Failed to get MSA_CSR (%d)\n", __func__, err);
> +            ret = err;
> +        }

Shouldn't MSA's float_status (i.e. msa_fp_status) be restored to reflect
MSACSR?

Thanks,
Leon

> +        /* Vector registers (includes FP registers) */
> +        for (i = 0; i < 32; ++i) {
> +            /* Big endian MSA not supported by QEMU yet anyway */
> +            err = kvm_mips_get_one_reg64(cs, KVM_REG_MIPS_VEC_128(i),
> +                                         env->active_fpu.fpr[i].wr.d);
>              if (err < 0) {
> -                DPRINTF("%s: Failed to get FPR%u (%d)\n", __func__, i, err);
> +                DPRINTF("%s: Failed to get VEC%u (%d)\n", __func__, i, err);
>                  ret = err;
>              }
>          }
> 

  reply	other threads:[~2016-02-02  9:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 10:45 [PATCH v4 0/7] mips/kvm: Support FPU & SIMD (MSA) in MIPS KVM guests James Hogan
2015-12-18 10:45 ` [Qemu-devel] " James Hogan
2015-12-18 10:45 ` [PATCH v4 1/7] mips/kvm: Remove a couple of noisy DPRINTFs James Hogan
2015-12-18 10:45   ` [Qemu-devel] " James Hogan
2015-12-18 10:45 ` [PATCH v4 2/7] mips/kvm: Implement PRid CP0 register James Hogan
2015-12-18 10:45   ` [Qemu-devel] " James Hogan
2015-12-18 10:46 ` [PATCH v4 3/7] mips/kvm: Implement Config CP0 registers James Hogan
2015-12-18 10:46   ` [Qemu-devel] " James Hogan
2015-12-18 10:46 ` [PATCH v4 4/7] mips/kvm: Support unsigned KVM registers James Hogan
2015-12-18 10:46   ` [Qemu-devel] " James Hogan
2015-12-18 10:46 ` [PATCH v4 5/7] mips/kvm: Support signed 64-bit " James Hogan
2015-12-18 10:46   ` [Qemu-devel] " James Hogan
2015-12-18 10:46 ` [PATCH v4 6/7] mips/kvm: Support FPU in MIPS KVM guests James Hogan
2015-12-18 10:46   ` [Qemu-devel] " James Hogan
2015-12-18 10:46 ` [PATCH v4 7/7] mips/kvm: Support MSA " James Hogan
2015-12-18 10:46   ` [Qemu-devel] " James Hogan
2016-02-02  9:58   ` Leon Alrae [this message]
2016-02-02  9:58     ` Leon Alrae
2016-02-02 12:39     ` James Hogan
2016-02-02 12:39       ` [Qemu-devel] " James Hogan
2016-02-02 13:56       ` Leon Alrae
2016-02-02 13:56         ` [Qemu-devel] " Leon Alrae

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B07DD6.8070203@imgtec.com \
    --to=leon.alrae@imgtec.com \
    --cc=aurelien@aurel32.net \
    --cc=james.hogan@imgtec.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.