diff options
author | Liu Yu-B13201 <Yu.Liu@freescale.com> | 2011-12-01 15:22:53 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2012-03-05 07:52:34 -0500 |
commit | befdc0a65afd17181392eff3d43c63407f266a9f (patch) | |
tree | 1adf9e1cbef1f5d555334de5ce2a9b71ae8dd490 /arch/powerpc | |
parent | 570135243a33174a5d74641de693b6c0233d1181 (diff) |
KVM: PPC: Avoid patching paravirt template code
Currently we patch the whole code include paravirt template code.
This isn't safe for scratch area and has impact to performance.
Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/kernel/kvm.c | 11 | ||||
-rw-r--r-- | arch/powerpc/kernel/kvm_emul.S | 6 |
2 files changed, 16 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c index 04d4b5aa6dca..62bdf2389669 100644 --- a/arch/powerpc/kernel/kvm.c +++ b/arch/powerpc/kernel/kvm.c | |||
@@ -665,6 +665,9 @@ static void kvm_check_ins(u32 *inst, u32 features) | |||
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | extern u32 kvm_template_start[]; | ||
669 | extern u32 kvm_template_end[]; | ||
670 | |||
668 | static void kvm_use_magic_page(void) | 671 | static void kvm_use_magic_page(void) |
669 | { | 672 | { |
670 | u32 *p; | 673 | u32 *p; |
@@ -692,8 +695,14 @@ static void kvm_use_magic_page(void) | |||
692 | */ | 695 | */ |
693 | local_irq_disable(); | 696 | local_irq_disable(); |
694 | 697 | ||
695 | for (p = start; p < end; p++) | 698 | for (p = start; p < end; p++) { |
699 | /* Avoid patching the template code */ | ||
700 | if (p >= kvm_template_start && p < kvm_template_end) { | ||
701 | p = kvm_template_end - 1; | ||
702 | continue; | ||
703 | } | ||
696 | kvm_check_ins(p, features); | 704 | kvm_check_ins(p, features); |
705 | } | ||
697 | 706 | ||
698 | local_irq_enable(); | 707 | local_irq_enable(); |
699 | 708 | ||
diff --git a/arch/powerpc/kernel/kvm_emul.S b/arch/powerpc/kernel/kvm_emul.S index 801058dd74db..e291cf3cf954 100644 --- a/arch/powerpc/kernel/kvm_emul.S +++ b/arch/powerpc/kernel/kvm_emul.S | |||
@@ -66,6 +66,9 @@ kvm_hypercall_start: | |||
66 | shared->critical == r1 and r2 is always != r1 */ \ | 66 | shared->critical == r1 and r2 is always != r1 */ \ |
67 | STL64(r2, KVM_MAGIC_PAGE + KVM_MAGIC_CRITICAL, 0); | 67 | STL64(r2, KVM_MAGIC_PAGE + KVM_MAGIC_CRITICAL, 0); |
68 | 68 | ||
69 | .global kvm_template_start | ||
70 | kvm_template_start: | ||
71 | |||
69 | .global kvm_emulate_mtmsrd | 72 | .global kvm_emulate_mtmsrd |
70 | kvm_emulate_mtmsrd: | 73 | kvm_emulate_mtmsrd: |
71 | 74 | ||
@@ -350,3 +353,6 @@ kvm_emulate_mtsrin_orig_ins_offs: | |||
350 | .global kvm_emulate_mtsrin_len | 353 | .global kvm_emulate_mtsrin_len |
351 | kvm_emulate_mtsrin_len: | 354 | kvm_emulate_mtsrin_len: |
352 | .long (kvm_emulate_mtsrin_end - kvm_emulate_mtsrin) / 4 | 355 | .long (kvm_emulate_mtsrin_end - kvm_emulate_mtsrin) / 4 |
356 | |||
357 | .global kvm_template_end | ||
358 | kvm_template_end: | ||