Skip to content

Commit 6bfb3a7

Browse files
bibo-maochenhuacai
authored andcommitted
LoongArch: KVM: Register perf callbacks for guest
Add selection for GUEST_PERF_EVENTS if KVM is enabled, also add perf callback register when KVM module is loading. Signed-off-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
1 parent 2bf463d commit 6bfb3a7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

arch/loongarch/kvm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ config KVM
3333
select KVM_MMIO
3434
select KVM_XFER_TO_GUEST_WORK
3535
select SCHED_INFO
36+
select GUEST_PERF_EVENTS if PERF_EVENTS
3637
help
3738
Support hosting virtualized guest machines using
3839
hardware virtualization extensions. You will need

arch/loongarch/kvm/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ static int kvm_loongarch_env_init(void)
394394
}
395395

396396
kvm_init_gcsr_flag();
397+
kvm_register_perf_callbacks(NULL);
397398

398399
/* Register LoongArch IPI interrupt controller interface. */
399400
ret = kvm_loongarch_register_ipi_device();
@@ -425,6 +426,8 @@ static void kvm_loongarch_env_exit(void)
425426
}
426427
kfree(kvm_loongarch_ops);
427428
}
429+
430+
kvm_unregister_perf_callbacks();
428431
}
429432

430433
static int kvm_loongarch_init(void)

0 commit comments

Comments
 (0)