]> git.baikalelectronics.ru Git - kernel.git/commit
x86/tsc_msr: Fix MSR_FSB_FREQ mask for Cherry Trail devices
authorHans de Goede <hdegoede@redhat.com>
Sun, 23 Feb 2020 14:06:09 +0000 (15:06 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Apr 2020 08:50:12 +0000 (10:50 +0200)
commit733cb551b84e5793210e8f59316535143ba335d0
treedccecdcf9ba9c287c321fb22a62f083ca60a61e9
parentf5a5fd7be1e7cbc7d69e050f24b5572ec97d8a74
x86/tsc_msr: Fix MSR_FSB_FREQ mask for Cherry Trail devices

commit e8c19d1d6e876698595959e435979ac05d7f029d upstream.

According to the "Intel 64 and IA-32 Architectures Software Developer's
Manual Volume 4: Model-Specific Registers" on Cherry Trail (Airmont)
devices the 4 lowest bits of the MSR_FSB_FREQ mask indicate the bus freq
unlike on e.g. Bay Trail where only the lowest 3 bits are used.

This is also the reason why MAX_NUM_FREQS is defined as 9, since Cherry
Trail SoCs have 9 possible frequencies, so the lo value from the MSR needs
to be masked with 0x0f, not with 0x07 otherwise the 9th frequency will get
interpreted as the 1st.

Bump MAX_NUM_FREQS to 16 to avoid any possibility of addressing the array
out of bounds and makes the mask part of the cpufreq struct so it can be
set it per model.

While at it also log an error when the index points to an uninitialized
part of the freqs lookup-table.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/20200223140610.59612-2-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/tsc_msr.c