From: Song Gao <gaosong@loongson.cn>
To: qemu-devel@nongnu.org
Cc: richard.henderson@linaro.org, Bibo Mao <maobibo@loongson.cn>
Subject: [PULL 3/3] target/loongarch: Put cpucfg operation before CSR register
Date: Thu, 9 May 2024 16:06:45 +0800 [thread overview]
Message-ID: <20240509080645.457303-4-gaosong@loongson.cn> (raw)
In-Reply-To: <20240509080645.457303-1-gaosong@loongson.cn>
From: Bibo Mao <maobibo@loongson.cn>
On Loongarch, cpucfg is register for cpu feature, some other registers
depend on cpucfg feature such as perf CSR registers. Here put cpucfg
read/write operations before CSR register, so that KVM knows how many
perf CSR registers are valid from pre-set cpucfg feature information.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20240428031651.1354587-1-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
target/loongarch/kvm/kvm.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
index 8224d94333..bc75552d0f 100644
--- a/target/loongarch/kvm/kvm.c
+++ b/target/loongarch/kvm/kvm.c
@@ -587,22 +587,22 @@ int kvm_arch_get_registers(CPUState *cs)
return ret;
}
- ret = kvm_loongarch_get_csr(cs);
+ ret = kvm_loongarch_get_cpucfg(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_get_regs_fp(cs);
+ ret = kvm_loongarch_get_csr(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_get_mpstate(cs);
+ ret = kvm_loongarch_get_regs_fp(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_get_cpucfg(cs);
+ ret = kvm_loongarch_get_mpstate(cs);
return ret;
}
@@ -615,22 +615,22 @@ int kvm_arch_put_registers(CPUState *cs, int level)
return ret;
}
- ret = kvm_loongarch_put_csr(cs, level);
+ ret = kvm_loongarch_put_cpucfg(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_put_regs_fp(cs);
+ ret = kvm_loongarch_put_csr(cs, level);
if (ret) {
return ret;
}
- ret = kvm_loongarch_put_mpstate(cs);
+ ret = kvm_loongarch_put_regs_fp(cs);
if (ret) {
return ret;
}
- ret = kvm_loongarch_put_cpucfg(cs);
+ ret = kvm_loongarch_put_mpstate(cs);
return ret;
}
--
2.25.1
next prev parent reply other threads:[~2024-05-09 8:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-09 8:06 [PULL 0/3] loongarch-to-apply queue Song Gao
2024-05-09 8:06 ` [PULL 1/3] hw/loongarch: Refine default numa id calculation Song Gao
2024-05-09 8:06 ` [PULL 2/3] target/loongarch: Add TCG macro in structure CPUArchState Song Gao
2024-05-09 8:06 ` Song Gao [this message]
2024-05-10 5:39 ` [PULL 0/3] loongarch-to-apply queue Richard Henderson
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=20240509080645.457303-4-gaosong@loongson.cn \
--to=gaosong@loongson.cn \
--cc=maobibo@loongson.cn \
--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 read-only IMAP folder(s) and NNTP newsgroup(s).