- 09 Jun, 2017 12 commits
-
-
Andre Przywara authored
The ITS emulation requires a unique device ID to be passed along the MSI payload when kvmtool wants to trigger an MSI in the guest. According to the proposed changes to the interface add the PCI bus/device/function triple to the structure passed with the ioctl. Check the respective capability before actually adding the device ID to the kvm_msi struct. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
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. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
The ARM GICv3 ITS requires a separate device tree node to describe the ITS. Add this as a child to the GIC interrupt controller node to let a guest discover and use the ITS if the user requests it. Since we now need to specify #address-cells for the GIC node, we have to add two zeroes to the interrupt map to match that. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
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. To cover the 64K page with the MSI doorbell (which directly follows the page with the register frames), we reserve this as well, although the guest is never expected to write into this. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Vladimir Murzin authored
KVM/arm recently got support for vGICv3 (and vITS), which is evident in the updated header file. So as now ARM has feature parity when it comes to the GIC emulation, we can remove the special defines we had in place to allow compilation for ARM(32). For simplicity we now use 64K sized GIC regions everywhere, as GICv3 mandates them. [Andre: some update, reword commit message] Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Vladimir Murzin <vladimir.murzin@arm.com> Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
The GICv3 ITS emulation brings some additions to the headers, so lets update kvmtool's version of the headers to Linux' v4.11-rc7-57. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
If we need to inject an MSI into the guest, we rely at the moment on a working GSI MSI routing functionality. However we can get away without IRQ routing, if the host supports MSI injection via the KVM_SIGNAL_MSI ioctl. So we try the GSI routing first, but if that fails due to a missing IRQ routing functionality, we fall back to KVM_SIGNAL_MSI (if that is supported). Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
Currently we deny any VHOST_* functionality if the architecture supports guests with different endianness than the host. Most of the time even on those architectures the endianness of guest and host are the same, though, so we are denying the glory of VHOST needlessly. Switch from compile time determination to a run time scheme, which takes the actual endianness of the guest into account. For this we change the semantics of VIRTIO_ENDIAN_HOST to return the actual endianness of the host (the endianness of kvmtool at compile time, really). The actual check in vhost_net now compares this against the guest endianness. This enables vhost support on ARM and ARM64. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
When we set up GSI routing to map MSIs to KVM's GSI numbers, we write the current device's MSI setup into the kernel routing table. However the device driver in the guest can use PCI configuration space accesses to change the MSI configuration (address and/or payload data). Whenever this happens after we have setup the routing table already, we must amend the previously sent data. So when MSI-X PCI config space accesses write address or payload, find the associated GSI number and the matching routing table entry and update the kernel routing table (only if the data has changed). This fixes vhost-net, where the queue's IRQFD was setup before the MSI vectors. To avoid issues, we ignore writes to the PBA region. The spec says: "Software should never write, and should only read Pending Bits. If software writes to Pending Bits, the result is undefined." Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
The current IRQ routing code in x86/irq.c is mostly implementing a generic KVM interface which other architectures may use too. Move the code to set up an MSI route into the generic irq.c file and guard it with the KVM_CAP_IRQ_ROUTING capability to return an error if the kernel does not support interrupt routing. This also removes the dummy implementations for all other architectures and only leaves the x86 specific code in x86/irq.c. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
As KVM supports only onc (v)GIC per guest and it's hard to imagine that we will ever need more than that, lets simplify the FDT generation by not passing that single, constant phandle around. Let's just reference that one global symbol from enum phandles instead. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
The current implementation of fdt__alloc_phandle() suffers from being implemented in a static inline function situated in a header file. This will only create expected results within a single compilation unit. It seems a bit over the top to use a function to allocate phandles, when at the end of the day a phandle is just a unique identifier. To simplify things - especially with upcoming patches - we just introduce an enum per architecture to hold all possible phandle sources and use that instead of the dynamic allocation. Acked-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 24 Apr, 2017 1 commit
-
-
Marc Zyngier authored
As I was trying to install a new VM using the Debian installer, I noticed that the return key would work just fine in a shell, but wouldn't do anything in the menu. Pretty annoying. Further investigation showed that the terminal was left in cooked mode, converting CR to LF, and thus giving the VM the wrong information. Clearing the ICRNL flag in the input flag set fixes the issue. Suggested-by:
Dave martin <dave.martin@arm.com> Signed-off-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 17 Feb, 2017 1 commit
-
-
Will Deacon authored
When merging virtio-net buffers using the VIRTIO_NET_F_MRG_RXBUF feature, the first buffer added to the used ring should indicate the total number of buffers used to hold the packet. Unfortunately, kvmtool has a number of issues when constructing these merged buffers: - Commit 5131332e3f1a ("kvmtool: convert net backend to support bi-endianness") introduced a strange loop counter, which resulted in hdr->num_buffers being set redundantly the first time round - When adding the buffers to the ring, we actually add them one-by-one, allowing the guest to see the header before we've inserted the rest of the data buffers... - ... which is made worse because we non-atomically increment the num_buffers count in the header each time we insert a new data buffer Consequently, the guest quickly becomes confused in its net rx code and the whole thing grinds to a halt. This is easily exemplified by trying to boot a root filesystem over NFS, which seldom succeeds. This patch resolves the issues by allowing us to insert items into the used ring without updating the index. Once the full payload has been added and num_buffers corresponds to the total size, we *then* publish the buffers to the guest. Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Sasha Levin <sasha.levin@oracle.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 01 Feb, 2017 1 commit
-
-
Robin Murphy authored
We use cacheable accesses on our end of the virtio ring, so make sure the guest is aware of that, and thus doesn't try to use non-cacheable DMA buffers, by including the dma-coherent property on its DT node. Signed-off-by:
Robin Murphy <robin.murphy@arm.com> [will: do the same for the PCI node for virtio-pci devices] Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 20 Dec, 2016 1 commit
-
-
Andrew Jones authored
Signed-off-by:
Andrew Jones <drjones@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 28 Nov, 2016 2 commits
-
-
G. Campana authored
Make use of get_full_path_helper() instead of sprintf. Signed-off-by:
G. Campana <gcampana+kvm@quarkslab.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
G. Campana authored
The check on the return value of snprintf should reuse the size parameter, rather than take sizeof(full_path) as the bound. Signed-off-by:
G. Campana <gcampana+kvm@quarkslab.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 18 Nov, 2016 4 commits
-
-
G. Campana authored
The code responsible of path verification is identical in several functions. Move it to a new function. Signed-off-by:
G. Campana <gcampana+kvm@quarkslab.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
G. Campana authored
Use strncpy instead of strcpy to avoid buffer overflow vulnerabilities. Signed-off-by:
G. Campana <gcampana+kvm@quarkslab.com> [will: keep strcpy when we've verified the size already] Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
G. Campana authored
Use snprintf instead of sprintf to avoid buffer overflow vulnerabilities. Signed-off-by:
G. Campana <gcampana+kvm@quarkslab.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
G. Campana authored
A path traversal exists because the guest can send "../" sequences to the host 9p handlers. To fix this vulnerability, we ensure that path components sent by the guest don't contain "../" sequences. Signed-off-by:
G. Campana <gcampana+kvm@quarkslab.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 05 Nov, 2016 1 commit
-
-
Riku Voipio authored
Latest Debian and Ubuntu GCC default to PIE code. Disable PIC for bios and PIE for pre_init. Since the flag -no-pie is not available on older GCC's, make use of flag only if the option is available. -fno-pic is more widely available and should be safe to enable uncondionally. Signed-off-by:
Riku Voipio <riku.voipio@linaro.org> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 09 Aug, 2016 1 commit
-
-
Stefan Agner authored
The madvise behavior is not a bit field and hence can not be or'ed. Also madvise_behavior_valid checks the flag using a case statement hence only one behavior is supposed to be supplied. Call madvise twice, once for MERGEABLE and once for HUGEPAGE. Acked-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Stefan Agner <stefan@agner.ch> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 29 Jul, 2016 1 commit
-
-
Will Deacon authored
open() sets the file osset to the beginning of the file, so there's no need for an explicit lseek when called in kvm__arch_load_kernel_image. Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 15 Jun, 2016 1 commit
-
-
James Morse authored
When walking the devices rbtree to insert a node, we must keep track of the parent node when we descend. If we skip this step, we always insert new nodes with a NULL parent, bypassing __rb_insert()s rebalance code. Things get worse when we come to walk the tree, as we can't move up a level. This isn't a problem in practice, as all devices appear to be inserted in-order, so our rbtree is actually a monochrome linked list. Signed-off-by:
James Morse <james.morse@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 14 Jun, 2016 1 commit
-
-
Marc Zyngier authored
KVM exposes a level triggered timer to the guest, and yet kvmtool presents it as being edge-triggered in the DT. Let's fix it and match what the kernel exposes. Signed-off-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 09 Jun, 2016 1 commit
-
-
Andrew Jones authored
Signed-off-by:
Andrew Jones <drjones@redhat.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 17 May, 2016 2 commits
-
-
Andre Przywara authored
From time to time (when new KVM kernel features get enabled in kvmtool), we need to update the public kernel headers from a recent Linux tree. Provide a script that makes sure we get the right files and that also covers every architecture. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
Update our copy of the KVM header files to match the kernel's v4.6.0. This fixes the ARM PMU support, where the feature identifier was changed during the merge window due to a merge conflict. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 18 Apr, 2016 1 commit
-
-
Michal Rostecki authored
readdir_r is deprecated[1] and usage of readdir is recommended. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=7584a3f96de88d5eefe5d6c634515278cbfbf052 Signed-off-by:
Michal Rostecki <michal.rostecki@gmail.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 14 Apr, 2016 1 commit
-
-
Will Deacon authored
Our exit/reboot code is a bit of a mess: - Both kvm__reboot and kvm_cpu_exit send SIGKVMEXIT to running vcpus - When vcpu0 exits, the main thread starts executing destructors (exitcalls) whilst other vcpus may be running - The pause_lock isn't always held when inspecting is_running for a vcpu This patch attempts to fix these issues by restricting the exit/reboot path to vcpu0 and the main thread. In particular, a KVM_SYSTEM_EVENT will signal SIGKVMEXIT to vcpu0, which will join with the main thread and then tear down the other vcpus before invoking any destructor code. Acked-by:
Balbir Singh <bsingharora@gmail.com> Tested-by:
Julien Grall <julien.grall@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 11 Apr, 2016 4 commits
-
-
Balbir Singh authored
Port the spapr_pci implementation for ppc64le. Based on suggestions by Alexey Kardashevskiy <aik@ozlabs.ru> We should have always used phys_hi and 64 bit addr and size. Cc: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by:
Balbir Singh <bsingharora@gmail.com> Acked-by:
Michael Ellerman <mpe@ellerman.id.au> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Balbir Singh authored
Use the infrastructure for queuing a task to a specific vCPU and sett ILE (Little Endian Interrupt Handling) on power via h_set_mode hypercall Signed-off-by:
Balbir Singh <bsingharora@gmail.com> Signed-off-by:
Michael Ellerman <mpe@ellerman.id.au> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Michael Ellerman authored
This patch adds kvm_cpu__run_on_all_cpus() to run a task on each vCPU. This infrastructure uses signals to signal the vCPU to allow a task to be added to each vCPU's task. The vCPU executes any pending tasks in the cpu run loop Signed-off-by:
Balbir Singh <bsingharora@gmail.com> Signed-off-by:
Michael Ellerman <mpe@ellerman.id.au> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Balbir Singh authored
Currently kvmtool works well/was designed for big endian ppc64 systems. This patch adds support for little endian systems The system does not yet boot as support for h_set_mode is required to help with exceptions in big endian mode -- first page fault. The support comes in the next patch of the series Signed-off-by:
Balbir Singh <bsingharora@gmail.com> Acked-by:
Michael Ellerman <mpe@ellerman.id.au> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 16 Mar, 2016 1 commit
-
-
Riku Voipio authored
Debian and some other distro's don't provide mkisofs due to licensing concerns. xorrisofs from package xorriso provides a command-line compatible command in this case. Update the makefile of tests to pick xorrisofs if mkisofs is not available. Signed-off-by:
Riku Voipio <riku.voipio@linaro.org> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 11 Mar, 2016 1 commit
-
-
Marc Zyngier authored
We don't have PMU support on 32bit ARM just yet, so let's work around this the ugly way for now. Cc: Will Deacon <will.deacon@arm.com> Reported-by:
Riku Voipio <riku.voipio@linaro.org> Signed-off-by:
Marc Zyngier <marc.zyngier@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
- 02 Mar, 2016 2 commits
-
-
Andre Przywara authored
Now that we have a manpage in place, we can remove the manpage-style text files from the Documentation directory. This allows us also to get rid of the crude common-cmds.h generation, which relied on these files and on a command-list.txt file. Instead include the version of that header file generated with the current HEAD into the source tree. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-
Andre Przywara authored
The kvmtool documentation is somewhat lacking, also it is not easily accessible when living in the source tree only. Add a good ol' manpage to document at least the basic commands and their options. This level of documentation matches the one that is already there in the Documentation directory and should be subject to extension. Signed-off-by:
Andre Przywara <andre.przywara@arm.com> Signed-off-by:
Will Deacon <will.deacon@arm.com>
-