linux/arch/loongarch/power
Huacai Chen 2135336574 LoongArch: Save and restore CSR.CNTC for hibernation
commit ceb9155d05 upstream.

Save and restore CSR.CNTC for hibernation which is similar to suspend.

For host this is unnecessary because sched clock is ensured continuous,
but for kvm guest sched clock isn't enough because rdtime.d should also
be continuous.

Host::rdtime.d = Host::CSR.CNTC + counter
Guest::rdtime.d = Host::CSR.CNTC + Host::CSR.GCNTC + Guest::CSR.CNTC + counter

so,

Guest::rdtime.d = Host::rdtime.d + Host::CSR.GCNTC + Guest::CSR.CNTC

To ensure Guest::rdtime.d continuous, Host::rdtime.d should be at first
continuous, while Host::CSR.GCNTC / Guest::CSR.CNTC is maintained by KVM.

Cc: stable@vger.kernel.org
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-05-22 14:29:44 +02:00
..
hibernate.c LoongArch: Save and restore CSR.CNTC for hibernation 2025-05-22 14:29:44 +02:00
hibernate_asm.S LoongArch: Add hibernation (ACPI S4) support 2022-12-14 08:41:53 +08:00
Makefile LoongArch: Add hibernation (ACPI S4) support 2022-12-14 08:41:53 +08:00
platform.c LoongArch: Fix warnings during S3 suspend 2025-02-08 09:57:59 +01:00
suspend.c LoongArch: Give a chance to build with !CONFIG_SMP 2024-05-14 12:24:18 +08:00
suspend_asm.S LoongArch: Add ACPI standard hardware register based S3 support 2024-07-20 22:41:06 +08:00