add safe_eoi_write and use from kvm
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 5eb6d56..7c41d3f 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h
@@ -357,12 +357,12 @@ u32 (*read)(u32 reg); void (*write)(u32 reg, u32 v); /* - * eoi_write has the same signature as write. - * Drivers can support both eoi_write and write by passing the same - * callback value. Kernel can override eoi_write and fall back - * on write for EOI. + * eoi_write, safe_eoi_write and write have the same signature. + * Drivers can support them all by passing the same callback value. + * reg and v will be set to APIC_EOI and APIC_EOI_ACK, respectively. */ void (*eoi_write)(u32 reg, u32 v); + void (*safe_eoi_write)(u32 reg, u32 v); u64 (*icr_read)(void); void (*icr_write)(u32 low, u32 high); void (*wait_icr_idle)(void);
diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c index 0e881c4..f6628a4 100644 --- a/arch/x86/kernel/apic/apic_flat_64.c +++ b/arch/x86/kernel/apic/apic_flat_64.c
@@ -228,6 +228,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle, @@ -388,6 +389,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c index a6e4c6e..2d9e107 100644 --- a/arch/x86/kernel/apic/apic_noop.c +++ b/arch/x86/kernel/apic/apic_noop.c
@@ -182,6 +182,7 @@ .read = noop_apic_read, .write = noop_apic_write, .eoi_write = noop_apic_write, + .safe_eoi_write = noop_apic_write, .icr_read = noop_apic_icr_read, .icr_write = noop_apic_icr_write, .wait_icr_idle = noop_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/apic_numachip.c b/arch/x86/kernel/apic/apic_numachip.c index 6ec6d5d..f44ab30 100644 --- a/arch/x86/kernel/apic/apic_numachip.c +++ b/arch/x86/kernel/apic/apic_numachip.c
@@ -296,6 +296,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c index 31fbdbf..f59e321 100644 --- a/arch/x86/kernel/apic/bigsmp_32.c +++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -249,6 +249,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c index db4ab1b..08c9a68 100644 --- a/arch/x86/kernel/apic/es7000_32.c +++ b/arch/x86/kernel/apic/es7000_32.c
@@ -679,6 +679,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle, @@ -744,6 +745,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c index f00a68cc..4872f57 100644 --- a/arch/x86/kernel/apic/numaq_32.c +++ b/arch/x86/kernel/apic/numaq_32.c
@@ -531,6 +531,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c index 1b291da..e18879c 100644 --- a/arch/x86/kernel/apic/probe_32.c +++ b/arch/x86/kernel/apic/probe_32.c
@@ -143,6 +143,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/summit_32.c b/arch/x86/kernel/apic/summit_32.c index 659897c..3fce4e6 100644 --- a/arch/x86/kernel/apic/summit_32.c +++ b/arch/x86/kernel/apic/summit_32.c
@@ -547,6 +547,7 @@ .read = native_apic_mem_read, .write = native_apic_mem_write, .eoi_write = native_apic_mem_write, + .safe_eoi_write = native_apic_mem_write, .icr_read = native_apic_icr_read, .icr_write = native_apic_icr_write, .wait_icr_idle = native_apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c index ff35cff..fbf16e6 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -261,6 +261,7 @@ .read = native_apic_msr_read, .write = native_apic_msr_write, .eoi_write = native_apic_msr_eoi_write, + .safe_eoi_write = native_apic_msr_eoi_write, .icr_read = native_x2apic_icr_read, .icr_write = native_x2apic_icr_write, .wait_icr_idle = native_x2apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/x2apic_phys.c b/arch/x86/kernel/apic/x2apic_phys.c index c17e982..0fa1f65 100644 --- a/arch/x86/kernel/apic/x2apic_phys.c +++ b/arch/x86/kernel/apic/x2apic_phys.c
@@ -173,6 +173,7 @@ .read = native_apic_msr_read, .write = native_apic_msr_write, .eoi_write = native_apic_msr_eoi_write, + .safe_eoi_write = native_apic_msr_eoi_write, .icr_read = native_x2apic_icr_read, .icr_write = native_x2apic_icr_write, .wait_icr_idle = native_x2apic_wait_icr_idle,
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index c6d03f7..15e4aad 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -405,6 +405,7 @@ .read = native_apic_msr_read, .write = native_apic_msr_write, .eoi_write = native_apic_msr_eoi_write, + .safe_eoi_write = native_apic_msr_eoi_write, .icr_read = native_x2apic_icr_read, .icr_write = native_x2apic_icr_write, .wait_icr_idle = native_x2apic_wait_icr_idle,
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index d568060..5fa4af0 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c
@@ -310,7 +310,7 @@ { if (kvm_test_and_clear_bit(0, &__get_cpu_var(kvm_apic_eoi))) return; - apic->write(APIC_EOI, APIC_EOI_ACK); + apic->safe_eoi_write(APIC_EOI, APIC_EOI_ACK); } void __cpuinit kvm_guest_cpu_init(void)