Skip to contentSkip to conversation

x86: enable cpu-specific functions for x86_64 target

PATCH New Ivan Gorinov 3 participants 4 messages May 25, 2018 – May 30, 2018 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: enable cpu-specific functions for x86_64 target

Add __weak prefix to the following functions to allow override:
misc_init_r(), checkcpu(), print_cpuinfo().

---
 arch/x86/cpu/x86_64/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/cpu/x86_64/cpu.c +3 -3
index 18b3e94..6f14efc 100644
@@ -59,17 +59,17 @@ int x86_mp_init(void)
 	return 0;
 }
 
-int misc_init_r(void)
+__weak int misc_init_r(void)
 {
 	return 0;
 }
 
-int checkcpu(void)
+__weak int checkcpu(void)
 {
 	return 0;
 }
 
-int print_cpuinfo(void)
+__weak int print_cpuinfo(void)
 {
 	return 0;
 }
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 x86: enable cpu-specific functions for x86_64 target

Hi Ivan,

Quoted 34 lines · Ivan Gorinov

Add __weak prefix to the following functions to allow override:
misc_init_r(), checkcpu(), print_cpuinfo().

---
 arch/x86/cpu/x86_64/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/cpu/x86_64/cpu.c +3 -4
index 18b3e94..6f14efc 100644
@@ -59,17 +59,17 @@ int x86_mp_init(void)
        return 0;
 }
 
-int misc_init_r(void)
+__weak int misc_init_r(void)
 {
        return 0;
 }
 
-int checkcpu(void)
+__weak int checkcpu(void)
 {
        return 0;
 }
 
-int print_cpuinfo(void)
+__weak int print_cpuinfo(void)
 {
        return 0;
 }
--
Quoted 2 lines

2.7.4

We should do with with a different CPU driver I think. What exactly is the problem?

Regards,
Simon

#2 lore raw

PATCH 1/1 x86: enable cpu-specific functions for x86_64 target

Quoted 2 lines · Simon Glass

We should do with with a different CPU driver I think. What exactly is the problem?

+1.

The approach feels wrong. It looks like whatever you are going to add later needs actually a fully-established folder under arch/x86/cpu rather than (dirty) hacks here and there.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw

PATCH 1/1 x86: enable cpu-specific functions for x86_64 target

In reply to Simon Glass
Quoted 31 lines · Simon Glass

Hi Ivan,

Quoted 28 lines · Ivan Gorinov

Add __weak prefix to the following functions to allow override:
misc_init_r(), checkcpu(), print_cpuinfo().

---
 arch/x86/cpu/x86_64/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/cpu/x86_64/cpu.c +2 -2
index 18b3e94..6f14efc 100644
@@ -59,17 +59,17 @@ int x86_mp_init(void)
        return 0;
 }
 
-int misc_init_r(void)
+__weak int misc_init_r(void)
 {
        return 0;
 }
 
-int checkcpu(void)
+__weak int checkcpu(void)
 {
        return 0;
 }
 
Quoted 11 lines
Quoted 8 lines
arch/x86/cpu/x86_64/cpu.c +1 -2
-int print_cpuinfo(void)
+__weak int print_cpuinfo(void)
 {
        return 0;
 }
--

2.7.4

We should do with with a different CPU driver I think. What exactly is the problem?

When I change a Minnowboard configuration (baytrail) to run in 64-bit mode, there are two conflicting definitions of misc_init_r():

arch/x86/cpu/x86_64/cpu.c
board/intel/minnowmax/minnowmax.c

On other CPU models, functions checkcpu() and print_cpuinfo() conflict with model-specific definitions for Tangier, Ivy Bridge, Broadwell, Quark.