android_kernel_oneplus_msm8998/arch/x86
Xiaoming Gao 624786b91e x86/tsc: Prevent 32bit truncation in calc_hpet_ref()
commit d3878e164dcd3925a237a20e879432400e369172 upstream.

The TSC calibration code uses HPET as reference. The conversion normalizes
the delta of two HPET timestamps:

    hpetref = ((tshpet1 - tshpet2) * HPET_PERIOD) / 1e6

and then divides the normalized delta of the corresponding TSC timestamps
by the result to calulate the TSC frequency.

    tscfreq = ((tstsc1 - tstsc2 ) * 1e6) / hpetref

This uses do_div() which takes an u32 as the divisor, which worked so far
because the HPET frequency was low enough that 'hpetref' never exceeded
32bit.

On Skylake machines the HPET frequency increased so 'hpetref' can exceed
32bit. do_div() truncates the divisor, which causes the calibration to
fail.

Use div64_u64() to avoid the problem.

[ tglx: Fixes whitespace mangled patch and rewrote changelog ]

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Cc: peterz@infradead.org
Cc: hpa@zytor.com
Link: https://lkml.kernel.org/r/38894564-4fc9-b8ec-353f-de702839e44e@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-29 07:50:01 +02:00
..
boot x86/boot/64: Verify alignment of the LOAD segment 2018-03-28 18:40:16 +02:00
configs kconfig: tinyconfig: provide whole choice blocks to avoid warnings 2016-09-24 10:07:42 +02:00
crypto crypto: x86/cast5-avx - fix ECB encryption when long sg follows short one 2018-04-08 11:52:00 +02:00
entry x86/entry/64: Don't use IST entry for #BP stack 2018-03-28 18:40:16 +02:00
ia32 Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-11-03 21:05:40 -08:00
include x86/hweight: Get rid of the special calling convention 2018-04-24 09:32:04 +02:00
kernel x86/tsc: Prevent 32bit truncation in calc_hpet_ref() 2018-04-29 07:50:01 +02:00
kvm KVM: SVM: do not zero out segment attributes if segment is unusable or not present 2018-04-13 19:50:15 +02:00
lguest x86/paravirt: Prevent rtc_cmos platform device init on PV guests 2015-12-19 21:35:13 +01:00
lib x86/hweight: Don't clobber %rdi 2018-04-24 09:32:04 +02:00
math-emu x86/fpu/math-emu: Fix possible uninitialized variable use 2018-02-25 11:03:43 +01:00
mm x86/mm: implement free pmd/pte page interfaces 2018-03-28 18:40:14 +02:00
net bpf, x64: increase number of passes 2018-03-28 18:40:17 +02:00
oprofile x86/oprofile: Fix bogus GCC-8 warning in nmi_setup() 2018-02-28 10:17:22 +01:00
pci x86/PCI: Make broadcom_postcore_init() check acpi_disabled 2017-12-16 10:33:48 +01:00
platform x86/platform/olpc: Fix resume handler build warning 2018-02-25 11:03:47 +01:00
power
purgatory x86/kexec: add -fno-PIE 2016-11-26 09:54:52 +01:00
ras
realmode x86/pti/efi: broken conversion from efi to kernel page table 2018-01-17 09:35:29 +01:00
tools x86: Treat R_X86_64_PLT32 as R_X86_64_PC32 2018-03-18 11:17:52 +01:00
um um: Use POSIX ucontext_t instead of struct ucontext 2018-04-24 09:32:08 +02:00
video
xen x86/mm: Enable CR4.PCIDE on supported systems 2018-01-02 20:33:24 +01:00
.gitignore
Kbuild
Kconfig x86/hweight: Get rid of the special calling convention 2018-04-24 09:32:04 +02:00
Kconfig.cpu x86/Kconfig/cpus: Fix/complete CPU type help texts 2015-10-21 11:12:56 +02:00
Kconfig.debug x86/platform: Add PCI dependency for PUNIT_ATOM_DEBUG 2018-02-25 11:03:43 +01:00
Makefile x86/build/64: Force the linker to use 2MB page size 2018-03-28 18:40:16 +02:00
Makefile.um
Makefile_32.cpu