x86: move APIC timer related defines to headers
PATCH 1/1 x86: move APIC timer related defines to headers
Change names to match Linux where necessary.
Signed-off-by Radim Krčmář <[email protected]>
---
Applies after Peter's "x86: apic: add LVTT test"
lib/x86/apic-defs.h | 2 ++ lib/x86/msr.h | 1 + x86/apic.c | 8 ++------ x86/tscdeadline_latency.c | 5 +---- 4 files changed, 6 insertions(+), 10 deletions(-)
lib/x86/apic-defs.h +2 -0
@@ -91,7 +91,9 @@#define APIC_TIMER_BASE_CLKIN 0x0#define APIC_TIMER_BASE_TMBASE 0x1#define APIC_TIMER_BASE_DIV 0x2 +#define APIC_LVT_TIMER_ONESHOT (0 << 17)#define APIC_LVT_TIMER_PERIODIC (1 << 17) +#define APIC_LVT_TIMER_TSCDEADLINE (2 << 17)#define APIC_LVT_MASKED (1 << 16)#define APIC_LVT_LEVEL_TRIGGER (1 << 15)#define APIC_LVT_REMOTE_IRR (1 << 14)
lib/x86/msr.h +1 -0
@@ -401,6 +401,7 @@#define MSR_IA32_VMX_TRUE_EXIT 0x0000048f#define MSR_IA32_VMX_TRUE_ENTRY 0x00000490 +#define MSR_IA32_TSCDEADLINE 0x000006e0/* AMD-V MSRs */
x86/apic.c +2 -6
@@ -15,10 +15,7 @@ static void test_lapic_existence(void)report ("apic existence" , (u16 )lvr ==0x14 ); } -#define TSC_DEADLINE_TIMER_MODE (2 << 17)#define TSC_DEADLINE_TIMER_VECTOR 0xef -#define MSR_IA32_TSC 0x00000010 -#define MSR_IA32_TSCDEADLINE 0x000006e0static int tdt_count;
@@ -44,7 +41,7 @@ static int enable_tsc_deadline_timer(void)uint32_t lvtt;if (cpuid (1 ).c & (1 <<24 )) { - lvtt =TSC_DEADLINE_TIMER_MODE |TSC_DEADLINE_TIMER_VECTOR ; + lvtt =APIC_LVT_TIMER_TSCDEADLINE |TSC_DEADLINE_TIMER_VECTOR ;apic_write (APIC_LVTT , lvtt);return 1 ; }else {
@@ -365,13 +362,12 @@ static void test_apic_timer_one_shot(void)static const uint32_t interval =0x10000 ;#define APIC_LVT_TIMER_VECTOR (0xee) -#define APIC_LVT_TIMER_ONE_SHOT (0)handle_irq (APIC_LVT_TIMER_VECTOR , lvtt_handler);irq_enable ();/* One shot mode */ -apic_write (APIC_LVTT ,APIC_LVT_TIMER_ONE_SHOT | +apic_write (APIC_LVTT ,APIC_LVT_TIMER_ONESHOT |APIC_LVT_TIMER_VECTOR );/* Divider == 1 */ apic_write (APIC_TDCR ,0x0000000b );
x86/tscdeadline_latency.c +1 -4
@@ -37,10 +37,7 @@ static void test_lapic_existence(void)report ("apic existence" , (u16 )lvr ==0x14 ); } -#define TSC_DEADLINE_TIMER_MODE (2 << 17)#define TSC_DEADLINE_TIMER_VECTOR 0xef -#define MSR_IA32_TSC 0x00000010 -#define MSR_IA32_TSCDEADLINE 0x000006e0static int tdt_count;u64 exptime;
@@ -84,7 +81,7 @@ static int enable_tsc_deadline_timer(void)uint32_t lvtt;if (cpuid (1 ).c & (1 <<24 )) { - lvtt =TSC_DEADLINE_TIMER_MODE |TSC_DEADLINE_TIMER_VECTOR ; + lvtt =APIC_LVT_TIMER_TSCDEADLINE |TSC_DEADLINE_TIMER_VECTOR ;apic_write (APIC_LVTT , lvtt);start_tsc_deadline_timer ();return 1 ;
Signature · 1 line
2.10.0
Quoted 3 lines · Radim Krčmář
Change names to match Linux where necessary.
Signed-off-by Radim Krčmář <[email protected]>
Reviewed-by Peter Xu <[email protected]>
-- peterx