Re: [PATCH v4 4/5] KVM: introduce kvm_arch functions for IRQ bypass

2015-08-10 Thread Eric Auger
On 08/07/2015 10:09 PM, Alex Williamson wrote: > On Mon, 2015-08-03 at 19:20 +0200, Eric Auger wrote: >> This patch introduces >> - kvm_arch_irq_bypass_add_producer >> - kvm_arch_irq_bypass_del_producer >> - kvm_arch_irq_bypass_stop >> - kvm_arch_irq_bypass_start >> >> They make possible to special

Re: [PATCH v4 5/5] KVM: eventfd: add irq bypass consumer management

2015-08-10 Thread Eric Auger
Hi Alex, On 08/07/2015 10:09 PM, Alex Williamson wrote: > On Mon, 2015-08-03 at 19:20 +0200, Eric Auger wrote: >> This patch adds the registration/unregistration of an >> irq_bypass_consumer on irqfd assignment/deassignment. >> >> Signed-off-by: Eric Auger >> Signed-off-by: Feng Wu >> >> --- >> >

Re: rdtsc() in kvm-unit-tests on x86

2015-08-10 Thread Paolo Bonzini
On 07/08/2015 21:19, Jintack Lim wrote: > Hi all, > > While I was looking at rdtsc() code in kvm-unit-tests (e.g. x86/vmexit.c), > I was getting curious that out-of-order execution on the processor > may make rdtsc() executed not in the place we expect. > > Referring to this document from intel

Re: [RFC PATCH 1/4] vhost: Introduce a universal thread to serve all users

2015-08-10 Thread Michael S. Tsirkin
On Mon, Jul 13, 2015 at 12:07:32AM -0400, Bandan Das wrote: > vhost threads are per-device, but in most cases a single thread > is enough. This change creates a single thread that is used to > serve all guests. > > However, this complicates cgroups associations. The current policy > is to attach t

Re: Fwd: KVM : Virtio ring size

2015-08-10 Thread Stefan Hajnoczi
On Fri, Aug 07, 2015 at 10:48:50AM +0530, sai kiran wrote: > I am experimenting on Virtio-net frontend driver. And I observe that > the virtio ring size is communicated to guest as 256. > I tried changing backend-qemu code manually, to propagate 512 ring size. > > But other than changing code and

[PATCH v3 10/10] KVM: arm/arm64: implement IRQ bypass consumer functions

2015-08-10 Thread Eric Auger
Implement IRQ bypass callbacks for arm/arm64 IRQ forwarding: - kvm_arch_irq_bypass_add_producer: perform VGIC/irqchip settings for forwarding - kvm_arch_irq_bypass_del_producer: same for inverse operation - kvm_arch_irq_bypass_stop: halt guest execution - kvm_arch_irq_bypass_start: resume guest e

[PATCH v3 07/10] KVM: arm/arm64: vgic: Allow HW interrupts for non-shared devices

2015-08-10 Thread Eric Auger
From: Marc Zyngier So far, the only use of the HW interrupt facility was the timer, implying that the active state is context-switched for each vcpu, as the device is is shared across all vcpus. This does not work for a device that has been assigned to a VM, as the guest is entierely in control

[PATCH v3 06/10] VFIO: platform: add irq bypass producer management

2015-08-10 Thread Eric Auger
This patch populates the IRQ bypass callacks: - stop/start producer simply consist in disabling/enabling the host irq - add/del consumer: basically set the automasked flag to false/true Signed-off-by: Eric Auger --- v2 -> v3: - vfio_platform_irq_bypass_add_consumer now returns an error in case

[PATCH v3 05/10] VFIO: platform: add vfio_platform_is_active

2015-08-10 Thread Eric Auger
This function returns whether the IRQ is active at irqchip level or VFIO masked. If either is true, it is considered the IRQ is active. Currently there is no way to differentiate userspace masked IRQ from automasked IRQ. There might be false detection of activity. However it is currently acceptable

[PATCH v3 09/10] KVM: arm/arm64: vgic: forwarding control

2015-08-10 Thread Eric Auger
Implements kvm_vgic_[set|unset]_forward. Handle low-level VGIC programming: physical IRQ/guest IRQ mapping, list register cleanup, VGIC state machine. Also interacts with the irqchip. Signed-off-by: Eric Auger --- v2 -> v3: - on unforward, we do not compute & output the active state anymore.

[PATCH v3 08/10] KVM: arm/arm64: vgic: support irqfd injection of a forwarded IRQ

2015-08-10 Thread Eric Auger
Currently irqfd injection relies on kvm_vgic_inject_irq function. However this function cannot be used anymore for mapped IRQs. So let's change the implementation to use kvm_vgic_inject_mapped_irq when the IRQ is forwarded. Signed-off-by: Eric Auger --- virt/kvm/arm/vgic.c | 8 +++- 1 file c

[PATCH v4 00/15] KVM: arm: debug infrastructure support

2015-08-10 Thread Zhichao Huang
This patch series adds debug support, a key feature missing from the KVM/armv7 port. The main idea is to keep track of whether the host and the guest have any break/watch points enabled or not. We only do the world switch for debug registers when the host or the guest is actually using it. We add

[PATCH v3 02/10] VFIO: platform: test forwarded state when selecting the IRQ handler

2015-08-10 Thread Eric Auger
Add a new forwarded flag in vfio_platform_irq. In case the IRQ is forwarded, the VFIO platform IRQ handler does not need to disable the IRQ anymore. When setting the IRQ handler we now also test the forwarded state. In case the IRQ is forwarded we select the vfio_irq_handler. Signed-off-by: Eric

[PATCH v3 00/10] ARM IRQ forward control based on IRQ bypass manager

2015-08-10 Thread Eric Auger
This series allows to set ARM IRQ forwarding between a VFIO platform device physical IRQ and a guest virtual IRQ. The link is coordinated by the IRQ bypass manager. The principle is the VFIO platform driver registers an IRQ bypass producer struct on VFIO_IRQ_SET_ACTION_TRIGGER while KVM irqfd regi

[PATCH v3 01/10] VFIO: platform: registration of a dummy IRQ bypass producer

2015-08-10 Thread Eric Auger
Register a dummy producer with void callbacks Signed-off-by: Eric Auger --- v2 -> v3: - rename vfio_platform_irq_bypass_resume into *_start --- drivers/vfio/platform/vfio_platform_irq.c | 32 +++ drivers/vfio/platform/vfio_platform_private.h | 2 ++ 2 files changed

[PATCH v4 04/15] KVM: arm: common infrastructure for handling AArch32 CP14/CP15

2015-08-10 Thread Zhichao Huang
As we're about to trap a bunch of CP14 registers, let's rework the CP15 handling so it can be generalized and work with multiple tables. We stop trapping access here, because we haven't finished our trap handlers. We will enable trapping agian until everything is OK. Signed-off-by: Zhichao Huang

[PATCH v4 02/15] KVM: arm: rename pm_fake handler to trap_raz_wi

2015-08-10 Thread Zhichao Huang
pm_fake doesn't quite describe what the handler does (ignoring writes and returning 0 for reads). As we're about to use it (a lot) in a different context, rename it with a (admitedly cryptic) name that make sense for all users. Signed-off-by: Zhichao Huang Reviewed-by: Alex Bennee Acked-by: Chr

[PATCH v3 04/10] VFIO: platform: add vfio_platform_set_automasked

2015-08-10 Thread Eric Auger
This function makes possible to change the automasked mode. Signed-off-by: Eric Auger --- v1 -> v2: - set forwarded flag --- drivers/vfio/platform/vfio_platform_irq.c | 19 +++ 1 file changed, 19 insertions(+) diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/v

[PATCH v4 03/15] KVM: arm: enable to use the ARM_DSCR_MDBGEN macro from KVM assembly code

2015-08-10 Thread Zhichao Huang
Add #ifndef __ASSEMBLY__ in hw_breakpoint.h, in order to use the ARM_DSCR_MDBGEN macro from KVM assembly code. Signed-off-by: Zhichao Huang Reviewed-by: Alex Bennee Acked-by: Christoffer Dall --- arch/arm/include/asm/hw_breakpoint.h | 54 +++- 1 file changed, 29

[PATCH v4 01/15] KVM: arm: plug guest debug exploit

2015-08-10 Thread Zhichao Huang
Hardware debugging in guests is not intercepted currently, it means that a malicious guest can bring down the entire machine by writing to the debug registers. This patch enable trapping of all debug registers, preventing the guests to access the debug registers. This patch also disable the debug

[PATCH v3 03/10] VFIO: platform: single handler using function pointer

2015-08-10 Thread Eric Auger
A single handler now is registered whatever the use case: automasked or not. A function pointer is set according to the wished behavior and the handler calls this function. The irq lock is taken/released in the root handler. eventfd_signal can be called in regions not allowed to sleep. Signed-off

[PATCH v4 05/15] KVM: arm: check ordering of all system register tables

2015-08-10 Thread Zhichao Huang
We now have multiple tables for the various system registers we trap. Make sure we check the order of all of them, as it is critical that we get the order right (been there, done that...). Signed-off-by: Zhichao Huang Reviewed-by: Christoffer Dall --- arch/arm/kvm/coproc.c | 26

[PATCH v4 10/15] KVM: arm: implement world switch for debug registers

2015-08-10 Thread Zhichao Huang
Implement switching of the debug registers. While the number of registers is massive, CPUs usually don't implement them all (A15 has 6 breakpoints and 4 watchpoints, which gives us a total of 22 registers "only"). Signed-off-by: Zhichao Huang --- arch/arm/kvm/interrupts_head.S | 170

[PATCH v4 08/15] KVM: arm: add a trace event for cp14 traps

2015-08-10 Thread Zhichao Huang
There are too many cp15 traps, so we don't reuse the cp15 trace event but add a new trace event to trace the access of debug registers. Signed-off-by: Zhichao Huang Acked-by: Christoffer Dall --- arch/arm/kvm/coproc.c | 14 ++ arch/arm/kvm/trace.h | 30 +

[PATCH v4 07/15] KVM: arm: add trap handlers for 64-bit debug registers

2015-08-10 Thread Zhichao Huang
Add handlers for all the 64-bit debug registers. There is an overlap between 32 and 64bit registers. Make sure that 64-bit registers preceding 32-bit ones. Signed-off-by: Zhichao Huang Reviewed-by: Christoffer Dall --- arch/arm/kvm/coproc.c | 10 ++ 1 file changed, 10 insertions(+) di

[PATCH v4 06/15] KVM: arm: add trap handlers for 32-bit debug registers

2015-08-10 Thread Zhichao Huang
Add handlers for all the 32-bit debug registers. Signed-off-by: Zhichao Huang --- arch/arm/include/asm/kvm_asm.h | 12 arch/arm/include/asm/kvm_host.h | 3 + arch/arm/kernel/asm-offsets.c | 1 + arch/arm/kvm/coproc.c | 124 4 files

[PATCH v4 09/15] KVM: arm: redefine kvm_cpu_context_t to save the host cp14 states

2015-08-10 Thread Zhichao Huang
Redefine kvm_cpu_context_t as a new struct that include the cp14 states, which we used to save the host cp14 states. Signed-off-by: Zhichao Huang --- arch/arm/include/asm/kvm_host.h | 6 +- arch/arm/kernel/asm-offsets.c | 4 +++- arch/arm/kvm/interrupts.S | 6 -- 3 files changed,

[PATCH v4 12/15] KVM: arm: keep track of host use of the debug registers

2015-08-10 Thread Zhichao Huang
Every guest entry, we need to keep track of host use of the debug registers. We only call the function upon guest entry, after preempt_disable() and local_irq_disable(), so there is no race for it. Signed-off-by: Zhichao Huang --- arch/arm/include/asm/kvm_asm.h| 3 +++ arch/arm/include/asm/

[PATCH v4 11/15] KVM: arm: add a function to keep track of host use of the debug registers

2015-08-10 Thread Zhichao Huang
As we're about to implement a lazy world switch for debug registers, we add a function reading the break/watch control variables directly to indicate whether the host has enabled any break/watch points or not. Signed-off-by: Zhichao Huang --- arch/arm/include/asm/hw_breakpoint.h | 5 + arch

[PATCH v4 13/15] KVM: arm: keep track of guest use of the debug registers

2015-08-10 Thread Zhichao Huang
We trap debug register accesses from guest all the time, and read the BCR/WCR to indicate whether the guest has enabled any break/watch points or not. Signed-off-by: Zhichao Huang --- arch/arm/include/asm/kvm_asm.h | 2 ++ arch/arm/kvm/coproc.c | 75

[PATCH v4 14/15] KVM: arm: implement lazy world switch for debug registers

2015-08-10 Thread Zhichao Huang
Avoid world-switching all the debug registers when neither the host nor the guest has configured any [WB]points. Signed-off-by: Zhichao Huang --- arch/arm/kvm/interrupts_head.S | 23 +-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/arch/arm/kvm/interrupts_he

[PATCH v4 15/15] KVM: arm: enable trapping of all debug registers

2015-08-10 Thread Zhichao Huang
Enable trapping of the debug registers unconditionally, allowing guests to use the debug infrastructure. Signed-off-by: Zhichao Huang Reviewed-by: Christoffer Dall --- arch/arm/kvm/interrupts_head.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kvm/interrupts_head

[PATCH v5 0/5] KVM: irqfd consumer based on IRQ bypass manager

2015-08-10 Thread Eric Auger
This series transforms irqfd into an IRQ bypass consumer and introduce the infrastructure shared by Intel posted-interrupts and ARM forwarded IRQ series. The bypass manager gets compiled for x86 and arm/arm64 when KVM is used. A new kvm_irqfd.h header is created to externalize some irqfd declarati

[PATCH v5 1/5] KVM: x86: select IRQ_BYPASS_MANAGER

2015-08-10 Thread Eric Auger
From: Feng Wu Select IRQ_BYPASS_MANAGER for x86 when CONFIG_KVM is set Signed-off-by: Feng Wu --- arch/x86/kvm/Kconfig | 2 ++ arch/x86/kvm/Makefile | 3 +++ 2 files changed, 5 insertions(+) diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig index d8a1d56..c951d44 100644 --- a/arch/x86

[PATCH v5 2/5] KVM: arm/arm64: select IRQ_BYPASS_MANAGER

2015-08-10 Thread Eric Auger
Select IRQ_BYPASS_MANAGER when CONFIG_KVM is set Also add compilation of virt/lib. Signed-off-by: Eric Auger Signed-off-by: Feng Wu --- v3 -> v4: - add compilation of virt/lib in arm/arm64 KVM v2 -> v3: - [Feng Wu] Correct a typo in 'arch/arm64/kvm/Kconfig' v1 -> v2: - also set IRQ_BYPASS_MA

[PATCH v5 5/5] KVM: eventfd: add irq bypass consumer management

2015-08-10 Thread Eric Auger
This patch adds the registration/unregistration of an irq_bypass_consumer on irqfd assignment/deassignment. Signed-off-by: Eric Auger Signed-off-by: Feng Wu --- v4 -> v5: - due to removal of static inline stubs, add #ifdef CONFIG_HAVE_KVM_IRQ_BYPASS around consumer registration/unregistrat

[PATCH v5 4/5] KVM: introduce kvm_arch functions for IRQ bypass

2015-08-10 Thread Eric Auger
This patch introduces - kvm_arch_irq_bypass_add_producer - kvm_arch_irq_bypass_del_producer - kvm_arch_irq_bypass_stop - kvm_arch_irq_bypass_start They make possible to specialize the KVM IRQ bypass consumer in case CONFIG_KVM_HAVE_IRQ_BYPASS is set. Signed-off-by: Eric Auger Signed-off-by: Feng

[PATCH v5 3/5] KVM: create kvm_irqfd.h

2015-08-10 Thread Eric Auger
Move _irqfd_resampler and _irqfd struct declarations in a new public header: kvm_irqfd.h. They are respectively renamed into kvm_kernel_irqfd_resampler and kvm_kernel_irqfd. Those datatypes will be used by architecture specific code, in the context of IRQ bypass manager integration. Signed-off-by:

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

2015-08-10 Thread Eric Auger
Hi Pavel, On 08/06/2015 02:06 PM, Pavel Fedin wrote: > Tested-by: Pavel Fedin Many thanks for testing! Best Regards Eric > > Kind regards, > Pavel Fedin > Expert Engineer > Samsung Electronics Research center Russia > >> -Original Message- >> From: Eric Auger [mailto:eric.au...@linaro

Re: rdtsc() in kvm-unit-tests on x86

2015-08-10 Thread Paolo Bonzini
On 10/08/2015 11:42, Christoffer Dall wrote: > > Thanks for the reply. > > On this note, is there an easy mechanism on x86 to obtain a TSC which is > synchronized across PCPUs and between the host and the guest? > > We can use the physical arch timer counter on arm64, but I'm not sure if > the

Re: rdtsc() in kvm-unit-tests on x86

2015-08-10 Thread Jintack Lim
On Mon, Aug 10, 2015 at 9:58 AM, Paolo Bonzini wrote: > > > On 10/08/2015 11:42, Christoffer Dall wrote: >> >> Thanks for the reply. >> >> On this note, is there an easy mechanism on x86 to obtain a TSC which is >> synchronized across PCPUs and between the host and the guest? >> >> We can use the

Re: rdtsc() in kvm-unit-tests on x86

2015-08-10 Thread Paolo Bonzini
On 10/08/2015 16:14, Jintack Lim wrote: >> > Yes, you just use the TSC. :) However, you first have to check that the >> > TSC is consistent across CPUs. On older machines it's not, but the >> > kernel can detect it. > Thanks, Paolo. > > What would be the best way to check if TSC is consistent

Re: [PATCH] KVM: x86: zero IDT limit on entry to SMM

2015-08-10 Thread Radim Krčmář
2015-08-07 12:54+0200, Paolo Bonzini: > The recent BlackHat 2015 presentation "The Memory Sinkhole" > mentions that the IDT limit is zeroed on entry to SMM. Slide 64 of https://www.blackhat.com/docs/us-15/materials/us-15-Domas-The-Memory-Sinkhole-Unleashing-An-x86-Design-Flaw-Allowing-Universal-Pr

Re: rdtsc() in kvm-unit-tests on x86

2015-08-10 Thread Jintack Lim
On Mon, Aug 10, 2015 at 10:47 AM, Paolo Bonzini wrote: > > > On 10/08/2015 16:14, Jintack Lim wrote: >>> > Yes, you just use the TSC. :) However, you first have to check that the >>> > TSC is consistent across CPUs. On older machines it's not, but the >>> > kernel can detect it. >> Thanks, Paolo

Re: [PATCH] kvm:s390:Fix assumption that kvm_set_irq_routing is always run successfully

2015-08-10 Thread Paolo Bonzini
On 10/08/2015 17:21, nick wrote: > > Seems good. > > > > Paolo > > If it makes it easier for you to trust my patches I can show at least 10 bug > fixes for other subsystems > to prove that I am trying to do this correctly. That's up to those maintainers... I definitely see some improvement in

Re: [RFC PATCH 0/4] Shared vhost design

2015-08-10 Thread Bandan Das
"Michael S. Tsirkin" writes: > On Sat, Aug 08, 2015 at 07:06:38PM -0400, Bandan Das wrote: >> Hi Michael, ... >> >> > - does the design address the issue of VM 1 being blocked >> > (e.g. because it hits swap) and blocking VM 2? >> Good question. I haven't thought of this yet. But IIUC, >> the w

Re: [RFC PATCH 1/4] vhost: Introduce a universal thread to serve all users

2015-08-10 Thread Bandan Das
"Michael S. Tsirkin" writes: > On Mon, Jul 13, 2015 at 12:07:32AM -0400, Bandan Das wrote: >> vhost threads are per-device, but in most cases a single thread >> is enough. This change creates a single thread that is used to >> serve all guests. >> >> However, this complicates cgroups association

Re: [RFC PATCH 1/4] vhost: Introduce a universal thread to serve all users

2015-08-10 Thread Bandan Das
Bandan Das writes: > "Michael S. Tsirkin" writes: > >> On Mon, Jul 13, 2015 at 12:07:32AM -0400, Bandan Das wrote: >>> vhost threads are per-device, but in most cases a single thread >>> is enough. This change creates a single thread that is used to >>> serve all guests. >>> >>> However, this c

[Bug 102301] Shutting down a Windowvs 10 virtual machine (with VGA passthrough) causes a hard crash, every time

2015-08-10 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=102301 Will Marler changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

[Bug 102651] New: vcpuX unhandled rdmsr: 0x570

2015-08-10 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=102651 Bug ID: 102651 Summary: vcpuX unhandled rdmsr: 0x570 Product: Virtualization Version: unspecified Kernel Version: 4.1.4 Hardware: All OS: Linux Tree: Mainline

[Bug 102651] vcpuX unhandled rdmsr: 0x570

2015-08-10 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=102651 --- Comment #1 from jamespharve...@gmail.com --- The libvirt/qemu log shows: 2015-08-11 03:29:38.508+: starting up libvirt version: 1.2.18, qemu version: 2.3.94 LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=sp

[PATCH v6 15/16] KVM: Warn if 'SN' is set during posting interrupts by software

2015-08-10 Thread Feng Wu
Currently, we don't support urgent interrupt, all interrupts are recognized as non-urgent interrupt, so we cannot post interrupts when 'SN' is set. If the vcpu is in guest mode, it cannot have been scheduled out, and that's the only case when SN is set currently, warning if SN is set. Signed-off-

[PATCH v6 16/16] iommu/vt-d: Add a command line parameter for VT-d posted-interrupts

2015-08-10 Thread Feng Wu
Enable VT-d Posted-Interrtups and add a command line parameter for it. Signed-off-by: Feng Wu --- Documentation/kernel-parameters.txt | 1 + drivers/iommu/irq_remapping.c | 12 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Documentation/kernel-parameters.txt

[PATCH v6 14/16] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-08-10 Thread Feng Wu
This patch updates the Posted-Interrupts Descriptor when vCPU is blocked. pre-block: - Add the vCPU to the blocked per-CPU list - Set 'NV' to POSTED_INTR_WAKEUP_VECTOR post-block: - Remove the vCPU from the per-CPU list Signed-off-by: Feng Wu --- arch/x86/include/asm/kvm_host.h | 3 + arch/x

[PATCH v6 12/16] KVM: Add an arch specific hooks in 'struct kvm_kernel_irqfd'

2015-08-10 Thread Feng Wu
This patch adds an arch specific hooks 'arch_update' in 'struct kvm_kernel_irqfd'. On Intel side, it is used to update the IRTE when VT-d posted-interrupts is used. Signed-off-by: Feng Wu --- arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/x86.c | 5 + include/linux/kvm_h

[PATCH v6 11/16] KVM: Implement IRQ bypass consumer callbacks for x86

2015-08-10 Thread Feng Wu
Implement the following callbacks for x86: - kvm_arch_irq_bypass_add_producer - kvm_arch_irq_bypass_del_producer - kvm_arch_irq_bypass_stop: dummy callback - kvm_arch_irq_bypass_resume: dummy callback and set CONFIG_HAVE_KVM_IRQ_BYPASS for x86. Signed-off-by: Feng Wu --- arch/x86/include/asm/k

[PATCH v6 13/16] KVM: Update Posted-Interrupts Descriptor when vCPU is preempted

2015-08-10 Thread Feng Wu
This patch updates the Posted-Interrupts Descriptor when vCPU is preempted. sched out: - Set 'SN' to suppress furture non-urgent interrupts posted for the vCPU. sched in: - Clear 'SN' - Change NDST if vCPU is scheduled to a different CPU - Set 'NV' to POSTED_INTR_VECTOR Signed-off-by: Feng Wu -

[PATCH v6 06/16] KVM: Make struct kvm_irq_routing_table accessible

2015-08-10 Thread Feng Wu
Move struct kvm_irq_routing_table from irqchip.c to kvm_host.h, so we can use it outside of irqchip.c. Signed-off-by: Feng Wu --- include/linux/kvm_host.h | 14 ++ virt/kvm/irqchip.c | 10 -- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/include/linux

[PATCH v6 10/16] KVM: x86: Update IRTE for posted-interrupts

2015-08-10 Thread Feng Wu
This patch adds the routine to update IRTE for posted-interrupts when guest changes the interrupt configuration. Signed-off-by: Feng Wu --- arch/x86/kvm/x86.c | 73 ++ 1 file changed, 73 insertions(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86

[PATCH v6 07/16] KVM: make kvm_set_msi_irq() public

2015-08-10 Thread Feng Wu
Make kvm_set_msi_irq() public, we can use this function outside. Signed-off-by: Feng Wu --- arch/x86/include/asm/kvm_host.h | 4 arch/x86/kvm/irq_comm.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kv

[PATCH v6 09/16] vfio: Register/unregister irq_bypass_producer

2015-08-10 Thread Feng Wu
This patch adds the registration/unregistration of an irq_bypass_producer for MSI/MSIx on vfio pci devices. v6: - Make the add_consumer and del_consumer callbacks static - Remove pointless INIT_LIST_HEAD to 'vdev->ctx[vector].producer.node)' - Use dev_info instead of WARN_ON() when irq_bypass_regi

[PATCH v6 08/16] vfio: Select IRQ_BYPASS_MANAGER for vfio PCI devices

2015-08-10 Thread Feng Wu
Enable irq bypass manager for vfio PCI devices. Signed-off-by: Feng Wu --- drivers/vfio/pci/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vfio/pci/Kconfig b/drivers/vfio/pci/Kconfig index 579d83b..02912f1 100644 --- a/drivers/vfio/pci/Kconfig +++ b/drivers/vfio/pci/Kconfig

[PATCH v6 01/16] KVM: Extend struct pi_desc for VT-d Posted-Interrupts

2015-08-10 Thread Feng Wu
Extend struct pi_desc for VT-d Posted-Interrupts. Signed-off-by: Feng Wu --- arch/x86/kvm/vmx.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 83b7b5c..271dd70 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/

[PATCH v6 00/16] Add VT-d Posted-Interrupts support

2015-08-10 Thread Feng Wu
VT-d Posted-Interrupts is an enhancement to CPU side Posted-Interrupt. With VT-d Posted-Interrupts enabled, external interrupts from direct-assigned devices can be delivered to guests without VMM intervention when guest is running in non-root mode. You can find the VT-d Posted-Interrtups Spec. in

[PATCH v6 02/16] KVM: Add some helper functions for Posted-Interrupts

2015-08-10 Thread Feng Wu
This patch adds some helper functions to manipulate the Posted-Interrupts Descriptor. Signed-off-by: Feng Wu --- arch/x86/kvm/vmx.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 271dd70..316f9bf 100644 --- a/arch/x86

[PATCH v6 05/16] KVM: Add interfaces to control PI outside vmx

2015-08-10 Thread Feng Wu
This patch adds pi_clear_sn and pi_set_sn to struct kvm_x86_ops, so we can set/clear SN outside vmx. Signed-off-by: Feng Wu --- arch/x86/include/asm/kvm_host.h | 3 +++ arch/x86/kvm/vmx.c | 13 + 2 files changed, 16 insertions(+) diff --git a/arch/x86/include/asm/kvm_h

[PATCH v6 03/16] KVM: Define a new interface kvm_intr_is_single_vcpu()

2015-08-10 Thread Feng Wu
This patch defines a new interface kvm_intr_is_single_vcpu(), which can returns whether the interrupt is for single-CPU or not. It is used by VT-d PI, since now we only support single-CPU interrupts, For lowest-priority interrupts, if user configures it via /proc/irq or uses irqbalance to make it

[PATCH v6 04/16] KVM: Get Posted-Interrupts descriptor address from 'struct kvm_vcpu'

2015-08-10 Thread Feng Wu
Define an interface to get PI descriptor address from the vCPU structure. Signed-off-by: Feng Wu --- arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/vmx.c | 11 +++ 2 files changed, 13 insertions(+) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/k