[PATCH 00/14] kvmtool: Refactor kernel image loading to allow pipes

2015-07-30 Thread Andre Przywara
architecture over to using the safe read wrappers. These patches apply on top of the latest kvmtool master branch. So far I could test arm, arm64 and x86, with MIPS and PowerPC being at least compile-tested. Cheers, Andre. Andre Przywara (14): Refactor kernel image loading arm/powerpc: remove

[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 05/14] kvmtool: introduce pseek

2015-07-30 Thread Andre Przywara
amount of data. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/read-write.h | 2 ++ util/read-write.c| 40 2 files changed, 42 insertions(+) diff --git a/include/kvm/read-write.h b/include/kvm/read-write.h index 67571f9..87eb167

[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 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 02/14] arm/powerpc: remove unneeded seeks in kernel loading

2015-07-30 Thread Andre Przywara
more work. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/fdt.c | 3 --- powerpc/kvm.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/arm/fdt.c b/arm/fdt.c index ec7453f..cb4f00d 100644 --- a/arm/fdt.c +++ b/arm/fdt.c @@ -245,9 +245,6 @@ bool kvm__arch_load_kernel_image

[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 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 09/14] arm: move kernel loading into arm/kvm.c

2015-07-30 Thread Andre Przywara
string. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/fdt.c | 96 +-- arm/kvm.c | 89 ++ 2 files changed, 90 insertions(+), 95 deletions(-) diff --git a/arm/fdt.c b

[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 09/14] arm: move kernel loading into arm/kvm.c

2015-07-30 Thread Andre Przywara
string. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/fdt.c | 96 +-- arm/kvm.c | 89 ++ 2 files changed, 90 insertions(+), 95 deletions(-) diff --git a/arm/fdt.c b

[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

[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 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

[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 02/14] arm/powerpc: remove unneeded seeks in kernel loading

2015-07-30 Thread Andre Przywara
more work. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/fdt.c | 3 --- powerpc/kvm.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/arm/fdt.c b/arm/fdt.c index ec7453f..cb4f00d 100644 --- a/arm/fdt.c +++ b/arm/fdt.c @@ -245,9 +245,6 @@ bool kvm__arch_load_kernel_image

[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 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 03/14] x86: allow pipes for bzImage kernel images

2015-07-30 Thread Andre Przywara
Streamline the x86 kernel loading implementation by removing unneeded seeks and thus allow an x86 bzImage to be loaded from a pipe. Flat binaries are taken care of in a separate patch. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- x86/kvm.c | 11 --- 1 file changed, 4

[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 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 05/14] kvmtool: introduce pseek

2015-07-30 Thread Andre Przywara
amount of data. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/read-write.h | 2 ++ util/read-write.c| 40 2 files changed, 42 insertions(+) diff --git a/include/kvm/read-write.h b/include/kvm/read-write.h index 67571f9..87eb167

[PATCH 03/14] x86: allow pipes for bzImage kernel images

2015-07-30 Thread Andre Przywara
Streamline the x86 kernel loading implementation by removing unneeded seeks and thus allow an x86 bzImage to be loaded from a pipe. Flat binaries are taken care of in a separate patch. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- x86/kvm.c | 11 --- 1 file changed, 4

[PATCH v2 0/2] kvmtool: remaining musl-libc and clang fixes

2015-07-21 Thread Andre Przywara
. Please check if that makes sense. Cheers, Andre. Andre Przywara (2): Makefile: avoid non-literal printf format string warnings avoid redefining PAGE_SIZE Makefile | 1 + include/kvm/kvm.h | 3 +++ 2 files changed, 4 insertions(+) -- 2.3.5 -- To unsubscribe from this list: send

[PATCH v2 2/2] avoid redefining PAGE_SIZE

2015-07-21 Thread Andre Przywara
PAGE_SIZE may have been defined by the C libary (musl-libc does that). So avoid redefining it here unconditionally, instead only use our definition if none has been provided by the libc. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/kvm.h | 3 +++ 1 file changed, 3

[PATCH v2 1/2] Makefile: avoid non-literal printf format string warnings

2015-07-21 Thread Andre Przywara
just disable the warning. Since GCC knows about this option as well (it just doesn't have it enabled with -Wall), we can unconditionally add this to the warning options. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b

Re: [PATCHv3 2/2] kvmtool: Restrict virtio queue number to 1 when vhost on

2015-07-21 Thread Andre Przywara
Hi, On 21/07/15 07:18, Fan Du wrote: vhost kernel driver does not support mutiple queue yet, Tweak queue number will fail with --net mode=tap,vhost=1,mq=2 as below when lkvm trying to set ring kick fd for queue 2: VHOST_SET_VRING_KICK failed: No buffer space available Error on this

Re: [PATCHv3 1/2] kvmtool: Introduce downscript option for virtio-net

2015-07-21 Thread Andre Przywara
Hi, thanks for the rework, that looks good to me, some minor nits below. Not sure if that requires a new version, maybe Will can fix that up when he applies it. On 21/07/15 07:18, Fan Du wrote: To detach tap device automatically from bridge when exiting, just like what the reverse of script

[PATCH 11/14] arm64: enable GICv3-ITS emulation

2015-07-20 Thread Andre Przywara
-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c| 2 ++ arm/include/arm-common/kvm-config-arch.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arm/gic.c b/arm/gic.c index d1cffa5..187fe46 100644 --- a/arm/gic.c +++ b/arm/gic.c

[PATCH 05/14] arm: use new phandle allocation functions

2015-07-20 Thread Andre Przywara
To refer to the GIC FDT node, we used to pass the GIC phandle to most of the functions dealing with FDT nodes. Since we now have a global phandle reference, use that to refer to the GIC handle in various places and get rid of the now unneeded parameter passing. Signed-off-by: Andre Przywara

[PATCH 04/14] FDT: introduce global phandle allocation

2015-07-20 Thread Andre Przywara
and reference code to properly allocate unique phandles. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Makefile | 1 + arm/fdt.c | 2 +- arm/gic.c | 2 +- include/kvm/fdt.h | 10 +- kvm-fdt.c | 26 ++ 5 files changed, 34

[PATCH 14/14] extend GSI IRQ routing to take a device ID

2015-07-20 Thread Andre Przywara
table if needed. For PCI devices we take the bus/device/function triplet and and that to the routing setup call. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- hw/pci-shmem.c| 3 ++- include/kvm/irq.h | 2 +- irq.c | 24 ++-- virtio/pci.c | 6

[PATCH 06/14] TEMPORARY: arm: update public headers for GICv3 ITS emulation

2015-07-20 Thread Andre Przywara
This patch is preliminary and updates the headers from a kernel with ITS emulation support. It should be replaced by a proper header update once ITS support is upstream. Contains a hack to support compiling on ARM, too. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/aarch64/include

[PATCH 07/14] arm: allow creation of an MSI register frame region

2015-07-20 Thread Andre Przywara
The GICv3 ITS expects a separate 64K page to hold ITS registers. Add a function to reserve such a page in the guest's I/O memory and use that for the ITS vGIC type. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c| 36

[PATCH 12/14] arm: setup SPI IRQ routing tables

2015-07-20 Thread Andre Przywara
not used for IRQs triggered by KVM_IRQ_LINE, but it needs to be here anyway. We use a simple 1:1 mapping. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c | 32 1 file changed, 32 insertions(+) diff --git a/arm/gic.c b/arm/gic.c index 187fe46

[PATCH 13/14] TEMPORARY: update public headers for kvm_irq_routing_msi extension

2015-07-20 Thread Andre Przywara
This patch is preliminary and updates the headers from a kernel with extended IRQ routing support (for ARM). It should be replaced by a proper header update once IRQ routing support is upstream. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/linux/kvm.h | 5 - 1 file

[PATCH 10/14] PCI: inject PCI device ID on MSI injection

2015-07-20 Thread Andre Przywara
before actually adding the device ID to the kvm_msi struct. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- virtio/pci.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/virtio/pci.c b/virtio/pci.c index 625fec0..e92a2df 100644 --- a/virtio/pci.c +++ b

[PATCH 01/14] irq: move IRQ routing into irq.c

2015-07-20 Thread Andre Przywara
interrupt routing. This also removes the dummy implementations for all other architectures and only leaves the x86 specific code in x86/irq.c. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Makefile | 4 +-- arm/irq.c | 9 -- hw/pci-shmem.c| 2 ++ include/kvm

[PATCH 09/14] add kvm__check_vm_capability

2015-07-20 Thread Andre Przywara
KVM capabilities can be per-VM, in this case the ioctl should be issued on the VM file descriptor, not on the system fd. Since this feature is guarded by a (system) capability itself, wrap the call into a function of its own. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm

[PATCH 02/14] MSI-X: update GSI routing after changed MSI-X configuration

2015-07-20 Thread Andre Przywara
vhost-net, where the queue's IRQFD was setup before the MSI vectors. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/irq.h | 1 + irq.c | 31 +++ virtio/pci.c | 36 +--- 3 files changed, 65

[PATCH 00/14] kvmtool: add ITS emulation and GSI routing for ARM

2015-07-20 Thread Andre Przywara
://www.linux-arm.org/git?p=kvmtool.git;a=log;h=refs/heads/its/v2 Andre Przywara (14): irq: move IRQ routing into irq.c MSI-X: update GSI routing after changed MSI-X configuration virtio: fix endianness check for vhost support FDT: introduce global phandle allocation arm: use new phandle

[PATCH 08/14] arm: FDT: create MSI controller DT node

2015-07-20 Thread Andre Przywara
to the interrupt map to match that. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arm/gic.c | 25 - arm/pci.c | 12 ++-- include/kvm/fdt.h | 2 +- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/arm/gic.c b/arm/gic.c index f9a20bd

[PATCH 03/14] virtio: fix endianness check for vhost support

2015-07-20 Thread Andre Przywara
this against the guest endianness. This enables vhost support on ARM and ARM64. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/virtio.h | 9 +++-- virtio/net.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/kvm/virtio.h b/include/kvm/virtio.h

Re: [PATCH 0/3] Fixes for kvmtool virtio-net part

2015-07-20 Thread Andre Przywara
Hi, This changset provide some fix and small enhancement for kvm tool when I play it with virtio part. have you seen the new kvmtool repository Will created, which is a stand-alone version outside of the Linux tree? https://git.kernel.org/cgit/linux/kernel/git/will/kvmtool.git/ It seems

Re: [PATCH 1/3] kvm-tool: Introduce downscript option

2015-07-20 Thread Andre Przywara
Hi, On 20/07/15 10:28, Fan Du wrote: To detach tap device automatically from bridge when exiting, just like the reverse of script does. Signed-off-by: Fan Du fan...@intel.com --- tools/kvm/include/kvm/virtio-net.h | 1 + tools/kvm/virtio/net.c | 28

Re: [PATCH 07/12] util/util.c: avoid clang error on vsnprintf

2015-07-20 Thread Andre Przywara
Hi Claudio, On 20/07/15 15:28, Claudio Fontana wrote: On 17.07.2015 18:50, Will Deacon wrote: On Fri, Jul 17, 2015 at 05:02:13PM +0100, Andre Przywara wrote: clang by default doesn't seem to like printf calls with non-literal format strings. Add the proper pragma to disable this warning

[PATCH 00/12] kvmtool: Improve portability

2015-07-17 Thread Andre Przywara
-libc gives you really small binaries (174K for ARM, for instance). The last patch just follows a comment in the code to remove a kludge. Cheers, Andre. Andre Przywara (12): avoid casts when initializing structures qcow: fix signedness bugs kvm-ipc: use proper type for file descriptor

[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 03/12] kvm-ipc: use proper type for file descriptor

2015-07-17 Thread Andre Przywara
A socket (as any other file descriptor) is of type int to catch the negative error cases. Fix the declaration to allow errors to be detected. Found and needed by clang. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- kvm-ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[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 02/12] qcow: fix signedness bugs

2015-07-17 Thread Andre Przywara
Some functions in qcow.c return u64, but are checked against 0 because they want to check for the -1 error return value. Do an explicit comparison against the casted -1 to express this properly. This was silently compiled out by gcc, but clang complained about it. Signed-off-by: Andre Przywara

[PATCH 08/12] Fix call to connect()

2015-07-17 Thread Andre Przywara
According to the manpage and the prototype the second argument to connect(2) is a const struct sockaddr*, so cast our protocol specific type back to the super type. This fixes compilation on musl-libc. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- kvm-ipc.c | 2 +- 1 file changed, 1

[PATCH 06/12] kvm__set_dir(): avoid variable arguments call

2015-07-17 Thread Andre Przywara
The clang compiler by default dislikes non-literal format strings in *printf functions, so it complains about kvm__set_dir() in kvm.c. Instead of suppressing this warning, lets change the code to avoid that unneeded var_args detour and use a literal format string. Signed-off-by: Andre Przywara

[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 05/12] ui: remove pointless double const in keymap declarations

2015-07-17 Thread Andre Przywara
clang does not like two const specifiers in one declaration, so remove one to let clang compile kvmtool. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- ui/gtk3.c | 2 +- ui/sdl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/gtk3.c b/ui/gtk3.c index b2335bc

[PATCH 09/12] use poll.h instead of sys/poll.h

2015-07-17 Thread Andre Przywara
The manpage of poll(2) states that the prototype of poll is defined in poll.h. Use that header file instead of sys/poll.h to allow compilation against musl-libc. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- disk/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH 10/12] check for and use C library provided strlcpy and strlcat

2015-07-17 Thread Andre Przywara
The musl-libc library provides implementations of strlcpy and strlcat, so introduce a feature check for it and only use the kvmtool implementation if there is no library support for it. This avoids clashes with the public definition. Signed-off-by: Andre Przywara andre.przyw...@arm.com

[PATCH 07/12] util/util.c: avoid clang error on vsnprintf

2015-07-17 Thread Andre Przywara
clang by default doesn't seem to like printf calls with non-literal format strings. Add the proper pragma to disable this warning in the report function to make kvmtool compile with clang. Despite its GCC name, clang also accepts this. Signed-off-by: Andre Przywara andre.przyw...@arm.com

[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

Re: [PATCH v2 15/15] KVM: arm64: enable ITS emulation as a virtual MSI controller

2015-07-15 Thread Andre Przywara
On 15/07/15 10:10, Pavel Fedin wrote: -Original Message- From: kvm-ow...@vger.kernel.org [mailto:kvm-ow...@vger.kernel.org] On Behalf Of Andre Przywara Sent: Friday, July 10, 2015 5:22 PM To: marc.zyng...@arm.com; christoffer.d...@linaro.org; kvm...@lists.cs.columbia.edu Cc

Extensions for KVM MSI related ioctls

2015-07-13 Thread Andre Przywara
Hi Paolo, we (Pavel, Eric and me) need your quick advice on how to proceed with a small API extension: (tl;dr: skip to the numbered list at the end) For using MSIs in a guest when running on an ARM(64) system using a GICv3 interrupt controller we need to have a device ID available. On real

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 v2 07/15] KVM: arm64: handle ITS related GICv3 redistributor registers

2015-07-10 Thread Andre Przywara
emulation. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h | 8 virt/kvm/arm/vgic-v3-emul.c | 44 virt/kvm/arm/vgic.c | 35 +++ virt/kvm/arm/vgic.h | 4 4

[PATCH v2 05/15] KVM: arm/arm64: make GIC frame address initialization model specific

2015-07-10 Thread Andre Przywara
-by: Andre Przywara andre.przyw...@arm.com --- virt/kvm/arm/vgic-v2-emul.c | 3 +++ virt/kvm/arm/vgic-v3-emul.c | 3 +++ virt/kvm/arm/vgic.c | 3 --- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/virt/kvm/arm/vgic-v2-emul.c b/virt/kvm/arm/vgic-v2-emul.c index 1390797

[PATCH v2 08/15] KVM: arm64: introduce ITS emulation file with stub functions

2015-07-10 Thread Andre Przywara
are not yet ready for the show. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- arch/arm64/kvm/Makefile| 1 + include/kvm/arm_vgic.h | 6 ++ include/linux/irqchip/arm-gic-v3.h | 1 + virt/kvm/arm/its-emul.c| 125

[PATCH v2 01/15] KVM: arm/arm64: VGIC: don't track used LRs in the distributor

2015-07-10 Thread Andre Przywara
once every 100,000 exits. This has been briefly tested on Midway, Juno and the model (the latter both with GICv2 and GICv3 guests). Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h | 6 --- virt/kvm/arm/vgic-v2.c | 1 + virt/kvm/arm/vgic-v3.c | 1 + virt/kvm/arm

[PATCH v2 04/15] KVM: arm/arm64: extend arch CAP checks to allow per-VM capabilities

2015-07-10 Thread Andre Przywara
KVM capabilities can be a per-VM property, though ARM/ARM64 currently does not pass on the VM pointer to the architecture specific capability handlers. Add a struct kvm* parameter to those function to later allow proper per-VM capability reporting. Signed-off-by: Andre Przywara andre.przyw

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

2015-07-10 Thread Andre Przywara
we will enable it when ITS emulation is used. Signed-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Eric Auger eric.au...@linaro.org --- Documentation/virtual/kvm/api.txt | 12 ++-- include/uapi/linux/kvm.h | 5 - 2 files changed, 14 insertions(+), 3 deletions

[PATCH v2 00/15] KVM: arm64: GICv3 ITS emulation

2015-07-10 Thread Andre Przywara
/com.arm.doc.ihi0069a/IHI0069A_gic_architecture_specification.pdf Andre Przywara (15): KVM: arm/arm64: VGIC: don't track used LRs in the distributor KVM: extend struct kvm_msi to hold a 32-bit device ID KVM: arm/arm64: add emulation model specific destroy function KVM: arm/arm64: extend arch CAP

[PATCH v2 10/15] KVM: arm64: add data structures to model ITS interrupt translation

2015-07-10 Thread Andre Przywara
quite low. Should the number of LPIs exceed the number where iterating through lists seems acceptable, we can later revisit this and use more efficient data structures. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h | 3 +++ virt/kvm/arm/its-emul.c | 48

[PATCH v2 06/15] KVM: arm64: Introduce new MMIO region for the ITS base address

2015-07-10 Thread Andre Przywara
by that check. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Documentation/virtual/kvm/devices/arm-vgic.txt | 9 + arch/arm64/include/uapi/asm/kvm.h | 2 ++ include/kvm/arm_vgic.h | 3 +++ virt/kvm/arm/vgic-v3-emul.c| 2

[PATCH v2 12/15] KVM: arm64: sync LPI configuration and pending tables

2015-07-10 Thread Andre Przywara
exercised by hardware, so the sync points are well known. Provide functions that read the guest memory and store the information from the configuration and pending tables in the kernel. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h | 2 + virt/kvm/arm/its-emul.c

[PATCH v2 09/15] KVM: arm64: implement basic ITS register handlers

2015-07-10 Thread Andre Przywara
before the actual command handler is called. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h | 3 + include/linux/irqchip/arm-gic-v3.h | 8 ++ virt/kvm/arm/its-emul.c| 205 + virt/kvm/arm/its-emul.h

[PATCH v2 03/15] KVM: arm/arm64: add emulation model specific destroy function

2015-07-10 Thread Andre Przywara
. Signed-off-by: Andre Przywara andre.przyw...@arm.com Reviewed-by: Eric Auger eric.au...@linaro.org --- include/kvm/arm_vgic.h | 1 + virt/kvm/arm/vgic-v3-emul.c | 9 + virt/kvm/arm/vgic.c | 11 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git

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

2015-07-10 Thread Andre Przywara
basic at this point, as we don't have a good way of communicating errors to the guest (usually a SError). The INT command handler is missing at this point, as we gain the capability of actually injecting MSIs into the guest only later on. Signed-off-by: Andre Przywara andre.przyw...@arm.com

[PATCH v2 11/15] KVM: arm64: handle pending bit for LPIs in ITS emulation

2015-07-10 Thread Andre Przywara
. With LPIs being only edge-triggered, we get away with a less complex IRQ handling. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h | 2 ++ virt/kvm/arm/its-emul.c | 71 virt/kvm/arm/its-emul.h | 3 ++ virt

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

2015-07-10 Thread Andre Przywara
provide the handler for the ITS INT command, which allows a guest to trigger an MSI via the ITS command queue. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- include/kvm/arm_vgic.h | 1 + virt/kvm/arm/its-emul.c | 65 + virt/kvm/arm/its

[PATCH v2 15/15] KVM: arm64: enable ITS emulation as a virtual MSI controller

2015-07-10 Thread Andre Przywara
we enable the KVM_SIGNAL_MSI feature to allow userland to inject MSIs into the guest. Not having enabled the ITS emulation will lead to a -ENODEV when trying to inject a MSI. Signed-off-by: Andre Przywara andre.przyw...@arm.com --- Documentation/virtual/kvm/api.txt | 2 +- arch/arm64/kvm/Kconfig

Re: [PATCH v2 1/7] KVM: api: introduce KVM_IRQ_ROUTING_EXTENDED_MSI

2015-07-10 Thread Andre Przywara
is populated. Signed-off-by: Eric Auger eric.au...@linaro.org Reviewed-by: Andre Przywara andre.przyw...@arm.com Just some forward looking statement: If this gets based on top of my ITS emulation v2 series, the documentation should state that the new KVM_CAP_MSI_DEVID capability tells userland

Re: [PATCH v2 4/7] KVM: arm/arm64: enable irqchip routing

2015-07-10 Thread Andre Przywara
Hi Eric, On 09/07/15 09:22, Eric Auger wrote: This patch adds compilation and link against irqchip. On ARM, irqchip routing is not really useful since there is a single irqchip. However main motivation behind using irqchip code is to enable MSI routing code. With the support of in-kernel

Re: [PATCH v2 3/7] KVM: irqchip: convey devid to kvm_set_msi

2015-07-10 Thread Andre Przywara
On 09/07/15 09:22, Eric Auger wrote: on ARM, a devid field is populated in kvm_msi struct in case the flag is set to KVM_MSI_VALID_DEVID. Let's populate the corresponding kvm_kernel_irq_routing_entry devid field and set the msi type to KVM_IRQ_ROUTING_EXTENDED_MSI. Signed-off-by: Eric Auger

Re: [PATCH v2 6/7] KVM: arm/arm64: enable MSI routing

2015-07-10 Thread Andre Przywara
On 09/07/15 09:22, Eric Auger wrote: Up to now, only irqchip routing entries could be set. This patch adds the capability to insert MSI routing entries, with or without device id. Although standard MSI entries can be set, their injection still is not supported. For ARM64, let's also increase

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

2015-07-10 Thread Andre Przywara
On 09/07/15 09:22, 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 --- v1 - v2: -

Re: [PATCH v2 0/7] KVM: arm/arm64: gsi routing support

2015-07-09 Thread Andre Przywara
Hi Pavel, On 09/07/15 15:37, Pavel Fedin wrote: Hello! v1 - v2: - user API changed: x devid id passed in kvm_irq_routing_msi x kept the new routing entry type: KVM_IRQ_ROUTING_EXTENDED_MSI Andre, you never replied to my last comment to the previous series. Oh dear, my draft

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

2015-07-07 Thread Andre Przywara
Good morning Pavel, On 07/07/15 08:16, Pavel Fedin wrote: Hello! 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 a global variable)?

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 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 that the flags field must be zero and the current KVM_SET_GSI_ROUTING handler bails out if it isn't. So userland would need to know

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 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 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 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
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-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 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 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...@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 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 00/10] kvmtool: arm64: GICv3 guest support

2015-07-03 Thread Andre Przywara
/heads/gicv3/v5 Andre Przywara (6): arm: finish VGIC initialisation explicitly arm: simplify MMIO dispatching limit number of VCPUs on demand arm: prepare for instantiating different IRQ chip devices arm: add support for supplying GICv3 redistributor addresses arm: use new irqchip

[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

<    1   2   3   4   5   6   7   >