diff mbox

[U-Boot,2/6] x86: tsc: Identify Intel-specific code

Message ID 1501038725-20850-2-git-send-email-bmeng.cn@gmail.com
State Accepted
Commit 0b992e4932303b0a379f590f67ec9759fc97275e
Delegated to: Bin Meng
Headers show

Commit Message

Bin Meng July 26, 2017, 3:12 a.m. UTC
cpu_mhz_from_msr() is currently Intel-specific, and should not
execute on any other vendor's parts.

This keeps in sync with Linux kernel commit:
  ba82683: x86/tsc_msr: Identify Intel-specific code

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/timer/tsc_timer.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bin Meng July 26, 2017, 3:16 a.m. UTC | #1
On Wed, Jul 26, 2017 at 11:12 AM, Bin Meng <bmeng.cn@gmail.com> wrote:
> cpu_mhz_from_msr() is currently Intel-specific, and should not

oops: patch ordering issue :)

It should be: try_msr_calibrate_tsc()... as try_msr_calibrate_tsc() is
renamed to cpu_mhz_from_msr() in patch [6/6]

> execute on any other vendor's parts.
>
> This keeps in sync with Linux kernel commit:
>   ba82683: x86/tsc_msr: Identify Intel-specific code
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/timer/tsc_timer.c | 4 ++++
>  1 file changed, 4 insertions(+)

Regards,
Bin
Simon Glass Aug. 1, 2017, 9:11 a.m. UTC | #2
On 25 July 2017 at 21:12, Bin Meng <bmeng.cn@gmail.com> wrote:
> cpu_mhz_from_msr() is currently Intel-specific, and should not
> execute on any other vendor's parts.
>
> This keeps in sync with Linux kernel commit:
>   ba82683: x86/tsc_msr: Identify Intel-specific code
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  drivers/timer/tsc_timer.c | 4 ++++
>  1 file changed, 4 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>
Bin Meng Aug. 1, 2017, 12:21 p.m. UTC | #3
On Tue, Aug 1, 2017 at 5:11 PM, Simon Glass <sjg@chromium.org> wrote:
> On 25 July 2017 at 21:12, Bin Meng <bmeng.cn@gmail.com> wrote:
>> cpu_mhz_from_msr() is currently Intel-specific, and should not

Fixed the commit message, and

>> execute on any other vendor's parts.
>>
>> This keeps in sync with Linux kernel commit:
>>   ba82683: x86/tsc_msr: Identify Intel-specific code
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>> ---
>>
>>  drivers/timer/tsc_timer.c | 4 ++++
>>  1 file changed, 4 insertions(+)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index ffbc709..4d01c9b 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -11,6 +11,7 @@ 
 #include <dm.h>
 #include <malloc.h>
 #include <timer.h>
+#include <asm/cpu.h>
 #include <asm/io.h>
 #include <asm/i8254.h>
 #include <asm/ibmpc.h>
@@ -86,6 +87,9 @@  static unsigned long __maybe_unused try_msr_calibrate_tsc(void)
 	unsigned long res;
 	int cpu_index;
 
+	if (gd->arch.x86_vendor != X86_VENDOR_INTEL)
+		return 0;
+
 	cpu_index = match_cpu(gd->arch.x86, gd->arch.x86_model);
 	if (cpu_index < 0)
 		return 0;