Re: [PATCH 2/4] powerpc kvm: added multiple TCEs requests support

2013-02-18 Thread Alexey Kardashevskiy
On 15/02/13 14:24, Paul Mackerras wrote: On Mon, Feb 11, 2013 at 11:12:41PM +1100, a...@ozlabs.ru wrote: +static long emulated_h_put_tce(struct kvmppc_spapr_tce_table *stt, + unsigned long ioba, unsigned long tce) +{ + unsigned long idx = ioba >> SPAPR_TCE_SHIFT; + str

Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information pointer in archdata.

2013-02-28 Thread Alexey Kardashevskiy
Hi! On POWERNV we use only the part of IOMMU API which handles devices and groups. We do not use IOMMU domains as VFIO containers do everything we need for VFIO and we do not implement iommu_ops as it is not very relevant to our architecture (does not give dma window properties, etc). So you

Re: [PATCH 1/6 v8] iommu/fsl: Store iommu domain information pointer in archdata.

2013-03-01 Thread Alexey Kardashevskiy
. Regards Varun -Original Message- From: Alexey Kardashevskiy [mailto:a...@ozlabs.ru] Sent: Friday, March 01, 2013 6:55 AM To: Kumar Gala Cc: Sethi Varun-B16395; Benjamin Herrenschmidt; iommu@lists.linux- foundation.org; linuxppc-dev@lists.ozlabs.org list; linux- ker...@vger.kernel.org list

Re: [PATCH 1/2] powerpc/powernv: reduce multi-hit of iommu_add_device()

2014-04-28 Thread Alexey Kardashevskiy
nv/pci-ioda.c > index bc8e74e..bd3870e 100644 > --- a/arch/powerpc/platforms/powernv/pci-ioda.c > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c > @@ -1423,7 +1423,7 @@ static void pnv_pci_ioda_dma_dev_setup(struct pnv_phb > *phb, struct pci_dev *pdev > > pe = &ph

Re: [PATCH 1/2] powerpc/powernv: reduce multi-hit of iommu_add_device()

2014-04-29 Thread Alexey Kardashevskiy
On 04/29/2014 04:49 PM, Wei Yang wrote: > On Mon, Apr 28, 2014 at 11:35:32PM +1000, Alexey Kardashevskiy wrote: >> On 04/23/2014 12:26 PM, Wei Yang wrote: >>> During the EEH hotplug event, iommu_add_device() will be invoked three times >>> and two of them will trigger wa

Re: [PATCH 1/2] powerpc/powernv: reduce multi-hit of iommu_add_device()

2014-04-29 Thread Alexey Kardashevskiy
On 04/29/2014 07:37 PM, Wei Yang wrote: > On Tue, Apr 29, 2014 at 05:55:48PM +1000, Alexey Kardashevskiy wrote: >> On 04/29/2014 04:49 PM, Wei Yang wrote: >>> On Mon, Apr 28, 2014 at 11:35:32PM +1000, Alexey Kardashevskiy wrote: >>>> On 04/23/2014 12:26 PM, Wei Ya

[PATCH] pci-scan: Fix setting the limit

2014-05-13 Thread Alexey Kardashevskiy
broken. This fixes pci-bridge-set-mem-base. Signed-off-by: Alexey Kardashevskiy --- I have doubts this is the right fix as I tried to "fix" pci-bridge-set-mmio-base (while I am here) and it broke the guest. The problem I am fixing by this is that QEMU started as below is unable to

Re: [PATCH] pci-scan: Fix setting the limit

2014-05-13 Thread Alexey Kardashevskiy
On 05/13/2014 08:48 PM, Alexey Kardashevskiy wrote: > PCI spec says that lower 20 bits are assumed 0xF. The existing code > seems to get it right in pci-bridge-set-mem-limit. > > However pci-bridge-set-mem-base does not account 0xF and poison > the limit. Since the limi

Re: [PATCH v7 3/3] drivers/vfio: EEH support for VFIO PCI device

2014-05-29 Thread Alexey Kardashevskiy
On 05/29/2014 07:58 AM, Benjamin Herrenschmidt wrote: > On Wed, 2014-05-28 at 22:49 +1000, Gavin Shan wrote: >> >> I will remove those "address" related macros in next revision because it's >> user-level bussiness, not related to host kernel any more. >> >> If the user is QEMU + guest, we need the

[PATCH 2/3] PPC: KVM: Reserve KVM_CAP_SPAPR_TCE_64 capability number

2014-06-05 Thread Alexey Kardashevskiy
This adds a capability number for 64-bit TCE tables support. Signed-off-by: Alexey Kardashevskiy --- include/uapi/linux/kvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 944cd21..e6972bf 100644 --- a/include/uapi/linux/kvm.h

[PATCH 0/3] Prepare for in-kernel VFIO DMA operations acceleration

2014-06-05 Thread Alexey Kardashevskiy
This reserves 2 capability numbers. This implements an extended version of KVM_CREATE_SPAPR_TCE_64 ioctl. Please advise how to proceed with these patches as I suspect that first two should go via Paolo's tree while the last one via Alex Graf's tree (correct?). Thanks! Alexey Kardas

[PATCH 3/3] PPC: KVM: Add support for 64bit TCE windows

2014-06-05 Thread Alexey Kardashevskiy
(DDW), let's add @bus_offset and @page_shift which are also required by DDW. Signed-off-by: Alexey Kardashevskiy --- Documentation/virtual/kvm/api.txt | 46 + arch/powerpc/include/asm/kvm_host.h | 4 +++- arch/powerpc/include/asm/kvm_ppc.h | 2 +-

[PATCH 1/3] PPC: KVM: Reserve KVM_CAP_SPAPR_TCE_VFIO capability number

2014-06-05 Thread Alexey Kardashevskiy
KVM_CREATE_SPAPR_TCE KVM ioctl because in that case TCE requests will not be passed to the user space which is desired action in the situation like that. Signed-off-by: Alexey Kardashevskiy --- include/uapi/linux/kvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/kvm.h b

Re: [PATCH 3/3] PPC: KVM: Add support for 64bit TCE windows

2014-06-05 Thread Alexey Kardashevskiy
On 06/05/2014 05:38 PM, Benjamin Herrenschmidt wrote: > On Thu, 2014-06-05 at 17:25 +1000, Alexey Kardashevskiy wrote: >> +This creates a virtual TCE (translation control entry) table, which >> +is an IOMMU for PAPR-style virtual I/O. It is used to translate >> +logical addr

Re: [PATCH 3/3] PPC: KVM: Add support for 64bit TCE windows

2014-06-05 Thread Alexey Kardashevskiy
On 06/05/2014 10:30 PM, Benjamin Herrenschmidt wrote: > On Thu, 2014-06-05 at 13:56 +0200, Alexander Graf wrote: >> What if we ask user space to give us a pointer to user space allocated >> memory along with the TCE registration? We would still ask user space to >> only use the returned fd for TC

Re: [PATCH 0/3] Prepare for in-kernel VFIO DMA operations acceleration

2014-06-05 Thread Alexey Kardashevskiy
On 06/05/2014 09:57 PM, Alexander Graf wrote: > > On 05.06.14 09:25, Alexey Kardashevskiy wrote: >> This reserves 2 capability numbers. >> >> This implements an extended version of KVM_CREATE_SPAPR_TCE_64 ioctl. >> >> Please advise how to proceed with these pa

[PATCH 4/6] powerpc/powernv: Add @it_owner to iommu_table struct

2014-06-06 Thread Alexey Kardashevskiy
defines an empty iommu_owner struct. This adds it to pnv_ioda_pe struct and replaces container_of(tbl) with container_of(tbl->it_owner). This adds an @owner parameter to pnv_pci_setup_iommu_table(). Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h| 6 ++ a

[PATCH 0/6] powerpc/powernv: Applying it_page_shift to platform code

2014-06-06 Thread Alexey Kardashevskiy
Here is what I got for powernv in order to support variable page size in iommu_table. I am very uncertain about Patch #4 "Add @it_owner to iommu_table struct" and wonder if there any better way to get PE from iommu_table. Please comment. Thanks. Alexey Kardashevskiy (6): powerpc/po

[PATCH 3/6] powerpc/powernv: Add a page size parameter to pnv_pci_setup_iommu_table()

2014-06-06 Thread Alexey Kardashevskiy
Since a TCE page size can be other than 4K, make it configurable for P5IOC2 and IODA PHBs. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 5 +++-- arch/powerpc/platforms/powernv/pci-p5ioc2.c | 3 ++- arch/powerpc/platforms/powernv/pci.c| 6

[PATCH 1/6] powerpc/powernv: use it_page_shift for TCE invalidation

2014-06-06 Thread Alexey Kardashevskiy
This fixes IODA1/2 to use it_page_shift as it may be bigger than 4K. This changes involved constant values to use "ull" modifier. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-)

[PATCH 2/6] powerpc/powernv: use it_page_shift in TCE build

2014-06-06 Thread Alexey Kardashevskiy
This makes use of iommu_table::it_page_shift instead of TCE_SHIFT and TCE_RPN_SHIFT hardcoded values. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci.c b

[PATCH 6/6] powerpc/powernv: Make invalidate() callback an iommu_table callback

2014-06-06 Thread Alexey Kardashevskiy
This implements pnv_pci_ioda(1|2)_tce_invalidate as a callback of iommu_table to simplify code structure. This registers invalidate() callbacks for IODA1 and IODA2. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h| 4 arch/powerpc/platforms/powernv/pci

[PATCH 5/6] powerpc/powernv: Make set_bypass() callback a type

2014-06-06 Thread Alexey Kardashevskiy
There are going to be other callbacks which are going to be used as function parameters so change the existing set_bypass() callback to be a type. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch

Re: [PATCH 0/6] powerpc/powernv: Applying it_page_shift to platform code

2014-06-18 Thread Alexey Kardashevskiy
On 06/06/2014 06:44 PM, Alexey Kardashevskiy wrote: > Here is what I got for powernv in order to support variable page size > in iommu_table. > > I am very uncertain about Patch #4 "Add @it_owner to iommu_table struct" > and wonder if there any better way to get PE from

[PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-18 Thread Alexey Kardashevskiy
lpers take native endian values and do swapping at the moment of writing to a PCI register using one of "store byte-reversed" instructions. Suggested-by: Benjamin Herrenschmidt Signed-off-by: Alexey Kardashevskiy --- drivers/vfio/pci/vfio_pci_rdwr.c | 20 1 file ch

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-18 Thread Alexey Kardashevskiy
On 06/19/2014 04:35 AM, Alex Williamson wrote: > On Wed, 2014-06-18 at 21:36 +1000, Alexey Kardashevskiy wrote: >> VFIO exposes BARs to user space as a byte stream so userspace can >> read it using pread()/pwrite(). Since this is a byte stream, VFIO should >> not do byte swapp

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-18 Thread Alexey Kardashevskiy
On 06/19/2014 10:50 AM, Alexey Kardashevskiy wrote: > On 06/19/2014 04:35 AM, Alex Williamson wrote: >> On Wed, 2014-06-18 at 21:36 +1000, Alexey Kardashevskiy wrote: >>> VFIO exposes BARs to user space as a byte stream so userspace can >>> read it using pread()/pwr

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-18 Thread Alexey Kardashevskiy
On 06/19/2014 10:50 AM, Alexey Kardashevskiy wrote: > On 06/19/2014 04:35 AM, Alex Williamson wrote: >> On Wed, 2014-06-18 at 21:36 +1000, Alexey Kardashevskiy wrote: >>> VFIO exposes BARs to user space as a byte stream so userspace can >>> read it using pread()/pwr

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-18 Thread Alexey Kardashevskiy
On 06/19/2014 11:50 AM, Alexey Kardashevskiy wrote: > On 06/19/2014 10:50 AM, Alexey Kardashevskiy wrote: >> On 06/19/2014 04:35 AM, Alex Williamson wrote: >>> On Wed, 2014-06-18 at 21:36 +1000, Alexey Kardashevskiy wrote: >>>> VFIO exposes BARs to user space as

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-18 Thread Alexey Kardashevskiy
On 06/19/2014 03:30 PM, bharat.bhus...@freescale.com wrote: > > >> -Original Message- >> From: Linuxppc-dev [mailto:linuxppc-dev- >> bounces+bharat.bhushan=freescale@lists.ozlabs.org] On Behalf Of Alexey >> Kardashevskiy >> Sent: Thursday, June 19,

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-20 Thread Alexey Kardashevskiy
On 06/20/2014 01:21 PM, Alex Williamson wrote: > On Thu, 2014-06-19 at 13:48 +1000, Alexey Kardashevskiy wrote: >> On 06/19/2014 11:50 AM, Alexey Kardashevskiy wrote: >>> On 06/19/2014 10:50 AM, Alexey Kardashevskiy wrote: >>>> On 06/19/2014 04:35 AM, Alex Williamso

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-24 Thread Alexey Kardashevskiy
On 06/10/2014 11:56 AM, Wei Yang wrote: > Current iommu_table of a PE is a static field. This will have a problem when > iommu_free_table is called. What kind of problem? This table is per PE and PE is not going anywhere. > > This patch allocate iommu_table dynamically. > > Signed-off-by: Wei

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-24 Thread Alexey Kardashevskiy
write32. Ping? We need to make a decision whether to move those xxx_native() helpers somewhere (where?) or leave the patch as is (as we figured out that iowriteXX functions implement barriers and we cannot just use raw accessors) and fix commit log to explain everything. Thanks! >> Thanks, >

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-24 Thread Alexey Kardashevskiy
On 06/24/2014 08:41 PM, Alexander Graf wrote: > > On 24.06.14 12:11, Alexey Kardashevskiy wrote: >> On 06/21/2014 09:12 AM, Benjamin Herrenschmidt wrote: >>> On Thu, 2014-06-19 at 21:21 -0600, Alex Williamson wrote: >>> >>>> Working on big endian being

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-24 Thread Alexey Kardashevskiy
On 06/24/2014 10:52 PM, Alexander Graf wrote: > > On 24.06.14 14:50, Alexey Kardashevskiy wrote: >> On 06/24/2014 08:41 PM, Alexander Graf wrote: >>> On 24.06.14 12:11, Alexey Kardashevskiy wrote: >>>> On 06/21/2014 09:12 AM, Benjamin Herrenschmidt wrote: >&g

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-24 Thread Alexey Kardashevskiy
On 06/25/2014 12:21 AM, Alex Williamson wrote: > On Tue, 2014-06-24 at 15:22 +0200, Alexander Graf wrote: >> On 24.06.14 15:01, Alexey Kardashevskiy wrote: >>> On 06/24/2014 10:52 PM, Alexander Graf wrote: >>>> On 24.06.14 14:50, Alexey Kardashevskiy wrote: >>&

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-24 Thread Alexey Kardashevskiy
On 06/25/2014 12:43 AM, Alex Williamson wrote: > On Wed, 2014-06-25 at 00:33 +1000, Alexey Kardashevskiy wrote: >> On 06/25/2014 12:21 AM, Alex Williamson wrote: >>> On Tue, 2014-06-24 at 15:22 +0200, Alexander Graf wrote: >>>> On 24.06.14 15:01, Alexey Kardashevskiy

Re: [PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-24 Thread Alexey Kardashevskiy
On 06/25/2014 07:54 AM, Benjamin Herrenschmidt wrote: > On Wed, 2014-06-25 at 00:33 +1000, Alexey Kardashevskiy wrote: >> >> I do not understand why @val is considered LE here and need to be >> converted >> to CPU. Really. I truly believe it should be cpu_to_le32().

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-24 Thread Alexey Kardashevskiy
On 06/25/2014 11:12 AM, Wei Yang wrote: > On Tue, Jun 24, 2014 at 08:06:32PM +1000, Alexey Kardashevskiy wrote: >> On 06/10/2014 11:56 AM, Wei Yang wrote: >>> Current iommu_table of a PE is a static field. This will have a problem when >>> iommu_free_table is called.

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-25 Thread Alexey Kardashevskiy
On 06/25/2014 03:27 PM, Wei Yang wrote: > On Wed, Jun 25, 2014 at 02:12:34PM +1000, Alexey Kardashevskiy wrote: >> On 06/25/2014 11:12 AM, Wei Yang wrote: >>> On Tue, Jun 24, 2014 at 08:06:32PM +1000, Alexey Kardashevskiy wrote: >>>> On 06/10/2014 11:56 AM,

Re: [RFC PATCH V3 06/17] ppc/pnv: allocate pe->iommu_table dynamically

2014-06-25 Thread Alexey Kardashevskiy
On 06/25/2014 07:20 PM, David Laight wrote: > From: Wei Yang >> On Wed, Jun 25, 2014 at 02:12:34PM +1000, Alexey Kardashevskiy wrote: >>> On 06/25/2014 11:12 AM, Wei Yang wrote: >>>> On Tue, Jun 24, 2014 at 08:06:32PM +1000, Alexey Kardashevskiy wrote: >>>&g

Re: [PATCH 0/3] Prepare for in-kernel VFIO DMA operations acceleration

2014-06-25 Thread Alexey Kardashevskiy
On 06/26/2014 07:12 AM, Alexander Graf wrote: > > On 06.06.14 02:20, Alexey Kardashevskiy wrote: >> On 06/05/2014 09:57 PM, Alexander Graf wrote: >>> On 05.06.14 09:25, Alexey Kardashevskiy wrote: >>>> This reserves 2 capability numbers. >>>>

Re: Regression in 3.15 on POWER8 with multipath SCSI

2014-07-08 Thread Alexey Kardashevskiy
On 07/08/2014 08:28 PM, Junichi Nomura wrote: > On 07/02/14 04:39, Mike Snitzer wrote: >> On Mon, Jun 30 2014 at 6:30am -0400, >> Paul Mackerras wrote: >> >>> I have a machine on which 3.15 usually fails to boot, and 3.14 boots >>> every time. The machine is a POWER8 2-socket server with 20 core

[PATCH v1 01/16] powerpc/iommu: Fix comments with it_page_shift

2014-07-15 Thread Alexey Kardashevskiy
There is a couple of commented debug prints which still use IOMMU_PAGE_SHIFT() which is not defined for POWERPC anymore, replace them with it_page_shift. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a

[PATCH v1 02/16] KVM: PPC: Use RCU when adding to arch.spapr_tce_tables

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 54cf9bc..516f2ee 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc

[PATCH v1 00/16] powernv: vfio: Add Dynamic DMA windows (DDW)

2014-07-15 Thread Alexey Kardashevskiy
This prepares existing upstream kernel for DDW (Dynamic DMA windows) and adds actual DDW support for VFIO. This patchset does not contain any in-kernel acceleration stuff. This patchset does not enable DDW for emulated devices. Alexey Kardashevskiy (16): powerpc/iommu: Fix comments with

[PATCH v1 06/16] powerpc/powernv: Make invalidate() callback an iommu_table callback

2014-07-15 Thread Alexey Kardashevskiy
; - pnv_pci_ioda2_tce_invalidate_32. There will be another pnv_pci_ioda2_tce_invalidate_64() callback for huge DMA windows. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 4 arch/powerpc/platforms/powernv/pci-ioda.c | 19 +-- arch/powerpc/platforms

[PATCH v1 07/16] powerpc/spapr: vfio: Implement spapr_tce_iommu_ops

2014-07-15 Thread Alexey Kardashevskiy
(); - spapr_tce_iommu_group points to either (depending on .get_table()): - iommu_table; - pnv_ioda_pe; Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h| 6 ++ arch/powerpc/include/asm/tce.h | 13 arch/powerpc/kernel/iommu.c | 31

[PATCH v1 05/16] powerpc/powernv: Add a page size parameter to pnv_pci_setup_iommu_table()

2014-07-15 Thread Alexey Kardashevskiy
Since a TCE page size can be other than 4K, make it configurable for P5IOC2 and IODA PHBs. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 5 +++-- arch/powerpc/platforms/powernv/pci-p5ioc2.c | 3 ++- arch/powerpc/platforms/powernv/pci.c| 6

[PATCH v1 03/16] powerpc/powernv: Use it_page_shift for TCE invalidation

2014-07-15 Thread Alexey Kardashevskiy
This fixes IODA1/2 to use it_page_shift as it may be bigger than 4K. This changes the involved constant values to use "ull" modifier. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletion

[PATCH v1 08/16] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-07-15 Thread Alexey Kardashevskiy
ver. This renames set_bypass() to take_ownership() as it is not necessarily just enabling bypassing, it can be something else/more so let's give it a generic name. The bool parameter is inverted. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 1 - arch/powe

[PATCH v1 04/16] powerpc/powernv: Use it_page_shift in TCE build

2014-07-15 Thread Alexey Kardashevskiy
This makes use of iommu_table::it_page_shift instead of TCE_SHIFT and TCE_RPN_SHIFT hardcoded values. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci.c b

[PATCH v1 11/16] powerpc/iommu: Extend ppc_md.tce_build(_rm) to return old TCE values

2014-07-15 Thread Alexey Kardashevskiy
-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/machdep.h | 2 ++ arch/powerpc/kernel/iommu.c| 8 +--- arch/powerpc/platforms/powernv/pci.c | 13 - arch/powerpc/platforms/pseries/iommu.c | 7 +-- arch/powerpc/sysdev/dart_iommu.c | 1 + 5 files

[PATCH v1 12/16] powerpc/powernv: Return non-zero TCE from pnv_tce_build

2014-07-15 Thread Alexey Kardashevskiy
This returns old TCE values to the caller if requested. The caller is expectded to call put_page() for them. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/platforms

[PATCH v1 13/16] powerpc/iommu: Implement put_page() if TCE had non-zero value

2014-07-15 Thread Alexey Kardashevskiy
Guests might put new TCEs without clearing them first and the PAPR spec allows that. This adds put_page() for TCEs which we just replaced. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/arch

[PATCH v1 10/16] powerpc/iommu: Fix missing permission bits in iommu_put_tce_user_mode()

2014-07-15 Thread Alexey Kardashevskiy
This adds missing permission bits to the translated TCE. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index da04561..01ac319 100644 --- a/arch/powerpc/kernel

[PATCH v1 09/16] powerpc/iommu: Fix IOMMU ownership control functions

2014-07-15 Thread Alexey Kardashevskiy
it_map. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 37 ++--- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index d9494b2..da04561 100644 --- a/arch/powerpc/kernel

[PATCH v1 16/16] vfio: powerpc: Enable Dynamic DMA windows

2014-07-15 Thread Alexey Kardashevskiy
VFIO_IOMMU_SPAPR_TCE_FLAG_DDW capability via VFIO_IOMMU_SPAPR_TCE_GET_INFO. This calls reset() when IOMMU is being disabled (happens when VFIO stops using it). Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 1 + drivers/vfio/vfio_iommu_spapr_tce.c

[PATCH v1 14/16] powerpc/powernv: Implement Dynamic DMA windows (DDW) for IODA

2014-07-15 Thread Alexey Kardashevskiy
et the DMA windows configuration to the default state; now it only removes the additional window if it was created. The next patch will add corresponding ioctls to VFIO SPAPR TCE driver to pass RTAS call from the userspace to the IODA code. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/i

[PATCH v1 3/7] powerpc/iommu: Clean up IOMMU API

2014-07-15 Thread Alexey Kardashevskiy
The iommu_tce_direction() function is not used from outside iommu.c so make it static. The iommu_clear_tce() is not used anymore at all so remove it. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 4 arch/powerpc/kernel/iommu.c | 22

[PATCH v1 1/7] powerpc/iommu: Change prototypes for realmode support

2014-07-15 Thread Alexey Kardashevskiy
ned-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 5 +++-- arch/powerpc/kernel/iommu.c | 15 +-- arch/powerpc/platforms/powernv/pci-ioda.c | 3 ++- drivers/vfio/vfio_iommu_spapr_tce.c | 6 -- 4 files changed, 18 insertions(+), 11

[PATCH v1 0/7] powerpc/iommu: kvm: Enable MultiTCE support

2014-07-15 Thread Alexey Kardashevskiy
accelerates emulated PCI and VIO devices. DDW is not affected. This was made on top of [PATCH v1 00/16] powernv: vfio: Add Dynamic DMA windows (DDW) Alexey Kardashevskiy (7): powerpc/iommu: Change prototypes for realmode support powerpc/iommu: Support real mode powerpc/iommu: Clean up IOMMU API

[PATCH v1 2/7] powerpc/iommu: Support real mode

2014-07-15 Thread Alexey Kardashevskiy
. This does not clear TCE for a huge page in real mode and passes handling of this to virtual mode. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 107 +--- 1 file changed, 81 insertions(+), 26 deletions(-) diff --git a/arch/powerpc

[PATCH v1 4/7] KVM: PPC: Replace SPAPR_TCE_SHIFT with IOMMU_PAGE_SHIFT_4K

2014-07-15 Thread Alexey Kardashevskiy
SPAPR_TCE_SHIFT is used in few places only and since IOMMU_PAGE_SHIFT_4K can bre easily used instead, remove SPAPR_TCE_SHIFT. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/kvm_book3s_64.h | 2 -- arch/powerpc/kvm/book3s_64_vio.c | 3 ++- arch/powerpc/kvm

[PATCH v1 5/7] KVM: PPC: Move reusable bits of H_PUT_TCE handler to helpers

2014-07-15 Thread Alexey Kardashevskiy
Upcoming multi-tce support (H_PUT_TCE_INDIRECT/H_STUFF_TCE hypercalls) will validate TCE (not to have unexpected bits) and IO address (to be within the DMA window boundaries). This introduces helpers to validate TCE and IO address. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include

[PATCH v1 6/7] KVM: PPC: Add kvmppc_find_tce_table()

2014-07-15 Thread Alexey Kardashevskiy
This adds a common helper to search for a kvmppc_spapr_tce_table by LIOBN. This makes H_PUT_TCE and H_GET_TCE handler use this new helper. The helper will be also used in H_PUT_TCE_INDIRECT and H_STUFF_TCE handlers. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio_hv.c

[PATCH v1 7/7] KVM: PPC: Add support for multiple-TCE hcalls

2014-07-15 Thread Alexey Kardashevskiy
powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc/kvm/book3s_64_vio.c @@ -14,6 +14,7 @@ * * Copyright 2010 Paul Mackerras, IBM Corp. * Copyright 2011 David Gibson, IBM Corporation + * Copyright 2013 Alexey Kardashevskiy, IBM Corporation */ #include @@ -37,8 +38,34 @@ #include #inc

[PATCH v1 15/16] vfio: Use it_page_size

2014-07-15 Thread Alexey Kardashevskiy
This makes use of the it_page_size from the iommu_table struct as page size can differ. This replaces missing IOMMU_PAGE_SHIFT macro in commented debug code as recently introduced IOMMU_PAGE_XXX macros do not include IOMMU_PAGE_SHIFT. Signed-off-by: Alexey Kardashevskiy --- drivers/vfio

[PATCH v1 00/13] powerpc: kvm: Enable in-kernel acceleration for VFIO

2014-07-15 Thread Alexey Kardashevskiy
MultiTCE support Alexey Kardashevskiy (13): KVM: PPC: Account TCE pages in locked_vm KVM: PPC: Rework kvmppc_spapr_tce_table to support variable page size KVM: PPC: Enable IOMMU_API for KVM_BOOK3S_64 permanently KVM: PPC: Reserve KVM_CAP_SPAPR_TCE_VFIO capability number KVM: PPC: Reserve

[PATCH v1 01/13] KVM: PPC: Account TCE pages in locked_vm

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 2137836..4ca33f1 100644 --- a/arch/powerpc

[PATCH v1 02/13] KVM: PPC: Rework kvmppc_spapr_tce_table to support variable page size

2014-07-15 Thread Alexey Kardashevskiy
At the moment the kvmppc_spapr_tce_table struct can only describe 4GB windows which is not enough for big DMA windows. This replaces window_size (in bytes, 4GB max) with page_shift (32bit) and size (64bit, in pages). Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/kvm_host.h

[PATCH v1 04/13] KVM: PPC: Reserve KVM_CAP_SPAPR_TCE_VFIO capability number

2014-07-15 Thread Alexey Kardashevskiy
KVM_CREATE_SPAPR_TCE KVM ioctl because in that case TCE requests will not be passed to the user space which is desired action in the situation like that. Signed-off-by: Alexey Kardashevskiy --- include/uapi/linux/kvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/kvm.h b

[PATCH v1 05/13] KVM: PPC: Reserve KVM_CAP_SPAPR_TCE_64 capability number

2014-07-15 Thread Alexey Kardashevskiy
This adds a capability number for 64-bit TCE tables support. Signed-off-by: Alexey Kardashevskiy --- include/uapi/linux/kvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 3048c86..65c2689 100644 --- a/include/uapi/linux/kvm.h

[PATCH v1 03/13] KVM: PPC: Enable IOMMU_API for KVM_BOOK3S_64 permanently

2014-07-15 Thread Alexey Kardashevskiy
k3s_64_vio*. With those ifdef's we could have only user space emulated devices accelerated (but not VFIO) which do not seem to be very useful. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kvm/Kconfig b/arch/powe

[PATCH v1 07/13] KVM: PPC: Add support for 64bit TCE windows

2014-07-15 Thread Alexey Kardashevskiy
(DDW), let's add @bus_offset and @page_shift which are also required by DDW. Signed-off-by: Alexey Kardashevskiy --- Documentation/virtual/kvm/api.txt | 51 + arch/powerpc/include/asm/kvm_ppc.h | 2 +- arch/powerpc/include/uapi/asm/kvm.h | 9 +++

[PATCH v1 06/13] KVM: PPC: Add @offset to kvmppc_spapr_tce_table

2014-07-15 Thread Alexey Kardashevskiy
This enables guest visible TCE tables to start from non-zero offset on a bus. This will be used for VFIO support. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/kvm_host.h | 1 + arch/powerpc/kvm/book3s_64_vio_hv.c | 5 - 2 files changed, 5 insertions(+), 1 deletion

[PATCH v1 08/13] KVM: PPC: Add hugepage support for IOMMU in-kernel handling

2014-07-15 Thread Alexey Kardashevskiy
kvmppc_iommu_hugepage_try_add() helper to add one. At the moment the fastest card available for tests uses up to 9 huge pages so walking through this hash table does not cost much. However this can change and we may want to optimize this. Signed-off-by: Alexey Kardashevskiy --- Changes: v11

[PATCH v1 09/13] KVM: PPC: Add page_shift support for in-kernel H_PUT_TCE/etc handlers

2014-07-15 Thread Alexey Kardashevskiy
16MB page sizes. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio.c| 8 arch/powerpc/kvm/book3s_64_vio_hv.c | 16 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm

[PATCH v1 10/13] KVM: PPC: Fix kvmppc_gpa_to_hva_and_get() to return host physical address

2014-07-15 Thread Alexey Kardashevskiy
page address. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 8250521..573fd6d 100644 --- a/arch/powerpc/kvm

[PATCH v1 12/13] KVM: PPC: vfio kvm device: support spapr tce

2014-07-15 Thread Alexey Kardashevskiy
to release them at unexpected KVM finish. Signed-off-by: Alexey Kardashevskiy --- Changes: v5: * added lock in search function * changed callback function type name v4: * fixed few bugs * changed kvm_vfio_find_group_by_liobn() to return informative errors v3: * total rework * added a release

[PATCH v1 11/13] KVM: PPC: Associate IOMMU group with guest copy of TCE table

2014-07-15 Thread Alexey Kardashevskiy
kvmppc_spapr_tce_table. This adds kvm_spapr_tce_attach_iommu_group() helper to initialize the pointers. This puts the group when guest copy of TCE table is destroyed which happens when TCE table fd is closed. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/kvm_host.h | 2 ++ arch

[PATCH v1 13/13] KVM: PPC: Add support for IOMMU in-kernel handling

2014-07-15 Thread Alexey Kardashevskiy
connection between KVM and VFIO. Tests show that this patch increases transmission speed from 220MB/s to 750..1020MB/s on 10Gb network (Chelsea CXGB3 10Gb ethernet card). Signed-off-by: Alexey Kardashevskiy --- Changes: v12: * reworked for the latest VFIO KVM device v11: * removed VFIO_IOMMU

Re: [PATCH v1 01/13] KVM: PPC: Account TCE pages in locked_vm

2014-07-15 Thread Alexey Kardashevskiy
On 07/15/2014 07:25 PM, Alexey Kardashevskiy wrote: > Signed-off-by: Alexey Kardashevskiy Just realized this should go to "powernv: vfio: Add Dynamic DMA windows (DDW)". And neither patchset accounts DDW in locked_vm, need to decide how... > --- > arch/powerpc/kvm/b

[PATCH QEMU 00/12] vfio: pci: Enable DDW and in-kernel acceleration

2014-07-15 Thread Alexey Kardashevskiy
required :) Alexey Kardashevskiy (12): spapr_iommu: Disable in-kernel IOMMU tables for >4GB windows spapr_pci: Make find_phb()/find_dev() public spapr_iommu: Make spapr_tce_find_by_liobn() public linux headers update for DDW spapr_rtas: Add Dynamic DMA windows (DDW) RTAS calls supp

[PATCH QEMU 05/12] spapr_rtas: Add Dynamic DMA windows (DDW) RTAS calls support

2014-07-15 Thread Alexey Kardashevskiy
to provide path for calling DDW-related ioctls via VFIO container fd. Signed-off-by: Alexey Kardashevskiy --- "Reset" is not implemented yet and it is questionable if we really want it. --- hw/ppc/Makefile.objs| 3 + hw/ppc/spapr_

[PATCH QEMU 02/12] spapr_pci: Make find_phb()/find_dev() public

2014-07-15 Thread Alexey Kardashevskiy
are addressed to BUID+config_addr in IEEE1275 format. Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr_pci.c | 22 +++--- include/hw/pci-host/spapr.h | 4 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c

[PATCH QEMU 04/12] linux headers update for DDW

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- linux-headers/linux/vfio.h | 37 - 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/linux-headers/linux/vfio.h b/linux-headers/linux/vfio.h index 26c218e..f0aa97d 100644 --- a/linux-headers/linux/vfio.h

[PATCH QEMU 03/12] spapr_iommu: Make spapr_tce_find_by_liobn() public

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr_iommu.c | 2 +- include/hw/ppc/spapr.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index 36f5d27..588d442 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c

[PATCH QEMU 06/12] spapr: Add "ddw" machine option

2014-07-15 Thread Alexey Kardashevskiy
This option will enable Dynamic DMA windows (DDW) support for pseries machine. Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr.c | 15 +++ vl.c | 4 2 files changed, 19 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index d01978f..fec295b 100644

[PATCH QEMU 01/12] spapr_iommu: Disable in-kernel IOMMU tables for >4GB windows

2014-07-15 Thread Alexey Kardashevskiy
, there will be no performance impact. Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr_iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index f6e32a4..36f5d27 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc

[PATCH QEMU 08/12] spapr_pci_vfio: Enable DDW

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr_pci_vfio.c | 73 + 1 file changed, 73 insertions(+) diff --git a/hw/ppc/spapr_pci_vfio.c b/hw/ppc/spapr_pci_vfio.c index d3bddf2..b72aff0 100644 --- a/hw/ppc/spapr_pci_vfio.c +++ b/hw/ppc

[PATCH QEMU 07/12] spapr_pci: Enable DDW

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr_pci.c | 62 + include/hw/pci-host/spapr.h | 3 +++ 2 files changed, 65 insertions(+) diff --git a/hw/ppc/spapr_pci.c b/hw/ppc/spapr_pci.c index 230b59c..038a485 100644 --- a/hw/ppc

[PATCH QEMU 11/12] target-ppc: kvm: make use of KVM_CREATE_SPAPR_TCE_64

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- hw/ppc/spapr_iommu.c | 7 --- target-ppc/kvm.c | 47 --- target-ppc/kvm_ppc.h | 10 +++--- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c

[PATCH QEMU 12/12] vfio: Enable in-kernel acceleration via VFIO KVM device

2014-07-15 Thread Alexey Kardashevskiy
ented completely in vfio.c because kvm_vfio_spapr_tce_liobn needs a group fd and we do not want to share resources likes that outside vfio.c. Signed-off-by: Alexey Kardashevskiy --- hw/misc/vfio.c | 41 + hw/ppc/spapr_iommu.c| 1 + hw/ppc/spapr_pci_v

[PATCH QEMU 10/12] headers: update for KVM_CAP_SPAPR_TCE_64 and VFIO KVM device

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- linux-headers/asm-mips/kvm_para.h | 6 +- linux-headers/asm-powerpc/kvm.h | 9 + linux-headers/linux/kvm.h | 12 linux-headers/linux/kvm_para.h| 3 +++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a

[PATCH QEMU 09/12] vfio: Enable DDW ioctls to VFIO IOMMU driver

2014-07-15 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- hw/misc/vfio.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/misc/vfio.c b/hw/misc/vfio.c index 0b9eba0..e7b4d6e 100644 --- a/hw/misc/vfio.c +++ b/hw/misc/vfio.c @@ -4437,6 +4437,10 @@ int vfio_container_ioctl(AddressSpace *as, int32_t

Re: [PATCH v1 13/16] powerpc/iommu: Implement put_page() if TCE had non-zero value

2014-07-16 Thread Alexey Kardashevskiy
On 07/15/2014 07:24 PM, Alexey Kardashevskiy wrote: > Guests might put new TCEs without clearing them first and the PAPR spec > allows that. > > This adds put_page() for TCEs which we just replaced. > > Signed-off-by: Alexey Kardashevskiy > --- > arch/pow

[PATCH v2 00/18] powernv: vfio: Add Dynamic DMA windows (DDW)

2014-07-22 Thread Alexey Kardashevskiy
re (was in later series) * added counting for huge window to locked_vm (ugly but better than nothing) * fixed bug with missing >>PAGE_SHIFT when calling pfn_to_page Alexey Kardashevskiy (18): powerpc/iommu: Fix comments with it_page_shift KVM: PPC: Use RCU when adding to arch.spapr_tce_t

[PATCH v2 03/18] KVM: PPC: Account TCE pages in locked_vm

2014-07-22 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio.c | 35 ++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 516f2ee..48b7ed4 100644 --- a/arch/powerpc

[PATCH v2 02/18] KVM: PPC: Use RCU when adding to arch.spapr_tce_tables

2014-07-22 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_64_vio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c index 54cf9bc..516f2ee 100644 --- a/arch/powerpc/kvm/book3s_64_vio.c +++ b/arch/powerpc

<    1   2   3   4   5   6   7   8   9   10   >