summaryrefslogtreecommitdiffstats
path: root/arch
Commit message (Collapse)AuthorAgeFilesLines
...
* KVM: PPC: Update int_pending also on dequeueAlexander Graf2010-10-241-0/+3
| | | | | | | | | | | When having a decrementor interrupt pending, the dequeuing happens manually through an mtdec instruction. This instruction simply calls dequeue on that interrupt, so the int_pending hint doesn't get updated. This patch enables updating the int_pending hint also on dequeue, thus correctly enabling guests to stay in guest contexts more often. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Make PV mtmsr work with r30 and r31Alexander Graf2010-10-242-16/+40
| | | | | | | | | | | So far we've been restricting ourselves to r0-r29 as registers an mtmsr instruction could use. This was bad, as there are some code paths in Linux actually using r30. So let's instead handle all registers gracefully and get rid of that stupid limitation Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Add mtsrin PV codeAlexander Graf2010-10-243-0/+111
| | | | | | | | This is the guest side of the mtsr acceleration. Using this a guest can now call mtsrin with almost no overhead as long as it ensures that it only uses it with (MSR_IR|MSR_DR) == 0. Linux does that, so we're good. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Put segment registers in shared pageAlexander Graf2010-10-245-12/+11
| | | | | | | | Now that the actual mtsr doesn't do anything anymore, we can move the sr contents over to the shared page, so a guest can directly read and write its sr contents from guest context. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Interpret SR registers on demandAlexander Graf2010-10-243-48/+46
| | | | | | | | | | | | | | Right now we're examining the contents of Book3s_32's segment registers when the register is written and put the interpreted contents into a struct. There are two reasons this is bad. For starters, the struct has worse real-time performance, as it occupies more ram. But the more important part is that with segment registers being interpreted from their raw values, we can put them in the shared page, allowing guests to mess with them directly. This patch makes the internal representation of SRs be u32s. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Move BAT handling code into spr handlerAlexander Graf2010-10-241-32/+16
| | | | | | | | The current approach duplicates the spr->bat finding logic and makes it harder to reuse the actually used variables. So let's move everything down to the spr handler. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Add feature bitmap for magic pageAlexander Graf2010-10-243-7/+21
| | | | | | | | | | We will soon add SR PV support to the shared page, so we need some infrastructure that allows the guest to query for features KVM exports. This patch adds a second return value to the magic mapping that indicated to the guest which features are available. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Remove unused defineAlexander Graf2010-10-241-1/+0
| | | | | | The define VSID_ALL is unused. Let's remove it. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Revert "KVM: PPC: Use kernel hash function"Alexander Graf2010-10-242-4/+17
| | | | | | | | | | It turns out the in-kernel hash function is sub-optimal for our subtle hash inputs where every bit is significant. So let's revert to the original hash functions. This reverts commit 05340ab4f9a6626f7a2e8f9fe5397c61d494f445. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Move slb debugging to tracepointsAlexander Graf2010-10-242-17/+78
| | | | | | This patch moves debugging printks for shadow SLB debugging over to tracepoints. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Make invalidation code more reliableAlexander Graf2010-10-241-6/+8
| | | | | | | | There is a race condition in the pte invalidation code path where we can't be sure if a pte was invalidated already. So let's move the spin lock around to get rid of the race. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Don't flush PTEs on NX/RO hitAlexander Graf2010-10-241-2/+0
| | | | | | | | | | | When hitting a no-execute or read-only data/inst storage interrupt we were flushing the respective PTE so we're sure it gets properly overwritten next. According to the spec, this is unnecessary though. The guest issues a tlbie anyways, so we're safe to just keep the PTE around and have it manually removed from the guest, saving us a flush. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Preload magic page when in kernel modeAlexander Graf2010-10-241-0/+10
| | | | | | | | When the guest jumps into kernel mode and has the magic page mapped, theres a very high chance that it will also use it. So let's detect that scenario and map the segment accordingly. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Add tracepoints for generic spte flushesAlexander Graf2010-10-242-15/+26
| | | | | | | | | | The different ways of flusing shadow ptes have their own debug prints which use stupid old printk. Let's move them to tracepoints, making them easier available, faster and possible to activate on demand Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Fix sid map search after flushAlexander Graf2010-10-241-2/+2
| | | | | | | | | | | | After a flush the sid map contained lots of entries with 0 for their gvsid and hvsid value. Unfortunately, 0 can be a real value the guest searches for when looking up a vsid so it would incorrectly find the host's 0 hvsid mapping which doesn't belong to our sid space. So let's also check for the valid bit that indicated that the sid we're looking at actually contains useful data. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Move pte invalidate debug code to tracepointAlexander Graf2010-10-242-2/+30
| | | | | | This patch moves the SPTE flush debug printk over to tracepoints. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Add tracepoint for generic mmu mapAlexander Graf2010-10-242-0/+32
| | | | | | This patch moves the generic mmu map debugging over to tracepoints. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Move book3s_64 mmu map debug print to trace pointAlexander Graf2010-10-242-11/+36
| | | | | | This patch moves Book3s MMU debugging over to tracepoints. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: PPC: Move EXIT_DEBUG partially to tracepointsAlexander Graf2010-10-242-22/+55
| | | | | | | | | | | We have a debug printk on every exit that is usually #ifdef'ed out. Using tracepoints makes a lot more sense here though, as they can be dynamically enabled. This patch converts the most commonly used debug printks of EXIT_DEBUG to tracepoints. Signed-off-by: Alexander Graf <agraf@suse.de>
* KVM: ia64: define kvm_lapic_enabled() to fix a compile errorTakuya Yoshikawa2010-10-241-0/+1
| | | | | | | | | | | | | | | The following patch commit 57ce1659316f4ca298919649f9b1b55862ac3826 KVM: x86: In DM_LOWEST, only deliver interrupts to vcpus with enabled LAPIC's ignored the fact that kvm_irq_delivery_to_apic() was also used by ia64. We define kvm_lapic_enabled() to fix a compile error caused by this. This will have the same effect as reverting the problematic patch for ia64. Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: lower the aduit frequencyXiao Guangrong2010-10-241-0/+7
| | | | | | | | The audit is very high overhead, so we need lower the frequency to assure the guest is running. Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: improve spte auditXiao Guangrong2010-10-241-79/+69
| | | | | | | | Both audit_mappings() and audit_sptes_have_rmaps() need to walk vcpu's page table, so we can do these checking in a spte walking Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: improve active sp auditXiao Guangrong2010-10-241-36/+38
| | | | | | | | Both audit_rmap() and audit_write_protection() need to walk all active sp, so we can do these checking in a sp walking Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: move audit to a separate fileXiao Guangrong2010-10-242-278/+298
| | | | | | | Move the audit code from arch/x86/kvm/mmu.c to arch/x86/kvm/mmu_audit.c Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: support disable/enable mmu audit dynamiclyXiao Guangrong2010-10-244-20/+101
| | | | | | | | | | | | | | | | Add a r/w module parameter named 'mmu_audit', it can control audit enable/disable: enable: echo 1 > /sys/module/kvm/parameters/mmu_audit disable: echo 0 > /sys/module/kvm/parameters/mmu_audit This patch not change the logic Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fix guest kernel crash on MSR_K7_CLK_CTLJes Sorensen2010-10-241-0/+22
| | | | | | | | | | MSR_K7_CLK_CTL is a no longer documented MSR, which is only relevant on said old AMD CPU models. This change returns the expected value, which the Linux kernel is expecting to avoid writing back the MSR, plus it ignores all writes to the MSR. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: i8259: Make ICW1 conform to specAvi Kivity2010-10-241-6/+10
| | | | | | | ICW is not a full reset, instead it resets a limited number of registers in the PIC. Change ICW1 emulation to only reset those registers. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: clean up control flow in x86_emulate_insn()Avi Kivity2010-10-241-57/+7
| | | | | | | | | | | | x86_emulate_insn() is full of things like if (rc != X86EMUL_CONTINUE) goto done; break; consolidate all of those at the end of the switch statement. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: fix group 11 decoding for reg != 0Avi Kivity2010-10-241-1/+5
| | | | | | These are all undefined. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: use single stage decoding for mov instructionsAvi Kivity2010-10-241-24/+18
| | | | Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Don't save/restore MSR_IA32_PERF_STATUSAvi Kivity2010-10-241-1/+1
| | | | | | It is read/only; restoring it only results in annoying messages. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: init_vmcb should reset vcpu->eferMarcelo Tosatti2010-10-241-1/+1
| | | | | | | | | Otherwise EFER_LMA bit is retained across a SIPI reset. Fixes guest cpu onlining. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: SVM: reset mmu context in init_vmcbMarcelo Tosatti2010-10-241-2/+2
| | | | | | | | | | | Since commit aad827034e419fa no mmu reinitialization is performed via init_vmcb. Zero vcpu->arch.cr0 and pass the reset value as a parameter to kvm_set_cr0. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: Fix pio trace directionAvi Kivity2010-10-241-2/+2
| | | | | | out = write, in = read, not the other way round. Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: remove count_rmaps()Xiao Guangrong2010-10-241-38/+0
| | | | | | | Nothing is checked in count_rmaps(), so remove it Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: rewrite audit_mappings_page() functionXiao Guangrong2010-10-241-35/+40
| | | | | | | | | | | | | | There is a bugs in this function, we call gfn_to_pfn() and kvm_mmu_gva_to_gpa_read() in atomic context(kvm_mmu_audit() is called under the spinlock(mmu_lock)'s protection). This patch fix it by: - introduce gfn_to_pfn_atomic instead of gfn_to_pfn - get the mapping gfn from kvm_mmu_page_get_gfn() And it adds 'notrap' ptes check in unsync/direct sps Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: fix wrong not write protected sp reportXiao Guangrong2010-10-242-3/+5
| | | | | | | | | | | | The audit code reports some sp not write protected in current code, it's just the bug in audit_write_protection(), since: - the invalid sp not need write protected - using uninitialize local variable('gfn') - call kvm_mmu_audit() out of mmu_lock's protection Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: check rmap for every spteXiao Guangrong2010-10-241-31/+26
| | | | | | | | The read-only spte also has reverse mapping, so fix the code to check them, also modify the function name to fit its doing Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: MMU: fix compile warning in audit codeXiao Guangrong2010-10-241-10/+10
| | | | | | | | | | | | | | | | | fix: arch/x86/kvm/mmu.c: In function ‘kvm_mmu_unprotect_page’: arch/x86/kvm/mmu.c:1741: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 3 has type ‘gfn_t’ arch/x86/kvm/mmu.c:1745: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 3 has type ‘gfn_t’ arch/x86/kvm/mmu.c: In function ‘mmu_unshadow’: arch/x86/kvm/mmu.c:1761: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 3 has type ‘gfn_t’ arch/x86/kvm/mmu.c: In function ‘set_spte’: arch/x86/kvm/mmu.c:2005: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 3 has type ‘gfn_t’ arch/x86/kvm/mmu.c: In function ‘mmu_set_spte’: arch/x86/kvm/mmu.c:2033: warning: format ‘%lx’ expects type ‘long unsigned int’, but argument 7 has type ‘gfn_t’ Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: pit: Do not check pending pit timer in vcpu threadJason Wang2010-10-242-15/+1
| | | | | | | | | Pit interrupt injection was done by workqueue, so no need to check pending pit timer in vcpu thread which could lead unnecessary unblocking of vcpu. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: PPC: Fix CONFIG_KVM_GUEST && !CONFIG_KVM caseAlexander Graf2010-10-242-4/+3
| | | | | | | | | | | When CONFIG_KVM_GUEST is selected, but CONFIG_KVM is not, we were missing some defines in asm-offsets.c and included too many headers at other places. This patch makes above configuration work. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
* KVM: x86 emulator: simplify ALU opcode block decode furtherAvi Kivity2010-10-241-18/+14
| | | | | | | | | | The ALU opcode block is very regular; introduce D6ALU() to define decode flags for 6 instructions at a time. Suggested by Paolo Bonzini. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: Fix build error due to 64-bit division in nsec_to_cycles()Avi Kivity2010-10-241-1/+6
| | | | | | | Use do_div() instead. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: x86 emulator: trap and propagate #DE from DIV and IDIVAvi Kivity2010-10-241-4/+16
| | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: x86 emulator: add macros for executing instructions that may trapAvi Kivity2010-10-241-0/+43
| | | | | | | Like DIV and IDIV. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: x86 emulator: simplify instruction decode flags for opcodes 0F 00-FFAvi Kivity2010-10-241-2/+2
| | | | | | | Use the new byte/word dual opcode decode. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: x86 emulator: simplify instruction decode flags for opcodes E0-FFAvi Kivity2010-10-241-4/+2
| | | | | | | Use the new byte/word dual opcode decode. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: x86 emulator: simplify instruction decode flags for opcodes C0-DFAvi Kivity2010-10-241-4/+3
| | | | | | | Use the new byte/word dual opcode decode. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: x86 emulator: simplify instruction decode flags for opcodes A0-AFAvi Kivity2010-10-241-3/+3
| | | | | | | Use the new byte/word dual opcode decode. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* KVM: x86 emulator: simplify instruction decode flags for opcodes 80-8FAvi Kivity2010-10-241-4/+3
| | | | | | | Use the new byte/word dual opcode decode. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
OpenPOWER on IntegriCloud