Re: KVM on ARM64

2014-08-04 Thread Wei Huang
On 08/04/2014 07:35 PM, Mathew Li wrote: Hi, I have a quick question. How do we add a hard disk to the qemu ARM VM? I tried: qemu-system-aarch64 -machine virt -hda disk.img -kernel image -initrd initrd.img qemu-system-aarch64 -machine virt -sd disk.img -kernel image -initrd initrd.img qemu

Re: [PATCH 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01

2014-08-04 Thread Wanpeng Li
Hi Davidlohr, On Mon, Aug 04, 2014 at 12:56:36PM -0700, Davidlohr Bueso wrote: >On Fri, 2014-08-01 at 16:12 +0800, Wanpeng Li wrote: >> External interrupt will cause L1 vmexit w/ reason external interrupt when L2 >> is >> running. Then L1 will pick up the interrupt through vmcs12 if L1 set the ac

[PATCH v2 2/2] KVM: nVMX: fix acknowledge interrupt on exit when APICv is in use

2014-08-04 Thread Wanpeng Li
After commit 77b0f5d (KVM: nVMX: Ack and write vector info to intr_info if L1 asks us to), "Acknowledge interrupt on exit" behavior can be emulated. To do so, KVM will ask the APIC for the interrupt vector if during a nested vmexit if VM_EXIT_ACK_INTR_ON_EXIT is set. With APICv, kvm_get_apic_inter

[PATCH v2 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01

2014-08-04 Thread Wanpeng Li
External interrupt will cause L1 vmexit w/ reason external interrupt when L2 is running. Then L1 will pick up the interrupt through vmcs12 if L1 set the ack interrupt bit. Commit 77b0f5d (KVM: nVMX: Ack and write vector info to intr_info if L1 asks us to) get intr that belongs to L1 before load v

Re: [PATCH] KVM: MMU: Use hashtable for MMU page hash

2014-08-04 Thread Xiao Guangrong
On 08/05/2014 04:54 AM, Sasha Levin wrote: > Use the kernel hashtable interface instead of the hlist interface. > This allows us to eliminate some unneeded code and make the code > simpler. The side effect is that the hash function is changed, the current way is: gfn & ((1 << KVM_MMU_HASH_

RE: [PATCH 5/5 v2] KVM: PPC: BOOKE: Emulate debug registers and exception

2014-08-04 Thread bharat.bhus...@freescale.com
> -Original Message- > From: Wood Scott-B07421 > Sent: Tuesday, August 05, 2014 4:23 AM > To: Bhushan Bharat-R65777 > Cc: ag...@suse.de; kvm-...@vger.kernel.org; kvm@vger.kernel.org; Yoder Stuart- > B08248 > Subject: Re: [PATCH 5/5 v2] KVM: PPC: BOOKE: Emulate debug registers and > except

Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-04 Thread Xiao Guangrong
On 08/05/2014 05:10 AM, David Matlack wrote: > The following events can lead to an incorrect KVM_EXIT_MMIO bubbling > up to userspace: > > (1) Guest accesses gpa X without a memory slot. The gfn is cached in > struct kvm_vcpu_arch (mmio_gfn). On Intel EPT-enabled hosts, KVM sets > the SPTE write-e

Re: [PATCH 4/5] KVM: PPC: BOOKE: Clear guest dbsr in userspace exit KVM_EXIT_DEBUG

2014-08-04 Thread Scott Wood
On Mon, 2014-08-04 at 22:33 -0500, Bhushan Bharat-R65777 wrote: > > > -Original Message- > > From: Wood Scott-B07421 > > Sent: Tuesday, August 05, 2014 4:17 AM > > To: Bhushan Bharat-R65777 > > Cc: ag...@suse.de; kvm-...@vger.kernel.org; kvm@vger.kernel.org; Yoder > > Stuart- > > B08248 >

RE: [PATCH 4/5] KVM: PPC: BOOKE: Clear guest dbsr in userspace exit KVM_EXIT_DEBUG

2014-08-04 Thread bharat.bhus...@freescale.com
> -Original Message- > From: Wood Scott-B07421 > Sent: Tuesday, August 05, 2014 4:17 AM > To: Bhushan Bharat-R65777 > Cc: ag...@suse.de; kvm-...@vger.kernel.org; kvm@vger.kernel.org; Yoder Stuart- > B08248 > Subject: Re: [PATCH 4/5] KVM: PPC: BOOKE: Clear guest dbsr in userspace exit > KV

KVM on ARM64

2014-08-04 Thread Mathew Li
Hi, I have a quick question. How do we add a hard disk to the qemu ARM VM? I tried: qemu-system-aarch64 -machine virt -hda disk.img -kernel image -initrd initrd.img qemu-system-aarch64 -machine virt -sd disk.img -kernel image -initrd initrd.img qemu-system-aarch64 -machine virt -mtdblock disk.

Re: [PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-04 Thread Wanpeng Li
Hi David, On Mon, Aug 04, 2014 at 02:10:20PM -0700, David Matlack wrote: >The following events can lead to an incorrect KVM_EXIT_MMIO bubbling >up to userspace: > >(1) Guest accesses gpa X without a memory slot. The gfn is cached in >struct kvm_vcpu_arch (mmio_gfn). On Intel EPT-enabled hosts, KVM

Re: [PATCH 5/5 v2] KVM: PPC: BOOKE: Emulate debug registers and exception

2014-08-04 Thread Scott Wood
On Mon, 2014-08-04 at 13:32 +0530, Bharat Bhushan wrote: > @@ -735,7 +745,27 @@ static int kvmppc_handle_debug(struct kvm_run *run, > struct kvm_vcpu *vcpu) > struct debug_reg *dbg_reg = &(vcpu->arch.shadow_dbg_reg); > u32 dbsr = vcpu->arch.dbsr; > > - /* Clear guest dbsr (vcpu->

Re: [PATCH 4/5] KVM: PPC: BOOKE: Clear guest dbsr in userspace exit KVM_EXIT_DEBUG

2014-08-04 Thread Scott Wood
On Mon, 2014-08-04 at 13:22 +0530, Bharat Bhushan wrote: > Dbsr is not visible to userspace and we do not think any need to > expose this to userspace because: > Userspace cannot inject debug interrupt to guest (as this > does not know guest ability to handle debug interrupt), so > userspace

Re: [PATCH v5 2/5] random: Add and use arch_get_rng_seed

2014-08-04 Thread Theodore Ts'o
On Wed, Jul 23, 2014 at 09:57:28PM -0700, Andy Lutomirski wrote: > Currently, init_std_data contains its own logic for using arch > random sources. This replaces that logic with a generic function > arch_get_rng_seed that allows arch code to supply its own logic. > The default implementation tries

[PATCH v2] kvm: x86: fix stale mmio cache bug

2014-08-04 Thread David Matlack
The following events can lead to an incorrect KVM_EXIT_MMIO bubbling up to userspace: (1) Guest accesses gpa X without a memory slot. The gfn is cached in struct kvm_vcpu_arch (mmio_gfn). On Intel EPT-enabled hosts, KVM sets the SPTE write-execute-noread so that future accesses cause EPT_MISCONFIG

[PATCH] KVM: MMU: Use hashtable for MMU page hash

2014-08-04 Thread Sasha Levin
Use the kernel hashtable interface instead of the hlist interface. This allows us to eliminate some unneeded code and make the code simpler. Signed-off-by: Sasha Levin --- arch/x86/include/asm/kvm_host.h |4 ++-- arch/x86/kvm/mmu.c | 16 ++-- 2 files changed, 8 ins

Re: [PATCH 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01

2014-08-04 Thread Davidlohr Bueso
On Fri, 2014-08-01 at 16:12 +0800, Wanpeng Li wrote: > External interrupt will cause L1 vmexit w/ reason external interrupt when L2 > is > running. Then L1 will pick up the interrupt through vmcs12 if L1 set the ack > interrupt bit. Commit 77b0f5d (KVM: nVMX: Ack and write vector info to > intr

Re: kvm-unit-tests failures

2014-08-04 Thread Chris J Arges
On 08/04/2014 01:40 PM, Paolo Bonzini wrote: > Il 04/08/2014 20:37, Chris J Arges ha scritto: >> Paolo, >> Yes this is how I initially ran the script: >> ./configure && make >> sudo ./run_tests.sh -v >> >> Then if any commands that failed, I re-ran the command it output in >> order to show more out

Re: kvm-unit-tests failures

2014-08-04 Thread Paolo Bonzini
Il 04/08/2014 20:37, Chris J Arges ha scritto: > Paolo, > Yes this is how I initially ran the script: > ./configure && make > sudo ./run_tests.sh -v > > Then if any commands that failed, I re-ran the command it output in > order to show more output here for debugging. Which tests are failing and

Re: kvm-unit-tests failures

2014-08-04 Thread Chris J Arges
On 08/04/2014 01:20 PM, Paolo Bonzini wrote: > Il 04/08/2014 19:02, Chris J Arges ha scritto: >> Paulo, >> Hopefully this is enough to get started; I can file this as a bug if its >> easier to track. Let me know if there is additional information that is >> needed. I'm thinking some may be usersp

Re: kvm-unit-tests failures

2014-08-04 Thread Paolo Bonzini
Il 04/08/2014 19:02, Chris J Arges ha scritto: > Paulo, > Hopefully this is enough to get started; I can file this as a bug if its > easier to track. Let me know if there is additional information that is > needed. I'm thinking some may be userspace qemu-system-x86_64 issues > since three of them c

Re: kvm-unit-tests failures

2014-08-04 Thread Chris J Arges
On 08/02/2014 01:35 AM, Paolo Bonzini wrote: > Il 01/08/2014 23:09, Chris J Arges ha scritto: >> Hi, >> >> We are planning on running kvm-unit-tests as part of our test suite; but >> I've noticed that many tests fail (even running the latest kvm tip). >> After searching I found many BZ entires that

[Bug 53361] Wrong CPUID data returned by KVM

2014-08-04 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=53361 Chris Harrington changed: What|Removed |Added CC||ironiri...@gmail.com --- Comment #1 fr

[GIT PULL 00/33] perf/core improvements and fixes

2014-08-04 Thread Arnaldo Carvalho de Melo
Hi Ingo, Mostly fixes plus some refactoring work, more to come as I process Adrian Hunter big patch set and other that missed this pull request. Please consider pulling, - Arnaldo The following changes since commit f9b9f812235d53f774a083e88a5a23b517a69752: Merge tag 'perf-cor

[PATCH 04/33] perf kvm stat: Properly show submicrosecond times

2014-08-04 Thread Arnaldo Carvalho de Melo
From: Christian Borntraeger For lots of exits the min time (and sometimes max) is 0 or 1. Lets increase the accurancy similar to what the average field alread does. Signed-off-by: Christian Borntraeger Acked-by: David Ahern Cc: David Ahern Cc: Jiri Olsa Cc: Paolo Bonzini Cc: kvm@vger.kernel

Re: [RFC][PATCH] kvm: x86: fix stale mmio cache bug

2014-08-04 Thread David Matlack
On Mon, Aug 4, 2014 at 5:44 AM, Paolo Bonzini wrote: > Il 02/08/2014 06:15, Xiao Guangrong ha scritto: >> I prefer to also caching the spte’s generation number, then check the number >> in quickly_check_mmio_pf(). > > I agree, thanks Xiao for the review and David for the report! I like this appro

Re: [PATCH v3] arm64: fix VTTBR_BADDR_MASK

2014-08-04 Thread Christoffer Dall
On Mon, Aug 04, 2014 at 09:42:46AM -0500, Joel Schopp wrote: > Since this fixes a real problem and didn't make it into 3.16 it would be > good if this made it into 3.17. > It's too late for the merge window, we have to review and test as I told you in a private e-mail. We will review this and tes

Re: [PATCH v3] arm64: fix VTTBR_BADDR_MASK

2014-08-04 Thread Joel Schopp
Since this fixes a real problem and didn't make it into 3.16 it would be good if this made it into 3.17. -Joel On 08/04/2014 09:38 AM, Joel Schopp wrote: > The current VTTBR_BADDR_MASK only masks 39 bits, which is broken on current > systems. Rather than just add a bit it seems like a good time

Re: KVM call for agenda for 2014-08-05

2014-08-04 Thread Juan Quintela
Reset, this time with the right mailing lists. Thanks to Markus for noticing. Later, Juan. Juan Quintela wrote: > Hi > > Please, send any topic that you are interested in covering. > > Thanks, Juan. > > Call details: > > 15:00 CEST > 13:00 UTC > 09:00 EDT > > Every two weeks > > By popular dem

[PATCH v3] arm64: fix VTTBR_BADDR_MASK

2014-08-04 Thread Joel Schopp
The current VTTBR_BADDR_MASK only masks 39 bits, which is broken on current systems. Rather than just add a bit it seems like a good time to also set things at run-time instead of compile time to accomodate more hardware. This patch sets TCR_EL2.PS, VTCR_EL2.T0SZ and vttbr_baddr_mask in runtime,

Re: [PATCH v2] vhost: Add polling mode

2014-08-04 Thread Michael S. Tsirkin
On Thu, Jul 31, 2014 at 02:50:00PM +0300, Razya Ladelsky wrote: > Resubmitting the patch in: http://marc.info/?l=kvm&m=140594903520308&w=2 > after fixing the whitespaces issues. > Thank you, > Razya > > >From f293e470b36ff9eb4910540c620315c418e4a8fc Mon Sep 17 00:00:00 2001 Above should c

Re: [PATCH v2 10/10] target-arm/kvm: make reg sync code common between kvm32/64

2014-08-04 Thread Peter Maydell
On 10 July 2014 16:50, Alex Bennée wrote: > Before we launch a guest we query KVM for the list of "co-processor" > registers it knows about which is used later for save/restore of machine > state. The logic is identical for both 32-bit and 64-bit so I've moved > it all into the common code and sim

Re: [PATCH v2 09/10] target-arm/kvm.c: better error reporting

2014-08-04 Thread Peter Maydell
On 10 July 2014 16:50, Alex Bennée wrote: > From: Alex Bennée > > When we have a problem syncing CP registers between kvm<->qemu it's a > lot more useful to have the names of the registers in the log than just > a random abort() and core dump. > > Signed-off-by: Alex Bennée No particular object

On vacation next week

2014-08-04 Thread Paolo Bonzini
I will be on vacation next week. I don't expect any big problems since I'll send the ARM and PPC patches to Linus no later than Thursday. I will not merge any more x86 patches for the merge window. Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message

Re: [PATCH v3] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-04 Thread Paolo Bonzini
Il 04/08/2014 12:58, Wanpeng Li ha scritto: > This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=61411 > > TPR shadow/threshold feature is important to speed up the Windows guest. > Besides, it is a must feature for certain VMM. > > We map virtual APIC page address and TPR threshold f

Re: [PATCH 1/2] KVM: nVMX: Fix nested vmexit ack intr before load vmcs01

2014-08-04 Thread Paolo Bonzini
Il 01/08/2014 10:12, Wanpeng Li ha scritto: > External interrupt will cause L1 vmexit w/ reason external interrupt when L2 > is > running. Then L1 will pick up the interrupt through vmcs12 if L1 set the ack > interrupt bit. Commit 77b0f5d (KVM: nVMX: Ack and write vector info to > intr_info > i

Re: [PATCH 2/2] KVM: nVMX: fix acknowledge interrupt on exit when APICv is in use

2014-08-04 Thread Paolo Bonzini
Il 01/08/2014 10:12, Wanpeng Li ha scritto: > +int kvm_lapic_ack_apicv(struct kvm_vcpu *vcpu) > +{ > + struct kvm_lapic *apic = vcpu->arch.apic; > + int vec; > + > + vec = kvm_apic_has_interrupt(vcpu); > + > + if (vec == -1) > + return vec; > + > + apic_set_vector(ve

Re: [RFC][PATCH] kvm: x86: fix stale mmio cache bug

2014-08-04 Thread Paolo Bonzini
Il 02/08/2014 06:15, Xiao Guangrong ha scritto: > I prefer to also caching the spte’s generation number, then check the number > in quickly_check_mmio_pf(). I agree, thanks Xiao for the review and David for the report! Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the

Re: [PATCH] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-08-04 Thread Alex Bennée
Christoffer Dall writes: > On Thu, Jul 31, 2014 at 07:21:44PM +0200, Paolo Bonzini wrote: >> Il 31/07/2014 19:04, Peter Maydell ha scritto: >> > On 31 July 2014 17:57, Paolo Bonzini wrote: >> >> Il 09/07/2014 15:55, Alex Bennée ha scritto: >> >> No, it's not. It's just the state of the CPU, s

Re: [PATCH] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-08-04 Thread Christoffer Dall
On Thu, Jul 31, 2014 at 07:21:44PM +0200, Paolo Bonzini wrote: > Il 31/07/2014 19:04, Peter Maydell ha scritto: > > On 31 July 2014 17:57, Paolo Bonzini wrote: > >> Il 09/07/2014 15:55, Alex Bennée ha scritto: > >>> To cleanly restore an SMP VM we need to ensure that the current pause > >>> state

Re: [PATCH] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-08-04 Thread Christoffer Dall
On Fri, Aug 01, 2014 at 10:11:52AM +0100, Alex Bennée wrote: > > Christoffer Dall writes: > > > On Thu, Jul 31, 2014 at 04:14:51PM +0100, Alex Bennée wrote: > >> > >> Christoffer Dall writes: > >> > >> > On Wed, Jul 09, 2014 at 02:55:12PM +0100, Alex Bennée wrote: > >> >> To cleanly restore an

Re: [PATCH] arm64: KVM: export current vcpu->pause state via pseudo regs

2014-08-04 Thread Christoffer Dall
On Fri, Aug 01, 2014 at 10:48:36AM +0100, Alex Bennée wrote: > > Christoffer Dall writes: > > > On Thu, Jul 31, 2014 at 05:45:28PM +0100, Peter Maydell wrote: > >> On 31 July 2014 17:38, Christoffer Dall > >> wrote: > >> >> > If we are not complaining when setting the pause value to false if it

[RFC PATCH] ARM: KVM: add irqfd support

2014-08-04 Thread Eric Auger
This patch enables irqfd on ARM. irqfd framework enables to inject a virtual IRQ into a guest upon an eventfd trigger. User-side uses KVM_IRQFD VM ioctl to provide KVM with a kvm_irqfd struct that associates a VM, an eventfd, an IRQ number (aka. the gsi). When an actor signals the eventfd (typical

Re: [PATCH v2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-04 Thread Wanpeng Li
On Mon, Aug 04, 2014 at 12:13:13PM +0200, Paolo Bonzini wrote: >Il 04/08/2014 12:11, Wanpeng Li ha scritto: >> Hi Paolo, >> On Fri, Aug 01, 2014 at 11:05:13AM +0200, Paolo Bonzini wrote: >>> Il 01/08/2014 10:09, Wanpeng Li ha scritto: This patch fix bug https://bugzilla.kernel.org/show_bug.cgi

[PATCH v3] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-04 Thread Wanpeng Li
This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=61411 TPR shadow/threshold feature is important to speed up the Windows guest. Besides, it is a must feature for certain VMM. We map virtual APIC page address and TPR threshold from L1 VMCS. If TPR_BELOW_THRESHOLD VM exit is triggered

Re: [PATCH] arm/arm64: KVM: Support KVM_CAP_READONLY_MEM

2014-08-04 Thread Christoffer Dall
On Thu, Jul 10, 2014 at 07:42:31AM -0700, Christoffer Dall wrote: > When userspace loads code and data in a read-only memory regions, KVM > needs to be able to handle this on arm and arm64. Specifically this is > used when running code directly from a read-only flash device; the > common scenario

Re: [PATCH v2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-04 Thread Paolo Bonzini
Il 04/08/2014 12:11, Wanpeng Li ha scritto: > Hi Paolo, > On Fri, Aug 01, 2014 at 11:05:13AM +0200, Paolo Bonzini wrote: >> Il 01/08/2014 10:09, Wanpeng Li ha scritto: >>> This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=61411 >>> >>> TPR shadow/threshold feature is important to speed

Re: [PATCH v2] KVM: nVMX: nested TPR shadow/threshold emulation

2014-08-04 Thread Wanpeng Li
Hi Paolo, On Fri, Aug 01, 2014 at 11:05:13AM +0200, Paolo Bonzini wrote: >Il 01/08/2014 10:09, Wanpeng Li ha scritto: >> This patch fix bug https://bugzilla.kernel.org/show_bug.cgi?id=61411 >> >> TPR shadow/threshold feature is important to speed up the Windows guest. >> Besides, it is a must feat

[GIT PULL] First round of KVM changes for 3.17

2014-08-04 Thread Paolo Bonzini
The following changes since commit 33b458d276bbdbe28febac0742835002b9f4778d: KVM: SVM: Fix CPL export via SS.DPL (2014-06-30 16:45:28 +0200) are available in the git repository at: git://git.kernel.org/pub/scm/virt/kvm/kvm.git tags/for-linus for you to fetch changes up to 42cbc04fd3b5e3f9b0

[GIT PULL 24/51] KVM: ARM: vgic: add the GICv3 backend

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Introduce the support code for emulating a GICv2 on top of GICv3 hardware. Acked-by: Catalin Marinas Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_asm.h | 2 + arch/arm64/kvm/vgic-v3-switch.S | 29 + include/kvm/arm_vgic.h | 28 + virt/kv

[GIT PULL 47/51] arm64: KVM: implement lazy world switch for debug registers

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Implement switching of the debug registers. While the number of registers is massive, CPUs usually don't implement them all (A57 has 6 breakpoints and 4 watchpoints, which gives us a total of 22 registers "only"). Also, we only save/restore them when MDSCR_EL1 has debug enable

[GIT PULL 33/51] ARM: KVM: one_reg coproc set and get BE fixes

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky Fix code that handles KVM_SET_ONE_REG, KVM_GET_ONE_REG ioctls to work in BE image. Before this fix get/set_one_reg functions worked correctly only in LE case - reg_from_user was taking 'void *' kernel address that actually could be target/source memory of either 4 bytes size

[GIT PULL 26/51] arm64: KVM: vgic: enable GICv2 emulation on top on GICv3 hardware

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Add the last missing bits that enable GICv2 emulation on top of GICv3 hardware. Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_host.h | 7 +++ arch/arm64/kvm/Makefile | 2 ++ virt/kvm/arm/vgic.c | 1 + 3 files changed, 10 insertions(+)

[GIT PULL 35/51] ARM64: KVM: MMIO support BE host running LE code

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky In case of guest CPU running in LE mode and host runs in BE mode we need byteswap data, so read/write is emulated correctly. Signed-off-by: Victor Kamensky Reviewed-by: Christoffer Dall Reviewed-by: Marc Zyngier Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kv

[GIT PULL 31/51] ARM: KVM: vgic mmio should hold data as LE bytes array in BE case

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky According to recent clarifications of mmio.data array meaning - the mmio.data array should hold bytes as they would appear in memory. Vgic is little endian device. And in case of BE image kernel side that emulates vgic, holds data in BE form. So we need to byteswap cpu<->le3

[GIT PULL 04/51] ARM: KVM: Unmap IPA on memslot delete/move

2014-08-04 Thread Christoffer Dall
From: Eric Auger Currently when a KVM region is deleted or moved after KVM_SET_USER_MEMORY_REGION ioctl, the corresponding intermediate physical memory is not unmapped. This patch corrects this and unmaps the region's IPA range in kvm_arch_commit_memory_region using unmap_stage2_range. Signed-o

[GIT PULL 32/51] ARM: KVM: MMIO support BE host running LE code

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky In case of status register E bit is not set (LE mode) and host runs in BE mode we need byteswap data, so read/write is emulated correctly. Signed-off-by: Victor Kamensky Reviewed-by: Christoffer Dall Reviewed-by: Marc Zyngier Signed-off-by: Marc Zyngier --- arch/arm/in

[GIT PULL 46/51] arm64: KVM: add trap handlers for AArch32 debug registers

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Add handlers for all the AArch32 debug registers that are accessible from EL0 or EL1. The code follow the same strategy as the AArch64 counterpart with regards to tracking the dirty state of the debug registers. Reviewed-by: Anup Patel Reviewed-by: Christoffer Dall Signed-of

[GIT PULL 18/51] KVM: ARM: introduce vgic_params structure

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Move all the data specific to a given GIC implementation into its own little structure. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h | 11 virt/kvm/arm/vgic.c| 70 ---

[GIT PULL 30/51] ARM: KVM: __kvm_vcpu_run function return result fix in BE case

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky The __kvm_vcpu_run function returns a 64-bit result in two registers, which has to be adjusted for BE case. Signed-off-by: Victor Kamensky Acked-by: Christoffer Dall Acked-by: Marc Zyngier Signed-off-by: Marc Zyngier --- arch/arm/kvm/interrupts.S | 5 + 1 file chan

[GIT PULL 08/51] arm64: GICv3 device tree binding documentation

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Add the necessary documentation to support GICv3. Cc: Thomas Gleixner Cc: Mark Rutland Acked-by: Catalin Marinas Acked-by: Rob Herring Acked-by: Christoffer Dall Signed-off-by: Marc Zyngier --- Documentation/devicetree/bindings/arm/gic-v3.txt | 79 ++

[GIT PULL 23/51] arm64: KVM: move HCR_EL2.{IMO,FMO} manipulation into the vgic switch code

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier GICv3 requires the IMO and FMO bits to be tightly coupled with some of the interrupt controller's register switch. In order to have similar code paths, move the manipulation of these bits to the GICv2 switch code. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Sign

[GIT PULL 28/51] ARM: KVM: fix vgic V7 assembler code to work in BE image

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky The vgic h/w registers are little endian; when BE asm code reads/writes from/to them, it needs to do byteswap after/before. Byteswap code uses ARM_BE8 wrapper to add swap only if CONFIG_CPU_BIG_ENDIAN is configured. Signed-off-by: Victor Kamensky Reviewed-by: Christoffer D

[GIT PULL 41/51] arm64: move DBG_MDSCR_* to asm/debug-monitors.h

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier In order to be able to use the DBG_MDSCR_* macros from the KVM code, move the relevant definitions to the obvious include file. Also move the debug_el enum to a portion of the file that is guarded by #ifndef __ASSEMBLY__ in order to use that file from assembly code. Acked-by:

[GIT PULL 16/51] KVM: ARM: vgic: abstract VMCR access

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Instead of directly messing with with the GICH_VMCR bits for the CPU interface save/restore code, add accessors that encode/decode the entire set of registers exposed by VMCR. Not the most efficient thing, but given that this code is only used by the save/restore code, perform

[GIT PULL 42/51] arm64: KVM: add trap handlers for AArch64 debug registers

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Add handlers for all the AArch64 debug registers that are accessible from EL0 or EL1. The trapping code keeps track of the state of the debug registers, allowing for the switch code to implement a lazy switching strategy. Reviewed-by: Anup Patel Reviewed-by: Christoffer Dall

[GIT PULL 40/51] arm64: KVM: rename pm_fake handler to trap_raz_wi

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier pm_fake doesn't quite describe what the handler does (ignoring writes and returning 0 for reads). As we're about to use it (a lot) in a different context, rename it with a (admitedly cryptic) name that make sense for all users. Reviewed-by: Anup Patel Reviewed-by: Christoffe

[GIT PULL 19/51] KVM: ARM: vgic: split GICv2 backend from the main vgic code

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Brutally hack the innocent vgic code, and move the GICv2 specific code to its own file, using vgic_ops and vgic_params as a way to pass information between the two blocks. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm/kvm/

[GIT PULL 43/51] arm64: KVM: common infrastructure for handling AArch32 CP14/CP15

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier As we're about to trap a bunch of CP14 registers, let's rework the CP15 handling so it can be generalized and work with multiple tables. Reviewed-by: Anup Patel Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_asm.h| 2 +- arch

[GIT PULL 27/51] ARM: virt: fix wrong HSCTLR.EE bit setting

2014-08-04 Thread Christoffer Dall
From: Li Liu HSCTLR.EE is defined as bit[25] referring to arm manual DDI0606C.b(p1590). Reviewed-by: Marc Zyngier Signed-off-by: Li Liu Signed-off-by: Marc Zyngier --- arch/arm/kernel/hyp-stub.S | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/arm/kernel/hyp-stub.S

[GIT PULL 44/51] arm64: KVM: use separate tables for AArch32 32 and 64bit traps

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier An interesting "feature" of the CP14 encoding is that there is an overlap between 32 and 64bit registers, meaning they cannot live in the same table as we did for CP15. Create separate tables for 64bit CP14 and CP15 registers, and let the top level handler use the right one.

[GIT PULL 39/51] ARM64: KVM: fix big endian issue in access_vm_reg for 32bit guest

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky Fix issue with 32bit guests running on top of BE KVM host. Indexes of high and low words of 64bit cp15 register are swapped in case of big endian code, since 64bit cp15 state is restored or saved with double word write or read instruction. Define helper macro to access low

[GIT PULL 21/51] arm64: KVM: remove __kvm_hyp_code_{start,end} from hyp.S

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier We already have __hyp_text_{start,end} to express the boundaries of the HYP text section, and __kvm_hyp_code_{start,end} are getting in the way of a more modular world switch code. Just turn __kvm_hyp_code_{start,end} into #defines mapping the linker-emited symbols. Acked-by:

[GIT PULL 29/51] ARM: KVM: handle 64bit values passed to mrcc or from mcrr instructions in BE case

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky In some cases the mcrr and mrrc instructions in combination with the ldrd and strd instructions need to deal with 64bit value in memory. The ldrd and strd instructions already handle endianness within word (register) boundaries but to get effect of the whole 64bit value repr

[GIT PULL 48/51] arm64: KVM: enable trapping of all debug registers

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Enable trapping of the debug registers, preventing the guests to mess with the host state (and allowing guests to use the debug infrastructure as well). Reviewed-by: Anup Patel Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp.S | 8

[GIT PULL 37/51] ARM64: KVM: fix vgic_bitmap_get_reg function for BE 64bit case

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky Fix vgic_bitmap_get_reg function to return 'right' word address of 'unsigned long' bitmap value in case of BE 64bit image. Signed-off-by: Victor Kamensky Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- virt/kvm/arm/vgic.c | 24 ++-- 1 f

[GIT PULL 38/51] ARM64: KVM: set and get of sys registers in BE case

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky Since size of all sys registers is always 8 bytes. Current code is actually endian agnostic. Just clean it up a bit. Removed comment about little endian. Change type of pointer from 'void *' to 'u64 *' to enforce stronger type checking. Signed-off-by: Victor Kamensky Acked

[GIT PULL 51/51] arm64: KVM: fix 64bit CP15 VM access for 32bit guests

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Commit f0a3eaff71b8 (ARM64: KVM: fix big endian issue in access_vm_reg for 32bit guest) changed the way we handle CP15 VM accesses, so that all 64bit accesses are done via vcpu_sys_reg. This looks like a good idea as it solves indianness issues in an elegant way, except for on

[GIT PULL 36/51] ARM64: KVM: store kvm_vcpu_fault_info est_el2 as word

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky esr_el2 field of struct kvm_vcpu_fault_info has u32 type. It should be stored as word. Current code works in LE case because existing puts least significant word of x1 into esr_el2, and it puts most significant work of x1 into next field, which accidentally is OK because it

[GIT PULL 17/51] KVM: ARM: vgic: introduce vgic_enable

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Move the code dealing with enabling the VGIC on to vgic_ops. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h | 1 + virt/kvm/arm/vgic.c| 29 + 2 files changed, 22 insertions(+),

[GIT PULL 25/51] arm64: KVM: vgic: add GICv3 world switch

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Introduce the GICv3 world switch code used to save/restore the GICv3 context. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/kvm_asm.h | 2 + arch/arm64/kernel/asm-offsets.c | 8 ++ arch/arm64/kvm/vgic-v3

[GIT PULL 49/51] arm64: KVM: GICv3: move system register access to msr_s/mrs_s

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Commit 72c583951526 (arm64: gicv3: Allow GICv3 compilation with older binutils) changed the way we express the GICv3 system registers, but couldn't change the occurences used by KVM as the code wasn't merged yet. Just fix the accessors. Cc: Will Deacon Cc: Catalin Marinas C

[GIT PULL 22/51] arm64: KVM: split GICv2 world switch from hyp code

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Move the GICv2 world switch code into its own file, and add the necessary indirection to the arm64 switch code. Also introduce a new type field to the vgic_params structure. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm/i

[GIT PULL 34/51] ARM: KVM: enable KVM in Kconfig on big-endian systems

2014-08-04 Thread Christoffer Dall
From: Victor Kamensky Previous patches addresses ARMV7 big-endian virtualiztion, kvm related issues, so enable ARM_VIRT_EXT for big-endian now. Signed-off-by: Victor Kamensky Acked-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm/kvm/Kconfig | 2 +- 1 file changed, 1 insertion(+

[GIT PULL 15/51] KVM: ARM: vgic: move underflow handling to vgic_ops

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Move the code dealing with LR underflow handling to its own functions, and make them accessible through vgic_ops. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h | 2 ++ virt/kvm/arm/vgic.c| 28 +++

[GIT PULL 45/51] arm64: KVM: check ordering of all system register tables

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier We now have multiple tables for the various system registers we trap. Make sure we check the order of all of them, as it is critical that we get the order right (been there, done that...). Reviewed-by: Anup Patel Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier ---

[GIT PULL 20/51] KVM: ARM: vgic: revisit implementation of irqchip_in_kernel

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier So far, irqchip_in_kernel() was implemented by testing the value of vctrl_base, which worked fine with GICv2. With GICv3, this field is useless, as we're using system registers instead of a emmory mapped interface. To solve this, add a boolean flag indicating if the we're usin

[GIT PULL 50/51] KVM: arm64: GICv3: mandate page-aligned GICV region

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Just like GICv2 was fixed in 63afbe7a0ac1 (kvm: arm64: vgic: fix hyp panic with 64k pages on juno platform), mandate the GICV region to be both aligned on a page boundary and its size to be a multiple of page size. This prevents a guest from being able to poke at regions where

[GIT PULL 06/51] arm64: KVM: export demux regids as KVM_REG_ARM64

2014-08-04 Thread Christoffer Dall
From: Alex Bennée I suspect this is a -ECUTPASTE fault from the initial implementation. If we don't declare the register ID to be KVM_REG_ARM64 the KVM_GET_ONE_REG implementation kvm_arm_get_reg() returns -EINVAL and hilarity ensues. The kvm/api.txt document describes all arm64 registers as star

[GIT PULL 05/51] ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping

2014-08-04 Thread Christoffer Dall
From: Kim Phillips A userspace process can map device MMIO memory via VFIO or /dev/mem, e.g., for platform device passthrough support in QEMU. During early development, we found the PAGE_S2 memory type being used for MMIO mappings. This patch corrects that by using the more strongly ordered mem

[GIT PULL 03/51] arm/arm64: KVM: Fix and refactor unmap_range

2014-08-04 Thread Christoffer Dall
unmap_range() was utterly broken, to quote Marc, and broke in all sorts of situations. It was also quite complicated to follow and didn't follow the usual scheme of having a separate iterating function for each level of page tables. Address this by refactoring the code and introduce a pgd_clear()

[GIT PULL 11/51] KVM: ARM: vgic: introduce vgic_ops and LR manipulation primitives

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier In order to split the various register manipulation from the main vgic code, introduce a vgic_ops structure, and start by abstracting the LR manipulation code with a couple of accessors. Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h |

[GIT PULL 07/51] arm64: KVM: allow export and import of generic timer regs

2014-08-04 Thread Christoffer Dall
From: Alex Bennée For correct guest suspend/resume behaviour we need to ensure we include the generic timer registers for 64 bit guests. As CONFIG_KVM_ARM_TIMER is always set for arm64 we don't need to worry about null implementations. However I have re-jigged the kvm_arm_timer_set/get_reg declar

[GIT PULL 09/51] arm64: boot protocol documentation update for GICv3

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Linux has some requirements that must be satisfied in order to boot on a system built with a GICv3. Acked-by: Christoffer Dall Signed-off-by: Marc Zyngier --- Documentation/arm64/booting.txt | 8 1 file changed, 8 insertions(+) diff --git a/Documentation/arm64/boo

[GIT PULL 01/51] irqchip: gic: Move some bits of GICv2 to a library-type file

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier A few GICv2 low-level function are actually very useful to GICv3, and it makes some sense to share them across the two drivers. They end-up in their own file, with an additional parameter used to ensure an optional synchronization (unused on GICv2). Cc: Thomas Gleixner Cc: Ja

[GIT PULL 02/51] irqchip: gic-v3: Initial support for GICv3

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier The Generic Interrupt Controller (version 3) offers services that are similar to GICv2, with a number of additional features: - Affinity routing based on the CPU MPIDR (ARE) - System register for the CPU interfaces (SRE) - Support for more that 8 CPUs - Locality-specific Periph

[GIT PULL 14/51] KVM: ARM: vgic: abstract MISR decoding

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Instead of directly dealing with the GICH_MISR bits, move the code to its own function and use a couple of public flags to represent the actual state. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h | 4

[GIT PULL 13/51] KVM: ARM: vgic: abstract EISR bitmap access

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Move the GICH_EISR access to its own function. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h | 1 + virt/kvm/arm/vgic.c| 25 +++-- 2 files changed, 24 insertions(+), 2 deletions(-) d

[GIT PULL 12/51] KVM: ARM: vgic: abstract access to the ELRSR bitmap

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier Move the GICH_ELRSR access to its own functions, and add them to the vgic_ops structure. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- include/kvm/arm_vgic.h | 2 ++ virt/kvm/arm/vgic.c| 46

[GIT PULL 10/51] KVM: arm/arm64: vgic: move GICv2 registers to their own structure

2014-08-04 Thread Christoffer Dall
From: Marc Zyngier In order to make way for the GICv3 registers, move the v2-specific registers to their own structure. Acked-by: Catalin Marinas Reviewed-by: Christoffer Dall Signed-off-by: Marc Zyngier --- arch/arm/kernel/asm-offsets.c | 14 +-- arch/arm/kvm/interrupts_head.S |

  1   2   >