Re: [PATCH V2 2/2] KVM: arm64: Increase number of user memslots to 508

2017-02-23 Thread Christoffer Dall
On Wed, Feb 08, 2017 at 12:45:41PM +0530, linucher...@gmail.com wrote: > From: Linu Cherian > > Having only 32 memslots is a real constraint for the maximum > number of PCI devices that can be assigned to a single guest. > Assuming each PCI device/virtual function having two memory BAR > regions,

Re: [PATCH v2 2/3] arm64: kvm: reuse existing cache type/info related macros

2017-02-23 Thread Christoffer Dall
cache type/info related macros and > replaces the hardcorded values. It also removes some of the comments > that become trivial with the macro names. > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Christoffer Dall > Cc: Marc Zyngier > Signed-off-by: Su

Re: [RFC PATCH 00/13] arm64/kvm: use common sysreg definitions

2017-02-24 Thread Christoffer Dall
Hi Mark, On Tue, Jan 31, 2017 at 06:05:38PM +, Mark Rutland wrote: > Whenever we add new functionality involving new system registers, we need to > add sys_reg() definitions so that we can access the registers regardless of > whether the toolchain can assemble them. At the same time, we have t

Re: A question about TTBRs

2017-02-24 Thread Christoffer Dall
On Fri, Feb 24, 2017 at 09:55:09AM +, Raz wrote: > Hello > I am reading the arm8a book. According to the documentation the output > address of each level 3 entry in TTBRx_EL1points to an address in the > physical memory. > By looking in the mmu tab in the DS5 studio I can see the TTBRs tables.

Re: [PATCH] KVM: arm/arm64: vgic-v3: Don't pretend to support IRQ/FIQ bypass

2017-02-24 Thread Christoffer Dall
that when the GIC is configured, but > we fail to indicate that to the guest. The obvious fix is to > set these bits (and never let them being changed again). > > Reported-by: Peter Maydell > Signed-off-by: Marc Zyngier Acked-by: Christoffer Dall > --- > include/linux/irqchip

Re: [PATCH V2 2/2] KVM: arm64: Increase number of user memslots to 508

2017-03-02 Thread Christoffer Dall
On Sun, Feb 26, 2017 at 12:36:58PM +0530, Linu Cherian wrote: > On Thu, Feb 23, 2017 at 3:44 PM, Christoffer Dall wrote: > > On Wed, Feb 08, 2017 at 12:45:41PM +0530, linucher...@gmail.com wrote: > >> From: Linu Cherian > >> > >> Having only 32 memslots

Re: [PATCH] arm64: KVM: VHE: Clear HCR_TGE when invalidating guest TLBs

2017-03-02 Thread Christoffer Dall
t to clear before invalidating TLBs. > > Address the issue by introducing two wrappers (__tlb_switch_to_guest > and __tlb_switch_to_host) that take care of both the VTTBR_EL2 > and HCR_EL2.TGE switching. > > Reported-by: Tomasz Nowicki > Tested-by: Tomasz Nowicki > Signed-off-by

Re: Android on virt device

2017-03-02 Thread Christoffer Dall
On Sun, Feb 26, 2017 at 12:12:35PM +0200, Roman Livshits wrote: > Hi > > I am trying to run Android on qemu virt machine. > I want to use virt as this was used by the op-tee for implementing > TEE for ARM TrustZone, see > https://github.com/OP-TEE/build#op-tee-buildgit, so hope that > running Andr

Re: [PATCH 0/8] arm64: KVM: Fix PMU exception generation

2017-03-05 Thread Christoffer Dall
Hi Marc, On Wed, Feb 22, 2017 at 11:47:20AM +, Marc Zyngier wrote: > Running the following code: > > root@zomby-woof:~# cat test-pmu.c > int main(int argc, char *argv[]) > { > unsigned int val; > asm ("mrc p15, 0, %0, c9, c13, 0\n" : "=r" (val)); > return val; > } > > in a

[PATCH] KVM: arm/arm64: Let vcpu thread modify its own active state

2017-03-06 Thread Christoffer Dall
From: Jintack Lim Currently, if a vcpu thread tries to change its own active state when the irq is already in AP list, it'll loop forever. Since the VCPU thread has already synced back LR state to the struct vgic_irq, let it modify its own state safely. Signed-off-by: Jintack Lim --- virt/kvm/

[PATCH v2] KVM: arm/arm64: Let vcpu thread modify its own active state

2017-03-06 Thread Christoffer Dall
From: Jintack Lim Currently, if a vcpu thread tries to change the active state of an interrupt which is already on the same vcpu's AP list, Since the VGIC mmio handler is called after a vcpu has already synced back the LR state to the struct vgic_irq, we can just let it proceed safely. Signed-of

[kvmtool PATCH] arm/arm64: gic: Test changing active state of interrupts

2017-03-06 Thread Christoffer Dall
From: Christoffer Dall We found a deadlock when changing the active state of an interrupt while the interrupt is queued on the LR of the running VCPU. Defend KVM against this bug in the future now when we've introduced a fix. Signed-off-by: Christoffer Dall --- arm/gic.c

Re: [PATCH 2/2] arm64/kvm: survive unknown traps from guests

2017-03-06 Thread Christoffer Dall
the guest, with a corresponding (ratelimited) warning in > the host dmesg. We could later improve on this with with a new (opt-in) > exit to the host userspace. > > Signed-off-by: Mark Rutland > Cc: Christoffer Dall > Cc: Dave Martin > Cc: Marc Zyngier > Cc: Suzuki K

Re: [PATCH 1/2] arm/kvm: survive unknown traps from guests

2017-03-06 Thread Christoffer Dall
t; The patch makes KVM handle any unknown EC by injecting an UNDEFINED > exception into the guest, with a corresponding (ratelimited) warning in > the host dmesg. We could later improve on this with with a new (opt-in) > exit to the host userspace. > > Signed-off-by: Mark Rutland &g

[kvm-unit-tests PATCH] arm/arm64: gic: Test changing active state of interrupts

2017-03-06 Thread Christoffer Dall
From: Christoffer Dall We found a deadlock when changing the active state of an interrupt while the interrupt is queued on the LR of the running VCPU. Defend KVM against this bug in the future now when we've introduced a fix. Signed-off-by: Christoffer Dall --- Sending with the right su

Re: [PATCH 0/8] arm64: KVM: Fix PMU exception generation

2017-03-07 Thread Christoffer Dall
On Tue, Mar 07, 2017 at 09:33:37AM +, Marc Zyngier wrote: > On Sun, Mar 05 2017 at 3:01:09 pm GMT, Christoffer Dall > wrote: > > Hi Marc, > > > > On Wed, Feb 22, 2017 at 11:47:20AM +, Marc Zyngier wrote: > >> Running the following code: > >&g

Re: KVM on ARM Cortex A53 in 32-bit Mode

2017-03-07 Thread Christoffer Dall
Hi Yasutaka, On Thu, Mar 02, 2017 at 09:57:50AM -0500, Yasutaka Tanaka wrote: > Hello KVM/ARM community, > > I am now trying to execute KVM on Raspberry Pi 3 Model B (RPI3). > Does anyone know whether KVM/ARM can run with 32-bit mode on ARM Cortex A53? Theoretically, it should. > > The CPU of

Re: [PATCH v2] KVM: arm/arm64: Let vcpu thread modify its own active state

2017-03-07 Thread Christoffer Dall
On Mon, Mar 06, 2017 at 02:20:44PM -0500, Jintack Lim wrote: > Hi Christoffer, > > thanks for submitting this patch. > > On Mon, Mar 6, 2017 at 8:42 AM, Christoffer Dall > wrote: > > From: Jintack Lim > > > > Currently, if a vcpu thread tries to change

Re: [PATCH] KVM: arm64: VGIC: fix command handling while ITS being disabled

2017-03-07 Thread Christoffer Dall
ite_its_ctlr(struct kvm *kvm, struct vgic_its *its, > + gpa_t addr, unsigned int len, > + unsigned long val) > +{ > + mutex_lock(&its->cmd_lock); > + > + its->enabled = !!(val & GITS_CTLR_ENABLE); > + > + /* > + * Try to process any pending commands. This function bails out early > + * if the ITS is disabled or no commands have been queued. > + */ > + vgic_its_process_commands(kvm, its); > + > + mutex_unlock(&its->cmd_lock); > +} > + > #define REGISTER_ITS_DESC(off, rd, wr, length, acc) \ > {\ > .reg_offset = off, \ > -- > 2.9.0 > Reviewed-by: Christoffer Dall ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Re: [PATCH V3 1/4] KVM: Add documentation for KVM_CAP_NR_MEMSLOTS

2017-03-07 Thread Christoffer Dall
On Tue, Mar 07, 2017 at 11:22:41AM +0530, linucher...@gmail.com wrote: > From: Linu Cherian Please add a patch description, even if it just repeats the subject line as in this case. Otherwise: Acked-by: Christoffer Dall > > Signed-off-by: Linu Cherian > --- > Documentat

Re: [kvm-unit-tests PATCH] arm/arm64: gic: Test changing active state of interrupts

2017-03-08 Thread Christoffer Dall
On Tue, Mar 07, 2017 at 08:34:33PM +0100, Radim Krčmář wrote: > 2017-03-07 17:58+0100, Andrew Jones: > > On Mon, Mar 06, 2017 at 07:16:09AM -0800, Christoffer Dall wrote: > > > From: Christoffer Dall > > > > > > We found a deadlock when changing the active s

Re: [PATCH 5/5] KVM: arm/arm64: allow userspace to set MPIDR

2017-03-08 Thread Christoffer Dall
On Mon, Feb 27, 2017 at 06:55:04PM +0100, Andrew Jones wrote: > QEMU would already prefer having control over the vcpu MPIDRs > in order to correctly map vcpus to virtual numa nodes without > having to first instantiate the vcpus. Also, when virtual cpu > topologies are eventually describable, QEMU

Re: [PATCH 1/5] KVM: arm/arm64: prepare to use vcpu requests

2017-03-08 Thread Christoffer Dall
> > Signed-off-by: Andrew Jones Acked-by: Christoffer Dall > --- > arch/arm/kvm/handle_exit.c | 1 + > arch/arm/kvm/psci.c | 1 + > arch/arm64/kvm/handle_exit.c | 1 + > 3 files changed, 3 insertions(+) > > diff --git a/arch/arm/kvm/handle_exit.c b/arch/arm/

Re: [PATCH 2/5] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu-request

2017-03-08 Thread Christoffer Dall
On Mon, Feb 27, 2017 at 06:55:01PM +0100, Andrew Jones wrote: > This not only ensures visibility of changes to pause by using > atomic ops, but also plugs a small race where a vcpu could get > its pause state enabled just after its last check before entering > the guest. With this patch, while the

Re: [PATCH 5/5] KVM: arm/arm64: allow userspace to set MPIDR

2017-03-08 Thread Christoffer Dall
On Wed, Mar 08, 2017 at 03:27:28PM +0100, Peter Maydell wrote: > On 8 March 2017 at 14:19, Christoffer Dall > wrote: > > Isn't this all super racy? What prevents two VCPUs from getting the > > same MPIDR at the same time? > > From a userspace API point of vie

Re: [PATCH 0/5] KVM: arm/arm64: fix some races and allow userspace to set MPIDR

2017-03-08 Thread Christoffer Dall
Hi Drew, On Mon, Feb 27, 2017 at 06:54:59PM +0100, Andrew Jones wrote: > This series fixes four races. Two are easy to produce with a > kvm-unit-test test[1], but the other two would be quite hard. I > didn't even try to produce those. The two hard to produce races are > addressed by changing vcpu

Re: [PATCH v4 0/4] KVM: arm64: Increase number of user memslots

2017-03-09 Thread Christoffer Dall
e/asm/kvm_host.h | 3 +-- > > 4 files changed, 8 insertions(+), 3 deletions(-) > > For the whole series: > > Acked-by: Marc Zyngier > > Christoffer: if you're happy with this series, I'll take it as part of > the next batch of fixes. > Yes: Reviewed-by: Christoffer Dall ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Re: [PATCH v2] arm64: kvm: Use has_vhe() instead of hyp_alternate_select()

2017-03-09 Thread Christoffer Dall
Hi Shanker, On Sun, Mar 05, 2017 at 08:33:18PM -0600, Shanker Donthineni wrote: > Now all the cpu_hwcaps features have their own static keys. We don't > need a separate function hyp_alternate_select() to patch the vhe/nvhe > code. We can achieve the same functionality by using has_vhe(). It > impr

Re: [PATCH RFC 2/7] ARM64: KVM: Add reset handlers for all ID registers

2017-03-09 Thread Christoffer Dall
On Mon, Jan 16, 2017 at 05:33:29PM +0800, Shannon Zhao wrote: > From: Shannon Zhao > > Move invariant_sys_regs before emulate_sys_reg so that it can be used > later. > > Signed-off-by: Shannon Zhao > --- > arch/arm64/kvm/sys_regs.c | 193 > -- > 1 f

Re: [PATCH RFC 4/7] ARM64: KVM: emulate accessing ID registers

2017-03-09 Thread Christoffer Dall
On Mon, Jan 16, 2017 at 05:33:31PM +0800, Shannon Zhao wrote: > From: Shannon Zhao Please provide a commit message. Thanks, -Christoffer ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Re: [PATCH RFC 5/7] ARM64: KVM: Support cross type vCPU

2017-03-09 Thread Christoffer Dall
On Sat, Jan 28, 2017 at 03:47:54PM +0100, Andrew Jones wrote: > On Mon, Jan 16, 2017 at 05:33:32PM +0800, Shannon Zhao wrote: > > From: Shannon Zhao > > > > Add a capability to tell userspace that KVM supports cross type vCPU. > > Add a cpu feature for userspace to set when it doesn't use host ty

Re: [PATCH RFC 7/7] ARM64: KVM: Add user set handler for id_aa64mmfr0_el1

2017-03-09 Thread Christoffer Dall
On Mon, Jan 16, 2017 at 05:33:34PM +0800, Shannon Zhao wrote: > From: Shannon Zhao > > Check if the configuration is fine. This commit message really needs some love and attention. > > Signed-off-by: Shannon Zhao > --- > arch/arm64/kvm/sys_regs.c | 32 +++- > 1 fi

Re: [PATCH 2/5] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu-request

2017-03-13 Thread Christoffer Dall
On Wed, Mar 08, 2017 at 03:44:11PM +0100, Andrew Jones wrote: > On Wed, Mar 08, 2017 at 06:33:12AM -0800, Christoffer Dall wrote: > > > static int kvm_vcpu_initialized(struct kvm_vcpu *vcpu) > > > @@ -621,7 +617,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, >

Re: [PATCH 2/5] KVM: arm/arm64: replace vcpu->arch.pause with a vcpu-request

2017-03-13 Thread Christoffer Dall
On Mon, Mar 13, 2017 at 06:27:55PM +0100, Andrew Jones wrote: > On Mon, Mar 13, 2017 at 11:30:05AM +0100, Christoffer Dall wrote: > > On Wed, Mar 08, 2017 at 03:44:11PM +0100, Andrew Jones wrote: > > > On Wed, Mar 08, 2017 at 06:33:12AM -0800, Christoffer Dall wrote: >

Re: [PATCH 00/15] arm64/kvm: use common sysreg definitions

2017-03-15 Thread Christoffer Dall
On Fri, Mar 10, 2017 at 08:17:22AM +, Marc Zyngier wrote: > On Thu, Mar 09 2017 at 5:07:12 pm GMT, Mark Rutland > wrote: > > Currently we duplicate effort in maintaining system register encodings > > across > > arm64's , KVM's sysreg tables, and other places. This > > redundancy > > is unf

Re: [PATCH 1/3] kvm: arm/arm64: Take mmap_sem in stage2_unmap_vm

2017-03-15 Thread Christoffer Dall
db105c997 ("arm/arm64: KVM: Introduce stage2_unmap_vm") > Cc: sta...@vger.kernel.org # v3.19+ > Cc: Christoffer Dall > Signed-off-by: Marc Zyngier > Signed-off-by: Suzuki K Poulose > --- > arch/arm/kvm/mmu.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff

Re: [PATCH 3/3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd

2017-03-15 Thread Christoffer Dall
ying to > unmap a range. > > Fixes: commit d5d8184d35c9 ("KVM: ARM: Memory virtualization setup") > Cc: sta...@vger.kernel.org # v3.10+ > Cc: Marc Zyngier > Cc: Christoffer Dall > Signed-off-by: Suzuki K Poulose > --- > arch/arm/kvm/mmu.c | 3 +++ > 1 fil

Re: [PATCH 3/3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd

2017-03-15 Thread Christoffer Dall
On Wed, Mar 15, 2017 at 09:39:26AM +, Marc Zyngier wrote: > On 15/03/17 09:21, Christoffer Dall wrote: > > On Tue, Mar 14, 2017 at 02:52:34PM +, Suzuki K Poulose wrote: > >> In kvm_free_stage2_pgd() we don't hold the kvm->mmu_lock while calling > >>

Re: [PATCH 1/3] kvm: arm/arm64: Take mmap_sem in stage2_unmap_vm

2017-03-15 Thread Christoffer Dall
On Wed, Mar 15, 2017 at 09:34:53AM +, Marc Zyngier wrote: > On 15/03/17 09:17, Christoffer Dall wrote: > > On Tue, Mar 14, 2017 at 02:52:32PM +, Suzuki K Poulose wrote: > >> From: Marc Zyngier > >> > >> We don't hold the mmap_sem while searching fo

Re: [PATCH 2/3] kvm: arm/arm64: Take mmap_sem in kvm_arch_prepare_memory_region

2017-03-15 Thread Christoffer Dall
uot;arm/arm64: KVM: map MMIO regions at creation > time") > Cc: Ard Biesheuvel > Cc: Christoffer Dall > Cc: Eric Auger > Cc: sta...@vger.kernel.org # v3.18+ > Signed-off-by: Marc Zyngier > [ Handle dirty page logging failure case ] > Signed-off-by: Suzuki K Poulos

Re: [PATCH RFC 6/7] ARM64: KVM: Support heterogeneous system

2017-03-15 Thread Christoffer Dall
Hi Drew, [Replying here to try to capture the discussion about this patch we had at connect]. On Sat, Jan 28, 2017 at 03:55:51PM +0100, Andrew Jones wrote: > On Mon, Jan 16, 2017 at 05:33:33PM +0800, Shannon Zhao wrote: > > From: Shannon Zhao > > > > When initializing KVM, check whether physica

Re: [PATCH 3/3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd

2017-03-15 Thread Christoffer Dall
On Wed, Mar 15, 2017 at 01:28:07PM +, Marc Zyngier wrote: > On 15/03/17 10:56, Christoffer Dall wrote: > > On Wed, Mar 15, 2017 at 09:39:26AM +, Marc Zyngier wrote: > >> On 15/03/17 09:21, Christoffer Dall wrote: > >>> On Tue, Mar 14, 2017 at 02:52:34PM

Re: [PATCH RFC 6/7] ARM64: KVM: Support heterogeneous system

2017-03-15 Thread Christoffer Dall
On Wed, Mar 15, 2017 at 01:51:13PM +0100, Andrew Jones wrote: > On Wed, Mar 15, 2017 at 12:50:44PM +0100, Christoffer Dall wrote: > > Hi Drew, > > > > [Replying here to try to capture the discussion about this patch we had > > at connect]. > > > > On Sat, J

Re: [PATCH RFC 6/7] ARM64: KVM: Support heterogeneous system

2017-03-15 Thread Christoffer Dall
On Wed, Mar 15, 2017 at 03:06:33PM +0100, Andrew Jones wrote: > On Wed, Mar 15, 2017 at 02:36:45PM +0100, Christoffer Dall wrote: > > > If QEMU wants to know > > > whether or not the host it's running on is heterogeneous, then > > > it can just query sysfs, rathe

Re: KVM on ARM Cortex A53 in 32-bit Mode

2017-03-16 Thread Christoffer Dall
On Wed, Mar 15, 2017 at 07:50:36PM -0400, Yasutaka, T wrote: > Hi Christopher and other KVM/ARM community members, > > I tried the following QEMU and Kernel combinations on Raspberry Pi 3 > (AArch64 mode) but failed: > > Latest commit of Alexander Graf's no-kvm-irqchip QEMU branch: > https://gith

Re: [PATCH] kvm: arm/arm64: Simplify lock relaxation in stage2_wp_range

2017-03-17 Thread Christoffer Dall
Marc Zyngier > [ Added assert_spin_locked check ] > Signed-off-by: Suzuki K Poulose Reviewed-by: Christoffer Dall > --- > arch/arm/kvm/mmu.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c > index 7628ef1..3

Re: [PATCH v2 3/3] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd

2017-03-17 Thread Christoffer Dall
kernel.org # v3.10+ > Cc: Paolo Bonzini > Cc: Marc Zyngier > Cc: Christoffer Dall > Signed-off-by: Suzuki K Poulose > [ Avoid vCPU starvation and lockup detector warnings ] > Signed-off-by: Marc Zyngier > Signed-off-by: Suzuki K Poulose Reviewed-by: Christoffer Dal

Re: KVM on ARM Cortex A53 in 32-bit Mode

2017-03-17 Thread Christoffer Dall
On Fri, Mar 17, 2017 at 01:09:22AM -0400, Yasutaka, T wrote: > 2017-03-16 5:38 GMT-04:00 Christoffer Dall : > > > On Wed, Mar 15, 2017 at 07:50:36PM -0400, Yasutaka, T wrote: > > > Hi Christopher and other KVM/ARM community members, > > > > > > I tried the

[PATCH] KVM: arm64: Ensure LRs are clear when they should be

2017-03-18 Thread Christoffer Dall
From: Christoffer Dall We currently have some code to clear the list registers on GICv3, but we never call this code, because the caller got nuked when removing the old vgic. We also used to have a similar GICv2 part, but that got lost in the process too. Let's reintroduce the logic for

Re: [PATCH] KVM: arm64: Ensure LRs are clear when they should be

2017-03-19 Thread Christoffer Dall
On Sat, Mar 18, 2017 at 02:07:47PM +, Marc Zyngier wrote: > On Sat, Mar 18 2017 at 12:56:56 pm GMT, Christoffer Dall > wrote: > > Hi Christoffer, > > > From: Christoffer Dall > > > > We currently have some code to clear the list registers on GICv3, but we

[PATCH 0/9] KVM: arm/arm64: vgic: Improvements and optimizations

2017-03-20 Thread Christoffer Dall
der-X. Patches also available on: git://git.kernel.org/pub/scm/linux/kernel/git/cdall/linux.git gic-optimize Thanks, -Christoffer Christoffer Dall (8): KVM: arm/arm64: vgic: Defer touching GICH_VMCR to vcpu_load/put KVM: arm/arm64: vgic: Get rid of live_lrs KVM: arm/arm64: vgic: Get r

[PATCH 2/9] KVM: arm/arm64: vgic: Avoid flushing vgic state when there's no pending IRQ

2017-03-20 Thread Christoffer Dall
d-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic.c | 8 1 file changed, 8 insertions(+) diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index 2ac0def..1436c2e 100644 --- a/virt/kvm/arm/vgic/vgic.c +++ b/virt/kvm/arm/vgic/vgic.c @@ -637,12 +637,17 @@ static

[PATCH 3/9] KVM: arm/arm64: vgic: Get rid of live_lrs

2017-03-20 Thread Christoffer Dall
From: Christoffer Dall There is no need to calculate and maintain live_lrs when we always populate the lowest numbered LRs first on every entry and clear all LRs on every exit. Signed-off-by: Christoffer Dall --- include/kvm/arm_vgic.h| 2 -- virt/kvm/arm/hyp/vgic-v2-sr.c | 39

[PATCH 1/9] KVM: arm/arm64: vgic: Defer touching GICH_VMCR to vcpu_load/put

2017-03-20 Thread Christoffer Dall
From: Christoffer Dall We don't have to save/restore the VMCR on every entry to/from the guest, since on GICv2 we can access the control interface from EL1 and on VHE systems with GICv3 we can access the control interface from KVM running in EL2. GICv3 systems without VHE becomes the rare

[PATCH 5/9] KVM: arm/arm64: vgic: Get rid of unnecessary save_maint_int_state

2017-03-20 Thread Christoffer Dall
From: Christoffer Dall Now when we don't look at the MISR and EISR values anymore, we can get rid of the logic to save them in the GIC save/restore code. Signed-off-by: Christoffer Dall --- virt/kvm/arm/hyp/vgic-v2-sr.c | 40 virt/kvm/arm/hyp/vg

[PATCH 8/9] KVM: arm/arm64: vgic: Don't check vgic_initialized in flush_hwstate

2017-03-20 Thread Christoffer Dall
(uses READ_ONCE) and can therefore check if a list is empty or not without the need to take the spinlock protecting the list. Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index

[PATCH 9/9] KVM: arm/arm64: vgic: Improve sync_hwstate performance

2017-03-20 Thread Christoffer Dall
pty or not without the need to take the spinlock protecting the list. Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index 093873e..8ecb009 100644 ---

[PATCH 6/9] KVM: arm/arm64: vgic: Get rid of MISR and EISR fields

2017-03-20 Thread Christoffer Dall
From: Christoffer Dall We don't use these fields anymore so let's nuke them completely. Signed-off-by: Christoffer Dall --- include/kvm/arm_vgic.h| 4 virt/kvm/arm/hyp/vgic-v2-sr.c | 2 -- virt/kvm/arm/hyp/vgic-v3-sr.c | 2 -- 3 files changed, 8 deletions(-) diff --git

[PATCH 7/9] KVM: arm/arm64: vgic: Implement early VGIC init functionality

2017-03-20 Thread Christoffer Dall
check additional initialization flags to ensure they don't look at uninitialized data structures. Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-init.c | 96 +-- 1 file changed, 56 insertions(+), 40 deletions(-) diff --git a/virt/kvm/arm

[PATCH 4/9] KVM: arm/arm64: vgic: Get rid of unnecessary process_maintenance operation

2017-03-20 Thread Christoffer Dall
From: Christoffer Dall Since we always read back the LRs that we wrote to the guest and the MISR and EISR registers simply provide a summary of the configuration of the bits in the LRs, there is really no need to read back those status registers and process them. We can might as well just

Re: [PATCH 1/2] KVM: arm/arm64: vgic-v2: Expose the correct GICC_PMR values to userspace

2017-03-20 Thread Christoffer Dall
On Thu, Mar 16, 2017 at 11:45:34AM +, Marc Zyngier wrote: > We allow userspace to save/restore the GICC_PMR values in order > to allow migration. This value is extracted from GICH_PMCR, where > it occupies a 5 bit field. But the canonical PMR is an 8 bit > value and we fail to shift the virtual

Re: [PATCH 2/2] KVM: arm/arm64: vgic-v3: Format PMR to mimic the GICv2 behaviour

2017-03-20 Thread Christoffer Dall
On Thu, Mar 16, 2017 at 11:45:35AM +, Marc Zyngier wrote: > Similarily to the GICv2 case, we need to expose a PMR value that > is either the 8bit value (KVM_DEV_ARM_VGIC_CTRL_CANONICAL_PMR > being set) or the 5bit, truncated value otherwise. I'm a bit puzzled by this patch as well. The struct

Re: [PATCH 1/2] KVM: arm/arm64: vgic-v2: Expose the correct GICC_PMR values to userspace

2017-03-20 Thread Christoffer Dall
On Mon, Mar 20, 2017 at 03:12:05PM +, Marc Zyngier wrote: > On 20/03/17 14:24, Christoffer Dall wrote: > > On Thu, Mar 16, 2017 at 11:45:34AM +, Marc Zyngier wrote: > >> We allow userspace to save/restore the GICC_PMR values in order > >> to allow migration. T

Re: [PATCH 1/2] KVM: arm/arm64: vgic-v2: Expose the correct GICC_PMR values to userspace

2017-03-20 Thread Christoffer Dall
On Mon, Mar 20, 2017 at 07:31:29PM +0100, Christoffer Dall wrote: > On Mon, Mar 20, 2017 at 03:12:05PM +, Marc Zyngier wrote: > > On 20/03/17 14:24, Christoffer Dall wrote: > > > On Thu, Mar 16, 2017 at 11:45:34AM +, Marc Zyngier wrote: > > >> We allow

[PATCH 4/5] KVM: arm64: vgic: Get rid of struct vmcr for GICv3

2017-03-21 Thread Christoffer Dall
between the ICH_VMCR register format stored in memory and the ICC_X_EL1 registers exported to user space. Signed-off-by: Christoffer Dall --- arch/arm64/kvm/vgic-sys-reg-v3.c | 133 +++ virt/kvm/arm/vgic/vgic-mmio.c| 4 +- virt/kvm/arm/vgic/vgic-v3.c

[PATCH 3/5] KVM: arm64: vgic: Rename vgic_v3_cpu to vgic_cpu

2017-03-21 Thread Christoffer Dall
ff-by: Christoffer Dall --- arch/arm64/kvm/vgic-sys-reg-v3.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kvm/vgic-sys-reg-v3.c b/arch/arm64/kvm/vgic-sys-reg-v3.c index 48848db..33f111c 100644 --- a/arch/arm64/kvm/vgic-sys-reg-v3.c +++ b/arch/arm6

[PATCH 0/5] Clarify GICC_PMR export format and remove struct vmcr

2017-03-21 Thread Christoffer Dall
ser access functions and get rid of the VMCR structure entirely, which results in a rather nice diffstat considering I've added quite a few lines of comments. Based on v4.11-rc1. Thanks, -Christoffer Christoffer Dall (5): KVM: arm/arm64: Clarify GICC_PMR export format KVM: arm64: v

[PATCH 2/5] KVM: arm64: vgic: Factor out access_gic_ctlr into separate r/w functions

2017-03-21 Thread Christoffer Dall
ned-off-by: Christoffer Dall --- arch/arm64/kvm/vgic-sys-reg-v3.c | 134 ++- 1 file changed, 75 insertions(+), 59 deletions(-) diff --git a/arch/arm64/kvm/vgic-sys-reg-v3.c b/arch/arm64/kvm/vgic-sys-reg-v3.c index 79f37e3..48848db 100644 --- a/arch/arm64/kvm/vg

[PATCH 5/5] KVM: arm/arm64: vgic: Get rid of struct vmcr for GICv2

2017-03-21 Thread Christoffer Dall
rid of struct vmcr and its common accessor functions. Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-mmio-v2.c | 51 +--- virt/kvm/arm/vgic/vgic-mmio.c| 16 - virt/kvm/arm/vgic/vgic-v2.c | 29 --- virt/kvm/arm

[PATCH 1/5] KVM: arm/arm64: Clarify GICC_PMR export format

2017-03-21 Thread Christoffer Dall
We are exporting the format of the priority field as it's stored in the GICH_VMCR.VMPriMask field using the lower five bits when accessing register state using the GICC_PMR offset. This is unfortunate, but it's ABI already, so we simply have to make it clear. Signed-off-by: Christ

Re: [PATCH 1/9] KVM: arm/arm64: vgic: Defer touching GICH_VMCR to vcpu_load/put

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 10:29:08AM +, Marc Zyngier wrote: > On 20/03/17 10:58, Christoffer Dall wrote: > > From: Christoffer Dall > > > > We don't have to save/restore the VMCR on every entry to/from the guest, > > since on GICv2 we can access the contr

Re: [PATCH 2/9] KVM: arm/arm64: vgic: Avoid flushing vgic state when there's no pending IRQ

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 10:57:49AM +, Marc Zyngier wrote: > On 20/03/17 10:58, Christoffer Dall wrote: > > From: Shih-Wei Li > > > > We do not need to flush vgic states in each world switch unless > > there is pending IRQ queued to the vgic's ap list. We can

Re: [PATCH] kvm: pass the virtual SEI syndrome to guest OS

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 02:32:29PM +0800, gengdongjiu wrote: > > > On 2017/3/20 23:08, James Morse wrote: > > Hi Dongjiu Geng, > > > > On 20/03/17 13:58, Marc Zyngier wrote: > >> On 20/03/17 12:28, gengdongjiu wrote: > >>> On 2017/3/20 19:24, Marc Zyngier wrote: > Please include James Morse

Re: [PATCH 4/9] KVM: arm/arm64: vgic: Get rid of unnecessary process_maintenance operationjjjj

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 11:36:19AM +, Marc Zyngier wrote: > On 20/03/17 10:58, Christoffer Dall wrote: > > From: Christoffer Dall > > > > Since we always read back the LRs that we wrote to the guest and the > > MISR and EISR registers simply provide a summary of t

Re: [PATCH 7/9] KVM: arm/arm64: vgic: Implement early VGIC init functionality

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 12:05:30PM +, Marc Zyngier wrote: > On 20/03/17 10:58, Christoffer Dall wrote: > > Implement early initialization for both the distributor and the CPU > > interfaces. The basic idea is that even though the VGIC is not > > functional or not requ

Re: [PATCH 8/9] KVM: arm/arm64: vgic: Don't check vgic_initialized in flush_hwstate

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 12:08:15PM +, Marc Zyngier wrote: > On 20/03/17 10:58, Christoffer Dall wrote: > > Now when we do an early init of the static parts of the VGIC data > > structures, we can do things like checking if the AP lists are empty > > directly without havin

Re: [PATCH 4/9] KVM: arm/arm64: vgic: Get rid of unnecessary process_maintenance operationjjjj

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 01:26:52PM +, Marc Zyngier wrote: > On 21/03/17 12:26, Christoffer Dall wrote: > > On Tue, Mar 21, 2017 at 11:36:19AM +, Marc Zyngier wrote: > >> On 20/03/17 10:58, Christoffer Dall wrote: > >>> From: Christoffer Dall > >>&g

Re: [PATCH 9/9] KVM: arm/arm64: vgic: Improve sync_hwstate performance

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 01:29:06PM +, Marc Zyngier wrote: > On 20/03/17 10:58, Christoffer Dall wrote: > > There is no need to call any functions to fold LRs when we don't use any > > LRs and we don't need to mess with overflow flags, take spinlocks, or > > prun

Re: [PATCH 5/5] KVM: arm/arm64: vgic: Get rid of struct vmcr for GICv2

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 02:36:00PM +, Marc Zyngier wrote: > On 21/03/17 11:05, Christoffer Dall wrote: > > There is no common code in the VGIC that uses the VMCR, so we have no > > use of the intermediate architecture-agnostic representation of the VMCR > > and might a

Re: [PATCH] kvm: pass the virtual SEI syndrome to guest OS

2017-03-21 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 8:11 PM, James Morse wrote: > Hi Christoffer, > > On 21/03/17 11:34, Christoffer Dall wrote: > > On Tue, Mar 21, 2017 at 02:32:29PM +0800, gengdongjiu wrote: > >> On 2017/3/20 23:08, James Morse wrote: > >>>>>> On 20/03/17 07

Re: [PATCH] kvm: pass the virtual SEI syndrome to guest OS

2017-03-21 Thread Christoffer Dall
[resending as clear text - I thought GMail supported that - sorry] On Tue, Mar 21, 2017 at 07:11:44PM +, James Morse wrote: > Hi Christoffer, > > On 21/03/17 11:34, Christoffer Dall wrote: > > On Tue, Mar 21, 2017 at 02:32:29PM +0800, gengdongjiu wrote: > >> On 2017

[PATCH] KVM: arm/arm64: vgic: Fix GICC_PMR uaccess on GICv3 and clarify ABI

2017-03-21 Thread Christoffer Dall
-off-by: Christoffer Dall --- Documentation/virtual/kvm/devices/arm-vgic.txt | 6 ++ include/linux/irqchip/arm-gic.h| 3 +++ virt/kvm/arm/vgic/vgic-mmio-v2.c | 20 ++-- virt/kvm/arm/vgic/vgic-v2.c| 8 virt/kvm/arm

[PATCH v2 08/10] KVM: arm/arm64: vgic: Implement early VGIC init functionality

2017-03-21 Thread Christoffer Dall
check additional initialization flags to ensure they don't look at uninitialized data structures. Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-init.c | 96 +-- 1 file changed, 56 insertions(+), 40 deletions(-) di

[PATCH v2 09/10] KVM: arm/arm64: vgic: Don't check vgic_initialized in sync/flush

2017-03-21 Thread Christoffer Dall
: Christoffer Dall --- Changes since v1: - Moved note about checking list_empty to other patch commit message - Removed check in both sync/flush in this patch virt/kvm/arm/vgic/vgic.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic.c b/virt/kvm/arm/vgic/vgic.c index

[PATCH v2 02/10] KVM: arm/arm64: vgic: Avoid flushing vgic state when there's no pending IRQ

2017-03-21 Thread Christoffer Dall
tomic read (uses READ_ONCE) and can therefore check if a list is empty or not without the need to take the spinlock protecting the list. Signed-off-by: Shih-Wei Li Signed-off-by: Christoffer Dall --- Changes since v1: - Added comment in kvm_vgic_flush_hwstate virt/kvm/arm/vgic/vgic.c

[PATCH v2 01/10] KVM: arm/arm64: vgic: Defer touching GICH_VMCR to vcpu_load/put

2017-03-21 Thread Christoffer Dall
From: Christoffer Dall We don't have to save/restore the VMCR on every entry to/from the guest, since on GICv2 we can access the control interface from EL1 and on VHE systems with GICv3 we can access the control interface from KVM running in EL2. GICv3 systems without VHE become the rare

[PATCH v2 00/10] KVM: arm/arm64: vgic: Improvements and optimizations

2017-03-21 Thread Christoffer Dall
der-X. Changelogs are in the patches. Patches also available on: git://git.kernel.org/pub/scm/linux/kernel/git/cdall/linux.git gic-optimize-v2 Thanks, -Christoffer Christoffer Dall (9): KVM: arm/arm64: vgic: Defer touching GICH_VMCR to vcpu_load/put KVM: arm/arm64: vgic: Get rid of live_lrs

[PATCH v2 04/10] KVM: arm/arm64: vgic: Only set underflow when actually out of LRs

2017-03-21 Thread Christoffer Dall
logic to only setting the underflow interrupt when we actually run out of LRs. As it turns out, this allows us to further simplify the handling in vgic_sync_hwstate in later patches. Signed-off-by: Christoffer Dall --- Changes since v1: - New patch virt/kvm/arm/vgic/vgic.c | 10 ++ 1

[PATCH v2 06/10] KVM: arm/arm64: vgic: Get rid of unnecessary save_maint_int_state

2017-03-21 Thread Christoffer Dall
From: Christoffer Dall Now when we don't look at the MISR and EISR values anymore, we can get rid of the logic to save them in the GIC save/restore code. Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall --- virt/kvm/arm/hyp/vgic-v2-sr.c

[PATCH v2 10/10] KVM: arm/arm64: vgic: Improve sync_hwstate performance

2017-03-21 Thread Christoffer Dall
pty or not without the need to take the spinlock protecting the list. Signed-off-by: Christoffer Dall --- Changes since v1: - Moved clearing used_lrs into fold_lr_state - Moved hunk that removes check for vgic_initialized into previous patch virt/kvm/arm/vgic/vgic-v2.c | 7 +-- virt/kv

[PATCH v2 07/10] KVM: arm/arm64: vgic: Get rid of MISR and EISR fields

2017-03-21 Thread Christoffer Dall
From: Christoffer Dall We don't use these fields anymore so let's nuke them completely. Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall --- include/kvm/arm_vgic.h| 4 virt/kvm/arm/hyp/vgic-v2-sr.c | 2 -- virt/kvm/arm/hyp/vgic-v3-sr.c | 2 -- 3 files changed, 8

[PATCH v2 03/10] KVM: arm/arm64: vgic: Get rid of live_lrs

2017-03-21 Thread Christoffer Dall
From: Christoffer Dall There is no need to calculate and maintain live_lrs when we always populate the lowest numbered LRs first on every entry and clear all LRs on every exit. Acked-by: Marc Zyngier Signed-off-by: Christoffer Dall --- include/kvm/arm_vgic.h| 2 -- virt/kvm/arm/hyp

[PATCH v2 05/10] KVM: arm/arm64: vgic: Get rid of unnecessary process_maintenance operation

2017-03-21 Thread Christoffer Dall
From: Christoffer Dall Since we always read back the LRs that we wrote to the guest and the MISR and EISR registers simply provide a summary of the configuration of the bits in the LRs, there is really no need to read back those status registers and process them. We can might as well just

Re: [PATCH v4 00/28] arm/arm64: KVM: Rework the hyp-stub API

2017-03-22 Thread Christoffer Dall
Hi Marc, On Tue, Mar 21, 2017 at 07:20:30PM +, Marc Zyngier wrote: > As noticed by RMK in this thread[1], the hyp-stub API on 32bit ARM > could do with some TLC (it cannot perform a soft-restart at HYP, and > has holes in the hyp-stub support in a number of places). In general, > it would be

Re: [PATCH v4 00/28] arm/arm64: KVM: Rework the hyp-stub API

2017-03-22 Thread Christoffer Dall
On Wed, Mar 22, 2017 at 04:14:44PM +, Marc Zyngier wrote: > Hi Christoffer, > > On 22/03/17 13:37, Christoffer Dall wrote: > > Hi Marc, > > > > > > On Tue, Mar 21, 2017 at 07:20:30PM +, Marc Zyngier wrote: > >> As noticed by RMK in thi

Re: [PATCH v4 00/28] arm/arm64: KVM: Rework the hyp-stub API

2017-03-23 Thread Christoffer Dall
On Thu, Mar 23, 2017 at 10:53:04AM +, Marc Zyngier wrote: > On 22/03/17 17:27, Christoffer Dall wrote: > > On Wed, Mar 22, 2017 at 04:14:44PM +, Marc Zyngier wrote: > >> Hi Christoffer, > >> > >> On 22/03/17 13:37, Christoffer Dall wrote: > >&g

Re: [PATCH v4 00/28] arm/arm64: KVM: Rework the hyp-stub API

2017-03-23 Thread Christoffer Dall
On Thu, Mar 23, 2017 at 03:16:49PM +, Marc Zyngier wrote: > On 23/03/17 14:39, Christoffer Dall wrote: > > On Thu, Mar 23, 2017 at 10:53:04AM +, Marc Zyngier wrote: > >> On 22/03/17 17:27, Christoffer Dall wrote: > >>> > >>> I don't think ther

Re: [PATCH v4 28/28] arm/arm64: Add hyp-stub API documentation

2017-03-24 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 07:20:58PM +, Marc Zyngier wrote: > In order to help people understanding the hyp-stub API that exists > between the host kernel and the hypervisor mode (whether a hypervisor > has been installed or not), let's document said API. > > As with any form of documentation, I

Re: [PATCH v4 05/28] arm64: KVM: Implement HVC_RESET_VECTORS stub hypercall in the init code

2017-03-24 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 07:20:35PM +, Marc Zyngier wrote: > In order to restore HYP mode to its original condition, KVM currently > implements __kvm_hyp_reset(). As we're moving towards a hyp-stub > defined API, it becomes necessary to implement HVC_RESET_VECTORS. > > This patch adds the HVC_R

Re: [PATCH v4 19/28] ARM: KVM: Allow the main HYP code to use the init hyp stub implementation

2017-03-24 Thread Christoffer Dall
On Tue, Mar 21, 2017 at 07:20:49PM +, Marc Zyngier wrote: > We now have a full hyp-stub implementation in the KVM init code, > but the main KVM code only supports HVC_GET_VECTORS, which is not > enough. > > Instead of reinventing the wheel, let's reuse the init implementation > by branching to

<    4   5   6   7   8   9   10   11   12   13   >