qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Aleksandar Rikalo <arikalo@gmail.com>,
	Hansni Bu <1926277@bugs.launchpad.net>
Cc: Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [PATCH v2] target/mips: Only update MVPControl.EVP bit if executed by master VPE
Date: Tue, 15 Jul 2025 08:57:27 +0200	[thread overview]
Message-ID: <3cfa886a-c0f2-40ae-af16-d9f019ab70d3@linaro.org> (raw)
In-Reply-To: <20210427133343.159718-1-f4bug@amsat.org>

Ping?

On 27/4/21 15:33, Philippe Mathieu-Daudé wrote:
> According to the 'MIPS MT Application-Specific Extension' manual:
> 
>    If the VPE executing the instruction is not a Master VPE,
>    with the MVP bit of the VPEConf0 register set, the EVP bit
>    is unchanged by the instruction.
> 
> Modify the DVPE/EVPE opcodes to only update the MVPControl.EVP bit
> if executed on a master VPE.
> 
> Reported-by: Hansni Bu <https://launchpad.net/%7Ehansni/+contactuser>
> Buglink: https://bugs.launchpad.net/qemu/+bug/1926277
> Fixes: f249412c749 ("mips: Add MT halting and waking of VPEs")
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Supersedes: <20210427103555.112652-1-f4bug@amsat.org>
> v2: Check VPEConf0.MVP bit (hansni)
> ---
>   target/mips/cp0_helper.c | 32 ++++++++++++++++++--------------
>   1 file changed, 18 insertions(+), 14 deletions(-)
> 
> diff --git a/target/mips/cp0_helper.c b/target/mips/cp0_helper.c
> index aae2af6eccc..d5f274f5cdf 100644
> --- a/target/mips/cp0_helper.c
> +++ b/target/mips/cp0_helper.c
> @@ -1635,12 +1635,14 @@ target_ulong helper_dvpe(CPUMIPSState *env)
>       CPUState *other_cs = first_cpu;
>       target_ulong prev = env->mvp->CP0_MVPControl;
>   
> -    CPU_FOREACH(other_cs) {
> -        MIPSCPU *other_cpu = MIPS_CPU(other_cs);
> -        /* Turn off all VPEs except the one executing the dvpe.  */
> -        if (&other_cpu->env != env) {
> -            other_cpu->env.mvp->CP0_MVPControl &= ~(1 << CP0MVPCo_EVP);
> -            mips_vpe_sleep(other_cpu);
> +    if (env->CP0_VPEConf0 & (1 << CP0VPEC0_MVP)) {
> +        CPU_FOREACH(other_cs) {
> +            MIPSCPU *other_cpu = MIPS_CPU(other_cs);
> +            /* Turn off all VPEs except the one executing the dvpe.  */
> +            if (&other_cpu->env != env) {
> +                other_cpu->env.mvp->CP0_MVPControl &= ~(1 << CP0MVPCo_EVP);
> +                mips_vpe_sleep(other_cpu);
> +            }
>           }
>       }
>       return prev;
> @@ -1651,15 +1653,17 @@ target_ulong helper_evpe(CPUMIPSState *env)
>       CPUState *other_cs = first_cpu;
>       target_ulong prev = env->mvp->CP0_MVPControl;
>   
> -    CPU_FOREACH(other_cs) {
> -        MIPSCPU *other_cpu = MIPS_CPU(other_cs);
> +    if (env->CP0_VPEConf0 & (1 << CP0VPEC0_MVP)) {
> +        CPU_FOREACH(other_cs) {
> +            MIPSCPU *other_cpu = MIPS_CPU(other_cs);
>   
> -        if (&other_cpu->env != env
> -            /* If the VPE is WFI, don't disturb its sleep.  */
> -            && !mips_vpe_is_wfi(other_cpu)) {
> -            /* Enable the VPE.  */
> -            other_cpu->env.mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP);
> -            mips_vpe_wake(other_cpu); /* And wake it up.  */
> +            if (&other_cpu->env != env
> +                /* If the VPE is WFI, don't disturb its sleep.  */
> +                && !mips_vpe_is_wfi(other_cpu)) {
> +                /* Enable the VPE.  */
> +                other_cpu->env.mvp->CP0_MVPControl |= (1 << CP0MVPCo_EVP);
> +                mips_vpe_wake(other_cpu); /* And wake it up.  */
> +            }
>           }
>       }
>       return prev;



  parent reply	other threads:[~2025-07-15  6:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-27  9:19 [Bug 1926277] [NEW] MIPS MT dvpe does not regard VPEConf0.MVP Hansni Bu
2021-04-27 10:35 ` [PATCH] target/mips: Only update MVPControl.EVP bit if executed on a master VPE Philippe Mathieu-Daudé
2021-04-27 10:35   ` [Bug 1926277] Re: MIPS MT dvpe does not regard VPEConf0.MVP Philippe Mathieu-Daudé
2021-04-27 11:42 ` Hansni Bu
2021-04-27 13:29 ` Philippe Mathieu-Daudé
2021-04-27 13:33 ` [PATCH v2] target/mips: Only update MVPControl.EVP bit if executed by master VPE Philippe Mathieu-Daudé
2021-04-27 13:33   ` [Bug 1926277] " Philippe Mathieu-Daudé
2025-07-15  6:57   ` Philippe Mathieu-Daudé [this message]
2025-07-15 19:06   ` [Bug 1926277] " Jiaxun Yang
2025-07-15 19:06     ` Jiaxun Yang
2025-07-28 15:51   ` Philippe Mathieu-Daudé
2021-05-09 16:16 ` [Bug 1926277] Re: MIPS MT dvpe does not regard VPEConf0.MVP Philippe Mathieu-Daudé

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=3cfa886a-c0f2-40ae-af16-d9f019ab70d3@linaro.org \
    --to=philmd@linaro.org \
    --cc=1926277@bugs.launchpad.net \
    --cc=aleksandar.rikalo@syrmia.com \
    --cc=arikalo@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=edgar.iglesias@gmail.com \
    --cc=jiaxun.yang@flygoat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).