Re: [PATCH 09/12] KVM: arm/arm64: prepare GICv2 emulation to be handled by kvm_io_bus

2015-03-17 Thread Andre Przywara
Hej, On 14/03/15 14:30, Christoffer Dall wrote: On Fri, Mar 13, 2015 at 04:10:09PM +, Andre Przywara wrote: Using the framework provided by the recent vgic.c changes we register a kvm_io_bus device when initializing the virtual GICv2. Signed-off-by: Andre Przywara andre.przyw...@arm.com

Re: [PATCH 08/12] KVM: arm/arm64: implement kvm_io_bus MMIO handling for the VGIC

2015-03-20 Thread Andre Przywara
On 03/19/2015 03:44 PM, Andre Przywara wrote: Hej Christoffer, [ ... ] +static int vgic_handle_mmio_access(struct kvm_vcpu *vcpu, + struct kvm_io_device *this, gpa_t addr, + int len, void *val, bool is_write) +{ + struct

Re: [PATCH] arm/arm64: KVM: fix missing unlock on error in kvm_vgic_create()

2015-03-13 Thread Andre Przywara
Hej Christoffer, On 02/03/15 17:29, Christoffer Dall wrote: On Fri, Feb 27, 2015 at 07:41:45PM +0800, weiyj...@163.com wrote: From: Wei Yongjun yongjun_...@trendmicro.com.cn Add the missing unlock before return from function kvm_vgic_create() in the error handling case. Signed-off-by: Wei

[PATCH 00/12] KVM: arm/arm64: move VGIC MMIO to kvm_io_bus

2015-03-13 Thread Andre Przywara
guest). Cheers, Andre. [1] https://lists.cs.columbia.edu/pipermail/kvmarm/2015-January/013379.html Andre Przywara (10): KVM: move iodev.h from virt/kvm/ to include/kvm KVM: arm/arm64: remove now unneeded include directory from Makefile KVM: x86: remove now unneeded include directory from

[PATCH 07/12] KVM: arm/arm64: simplify vgic_find_range() and callers

2015-03-13 Thread Andre Przywara
directly. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- virt/kvm/arm/vgic-v2-emul.c |2 +- virt/kvm/arm/vgic.c | 22 -- virt/kvm/arm/vgic.h |3 +-- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/virt/kvm/arm/vgic-v2-emul.c b

[PATCH 03/12] KVM: arm/arm64: remove now unneeded include directory from Makefile

2015-03-13 Thread Andre Przywara
virt/kvm was never really a good include directory for anything else than locally included headers. With the move of iodev.h there is no need anymore to add this directory the compiler's include path, so remove it from the arm and arm64 kvm Makefile. Signed-off-by: Andre Przywara andre.przyw

[PATCH 04/12] KVM: x86: remove now unneeded include directory from Makefile

2015-03-13 Thread Andre Przywara
virt/kvm was never really a good include directory for anything else than locally included headers. With the move of iodev.h there is no need anymore to add this directory the compiler's include path, so remove it from the x86 kvm Makefile. Signed-off-by: Andre Przywara andre.przyw...@arm.com

[PATCH 11/12] KVM: ARM: on IO mem abort - route the call to KVM MMIO bus

2015-03-13 Thread Andre Przywara
MMIO handler alltogether.] Signed-off-by: Nikolay Nikolaev n.nikol...@virtualopensystems.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arch/arm/kvm/mmio.c| 32 +++- include/kvm/arm_vgic.h |2 -- 2 files changed, 31 insertions(+), 3 deletions

[PATCH 05/12] KVM: arm/arm64: rename struct kvm_mmio_range to vgic_io_range

2015-03-13 Thread Andre Przywara
The name kvm_mmio_range is a bit bold, given that it only covers the VGIC's MMIO ranges. To avoid confusion with kvm_io_range, rename it to vgic_io_range. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- virt/kvm/arm/vgic-v2-emul.c |6 +++--- virt/kvm/arm/vgic-v3-emul.c |8

[PATCH 08/12] KVM: arm/arm64: implement kvm_io_bus MMIO handling for the VGIC

2015-03-13 Thread Andre Przywara
patches. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h |9 virt/kvm/arm/vgic.c| 111 virt/kvm/arm/vgic.h|7 +++ 3 files changed, 127 insertions(+) diff --git a/include/kvm/arm_vgic.h b/include

[PATCH 01/12] KVM: Redesign kvm_io_bus_ API to pass VCPU structure to the callbacks.

2015-03-13 Thread Andre Przywara
From: Nikolay Nikolaev n.nikol...@virtualopensystems.com This is needed in e.g. ARM vGIC emulation, where the MMIO handling depends on the VCPU that does the access. Signed-off-by: Nikolay Nikolaev n.nikol...@virtualopensystems.com Signed-off-by: Andre Przywara andre.przyw...@arm.com Acked

[PATCH 02/12] KVM: move iodev.h from virt/kvm/ to include/kvm

2015-03-13 Thread Andre Przywara
the file into include/kvm, so that a more natural #include kvm/iodev.h can be used by all of the code. This also solves a problem later when using struct kvm_io_device in arm_vgic.h. Fixing up the FSF address in the GPL header and a wrong include path on the way. Signed-off-by: Andre Przywara

[PATCH 09/12] KVM: arm/arm64: prepare GICv2 emulation to be handled by kvm_io_bus

2015-03-13 Thread Andre Przywara
Using the framework provided by the recent vgic.c changes we register a kvm_io_bus device when initializing the virtual GICv2. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h |1 + virt/kvm/arm/vgic-v2-emul.c | 13 + virt/kvm/arm/vgic.c

[PATCH 06/12] KVM: mark kvm-buses as empty once they were destroyed

2015-03-13 Thread Andre Przywara
with the VGIC using the kvm_io_bus later (the unregistering is in there to be able to roll back a faulting init). Signed-off-by: Andre Przywara andre.przyw...@arm.com --- virt/kvm/kvm_main.c |4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm

[PATCH 12/12] KVM: arm/arm64: remove now obsolete VGIC specific MMIO handling code

2015-03-13 Thread Andre Przywara
With all of the virtual GIC emulation code now being registered with the kvm_io_bus, we can remove all of the old MMIO handling code and its dispatching functionality. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h |2 -- virt/kvm/arm/vgic-v2-emul.c

[PATCH 10/12] KVM: arm/arm64: prepare GICv3 emulation to use kvm_io_bus MMIO handling

2015-03-13 Thread Andre Przywara
: VCPU) they are connected with. We use the kvm_io_bus framework to register two devices per VCPU, as each block is handled independently by the VGIC code. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h |1 + virt/kvm/arm/vgic-v3-emul.c | 32

[PATCH] KVM: arm/arm64: fix MMIO handling on userland induced accesses

2015-03-24 Thread Andre Przywara
as the userland control tool. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Hi, just embarrassingly realised that I haven't tested the latest version of this series with QEMU, so this bug slipped me. Sorry for that! I will merge this patch in the next revision of this series (or just send a new

Re: [PATCH v2 06/12] KVM: mark kvm-buses as empty once they were destroyed

2015-03-26 Thread Andre Przywara
Hi Marcelo, On 25/03/15 21:59, Marcelo Tosatti wrote: On Wed, Mar 25, 2015 at 05:09:13PM +, Marc Zyngier wrote: On 23/03/15 15:58, Andre Przywara wrote: In kvm_destroy_vm() we call kvm_io_bus_destroy() pretty early, especially before calling kvm_arch_destroy_vm(). To avoid unregistering

[PATCH v2 11/12] KVM: arm/arm64: rework MMIO abort handling to use KVM MMIO bus

2015-03-23 Thread Andre Przywara
in kvm_run, so we get rid of some copying on the way. I didn't bother to rename kvm_exit_mmio (to vgic_mmio or something), because that touches a lot of code lines without any good reason. This is based on an original patch by Nikolay. Signed-off-by: Andre Przywara andre.przyw...@arm.com Cc: Nikolay

Re: [PATCH v3 09/11] KVM: arm/arm64: merge GICv3 RD_base and SGI_base register frames

2015-03-26 Thread Andre Przywara
On 03/26/2015 09:53 PM, Marc Zyngier wrote: On Thu, 26 Mar 2015 14:39:36 + Andre Przywara andre.przyw...@arm.com wrote: Currently we handle the redistributor registers in two separate MMIO regions, one for the overall behaviour and SPIs and one for the SGIs/PPIs. That latter forces

[PATCH v3 07/11] KVM: arm/arm64: implement kvm_io_bus MMIO handling for the VGIC

2015-03-26 Thread Andre Przywara
patches. Signed-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Marc Zyngier marc.zyng...@arm.com --- include/kvm/arm_vgic.h |9 virt/kvm/arm/vgic.c| 129 virt/kvm/arm/vgic.h|7 +++ 3 files changed, 145 insertions

[PATCH v3 08/11] KVM: arm/arm64: prepare GICv2 emulation to be handled by kvm_io_bus

2015-03-26 Thread Andre Przywara
Using the framework provided by the recent vgic.c changes we register a kvm_io_bus device when initializing the virtual GICv2. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h |1 + virt/kvm/arm/vgic-v2-emul.c | 22 -- 2 files changed

[PATCH v3 00/11] KVM: arm/arm64: move VGIC MMIO to kvm_io_bus

2015-03-26 Thread Andre Przywara
with NULL - merge framework switch and code removal patch Andre Przywara (10): KVM: move iodev.h from virt/kvm/ to include/kvm KVM: arm/arm64: remove now unneeded include directory from Makefile KVM: x86: remove now unneeded include directory from Makefile KVM: arm/arm64: rename struct

[PATCH] KVM: arm/arm64: avoid using kvm_run for in-kernel emulation

2015-03-27 Thread Andre Przywara
the usage of struct kvm_run in favour of passing separate parameters into kvm_handle_mmio_return (and rename the function on the way) to optimise the VGIC emulation. The real userland MMIO code path does not change much. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Hi

[PATCH] KVM: arm64: add active register handling to GICv3 emulation as well

2015-04-23 Thread Andre Przywara
their handling in the distributor and redistributor frames of an emulated GICv3. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- virt/kvm/arm/vgic-v3-emul.c | 54 +++ 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/virt/kvm/arm/vgic-v3

[PATCH v2 3/8] irq: add irq__get_nr_allocated_lines

2015-06-05 Thread Andre Przywara
allocated so far. Signed-off-by: Marc Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/irq.h | 1 + irq.c | 5 + 2 files changed, 6 insertions(+) diff --git a/include/kvm/irq.h b/include/kvm/irq.h index 4cec6f0..8a78e43 100644

[PATCH v2 7/8] arm: add support for supplying GICv3 redistributor addresses

2015-06-05 Thread Andre Przywara
which are not (yet) in the (32 bit) header files to allow compilation for ARM. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c | 37 +++-- arm/include/arm-common/gic.h | 2 +- arm/include/arm-common/kvm-arch.h | 18

[PATCH v2 4/8] AArch{32, 64}: dynamically configure the number of GIC interrupts

2015-06-05 Thread Andre Przywara
. [Andre: rename to gic__init_gic() to ease future expansion] Signed-off-by: Marc Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c | 25 + 1 file changed, 25 insertions(+) diff --git a/arm/gic.c b/arm/gic.c index ce5f7fa

[PATCH v2 1/8] AArch64: Reserve two 64k pages for GIC CPU interface

2015-06-05 Thread Andre Przywara
Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/aarch64/include/kvm/kvm-arch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/aarch64/include/kvm/kvm-arch.h b/arm/aarch64/include/kvm/kvm-arch.h index 2f08a26..4925736 100644 --- a/arm

Re: [PATCH v2 6/8] arm: prepare for instantiating different IRQ chip devices

2015-06-09 Thread Andre Przywara
Hi, contrary to my boasting in the cover letter I managed to accidentially drop the fix for the GIC device initialization error handling Will requested from this series. If we fail the GIC initialization sequence at some point, we should make sure to not let the gic_fd initialized, so that

[PATCH] kvmtool: Makefile: allow overriding CC and LD

2015-06-18 Thread Andre Przywara
rid of the PowerPC overrides in the Makefile. Possible uses: $ make CC=gcc -m64 LD=ld -melf64ppc (build kvmtool on a PowerPC toolchain defaulting to 32-bit) $ make CC=gcc -m32 LD=ld -melf_i386 (build a 32-bit binary on a multilib-enabled x86-64 compiler) Signed-off-by: Andre Przywara andre.przyw

Re: [PATCH] kvmtool: don't use PCI config space IRQ line field

2015-06-18 Thread Andre Przywara
Hi Will, On 06/16/2015 06:06 PM, Will Deacon wrote: On Mon, Jun 15, 2015 at 11:45:38AM +0100, Andre Przywara wrote: On 06/05/2015 05:41 PM, Will Deacon wrote: On Thu, Jun 04, 2015 at 04:20:45PM +0100, Andre Przywara wrote: In PCI config space there is an interrupt line field (offset 0x3f

Re: [PATCH] kvmtool: Makefile: allow overriding CC and LD

2015-06-19 Thread Andre Przywara
Hi Michael, On 19/06/15 02:14, Michael Ellerman wrote: On Thu, 2015-06-18 at 16:50 +0100, Andre Przywara wrote: Currently we set CC unconditionally to ${CROSS_COMPILE}gcc, the same for LD. Allow people to override the compiler name by specifying it explicitly on the command line or via

Re: [PATCH] kvmtool: Makefile: allow overriding CC and LD

2015-06-19 Thread Andre Przywara
Hi Paolo, On 19/06/15 10:59, Paolo Bonzini wrote: On 18/06/2015 17:50, Andre Przywara wrote: Currently we set CC unconditionally to ${CROSS_COMPILE}gcc, the same for LD. Allow people to override the compiler name by specifying it explicitly on the command line or via the environment

Re: [RFC 0/6] KVM: arm/arm64: gsi routing support

2015-06-23 Thread Andre Przywara
Hi Eric, I went back reading the code and looked at how the x86 APIC works more closely to understand the GSI routing better. See below for more ... On 22/06/15 10:21, Eric Auger wrote: On 06/22/2015 10:40 AM, Andre Przywara wrote: Hi Eric, I briefly looked over the series, the patches

Re: [PATCH v2 7/8] arm: add support for supplying GICv3 redistributor addresses

2015-06-15 Thread Andre Przywara
On 06/10/2015 06:40 PM, Marc Zyngier wrote: On 05/06/15 09:37, Andre Przywara wrote: The code currently is assuming fixed sized memory regions for the distributor and CPU interface. GICv3 needs a dynamic allocation of its redistributor region, since its size depends on the number of vCPUs

Re: [PATCH] kvmtool: don't use PCI config space IRQ line field

2015-06-15 Thread Andre Przywara
On 06/05/2015 05:41 PM, Will Deacon wrote: On Thu, Jun 04, 2015 at 04:20:45PM +0100, Andre Przywara wrote: Hi Will, sorry, almost forgot about this email... In PCI config space there is an interrupt line field (offset 0x3f), which is used to initially communicate the IRQ line number from

[PATCH v3 05/10] arm: finish VGIC initialisation explicitly

2015-06-17 Thread Andre Przywara
-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Marc Zyngier marc.zyng...@arm.com --- arm/gic.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/arm/gic.c b/arm/gic.c index 8560c9b..99f0d2b 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -98,24

[PATCH v3 07/10] limit number of VCPUs on demand

2015-06-17 Thread Andre Przywara
reached a VCPU limit. If we see this and have at least brought up one VCPU already successfully, then don't panic, but limit the number of VCPUs instead. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c | 6 -- arm/kvm-cpu.c | 11 +-- kvm-cpu.c | 7

[PATCH v3 02/10] AArch{32, 64}: use KVM_CREATE_DEVICE co to instanciate the GIC

2015-06-17 Thread Andre Przywara
to differentiate between creation and initialisation more clearly and fix error path.] Signed-off-by: Marc Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c| 69 +++- arm/include/arm-common

[PATCH v3 01/10] AArch64: Reserve two 64k pages for GIC CPU interface

2015-06-17 Thread Andre Przywara
Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/aarch64/include/kvm/kvm-arch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/aarch64/include/kvm/kvm-arch.h b/arm/aarch64/include/kvm/kvm-arch.h index 2f08a26..4925736 100644 --- a/arm

[PATCH v3 10/10] arm: use new irqchip parameter to create different vGIC types

2015-06-17 Thread Andre Przywara
Currently we unconditionally create a virtual GICv2 in the guest. Add a --irqchip= parameter to let the user specify a different GIC type for the guest. For now we the only other supported type is GICv3. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/aarch64/arm-cpu.c

[PATCH v3 00/10] kvmtool: arm64: GICv3 guest support

2015-06-17 Thread Andre Przywara
included at my repo [2]. [1] git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git [2] git://linux-arm.org/kvmtool.git (branch gicv3/v3) http://www.linux-arm.org/git?p=kvmtool.git;a=log;h=refs/heads/gicv3/v3 Andre Przywara (6): arm: finish VGIC initialisation explicitly arm: simplify

[PATCH v3 06/10] arm: simplify MMIO dispatching

2015-06-17 Thread Andre Przywara
extensions (like expanding the GIC regions). To be in line with the other architectures, move the now simpler code into a header file. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/include/arm-common/kvm-arch.h | 12 arm/include/arm-common/kvm-cpu-arch.h | 14

[PATCH v3 04/10] AArch{32, 64}: dynamically configure the number of GIC interrupts

2015-06-17 Thread Andre Przywara
. [Andre: rename to gic__init_gic() to ease future expansion] Signed-off-by: Marc Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c | 25 + 1 file changed, 25 insertions(+) diff --git a/arm/gic.c b/arm/gic.c index 1ff3663

[PATCH v3 08/10] arm: prepare for instantiating different IRQ chip devices

2015-06-17 Thread Andre Przywara
Extend the vGIC handling code to potentially deal with different IRQ chip devices instead of hard-coding the GICv2 in. We extend most vGIC functions to take a type parameter, but still put GICv2 in at the top for the time being. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm

Re: [PATCH v3 07/10] limit number of VCPUs on demand

2015-06-17 Thread Andre Przywara
On 06/17/2015 01:53 PM, Marc Zyngier wrote: On 17/06/15 12:21, Andre Przywara wrote: Currently the ARM GIC checks the number of VCPUs against a fixed limit, which is GICv2 specific. Don't pretend we know better than the kernel and let's get rid of that explicit check. Instead be more relaxed

Re: [PATCH v3 06/10] arm: simplify MMIO dispatching

2015-06-17 Thread Andre Przywara
Hi Marc, On 06/17/2015 01:48 PM, Marc Zyngier wrote: On 17/06/15 12:21, Andre Przywara wrote: Currently we separate any incoming MMIO request into one of the ARM memory map regions and take care to spare the GIC. It turns out that this is unnecessary, as we only have one special region

Re: [PATCH 05/13] KVM: arm64: handle ITS related GICv3 redistributor registers

2015-06-12 Thread Andre Przywara
Hi Eric, On 06/09/2015 09:52 AM, Eric Auger wrote: On 05/29/2015 11:53 AM, Andre Przywara wrote: In the GICv3 redistributor there are the PENDBASER and PROPBASER registers which we did not emulate so far, as they only make sense when having an ITS. In preparation for that emulate those MMIO

[PATCH 11/13] KVM: arm64: implement ITS command queue command handlers

2015-05-29 Thread Andre Przywara
ITS commands and let them store the requested relation into our own data structures. Error handling is very basic at this point, as we don't have a good way of communicating errors to the guest (usually a SError). Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/linux/irqchip/arm

[PATCH 05/13] KVM: arm64: handle ITS related GICv3 redistributor registers

2015-05-29 Thread Andre Przywara
emulation. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h | 4 virt/kvm/arm/vgic-v3-emul.c | 43 +++ virt/kvm/arm/vgic.c | 35 +++ virt/kvm/arm/vgic.h | 4 4 files

Re: [PATCH 11/13] KVM: arm64: implement ITS command queue command handlers

2015-07-03 Thread Andre Przywara
Hi Christoffer, + +static struct its_collection *vits_new_collection(struct kvm *kvm, u32 coll_id) +{ +struct its_collection *collection; + +collection = kmalloc(sizeof(struct its_collection), GFP_KERNEL); If I manage to understand the structure here, you're calling all

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-03 Thread Andre Przywara
Hi, On 03/07/15 10:05, Andre Przywara wrote: Hi Pavel, On 02/07/15 08:26, Pavel Fedin wrote: Hello! -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Eric Auger Sent: Monday, June 29, 2015 6:37 PM To: eric.au...@st.com; eric.au

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-02 Thread Andre Przywara
Hi Eric, On 02/07/15 15:49, Eric Auger wrote: Hi Pavel, On 07/02/2015 09:26 AM, Pavel Fedin wrote: Hello! -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Eric Auger Sent: Monday, June 29, 2015 6:37 PM To: eric.au...@st.com;

Re: [PATCH] kvmtool: don't use PCI config space IRQ line field

2015-06-29 Thread Andre Przywara
Hi Will, On 29/06/15 11:10, Will Deacon wrote: Hi Andre, On Thu, Jun 18, 2015 at 06:19:53PM +0100, Andre Przywara wrote: I am tempted to remove shmem, since it's broken: a) there is no upstream driver, only some out-of-tree uio driver module in some Github repo Right, but that's

Re: [PATCH 0/3] KVM: arm: Implement software vGICv2 emulation

2015-06-29 Thread Andre Przywara
Hi, On 29/06/15 13:52, Christoffer Dall wrote: Hi Pavel, [Please cc the kvm/arm list for such patches according to the MAINTAINERS file in the future] On Mon, Jun 29, 2015 at 12:53:46PM +0300, Pavel Fedin wrote: Some hardware (like Raspberry Pi 2) is capable of running KVM, however lacks

Re: [PATCH 02/13] KVM: extend struct kvm_msi to hold a 32-bit device ID

2015-06-29 Thread Andre Przywara
Hi Christoffer, thanks for your time to reviewing this! Was probably no pleasure ;-) On 28/06/15 20:12, Christoffer Dall wrote: On Fri, May 29, 2015 at 10:53:18AM +0100, Andre Przywara wrote: The ARM GICv3 ITS MSI controller requires a device ID to be able to assign the proper interrupt

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Andre Przywara
Hi Christoffer, On 06/07/15 10:30, Christoffer Dall wrote: On Mon, Jul 06, 2015 at 09:30:20AM +0100, Andre Przywara wrote: Hi Pavel, On 06/07/15 07:42, Pavel Fedin wrote: Hello! I like this approach, but it runs into problems: As you read above the current documentation says

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Andre Przywara
Hi Paolo, thanks for looking at this! On 06/07/15 12:07, Paolo Bonzini wrote: On 06/07/2015 12:37, Christoffer Dall wrote: I don't view it as 'the kernel requires this' but as 'the kernel will not complain with arbitrary error code if you set the devid flag' capability, and it's up to

Re: [PATCH 2/7] KVM: kvm_host: add kvm_extended_msi

2015-07-02 Thread Andre Przywara
Hi Eric, just played a bit with the code and I could make things easier by the following change: On 29/06/15 16:37, Eric Auger wrote: Add a new kvm_extended_msi struct to store the additional device ID specific to ARM. kvm_kernel_irq_routing_entry union now encompasses this new struct.

Re: [PATCH 7/7] KVM: arm: implement kvm_set_msi by gsi direct mapping

2015-07-02 Thread Andre Przywara
Hi Eric, On 29/06/15 16:37, Eric Auger wrote: If the ITS modality is not available, let's simply support MSI injection by transforming the MSI.data into an SPI ID. This becomes possible to use KVM_SIGNAL_MSI ioctl for arm too. Signed-off-by: Eric Auger eric.au...@linaro.org ---

[PATCH v5 02/10] AArch{32, 64}: use KVM_CREATE_DEVICE co to instanciate the GIC

2015-07-03 Thread Andre Przywara
to differentiate between creation and initialisation more clearly and fix error path.] Signed-off-by: Marc Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c| 69 +++- arm/include/arm-common

[PATCH v5 05/10] arm: finish VGIC initialisation explicitly

2015-07-03 Thread Andre Przywara
-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Marc Zyngier marc.zyng...@arm.com --- arm/gic.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/arm/gic.c b/arm/gic.c index 8560c9b..99f0d2b 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -98,24

[PATCH v5 01/10] AArch64: Reserve two 64k pages for GIC CPU interface

2015-07-03 Thread Andre Przywara
Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/aarch64/include/kvm/kvm-arch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/aarch64/include/kvm/kvm-arch.h b/arm/aarch64/include/kvm/kvm-arch.h index 2f08a26..4925736 100644 --- a/arm

[PATCH v5 03/10] irq: add irq__get_nr_allocated_lines

2015-07-03 Thread Andre Przywara
allocated so far. Signed-off-by: Marc Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/irq.h | 1 + irq.c | 5 + 2 files changed, 6 insertions(+) diff --git a/include/kvm/irq.h b/include/kvm/irq.h index 4cec6f0..8a78e43 100644

[PATCH v5 08/10] arm: prepare for instantiating different IRQ chip devices

2015-07-03 Thread Andre Przywara
Extend the vGIC handling code to potentially deal with different IRQ chip devices instead of hard-coding the GICv2 in. We extend most vGIC functions to take a type parameter, but still put GICv2 in at the top for the time being. Signed-off-by: Andre Przywara andre.przyw...@arm.com Reviewed

[PATCH v5 10/10] arm: use new irqchip parameter to create different vGIC types

2015-07-03 Thread Andre Przywara
Currently we unconditionally create a virtual GICv2 in the guest. Add a --irqchip= parameter to let the user specify a different GIC type for the guest, when omitting this parameter it still defaults to --irqchip=gicv2. For now the only other supported type is --irqchip=gicv3 Signed-off-by: Andre

[PATCH v5 09/10] arm: add support for supplying GICv3 redistributor addresses

2015-07-03 Thread Andre Przywara
) header files to allow compilation for ARM. Signed-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Marc Zyngier marc.zyng...@arm.com --- arm/gic.c | 36 +++- arm/include/arm-common/gic.h | 1 + arm/include/arm-common/kvm-arch.h

Re: [PATCH 12/13] KVM: arm64: implement MSI injection in ITS emulation

2015-07-06 Thread Andre Przywara
Hi Eric, diff --git a/virt/kvm/arm/its-emul.c b/virt/kvm/arm/its-emul.c index 574cf05..35e886c 100644 --- a/virt/kvm/arm/its-emul.c +++ b/virt/kvm/arm/its-emul.c @@ -340,6 +340,55 @@ static bool handle_mmio_gits_idregs(struct kvm_vcpu *vcpu, } /* + * Translates an incoming

Re: [PATCH 09/13] KVM: arm64: handle pending bit for LPIs in ITS emulation

2015-06-11 Thread Andre Przywara
Salut Eric, On 06/09/2015 04:59 PM, Eric Auger wrote: On 05/29/2015 11:53 AM, Andre Przywara wrote: As the actual LPI number in a guest can be quite high, but is mostly assigned using a very sparse allocation scheme, bitmaps and arrays for storing the virtual interrupt status are a waste

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Andre Przywara
On 06/07/15 16:54, Paolo Bonzini wrote: On 06/07/2015 17:37, Andre Przywara wrote: Wouldn't: if (kvm_vm_check_extension(s, KVM_CAP_MSI_DEVID)) { kroute.flags = KVM_MSI_VALID_DEVID; kroute.u.msi.devid = (pci_bus_num(dev-bus) 8) | dev-devfn; } be saner (without

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Andre Przywara
On 06/07/15 13:08, Christoffer Dall wrote: On Mon, Jul 06, 2015 at 12:23:19PM +0100, Andre Przywara wrote: Hi Paolo, thanks for looking at this! On 06/07/15 12:07, Paolo Bonzini wrote: On 06/07/2015 12:37, Christoffer Dall wrote: I don't view it as 'the kernel requires

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Andre Przywara
Salut Eric, ITS code in qemu just does: ---cut --- msi_supported = true; kvm_msi_flags = KVM_MSI_VALID_DEVID; kvm_msi_via_irqfd_allowed = kvm_has_gsi_routing(); kvm_gsi_routing_allowed = kvm_msi_via_irqfd_allowed; --- cut --- I set KVM_MSI_VALID_DEVID

Re: [PATCH 1/7] KVM: api: add kvm_irq_routing_extended_msi

2015-07-06 Thread Andre Przywara
Hi Pavel, On 06/07/15 14:32, Pavel Fedin wrote: Hi! Well, as we are about to implement this: yes. But the issue is that MSI injection and GSI routing code is generic PCI code in userland (at least in kvmtool, guess in QEMU, too), so I don't want to pull in any kind of ARM specific code in

Re: [PATCH v2 07/15] KVM: arm64: handle ITS related GICv3 redistributor registers

2015-08-24 Thread Andre Przywara
Hi Eric, On 13/08/15 13:17, Eric Auger wrote: On 07/10/2015 04:21 PM, Andre Przywara wrote: In the GICv3 redistributor there are the PENDBASER and PROPBASER registers which we did not emulate so far, as they only make sense when having an ITS. In preparation for that emulate those MMIO

[PATCH v4 00/10] kvmtool: arm64: GICv3 guest support

2015-06-26 Thread Andre Przywara
]. [1] git://git.kernel.org/pub/scm/linux/kernel/git/will/kvmtool.git [2] git://linux-arm.org/kvmtool.git (branch gicv3/v4) http://www.linux-arm.org/git?p=kvmtool.git;a=log;h=refs/heads/gicv3/v4 Andre Przywara (6): arm: finish VGIC initialisation explicitly arm: simplify MMIO dispatching

[PATCH v4 01/10] AArch64: Reserve two 64k pages for GIC CPU interface

2015-06-26 Thread Andre Przywara
Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/aarch64/include/kvm/kvm-arch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arm/aarch64/include/kvm/kvm-arch.h b/arm/aarch64/include/kvm/kvm-arch.h index 2f08a26..4925736 100644 --- a/arm

[PATCH v4 05/10] arm: finish VGIC initialisation explicitly

2015-06-26 Thread Andre Przywara
-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Marc Zyngier marc.zyng...@arm.com --- arm/gic.c | 25 ++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/arm/gic.c b/arm/gic.c index 8560c9b..99f0d2b 100644 --- a/arm/gic.c +++ b/arm/gic.c @@ -98,24

[PATCH v4 07/10] limit number of VCPUs on demand

2015-06-26 Thread Andre Przywara
reached a VCPU limit. If we see this and have at least brought up one VCPU already successfully, then don't panic, but limit the number of VCPUs instead. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c | 6 -- arm/kvm-cpu.c | 7 ++- kvm-cpu.c | 7 +++ 3

[PATCH v4 02/10] AArch{32, 64}: use KVM_CREATE_DEVICE co to instanciate the GIC

2015-06-26 Thread Andre Przywara
to differentiate between creation and initialisation more clearly and fix error path.] Signed-off-by: Marc Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c| 69 +++- arm/include/arm-common

[PATCH v4 06/10] arm: simplify MMIO dispatching

2015-06-26 Thread Andre Przywara
extensions (like expanding the GIC regions). To be in line with the other architectures, move the now simpler code into a header file. Signed-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Marc Zyngier marc.zyng...@arm.com --- arm/include/arm-common/kvm-arch.h | 12 arm

[PATCH v4 09/10] arm: add support for supplying GICv3 redistributor addresses

2015-06-26 Thread Andre Przywara
) header files to allow compilation for ARM. Signed-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Marc Zyngier marc.zyng...@arm.com --- arm/gic.c | 36 +++- arm/include/arm-common/gic.h | 1 + arm/include/arm-common/kvm-arch.h

[PATCH v4 04/10] AArch{32, 64}: dynamically configure the number of GIC interrupts

2015-06-26 Thread Andre Przywara
. [Andre: rename to gic__init_gic() to ease future expansion] Signed-off-by: Marc Zyngier marc.zyng...@arm.com Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c | 25 + 1 file changed, 25 insertions(+) diff --git a/arm/gic.c b/arm/gic.c index 1ff3663

Re: [PATCH v4 07/10] limit number of VCPUs on demand

2015-06-30 Thread Andre Przywara
Hi, On 30/06/15 17:09, Will Deacon wrote: On Fri, Jun 26, 2015 at 02:16:15PM +0100, Andre Przywara wrote: Currently the ARM GIC checks the number of VCPUs against a fixed limit, which is GICv2 specific. Don't pretend we know better than the kernel and let's get rid of that explicit check

Re: [PATCH v2 14/15] KVM: arm64: implement MSI injection in ITS emulation

2015-08-02 Thread Andre Przywara
On 31/07/15 14:22, Eric Auger wrote: Salut Eric, On 07/10/2015 04:21 PM, Andre Przywara wrote: When userland wants to inject a MSI into the guest, we have to use our data structures to find the LPI number and the VCPU to receive the interrupt. Use the wrapper functions to iterate the linked

[PATCH 01/14] Refactor kernel image loading

2015-07-30 Thread Andre Przywara
for MIPS as special cases for those architectures and rename the existing flat binary loader functions for the other architectures to the new name. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/fdt.c | 4 ++-- include/kvm/kvm.h | 5 ++--- kvm.c | 42

[PATCH 04/14] x86: support loading flat binary kernel images from a pipe

2015-07-30 Thread Andre Przywara
without using a seek, so kvmtool will happily accept any file descriptor (including pipes) for the image file. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- x86/kvm.c | 48 +--- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/x86

[PATCH 06/14] MIPS: use pseek() in ELF kernel image loading

2015-07-30 Thread Andre Przywara
Use the newly introduced pseek() function when skipping to the start offset in the ELF file. The layout of an ELF file should satisfy the constraints of pseek, so that we should be able to use a pipe file descriptor as well. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- mips/kvm.c | 4

[PATCH 13/14] MIPS: use read wrappers in kernel loading

2015-07-30 Thread Andre Przywara
Replace the unsafe read-loops used in the MIPS kernel image loading with our safe read_file() and read_in_full() wrappers. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- mips/kvm.c | 35

[PATCH 12/14] powerpc: use read_file() in kernel and initrd loading

2015-07-30 Thread Andre Przywara
Replace the unsafe read-loops in the powerpc kernel image loading function with our new and safe read_file() wrapper. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- powerpc/kvm.c | 36

[PATCH 08/14] MIPS: remove seeks from load_flat_binary()

2015-07-30 Thread Andre Przywara
Remove the need to rewind the kernel image file if loading it as a flat binary by re-using the already read portion of the file passed in as a buffer. This allows the MIPS flat binary kernel image to be read from a pipe. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- mips/kvm.c | 14

[PATCH 10/14] provide generic read_file() implementation

2015-07-30 Thread Andre Przywara
to provide the only safe implementation, so take that as an inspiration to provide a generic read_file() function usable by every part of kvmtool. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/read-write.h | 2 ++ util/read-write.c| 21 + 2 files

[PATCH 11/14] arm/arm64: use read_file() in kernel and initrd loading

2015-07-30 Thread Andre Przywara
Use the new read_file() wrapper in our arm/arm64 kernel image loading function instead of the private implementation. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/kvm.c | 42 -- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git

[PATCH 07/14] MIPS: move ELF headers loading outside of load_elf_binary()

2015-07-30 Thread Andre Przywara
Refactor MIPS' load_elf_binary() implementation by not reading the ELF header itself, but using a pointer to a memory buffer instead. This prepares for removing the need to rewind the image file later. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- mips/kvm.c | 52

[PATCH 14/14] x86: use read wrappers in kernel loading

2015-07-30 Thread Andre Przywara
Replace the unsafe read-loops in the x86 kernel image loading functions with our safe read_file() and read_in_full() wrappers. This should fix random fails in kernel image loading, especially from pipes and sockets. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- x86/kvm.c | 40

Re: Extensions for KVM MSI related ioctls

2015-07-13 Thread Andre Przywara
Hi, On 13/07/15 15:24, Eric Auger wrote: On 07/13/2015 03:32 PM, Pavel Fedin wrote: Hello! I think I prefer the flag. Offhand it sounds easier to add support for it to non-ARM architectures, compared to KVM_IRQ_ROUTING_EXTENDED_MSI. Actually i also voted for flag, because it is already

[PATCH 01/12] avoid casts when initializing structures

2015-07-17 Thread Andre Przywara
default standard, so lets fix this better sooner than later. (Compiling without GNU extensions still breaks and I don't bother to fix that without very good reasons.) Signed-off-by: Andre Przywara andre.przyw...@arm.com --- disk/qcow.c| 6 +++--- include/kvm/mutex.h| 2 +- include/linux

[PATCH 11/12] avoid using predefined PAGE_SIZE

2015-07-17 Thread Andre Przywara
The musl-libc comes with a predefined PAGE_SIZE macro, which may be wrong on systems which support multiple smallest page sizes. Make sure we use our own (runtime evaluated) definition of PAGE_SIZE. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/kvm.h | 4 1 file

[PATCH 04/12] Makefile: remove unneeded -s switch on compiling BIOS files

2015-07-17 Thread Andre Przywara
Stripping has no effect on object files, so having -s -c on the command line makes no sense. In fact clang complains about it and aborts with an error, so lets just remove the unneeded -s switch here. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Makefile | 10 +- 1 file

[PATCH 12/12] remove KVM_CAP_MAX_VCPUS hack

2015-07-17 Thread Andre Przywara
As we now have the header file in our repository, we can safely follow the recommendation in kvm.c and remove the hack adding the KVM_CAP_MAX_VCPUS macro. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- kvm.c | 8 1 file changed, 8 deletions(-) diff --git a/kvm.c b/kvm.c index

  1   2   3   4   5   6   7   8   9   10   >