From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Bibo Mao <maobibo@loongson.cn>, Song Gao <gaosong@loongson.cn>
Cc: qemu-devel@nongnu.org
Subject: Re: [RFC v2 1/2] target/loongarch: Add loongson binary translation feature
Date: Mon, 27 May 2024 12:37:56 +0200 [thread overview]
Message-ID: <40cad008-6959-495c-97c0-978c0868bf86@linaro.org> (raw)
In-Reply-To: <20240527083501.844854-2-maobibo@loongson.cn>
Hi Bibo,
On 27/5/24 10:35, Bibo Mao wrote:
> Loongson Binary Translation (LBT) is used to accelerate binary
> translation, which contains 4 scratch registers (scr0 to scr3), x86/ARM
> eflags (eflags) and x87 fpu stack pointer (ftop).
>
> Now LBT feature is added in kvm mode, not supported in TCG mode since
> it is not emulated. There are two feature flags such as forced_features
> and default_features for each vcpu, the real feature is still in cpucfg.
> Flag forced_features is parsed from command line, default_features is
> parsed from cpu type.
>
> Flag forced_features has higher priority than flag default_features,
> default_features will be used if there is no command line option for LBT
> feature. If the feature is not supported with KVM host, it reports error
> and exits if forced_features is set, else it disables feature and continues
> if default_features is set.
>
> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
> ---
> target/loongarch/cpu.c | 69 +++++++++++++++++++++++++++
> target/loongarch/cpu.h | 12 +++++
> target/loongarch/kvm/kvm.c | 26 ++++++++++
> target/loongarch/kvm/kvm_loongarch.h | 16 +++++++
> target/loongarch/loongarch-qmp-cmds.c | 2 +-
> 5 files changed, 124 insertions(+), 1 deletion(-)
> +static void loongarch_set_lbt(Object *obj, bool value, Error **errp)
> +{
> + LoongArchCPU *cpu = LOONGARCH_CPU(obj);
> +
> + if (!kvm_enabled()) {
Either set errp, ...
> + return;
> + }
> +
> + if (value) {
> + /* Enable binary translation for all architectures */
> + cpu->env.forced_features |= BIT_ULL(LOONGARCH_FEATURE_LBT);
> + } else {
> + /* Disable default features also */
> + cpu->env.default_features &= ~BIT_ULL(LOONGARCH_FEATURE_LBT);
> + }
> +}
> +
> void loongarch_cpu_post_init(Object *obj)
> {
> object_property_add_bool(obj, "lsx", loongarch_get_lsx,
> loongarch_set_lsx);
> object_property_add_bool(obj, "lasx", loongarch_get_lasx,
> loongarch_set_lasx);
... or only add the property if KVM is enabled:
if (kvm_enabled()) {
> + object_property_add_bool(obj, "lbt", loongarch_get_lbt,
> + loongarch_set_lbt);
> }
next prev parent reply other threads:[~2024-05-27 10:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-27 8:34 [RFC v2 0/2] target/loongarch: Add loongson binary translation feature Bibo Mao
2024-05-27 8:35 ` [RFC v2 1/2] " Bibo Mao
2024-05-27 10:37 ` Philippe Mathieu-Daudé [this message]
2024-05-28 1:07 ` maobibo
2024-05-28 12:56 ` gaosong
2024-05-29 8:18 ` maobibo
2024-05-27 8:35 ` [RFC v2 2/2] target/loongarch: Implement lbt registers save/restore function Bibo Mao
2024-05-27 10:39 ` [RFC v2 0/2] target/loongarch: Add loongson binary translation feature Philippe Mathieu-Daudé
2024-05-28 1:14 ` maobibo
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=40cad008-6959-495c-97c0-978c0868bf86@linaro.org \
--to=philmd@linaro.org \
--cc=gaosong@loongson.cn \
--cc=maobibo@loongson.cn \
--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).