diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/lguest_hcall.h | 1 | ||||
-rw-r--r-- | arch/x86/lguest/boot.c | 21 | ||||
-rw-r--r-- | arch/x86/lguest/i386_head.S | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/arch/x86/include/asm/lguest_hcall.h b/arch/x86/include/asm/lguest_hcall.h index faae1996487b..f9a9f7811248 100644 --- a/arch/x86/include/asm/lguest_hcall.h +++ b/arch/x86/include/asm/lguest_hcall.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #define LHCALL_LOAD_TLS 16 | 17 | #define LHCALL_LOAD_TLS 16 |
18 | #define LHCALL_NOTIFY 17 | 18 | #define LHCALL_NOTIFY 17 |
19 | #define LHCALL_LOAD_GDT_ENTRY 18 | 19 | #define LHCALL_LOAD_GDT_ENTRY 18 |
20 | #define LHCALL_SEND_INTERRUPTS 19 | ||
20 | 21 | ||
21 | #define LGUEST_TRAP_ENTRY 0x1F | 22 | #define LGUEST_TRAP_ENTRY 0x1F |
22 | 23 | ||
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 2392a7a171c2..37b8c1d3e022 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -205,6 +205,12 @@ PV_CALLEE_SAVE_REGS_THUNK(save_fl); | |||
205 | static void restore_fl(unsigned long flags) | 205 | static void restore_fl(unsigned long flags) |
206 | { | 206 | { |
207 | lguest_data.irq_enabled = flags; | 207 | lguest_data.irq_enabled = flags; |
208 | mb(); | ||
209 | /* Null hcall forces interrupt delivery now, if irq_pending is | ||
210 | * set to X86_EFLAGS_IF (ie. an interrupt is pending, and flags | ||
211 | * enables interrupts. */ | ||
212 | if (flags & lguest_data.irq_pending) | ||
213 | kvm_hypercall0(LHCALL_SEND_INTERRUPTS); | ||
208 | } | 214 | } |
209 | PV_CALLEE_SAVE_REGS_THUNK(restore_fl); | 215 | PV_CALLEE_SAVE_REGS_THUNK(restore_fl); |
210 | 216 | ||
@@ -219,6 +225,11 @@ PV_CALLEE_SAVE_REGS_THUNK(irq_disable); | |||
219 | static void irq_enable(void) | 225 | static void irq_enable(void) |
220 | { | 226 | { |
221 | lguest_data.irq_enabled = X86_EFLAGS_IF; | 227 | lguest_data.irq_enabled = X86_EFLAGS_IF; |
228 | mb(); | ||
229 | /* Null hcall forces interrupt delivery now. */ | ||
230 | if (lguest_data.irq_pending) | ||
231 | kvm_hypercall0(LHCALL_SEND_INTERRUPTS); | ||
232 | |||
222 | } | 233 | } |
223 | PV_CALLEE_SAVE_REGS_THUNK(irq_enable); | 234 | PV_CALLEE_SAVE_REGS_THUNK(irq_enable); |
224 | 235 | ||
@@ -972,10 +983,10 @@ static void lguest_restart(char *reason) | |||
972 | * | 983 | * |
973 | * Our current solution is to allow the paravirt back end to optionally patch | 984 | * Our current solution is to allow the paravirt back end to optionally patch |
974 | * over the indirect calls to replace them with something more efficient. We | 985 | * over the indirect calls to replace them with something more efficient. We |
975 | * patch the four most commonly called functions: disable interrupts, enable | 986 | * patch two of the simplest of the most commonly called functions: disable |
976 | * interrupts, restore interrupts and save interrupts. We usually have 6 or 10 | 987 | * interrupts and save interrupts. We usually have 6 or 10 bytes to patch |
977 | * bytes to patch into: the Guest versions of these operations are small enough | 988 | * into: the Guest versions of these operations are small enough that we can |
978 | * that we can fit comfortably. | 989 | * fit comfortably. |
979 | * | 990 | * |
980 | * First we need assembly templates of each of the patchable Guest operations, | 991 | * First we need assembly templates of each of the patchable Guest operations, |
981 | * and these are in i386_head.S. */ | 992 | * and these are in i386_head.S. */ |
@@ -986,8 +997,6 @@ static const struct lguest_insns | |||
986 | const char *start, *end; | 997 | const char *start, *end; |
987 | } lguest_insns[] = { | 998 | } lguest_insns[] = { |
988 | [PARAVIRT_PATCH(pv_irq_ops.irq_disable)] = { lgstart_cli, lgend_cli }, | 999 | [PARAVIRT_PATCH(pv_irq_ops.irq_disable)] = { lgstart_cli, lgend_cli }, |
989 | [PARAVIRT_PATCH(pv_irq_ops.irq_enable)] = { lgstart_sti, lgend_sti }, | ||
990 | [PARAVIRT_PATCH(pv_irq_ops.restore_fl)] = { lgstart_popf, lgend_popf }, | ||
991 | [PARAVIRT_PATCH(pv_irq_ops.save_fl)] = { lgstart_pushf, lgend_pushf }, | 1000 | [PARAVIRT_PATCH(pv_irq_ops.save_fl)] = { lgstart_pushf, lgend_pushf }, |
992 | }; | 1001 | }; |
993 | 1002 | ||
diff --git a/arch/x86/lguest/i386_head.S b/arch/x86/lguest/i386_head.S index f79541989471..3e0c5545d59c 100644 --- a/arch/x86/lguest/i386_head.S +++ b/arch/x86/lguest/i386_head.S | |||
@@ -46,8 +46,6 @@ ENTRY(lguest_entry) | |||
46 | .globl lgstart_##name; .globl lgend_##name | 46 | .globl lgstart_##name; .globl lgend_##name |
47 | 47 | ||
48 | LGUEST_PATCH(cli, movl $0, lguest_data+LGUEST_DATA_irq_enabled) | 48 | LGUEST_PATCH(cli, movl $0, lguest_data+LGUEST_DATA_irq_enabled) |
49 | LGUEST_PATCH(sti, movl $X86_EFLAGS_IF, lguest_data+LGUEST_DATA_irq_enabled) | ||
50 | LGUEST_PATCH(popf, movl %eax, lguest_data+LGUEST_DATA_irq_enabled) | ||
51 | LGUEST_PATCH(pushf, movl lguest_data+LGUEST_DATA_irq_enabled, %eax) | 49 | LGUEST_PATCH(pushf, movl lguest_data+LGUEST_DATA_irq_enabled, %eax) |
52 | /*:*/ | 50 | /*:*/ |
53 | 51 | ||