Re: [PATCH v9 00/18] Add VT-d Posted-Interrupts support - including prerequisite series

2015-09-18 Thread Alex Williamson
On Fri, 2015-09-18 at 16:58 +0200, Paolo Bonzini wrote: > > On 18/09/2015 16:29, Feng Wu wrote: > > 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 withou

Re: [PATCH v9 12/18] vfio: Register/unregister irq_bypass_producer

2015-09-18 Thread Alex Williamson
On Fri, 2015-09-18 at 22:29 +0800, Feng Wu wrote: > This patch adds the registration/unregistration of an > irq_bypass_producer for MSI/MSIx on vfio pci devices. > > Signed-off-by: Feng Wu On nit, Paolo could you please fix the spelling of "registration" in the dev_info, otherwise: Acked-by: Al

Re: [PATCH v8 03/13] KVM: Define a new interface kvm_intr_is_single_vcpu()

2015-09-18 Thread Paolo Bonzini
On 18/09/2015 18:16, Radim Krčmář wrote: >>> >> Ok, I was wondering whether this was the correct interpretation. Thanks! >> > >> > Paolo, I don't think Radim clarify your concern, right? Since mda is >> > 8-bit, it >> > is wrong with mda >> 16, this is your concern, right? > In case it was: m

Re: [PATCH v8 03/13] KVM: Define a new interface kvm_intr_is_single_vcpu()

2015-09-18 Thread Radim Krčmář
2015-09-17 23:18+, Wu, Feng: >> From: Paolo Bonzini [mailto:pbonz...@redhat.com] >> On 17/09/2015 17:58, Radim Krčmář wrote: >>> xAPIC address are only 8 bit long so they always get delivered to x2APIC >>> cluster 0, where first 16 bits work like xAPIC flat logical mode. >> >> Ok, I was wonder

Re: [PATCH v9 17/18] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-09-18 Thread Paolo Bonzini
On 18/09/2015 16:29, Feng Wu wrote: > 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: F

RE: [PATCH v9 00/18] Add VT-d Posted-Interrupts support - including prerequisite series

2015-09-18 Thread Wu, Feng
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Friday, September 18, 2015 11:21 PM > To: Wu, Feng; alex.william...@redhat.com; j...@8bytes.org; > mtosa...@redhat.com > Cc: eric.au...@linaro.org; k...@vger.kernel.org; > iommu@lists.linux-foundation.org; lin

RE: [PATCH v9 04/18] KVM: create kvm_irqfd.h

2015-09-18 Thread Wu, Feng
Signed-off-by: Feng Wu > -Original Message- > From: iommu-boun...@lists.linux-foundation.org > [mailto:iommu-boun...@lists.linux-foundation.org] On Behalf Of Feng Wu > Sent: Friday, September 18, 2015 10:30 PM > To: pbonz...@redhat.com; alex.william...@redhat.com; j...@8bytes.org; > mtosa

RE: [PATCH v9 01/18] virt: IRQ bypass manager

2015-09-18 Thread Wu, Feng
Signed-off-by: Feng Wu > -Original Message- > From: iommu-boun...@lists.linux-foundation.org > [mailto:iommu-boun...@lists.linux-foundation.org] On Behalf Of Feng Wu > Sent: Friday, September 18, 2015 10:30 PM > To: pbonz...@redhat.com; alex.william...@redhat.com; j...@8bytes.org; > mtosa

Re: [PATCH v9 00/18] Add VT-d Posted-Interrupts support - including prerequisite series

2015-09-18 Thread Paolo Bonzini
On 18/09/2015 17:08, Wu, Feng wrote: > > >> -Original Message- >> From: Paolo Bonzini [mailto:pbonz...@redhat.com] >> Sent: Friday, September 18, 2015 10:59 PM >> To: Wu, Feng; alex.william...@redhat.com; j...@8bytes.org; >> mtosa...@redhat.com >> Cc: eric.au...@linaro.org; k...@vger.ke

[PATCH] iommu/arm-smmu: Use correct address mask for CMD_TLBI_S2_IPA

2015-09-18 Thread Will Deacon
Stage-2 TLBI by IPA takes a 48-bit address field, as opposed to the 64-bit field used by the VA-based invalidation commands. This patch re-jigs the SMMUv3 command construction code so that the address field is correctly masked. Signed-off-by: Will Deacon --- drivers/iommu/arm-smmu-v3.c | 9

RE: [PATCH v9 00/18] Add VT-d Posted-Interrupts support - including prerequisite series

2015-09-18 Thread Wu, Feng
> -Original Message- > From: Paolo Bonzini [mailto:pbonz...@redhat.com] > Sent: Friday, September 18, 2015 10:59 PM > To: Wu, Feng; alex.william...@redhat.com; j...@8bytes.org; > mtosa...@redhat.com > Cc: eric.au...@linaro.org; k...@vger.kernel.org; > iommu@lists.linux-foundation.org; lin

Re: [PATCH v9 00/18] Add VT-d Posted-Interrupts support - including prerequisite series

2015-09-18 Thread Paolo Bonzini
On 18/09/2015 16:29, Feng Wu wrote: > 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. > >

[PATCH v9 09/18] KVM: Define a new interface kvm_intr_is_single_vcpu()

2015-09-18 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 v9 17/18] KVM: Update Posted-Interrupts Descriptor when vCPU is blocked

2015-09-18 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 --- v9: - Add description for blocked_vcpu_on_cpu_lo

[PATCH v9 15/18] KVM: Add an arch specific hooks in 'struct kvm_kernel_irqfd'

2015-09-18 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 --- v9: - Use 'if' instead of "? :" in kvm_arch_update_irqfd_routing() - coding style v8: - Remove callback

[PATCH v9 12/18] vfio: Register/unregister irq_bypass_producer

2015-09-18 Thread Feng Wu
This patch adds the registration/unregistration of an irq_bypass_producer for MSI/MSIx on vfio pci devices. Signed-off-by: Feng Wu --- v8: - Merge "[PATCH v7 08/17] vfio: Select IRQ_BYPASS_MANAGER for vfio PCI devices" into this patch. v6: - Make the add_consumer and del_consumer callbacks sta

[PATCH v9 13/18] KVM: x86: Update IRTE for posted-interrupts

2015-09-18 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 --- v9: - Check !kvm_arch_has_assigned_device(kvm) first then !irq_remapping_cap(IRQ_POSTING_CAP) v8: - Move 'kvm_arch_update_pi_irte' to vmx.c as a callback

[PATCH v9 14/18] KVM: Implement IRQ bypass consumer callbacks for x86

2015-09-18 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 --- v8: - Move the weak irq

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

2015-09-18 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 v9 18/18] iommu/vt-d: Add a command line parameter for VT-d posted-interrupts

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

[PATCH v9 04/18] KVM: create kvm_irqfd.h

2015-09-18 Thread Feng Wu
From: 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 integrati

[PATCH v9 06/18] KVM: eventfd: add irq bypass consumer management

2015-09-18 Thread Feng Wu
From: 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 registr

[PATCH v9 11/18] KVM: make kvm_set_msi_irq() public

2015-09-18 Thread Feng Wu
Make kvm_set_msi_irq() public, we can use this function outside. Signed-off-by: Feng Wu Reviewed-by: Paolo Bonzini --- v8: - Export kvm_set_msi_irq() so we can use it in vmx code arch/x86/include/asm/kvm_host.h | 4 arch/x86/kvm/irq_comm.c | 5 +++-- 2 files changed, 7 insertions(

[PATCH v9 08/18] KVM: Add some helper functions for Posted-Interrupts

2015-09-18 Thread Feng Wu
This patch adds some helper functions to manipulate the Posted-Interrupts Descriptor. Signed-off-by: Feng Wu Reviewed-by: Paolo Bonzini --- 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..3

[PATCH v9 10/18] KVM: Make struct kvm_irq_routing_table accessible

2015-09-18 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 Reviewed-by: Paolo Bonzini --- include/linux/kvm_host.h | 14 ++ virt/kvm/irqchip.c | 10 -- 2 files changed, 14 insertions(+), 10 deletions(-)

[PATCH v9 05/18] KVM: introduce kvm_arch functions for IRQ bypass

2015-09-18 Thread Feng Wu
From: 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

[PATCH v9 07/18] KVM: Extend struct pi_desc for VT-d Posted-Interrupts

2015-09-18 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 v9 00/18] Add VT-d Posted-Interrupts support - including prerequisite series

2015-09-18 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 v9 01/18] virt: IRQ bypass manager

2015-09-18 Thread Feng Wu
From: 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 by

[PATCH v9 03/18] KVM: arm/arm64: select IRQ_BYPASS_MANAGER

2015-09-18 Thread Feng Wu
From: 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

[PATCH v9 02/18] KVM: x86: select IRQ_BYPASS_MANAGER

2015-09-18 Thread 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/kvm/Kconfig +++

[PATCH] iommu/arm-smmu: Ensure IAS is set correctly for AArch32-capable SMMUs

2015-09-18 Thread Will Deacon
AArch32-capable SMMU implementations have a minimum IAS of 40 bits, so ensure that is reflected in the stage-2 page table configuration. Signed-off-by: Will Deacon --- drivers/iommu/arm-smmu-v3.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/arm-s

Re: [PATCH v2] iommu/io-pgtable-arm: Don't use dma_to_phys()

2015-09-18 Thread Russell King - ARM Linux
On Fri, Sep 18, 2015 at 12:04:26PM +0100, Robin Murphy wrote: > Specifically, the problem case for that is when phys_addr_t is 64-bit but > dma_addr_t is 32-bit. The cast in __arm_lpae_dma_addr is necessary to avoid > a truncation warning when we make the DMA API calls, but we actually need > the o

Re: [PATCH v2] iommu/io-pgtable-arm: Don't use dma_to_phys()

2015-09-18 Thread Robin Murphy
On 18/09/15 09:55, Yong Wu wrote: On Thu, 2015-09-17 at 17:42 +0100, Robin Murphy wrote: [...] the appropriate course of action. Further care (and ugliness) is also necessary in the comparison to avoid truncation if phys_addr_t and dma_addr_t differ in size. [...] /*

Re: [PATCH v2] iommu/io-pgtable-arm: Don't use dma_to_phys()

2015-09-18 Thread Yong Wu
On Thu, 2015-09-17 at 17:42 +0100, Robin Murphy wrote: > In checking whether DMA addresses differ from physical addresses, using > dma_to_phys() is actually the wrong thing to do, since it may hide any > DMA offset, which is precisely one of the things we are checking for. > Simply casting between