android_kernel_motorola_sm6375/arch/x86
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Zhang Rui 4aa8948673 x86/apic: Always explicitly disarm TSC-deadline timer
commit ffd95846c6ec6cf1f93da411ea10d504036cab42 upstream.

New processors have become pickier about the local APIC timer state
before entering low power modes. These low power modes are used (for
example) when you close your laptop lid and suspend. If you put your
laptop in a bag and it is not in this low power mode, it is likely
to get quite toasty while it quickly sucks the battery dry.

The problem boils down to some CPUs' inability to power down until the
CPU recognizes that the local APIC timer is shut down. The current
kernel code works in one-shot and periodic modes but does not work for
deadline mode. Deadline mode has been the supported and preferred mode
on Intel CPUs for over a decade and uses an MSR to drive the timer
instead of an APIC register.

Disable the TSC Deadline timer in lapic_timer_shutdown() by writing to
MSR_IA32_TSC_DEADLINE when in TSC-deadline mode. Also avoid writing
to the initial-count register (APIC_TMICT) which is ignored in
TSC-deadline mode.

Note: The APIC_LVTT|=APIC_LVT_MASKED operation should theoretically be
enough to tell the hardware that the timer will not fire in any of the
timer modes. But mitigating AMD erratum 411[1] also requires clearing
out APIC_TMICT. Solely setting APIC_LVT_MASKED is also ineffective in
practice on Intel Lunar Lake systems, which is the motivation for this
change.

1. 411 Processor May Exit Message-Triggered C1E State Without an Interrupt if Local APIC Timer Reaches Zero - https://www.amd.com/content/dam/amd/en/documents/archived-tech-docs/revision-guides/41322_10h_Rev_Gd.pdf

Fixes: 279f146143 ("x86: apic: Use tsc deadline for oneshot when available")
Suggested-by: Dave Hansen <[email protected]>
Signed-off-by: Zhang Rui <[email protected]>
Signed-off-by: Dave Hansen <[email protected]>
Reviewed-by: Rafael J. Wysocki <[email protected]>
Tested-by: Srinivas Pandruvada <[email protected]>
Tested-by: Todd Brandt <[email protected]>
Cc: [email protected]
Link: https://lore.kernel.org/all/20241015061522.25288-1-rui.zhang%40intel.com
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2024-11-08 16:20:49 +01:00
..
boot x86/decompressor: Don't rely on upper 32 bits of GPRs being preserved 2023-09-23 10:59:41 +02:00
configs
crypto crypto: x86/ghash - fix unaligned access in ghash_setkey() 2023-03-11 16:43:38 +01:00
entry x86/mm: Remove broken vsyscall emulation code from the page fault code 2024-06-16 13:28:49 +02:00
events perf/x86/intel/pt: Fix a topa_entry base address calculation 2024-08-19 05:33:39 +02:00
hyperv x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup fails 2021-11-26 10:47:21 +01:00
ia32 binfmt: Move install_exec_creds after setup_new_exec to match binfmt_elf 2023-01-18 11:41:46 +01:00
include x86/cpufeatures: Define X86_FEATURE_AMD_IBPB_RET 2024-11-08 16:20:48 +01:00
kernel x86/apic: Always explicitly disarm TSC-deadline timer 2024-11-08 16:20:49 +01:00
kvm KVM: x86: Ignore MSR_AMD64_TW_CFG access 2023-11-28 16:50:18 +00:00
lib x86/insn: Fix PUSH instruction in x86 instruction decoder opcode map 2024-06-16 13:28:39 +02:00
math-emu
mm x86/mm: Fix pti_clone_pgtable() alignment assumption 2024-08-19 05:33:46 +02:00
net
oprofile
pci x86/pci/xen: Fix PCIBIOS_* return code handling 2024-08-19 05:33:25 +02:00
platform x86/platform/iosf_mbi: Convert PCIBIOS_* return codes to errnos 2024-08-19 05:33:26 +02:00
power x86/pm: Add enumeration check before spec MSRs save/restore setup 2022-12-08 11:23:05 +01:00
purgatory x86/purgatory: Switch to the position-independent small code model 2024-06-16 13:28:35 +02:00
ras
realmode x86/asm: Make more symbols local 2023-09-23 10:59:40 +02:00
tools x86/boot: Ignore relocations in .notes sections in walk_relocs() too 2024-06-16 13:28:33 +02:00
um x86: um: vdso: Add '%rcx' and '%r11' to the syscall clobber list 2023-03-11 16:44:10 +01:00
video
xen xen: use correct end address of kernel for conflict checking 2024-11-08 16:20:30 +01:00
.gitignore
Kbuild
Kconfig x86/speculation: Add Kconfig option for GDS 2023-08-08 19:56:35 +02:00
Kconfig.cpu x86/Kconfig: Transmeta Crusoe is CPU family 5, not 6 2024-02-23 08:25:12 +01:00
Kconfig.debug x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y 2024-06-16 13:28:45 +02:00
Makefile
Makefile.um um: allow not setting extra rpaths in the linux binary 2024-03-15 10:48:16 -04:00
Makefile_32.cpu