diff options
author | Song Gao <gaosong@loongson.cn> | 2024-09-12 20:53:40 +0800 |
---|---|---|
committer | Huacai Chen <chenhuacai@loongson.cn> | 2024-09-12 20:53:40 +0800 |
commit | f4e40ea9f78fed585e953bf38575e47d24922e1a (patch) | |
tree | 276a9131b25c79f8b8f1710c6ac4f145e2b710f4 /usr | |
parent | acc7f20d54a3eeceec7602b11d6e3462e7fba862 (diff) |
LoongArch: KVM: Add PMU support for guest
On LoongArch, the host and guest have their own PMU CSRs registers and
they share PMU hardware resources. A set of PMU CSRs consists of a CTRL
register and a CNTR register. We can set which PMU CSRs are used by the
guest by writing to the GCFG register [24:26] bits.
On KVM side:
- Save the host PMU CSRs into structure kvm_context.
- If the host supports the PMU feature.
- When entering guest mode, save the host PMU CSRs and restore the guest PMU CSRs.
- When exiting guest mode, save the guest PMU CSRs and restore the host PMU CSRs.
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'usr')
0 files changed, 0 insertions, 0 deletions