aboutsummaryrefslogtreecommitdiffstats
path: root/arch/loongarch/include/uapi
diff options
context:
space:
mode:
authorSong Gao <gaosong@loongson.cn>2024-09-12 20:53:40 +0800
committerHuacai Chen <chenhuacai@loongson.cn>2024-09-12 20:53:40 +0800
commitf4e40ea9f78fed585e953bf38575e47d24922e1a (patch)
tree276a9131b25c79f8b8f1710c6ac4f145e2b710f4 /arch/loongarch/include/uapi
parentLoongArch: KVM: Add vm migration support for LBT registers (diff)
downloadlinux-f4e40ea9f78fed585e953bf38575e47d24922e1a.tar.gz
linux-f4e40ea9f78fed585e953bf38575e47d24922e1a.zip
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 'arch/loongarch/include/uapi')
-rw-r--r--arch/loongarch/include/uapi/asm/kvm.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/loongarch/include/uapi/asm/kvm.h b/arch/loongarch/include/uapi/asm/kvm.h
index 003fb766c93f..06778dd37ad1 100644
--- a/arch/loongarch/include/uapi/asm/kvm.h
+++ b/arch/loongarch/include/uapi/asm/kvm.h
@@ -98,6 +98,7 @@ struct kvm_fpu {
#define KVM_LOONGARCH_VM_FEAT_X86BT 2
#define KVM_LOONGARCH_VM_FEAT_ARMBT 3
#define KVM_LOONGARCH_VM_FEAT_MIPSBT 4
+#define KVM_LOONGARCH_VM_FEAT_PMU 5
/* Device Control API on vcpu fd */
#define KVM_LOONGARCH_VCPU_CPUCFG 0