From: gaosong <gaosong@loongson.cn>
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: philmd@redhat.com, peter.maydell@linaro.org, eblake@redhat.com,
armbru@redhat.com, maobibo@loongson.cn
Subject: Re: [PATCH v1 2/3] target/loongarch: Allow user enable/disable LSX/LASX features
Date: Thu, 19 Oct 2023 11:27:19 +0800 [thread overview]
Message-ID: <012c5dbb-a70f-f46a-4ab5-8284e2a7fc50@loongson.cn> (raw)
In-Reply-To: <88eb5431-9183-4619-8049-2910544f6b68@linaro.org>
在 2023/10/19 上午7:47, Richard Henderson 写道:
> On 10/18/23 01:59, Song Gao wrote:
>> Some users may not need LSX/LASX, this patch allows the user
>> enable/disable LSX/LASX features.
>>
>> e.g
>> '-cpu max,lsx=on,lasx=on' (default);
>> '-cpu max,lsx=on,lasx=off' (enabled LSX);
>> '-cpu max,lsx=off,lasx=on' (error, need lsx=on);
>> '-cpu max,lsx=off' (disable LSX and LASX).
>
> ...
>
>> + /* CPU has LSX */
>> + bool has_lsx;
>> + /* CPU has LASX */
>> + bool has_lasx;
>
> Why do you need these variables?
>
> I suspect that you've copied them from one of the more complex Arm
> cases where we need to resolve multiple properties simultaneously
> during realize.
>
> You'll get identical behaviour in your current code if you drop these
> and rely only on the CPUCFG2 bits.
>
> If you wanted to do something more complex, you could use OnOffAuto,
> so that you can detect conflicting settings (such as #3 above), but
> not generate an error for
>
> -cpu foo,lasx=on
>
Got it, thanks for you suggestion.
> where 'foo' is some cpu model which does *no* default lsx=on. You
> would see that has_lsx==AUTO && has_lasx==ON and then set lsx=ON.
>
Some cpu model not support lasx or lsx feature, we should't allow user
set lsx=on or lasx=on.
I think we need env->features. set the feature when the cpu model
support this feature.
If the cpu model support the feature, we allow user set CPUCFG to
enable/disable this feature.
Do you have more suggestion?
Thanks.
Song Gao
next prev parent reply other threads:[~2023-10-19 3:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 8:59 [PATCH v1 0/3] Allow user enable/disable LSX/LASX features Song Gao
2023-10-18 8:59 ` [PATCH v1 1/3] target/loongarch: Add cpu model 'max' Song Gao
2023-10-18 8:59 ` [PATCH v1 2/3] target/loongarch: Allow user enable/disable LSX/LASX features Song Gao
2023-10-18 23:47 ` Richard Henderson
2023-10-19 3:27 ` gaosong [this message]
2023-10-18 8:59 ` [PATCH v1 3/3] target/loongarch: Implement query-cpu-model-expansion Song Gao
2023-10-18 10:47 ` Markus Armbruster
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=012c5dbb-a70f-f46a-4ab5-8284e2a7fc50@loongson.cn \
--to=gaosong@loongson.cn \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=maobibo@loongson.cn \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).