@@ -16,6 +16,7 @@ struct vm86;
16
16
#include <uapi/asm/sigcontext.h>
17
17
#include <asm/current.h>
18
18
#include <asm/cpufeatures.h>
19
+ #include <asm/cpuid.h>
19
20
#include <asm/page.h>
20
21
#include <asm/pgtable_types.h>
21
22
#include <asm/percpu.h>
@@ -146,17 +147,6 @@ struct cpuinfo_x86 {
146
147
unsigned initialized : 1 ;
147
148
} __randomize_layout ;
148
149
149
- struct cpuid_regs {
150
- u32 eax , ebx , ecx , edx ;
151
- };
152
-
153
- enum cpuid_regs_idx {
154
- CPUID_EAX = 0 ,
155
- CPUID_EBX ,
156
- CPUID_ECX ,
157
- CPUID_EDX ,
158
- };
159
-
160
150
#define X86_VENDOR_INTEL 0
161
151
#define X86_VENDOR_CYRIX 1
162
152
#define X86_VENDOR_AMD 2
@@ -205,45 +195,6 @@ extern void identify_secondary_cpu(struct cpuinfo_x86 *);
205
195
extern void print_cpu_info (struct cpuinfo_x86 * );
206
196
void print_cpu_msr (struct cpuinfo_x86 * );
207
197
208
- #ifdef CONFIG_X86_32
209
- extern int have_cpuid_p (void );
210
- #else
211
- static inline int have_cpuid_p (void )
212
- {
213
- return 1 ;
214
- }
215
- #endif
216
- static inline void native_cpuid (unsigned int * eax , unsigned int * ebx ,
217
- unsigned int * ecx , unsigned int * edx )
218
- {
219
- /* ecx is often an input as well as an output. */
220
- asm volatile ("cpuid"
221
- : "=a" (* eax ),
222
- "=b" (* ebx ),
223
- "=c" (* ecx ),
224
- "=d" (* edx )
225
- : "0" (* eax ), "2" (* ecx )
226
- : "memory" );
227
- }
228
-
229
- #define native_cpuid_reg (reg ) \
230
- static inline unsigned int native_cpuid_##reg(unsigned int op) \
231
- { \
232
- unsigned int eax = op, ebx, ecx = 0, edx; \
233
- \
234
- native_cpuid(&eax, &ebx, &ecx, &edx); \
235
- \
236
- return reg; \
237
- }
238
-
239
- /*
240
- * Native CPUID functions returning a single datum.
241
- */
242
- native_cpuid_reg (eax )
243
- native_cpuid_reg (ebx )
244
- native_cpuid_reg (ecx )
245
- native_cpuid_reg (edx )
246
-
247
198
/*
248
199
* Friendlier CR3 helpers.
249
200
*/
@@ -578,7 +529,6 @@ static __always_inline bool on_thread_stack(void)
578
529
#ifdef CONFIG_PARAVIRT_XXL
579
530
#include <asm/paravirt.h>
580
531
#else
581
- #define __cpuid native_cpuid
582
532
583
533
static inline void load_sp0 (unsigned long sp0 )
584
534
{
@@ -589,69 +539,6 @@ static inline void load_sp0(unsigned long sp0)
589
539
590
540
unsigned long __get_wchan (struct task_struct * p );
591
541
592
- /*
593
- * Generic CPUID function
594
- * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
595
- * resulting in stale register contents being returned.
596
- */
597
- static inline void cpuid (unsigned int op ,
598
- unsigned int * eax , unsigned int * ebx ,
599
- unsigned int * ecx , unsigned int * edx )
600
- {
601
- * eax = op ;
602
- * ecx = 0 ;
603
- __cpuid (eax , ebx , ecx , edx );
604
- }
605
-
606
- /* Some CPUID calls want 'count' to be placed in ecx */
607
- static inline void cpuid_count (unsigned int op , int count ,
608
- unsigned int * eax , unsigned int * ebx ,
609
- unsigned int * ecx , unsigned int * edx )
610
- {
611
- * eax = op ;
612
- * ecx = count ;
613
- __cpuid (eax , ebx , ecx , edx );
614
- }
615
-
616
- /*
617
- * CPUID functions returning a single datum
618
- */
619
- static inline unsigned int cpuid_eax (unsigned int op )
620
- {
621
- unsigned int eax , ebx , ecx , edx ;
622
-
623
- cpuid (op , & eax , & ebx , & ecx , & edx );
624
-
625
- return eax ;
626
- }
627
-
628
- static inline unsigned int cpuid_ebx (unsigned int op )
629
- {
630
- unsigned int eax , ebx , ecx , edx ;
631
-
632
- cpuid (op , & eax , & ebx , & ecx , & edx );
633
-
634
- return ebx ;
635
- }
636
-
637
- static inline unsigned int cpuid_ecx (unsigned int op )
638
- {
639
- unsigned int eax , ebx , ecx , edx ;
640
-
641
- cpuid (op , & eax , & ebx , & ecx , & edx );
642
-
643
- return ecx ;
644
- }
645
-
646
- static inline unsigned int cpuid_edx (unsigned int op )
647
- {
648
- unsigned int eax , ebx , ecx , edx ;
649
-
650
- cpuid (op , & eax , & ebx , & ecx , & edx );
651
-
652
- return edx ;
653
- }
654
-
655
542
extern void select_idle_routine (const struct cpuinfo_x86 * c );
656
543
extern void amd_e400_c1e_apic_setup (void );
657
544
@@ -805,24 +692,6 @@ static inline u32 amd_get_nodes_per_socket(void) { return 0; }
805
692
static inline u32 amd_get_highest_perf (void ) { return 0 ; }
806
693
#endif
807
694
808
- #define for_each_possible_hypervisor_cpuid_base (function ) \
809
- for (function = 0x40000000; function < 0x40010000; function += 0x100)
810
-
811
- static inline uint32_t hypervisor_cpuid_base (const char * sig , uint32_t leaves )
812
- {
813
- uint32_t base , eax , signature [3 ];
814
-
815
- for_each_possible_hypervisor_cpuid_base (base ) {
816
- cpuid (base , & eax , & signature [0 ], & signature [1 ], & signature [2 ]);
817
-
818
- if (!memcmp (sig , signature , 12 ) &&
819
- (leaves == 0 || ((eax - base ) >= leaves )))
820
- return base ;
821
- }
822
-
823
- return 0 ;
824
- }
825
-
826
695
extern unsigned long arch_align_stack (unsigned long sp );
827
696
void free_init_pages (const char * what , unsigned long begin , unsigned long end );
828
697
extern void free_kernel_image_pages (const char * what , void * begin , void * end );
0 commit comments