[PATCH] vfio: Drop owner assignment from platform_driver

2015-07-10 Thread Krzysztof Kozlowski
platform_driver does not need to set an owner because platform_driver_register() will set it. Signed-off-by: Krzysztof Kozlowski k.kozlow...@samsung.com --- The coccinelle script which generated the patch was sent here: http://www.spinics.net/lists/kernel/msg2029903.html ---

RE: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-10 Thread Wu, Feng
-Original Message- From: Wu, Feng Sent: Friday, July 10, 2015 12:13 PM To: Alex Williamson Cc: kvm@vger.kernel.org; pbonz...@redhat.com; j...@8bytes.org; avi.kiv...@gmail.com; eric.au...@linaro.org; Wu, Feng Subject: RE: [RFC v1 5/5] Call irqbypass update routine when updating

Re: [PATCH 4/6] irqchip: GIC: Use chip_data instead of handler_data for cascaded interrupts

2015-07-10 Thread Marc Zyngier
On 10/07/15 09:17, Jiang Liu wrote: On 2015/7/10 15:52, Marc Zyngier wrote: On 09/07/15 22:33, Thomas Gleixner wrote: On Thu, 9 Jul 2015, Marc Zyngier wrote: When used as a primary interrupt controller, the GIC driver uses irq_data-chip_data to extract controller-specific information. When

Re: [PATCH 4/6] irqchip: GIC: Use chip_data instead of handler_data for cascaded interrupts

2015-07-10 Thread Marc Zyngier
On 09/07/15 22:33, Thomas Gleixner wrote: On Thu, 9 Jul 2015, Marc Zyngier wrote: When used as a primary interrupt controller, the GIC driver uses irq_data-chip_data to extract controller-specific information. When used as a secondary interrupt controller, it uses handler_data instead. As

Re: [PATCH 4/6] irqchip: GIC: Use chip_data instead of handler_data for cascaded interrupts

2015-07-10 Thread Jiang Liu
On 2015/7/10 15:52, Marc Zyngier wrote: On 09/07/15 22:33, Thomas Gleixner wrote: On Thu, 9 Jul 2015, Marc Zyngier wrote: When used as a primary interrupt controller, the GIC driver uses irq_data-chip_data to extract controller-specific information. When used as a secondary interrupt

Re: [PATCH] vfio: Drop owner assignment from platform_driver

2015-07-10 Thread Baptiste Reynal
Thanks for the point Krzysztof. Acked-by: Baptiste Reynal b.rey...@virtualopensystems.com On Fri, Jul 10, 2015 at 8:37 AM, Krzysztof Kozlowski k.kozlow...@samsung.com wrote: platform_driver does not need to set an owner because platform_driver_register() will set it. Signed-off-by: Krzysztof

[PATCH] KVM: svm: remove KVM_QUIRK_CD_NW_CLEARED quirk

2015-07-10 Thread Paolo Bonzini
We can disable CD unconditionally when there is no assigned device. KVM now forces guest PAT to all-writeback in that case, so it makes sense to also force CR0.CD=0. When there are assigned devices, emulate cache-disabled operation through the page tables. This behavior is consistent with VMX,

Re: [PATCH] kvm/x86: add support for MONITOR_TRAP_FLAG

2015-07-10 Thread Paolo Bonzini
On 09/07/2015 21:49, Jan Kiszka wrote: CPU_BASED_MOV_DR_EXITING | CPU_BASED_UNCOND_IO_EXITING | - CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_EXITING | + CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_TRAP_FLAG | CPU_BASED_MONITOR_EXITING | Overlong line.

Re: [PATCH 07/13] arm64: KVM: VHE: Patch out use of HVC

2015-07-10 Thread Paolo Bonzini
On 08/07/2015 19:54, Marc Zyngier wrote: Alternatively, I could move it to arch/arm64/include/asm (renamed to kvm_vhe_macros.h?), which would solve this issue. I just gave it a go, and that seems sensible enough. Yes, that would do. Alternatively: * create kvm_hyp_macros.h and put more

Re: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-10 Thread Paolo Bonzini
On 10/07/2015 10:28, Wu, Feng wrote: Yes, you are right. All we need is the producer information which has been passed in the register routine. And we can easily make this update logic inside the consumer. Thanks for your comments! BTW, Paolo Alex, in VFIO framework, how can we know a

Re: [PATCH] KVM: svm: remove KVM_QUIRK_CD_NW_CLEARED quirk

2015-07-10 Thread Joerg Roedel
On Fri, Jul 10, 2015 at 02:01:33PM +0200, Paolo Bonzini wrote: We can disable CD unconditionally when there is no assigned device. KVM now forces guest PAT to all-writeback in that case, so it makes sense to also force CR0.CD=0. When there are assigned devices, emulate cache-disabled

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-10 Thread Bandan Das
Laszlo Ersek ler...@redhat.com writes: On 07/10/15 16:59, Paolo Bonzini wrote: On 10/07/2015 16:57, Laszlo Ersek wrote: ... In any case, please understand that I'm not campaigning for this warning :) IIRC the warning was your (very welcome!) idea after I reported the problem; I'm just

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-10 Thread Paolo Bonzini
On 09/07/2015 20:57, Laszlo Ersek wrote: Without EPT, you don't hit the processor limitation with your setup, but the user should nevertheless still be notified. I disagree. FWIW, I also disagree (and it looks like Bandan disagrees with himself now :)). In fact, I think shadow paging

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-10 Thread Laszlo Ersek
On 07/10/15 16:13, Paolo Bonzini wrote: On 09/07/2015 20:57, Laszlo Ersek wrote: Without EPT, you don't hit the processor limitation with your setup, but the user should nevertheless still be notified. I disagree. FWIW, I also disagree (and it looks like Bandan disagrees with

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-10 Thread Laszlo Ersek
On 07/10/15 16:59, Paolo Bonzini wrote: On 10/07/2015 16:57, Laszlo Ersek wrote: ... In any case, please understand that I'm not campaigning for this warning :) IIRC the warning was your (very welcome!) idea after I reported the problem; I'm just trying to ensure that the warning match

Re: [PATCH 2/4] KVM: SVM: use NPT page attributes

2015-07-10 Thread Paolo Bonzini
On 10/07/2015 03:19, Xiao Guangrong wrote: yes, this is correct. QEMU still does not have support for disabling quirks, so gCR0.CD is currently hidden on SVM. I would like to include this series in 4.2, while for 4.3 I will disable the quirk above altogether (it is superseded by the way

Re: [RFC v1 5/5] Call irqbypass update routine when updating irqfd

2015-07-10 Thread Alex Williamson
On Fri, 2015-07-10 at 14:47 +0200, Paolo Bonzini wrote: On 10/07/2015 10:28, Wu, Feng wrote: Yes, you are right. All we need is the producer information which has been passed in the register routine. And we can easily make this update logic inside the consumer. Thanks for your

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

2015-07-10 Thread Andre Przywara
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 accesses by storing the 64-bit data written into it into a variable which we later read in the ITS

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

2015-07-10 Thread Andre Przywara
Currently we initialize all the possible GIC frame addresses in one function, without looking at the specific GIC model we instantiate for the guest. As this gets confusing when adding another VGIC model later, lets move these initializations into the respective model's init functions.

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

2015-07-10 Thread Andre Przywara
The ARM GICv3 ITS emulation code goes into a separate file, but needs to be connected to the GICv3 emulation, of which it is an option. Introduce the skeleton with function stubs to be filled later. Introduce the basic ITS data structure and initialize it, but don't return any success yet, as we

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

2015-07-10 Thread Andre Przywara
Currently we track which IRQ has been mapped to which VGIC list register and also have to synchronize both. We used to do this to hold some extra state (for instance the active bit). It turns out that this extra state in the LRs is no longer needed and this extra tracking causes some pain later.

[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

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

2015-07-10 Thread Andre Przywara
The ARM GICv3 ITS MSI controller requires a device ID to be able to assign the proper interrupt vector. On real hardware, this ID is sampled from the bus. To be able to emulate an ITS controller, extend the KVM MSI interface to let userspace provide such a device ID. For PCI devices, the device ID

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

2015-07-10 Thread Andre Przywara
Hi, this respin tries to address all comments I got so far from the list. Thanks to Eric, Pavel and Christoffer for the review! The major change in this series is the reworked locking. The current implementation is now much more fine grained and avoids any calls to functions that could possibly

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

2015-07-10 Thread Andre Przywara
The GICv3 Interrupt Translation Service (ITS) uses tables in memory to allow a sophisticated interrupt routing. It features device tables, an interrupt table per device and a table connecting collections to actual CPUs (aka. redistributors in the GICv3 lingo). Since the interrupt numbers for the

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

2015-07-10 Thread Andre Przywara
The ARM GICv3 ITS controller requires a separate register frame to cover ITS specific registers. Add a new VGIC address type and store the address in a field in the vgic_dist structure. Provide a function to check whether userland has provided the address, so ITS functionality can be guarded by

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

2015-07-10 Thread Andre Przywara
The LPI configuration and pending tables of the GICv3 LPIs are held in tables in (guest) memory. To achieve reasonable performance, we cache this data in our own data structures, so we need to sync those two views from time to time. This behaviour is well described in the GICv3 spec and is also

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

2015-07-10 Thread Andre Przywara
Add emulation for some basic MMIO registers used in the ITS emulation. This includes: - GITS_{CTLR,TYPER,IIDR} - ID registers - GITS_{CBASER,CREADR,CWRITER} those implement the ITS command buffer handling Most of the handlers are pretty straight forward, but CWRITER goes some extra miles to

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

2015-07-10 Thread Andre Przywara
Currently we destroy the VGIC emulation in one function that cares for all emulated models. To be on par with init_model (which is model specific), lets introduce a per-emulation-model destroy method, too. Use it for a tiny GICv3 specific code already, later it will be handy for the ITS emulation.

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

2015-07-10 Thread Andre Przywara
The connection between a device, an event ID, the LPI number and the allocated CPU is stored in in-memory tables in a GICv3, but their format is not specified by the spec. Instead software uses a command queue in a ring buffer to let the ITS implementation use their own format. Implement handlers

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

2015-07-10 Thread Andre Przywara
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 of memory. We use our equivalent of the Interrupt Translation Table Entry (ITTE) to hold this extra status

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

2015-07-10 Thread Andre Przywara
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 lists and find the proper Interrupt Translation Table Entry. Then set the pending bit in this ITTE to

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

2015-07-10 Thread Andre Przywara
If userspace has provided a base address for the ITS register frame, we enable the bits that advertise LPIs in the GICv3. When the guest has enabled LPIs and the ITS, we enable the emulation part by initializing the ITS data structures and trapping on ITS register frame accesses by the guest. Also

[PATCH] virt: IRQ bypass manager

2015-07-10 Thread Alex Williamson
When a physical I/O device is assigned to a virtual machine through facilities like VFIO and KVM, the interrupt for the device generally bounces through the host system before being injected into the VM. However, hardware technologies exist that often allow the host to be bypassed for some of

[kvm-unit-tests PATCH 0/9] Generate standalone tests

2015-07-10 Thread Andrew Jones
Add support to convert unit tests to standalone scripts that can be run outside the framework. This is almost an RFC, but it doesn't impact the current framework (except for 'make install', but was that ever used?). The scripting is ugly, but I see value in having easily distributable unit tests.

[kvm-unit-tests PATCH 2/9] run_tests.sh: remove blank line from start of log

2015-07-10 Thread Andrew Jones
Signed-off-by: Andrew Jones drjo...@redhat.com --- run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run_tests.sh b/run_tests.sh index e48f1db049f81..6f00aa495744c 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -120,7 +120,7 @@ specify the appropriate qemu binary

[kvm-unit-tests PATCH 9/9] standalone: add documentation to README

2015-07-10 Thread Andrew Jones
Signed-off-by: Andrew Jones drjo...@redhat.com --- README | 10 ++ 1 file changed, 10 insertions(+) diff --git a/README b/README index e9869d12bfa20..8bc966bdf1284 100644 --- a/README +++ b/README @@ -16,6 +16,16 @@ To select a specific qemu binary, specify the QEMU=path environment

[kvm-unit-tests PATCH 7/9] scripts: introduce mk[all]standalone.sh

2015-07-10 Thread Andrew Jones
This is a super ugly bash script, wrapped around a couple ugly bash scripts, and it generates an ugly bash script. But, it gets the job done. What's the job? Take a unit test and generate a standalone script that can be run on any appropriate system with an appropriate qemu. This makes

Re: [PATCH 2/4] KVM: SVM: use NPT page attributes

2015-07-10 Thread Xiao Guangrong
On 07/10/2015 06:47 PM, Paolo Bonzini wrote: On 10/07/2015 03:19, Xiao Guangrong wrote: yes, this is correct. QEMU still does not have support for disabling quirks, so gCR0.CD is currently hidden on SVM. I would like to include this series in 4.2, while for 4.3 I will disable the quirk

Re: [PATCH] KVM: svm: remove KVM_QUIRK_CD_NW_CLEARED quirk

2015-07-10 Thread Xiao Guangrong
On 07/10/2015 08:01 PM, Paolo Bonzini wrote: We can disable CD unconditionally when there is no assigned device. KVM now forces guest PAT to all-writeback in that case, so it makes sense to also force CR0.CD=0. When there are assigned devices, emulate cache-disabled operation through the page

Re: [PATCH] kvm/x86: add support for MONITOR_TRAP_FLAG

2015-07-10 Thread Mihai Donțu
On Friday 10 July 2015 13:28:26 Paolo Bonzini wrote: On 09/07/2015 21:49, Jan Kiszka wrote: CPU_BASED_MOV_DR_EXITING | CPU_BASED_UNCOND_IO_EXITING | -CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MONITOR_EXITING | +CPU_BASED_USE_IO_BITMAPS |

[kvm-unit-tests PATCH 1/9] x86/run: source config.mak

2015-07-10 Thread Andrew Jones
We'll use a variable from config.mak in a later patch. Try not to break users that have gotten used to doing cd x86; ./run test.flat by also looking in the parent directory. While at it, add this parent directory check to arm too. Signed-off-by: Andrew Jones drjo...@redhat.com --- arm/run | 8

[kvm-unit-tests PATCH 3/9] run_tests.sh: add '-d' for dry-run

2015-07-10 Thread Andrew Jones
Add an option that allows us to just get the qemu command line for each test. Running ./run_tests.sh -d will result in each test saying it passed, and test.log will contain a list of each qemu command line that would have been executed, had it not been a dry-run. Signed-off-by: Andrew Jones

[kvm-unit-tests PATCH 4/9] run_tests.sh: allow default unittests.cfg override

2015-07-10 Thread Andrew Jones
Signed-off-by: Andrew Jones drjo...@redhat.com --- run_tests.sh | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 4246f1b60a733..4a9c54b0817cd 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -110,13 +110,14 @@ function usage() { cat

[kvm-unit-tests PATCH 8/9] Makefile: change 'make install' to install standalone tests

2015-07-10 Thread Andrew Jones
make install wasn't very useful without also installing scripts for the qemu command lines. I suspect 'make install' was never used. Installing standalone tests could be useful though, so let's do that instead. Signed-off-by: Andrew Jones drjo...@redhat.com --- Makefile | 6

[kvm-unit-tests PATCH 6/9] arm/unittests.cfg: make test names more friendly

2015-07-10 Thread Andrew Jones
Prepares for the mkstandalone script coming in a later patch. Signed-off-by: Andrew Jones drjo...@redhat.com --- arm/unittests.cfg | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arm/unittests.cfg b/arm/unittests.cfg index 32fb4bb6c146b..8fae8a714a83b 100644 ---

[kvm-unit-tests PATCH 5/9] unittests.cfg: use double quotes

2015-07-10 Thread Andrew Jones
Quotes, bash, and bash generation from bash are painful enough without having to handle both single and double quotes. Let's just handle double. This prepares for the mkstandalone script coming in a later patch. Signed-off-by: Andrew Jones drjo...@redhat.com --- arm/unittests.cfg | 8

Re: [PATCH] KVM: x86: Add host physical address width capability

2015-07-10 Thread Paolo Bonzini
On 10/07/2015 16:57, Laszlo Ersek wrote: ... In any case, please understand that I'm not campaigning for this warning :) IIRC the warning was your (very welcome!) idea after I reported the problem; I'm just trying to ensure that the warning match the exact issue I encountered.

Re: [PATCH] virt: IRQ bypass manager

2015-07-10 Thread Paolo Bonzini
On 10/07/2015 19:52, Alex Williamson wrote: Perhaps if a second consumer comes along that would be justification for tying it elsewhere in the build system. ARM will obviously need to do similar. Are there better options? Also, there's no maintainer for the top level virt/ directory.

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

2015-07-10 Thread Andre Przywara
On 09/07/15 09:22, Eric Auger wrote: On ARM, the MSI msg (address and data) comes along with out-of-band device ID information. The device ID encodes the device that writes the MSI msg. Let's convey the device id in kvm_irq_routing_msi and use a new routing entry type to indicate the devid is

Re: [PATCH] vhost-blk: Add vhost-blk support v6

2015-07-10 Thread Ming Lin
On Sat, Dec 1, 2012 at 5:33 PM, Asias He as...@redhat.com wrote: vhost-blk is an in-kernel virito-blk device accelerator. Due to lack of proper in-kernel AIO interface, this version converts guest's I/O request to bio and use submit_bio() to submit I/O directly. So this version any supports

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