[PATCH v3 10/24] powerpc/powernv/ioda2: Rework IOMMU ownership control

2015-01-29 Thread Alexey Kardashevskiy
()/iommu_release_ownership() if needed. Next patches will remove these calls from IODA2 code. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 18 +-- arch/powerpc/kernel/iommu.c | 53 +++ arch/powerpc/platforms/powernv/pci-ioda.c | 30

[PATCH v3 14/24] vfio: powerpc/spapr: Register memory

2015-01-29 Thread Alexey Kardashevskiy
-by: Alexey Kardashevskiy --- drivers/vfio/vfio_iommu_spapr_tce.c | 333 include/uapi/linux/vfio.h | 29 2 files changed, 331 insertions(+), 31 deletions(-) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c

[PATCH v3 19/24] powerpc/powernv: Implement multilevel TCE tables

2015-01-29 Thread Alexey Kardashevskiy
This adds multi-level TCE tables support to pnv_pci_ioda2_create_table() and pnv_pci_ioda2_free_table() callbacks. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 4 + arch/powerpc/platforms/powernv/pci-ioda.c | 125 +++--- arch

[PATCH v3 20/24] powerpc/powernv: Change prototypes to receive iommu

2015-01-29 Thread Alexey Kardashevskiy
This changes few functions to receive a powerpc_iommu pointer rather than PE as they are going to be a part of upcoming powerpc_iommu_ops callback set. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 13 - 1 file changed, 8 insertions(+), 5

[PATCH v3 22/24] powerpc/iommu: Get rid of ownership helpers

2015-01-29 Thread Alexey Kardashevskiy
iommu_take_ownership/iommu_release_ownership used to be used to mark bits in iommu_table::it_map. Since the IOMMU tables are recreated for VFIO, it_map is always NULL. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 2 - arch/powerpc/kernel/iommu.c | 96

[PATCH v3 13/24] powerpc/pseries/lpar: Enable VFIO

2015-01-29 Thread Alexey Kardashevskiy
so VFIO performance in guests running under PR KVM is expected to be slower than in guests running under HV KVM or bare metal hosts. Signed-off-by: Alexey Kardashevskiy --- Changes: v5: * added global lock for xchg operations * added missing be64_to_cpu(oldtce) --- arch/powerpc/platforms/pseries

[PATCH v3 21/24] powerpc/powernv/ioda: Define and implement DMA table/window management callbacks

2015-01-29 Thread Alexey Kardashevskiy
user is expected to unprogram DMA windows on PHBs before returning ownership back to the kernel. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 31 ++ arch/powerpc/platforms/powernv/pci-ioda.c | 98 ++- 2 files changed, 113

[PATCH v3 24/24] vfio: powerpc/spapr: Support Dynamic DMA windows

2015-01-29 Thread Alexey Kardashevskiy
This adds create/remove window ioctls to create and remove DMA windows. This changes VFIO_IOMMU_SPAPR_TCE_GET_INFO handler to return additional information such as a number of supported windows and maximum number levels of TCE tables. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc

[PATCH v3 23/24] vfio/spapr: Enable multiple groups in a container

2015-01-29 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy --- drivers/vfio/vfio_iommu_spapr_tce.c | 243 +++- 1 file changed, 155 insertions(+), 88 deletions(-) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index d0987ae..8bcafb7 100644

[PATCH v3 15/24] poweppc/powernv/ioda2: Rework iommu_table creation

2015-01-29 Thread Alexey Kardashevskiy
This moves iommu_table creation to the beginning. This is a mechanical patch. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/platforms/powernv

[PATCH v3 01/24] vfio: powerpc/spapr: Move page pinning from arch code to VFIO IOMMU driver

2015-01-29 Thread Alexey Kardashevskiy
only. This removes page unpinning from iommu_take_ownership() as the actual TCE table might contain garbage and doing put_page() on it is undefined behaviour. Besides the last part, the rest of the patch is mechanical. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h

[PATCH v3 06/24] powerpc/iommu: Move tce_xxx callbacks from ppc_md to iommu_table

2015-01-29 Thread Alexey Kardashevskiy
ot; callbacks with single ones. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h| 17 +++ arch/powerpc/include/asm/machdep.h | 25 arch/powerpc/kernel/iommu.c | 46 +++---

[PATCH v3 17/24] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_set_window

2015-01-29 Thread Alexey Kardashevskiy
This is a part of moving DMA window programming to an iommu_ops callback. This is a mechanical patch. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 84 --- 1 file changed, 56 insertions(+), 28 deletions(-) diff --git a/arch

[PATCH v3 16/24] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_create_table

2015-01-29 Thread Alexey Kardashevskiy
This is a part of moving TCE table allocation into an iommu_ops callback to support multiple IOMMU groups per one VFIO container. This is a mechanical patch. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 88 +++ 1 file changed

[PATCH v3 08/24] powerpc/spapr: vfio: Switch from iommu_table to new powerpc_iommu

2015-01-29 Thread Alexey Kardashevskiy
Modern IBM POWERPC systems support multiple (currently two) TCE tables per IOMMU group (a.k.a. PE). This adds a powerpc_iommu container for TCE tables. Right now just one table is supported. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h| 18 ++-- arch

[PATCH v3 03/24] powerpc/powernv: Do not set "read" flag if direction==DMA_NONE

2015-01-29 Thread Alexey Kardashevskiy
Normally a bitmap from the iommu_table is used to track what TCE entry is in use. Since we are going to use iommu_table without its locks and do xchg() instead, it becomes essential not to put bits which are not implied in the direction flag. Signed-off-by: Alexey Kardashevskiy Reviewed

[PATCH v3 15/24] poweppc/powernv/ioda2: Rework iommu_table creation

2015-01-29 Thread Alexey Kardashevskiy
This moves iommu_table creation to the beginning. This is a mechanical patch. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci-ioda.c | 31 +-- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/arch/powerpc

[PATCH v3 04/24] vfio: powerpc/spapr: Use it_page_size

2015-01-29 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 a...@ozlabs.ru Reviewed

[PATCH v3 05/24] vfio: powerpc/spapr: Move locked_vm accounting to helpers

2015-01-29 Thread Alexey Kardashevskiy
-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio/vfio_iommu_spapr_tce.c | 72 +++-- 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index c596053..29d5708 100644

[PATCH v3 11/24] powerpc/powernv/ioda/ioda2: Rework tce_build()/tce_free()

2015-01-29 Thread Alexey Kardashevskiy
are PCI addresses shifted by IOMMU page shift. The patch is pretty mechanical and behaviour is not expected to change. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci-ioda.c | 92 ++--- arch/powerpc/platforms/powernv/pci-p5ioc2.c

[PATCH v3 02/24] vfio: powerpc/iommu: Check that TCE page size is equal to it_page_size

2015-01-29 Thread Alexey Kardashevskiy
compound_order() and compound_head() work correctly on non-huge pages, there is no need for additional check whether the page is huge. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v5: * check is done for all page sizes now, not just for huge pages * failed check returns EFAULT now

[PATCH v3 09/24] powerpc/iommu: Fix IOMMU ownership control functions

2015-01-29 Thread Alexey Kardashevskiy
in it_map. Clearing must be done outside of the table locks as iommu_clear_tce() called from iommu_clear_tces_and_put_pages() does this. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Note: we might want to get rid of it as this patchset removes it_map from tables passed to VFIO. Changes: v5: * do

[PATCH v3 07/24] powerpc/iommu: Introduce iommu_table_alloc() helper

2015-01-29 Thread Alexey Kardashevskiy
This replaces multiple calls of kzalloc_node() with a new iommu_table_alloc() helper. Right now it calls kzalloc_node() but later it will be modified to allocate a powerpc_iommu struct with a single iommu_table in it. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include

[PATCH v3 08/24] powerpc/spapr: vfio: Switch from iommu_table to new powerpc_iommu

2015-01-29 Thread Alexey Kardashevskiy
Modern IBM POWERPC systems support multiple (currently two) TCE tables per IOMMU group (a.k.a. PE). This adds a powerpc_iommu container for TCE tables. Right now just one table is supported. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h| 18

[PATCH v3 03/24] powerpc/powernv: Do not set read flag if direction==DMA_NONE

2015-01-29 Thread Alexey Kardashevskiy
Normally a bitmap from the iommu_table is used to track what TCE entry is in use. Since we are going to use iommu_table without its locks and do xchg() instead, it becomes essential not to put bits which are not implied in the direction flag. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru

[PATCH v3 01/24] vfio: powerpc/spapr: Move page pinning from arch code to VFIO IOMMU driver

2015-01-29 Thread Alexey Kardashevskiy
only. This removes page unpinning from iommu_take_ownership() as the actual TCE table might contain garbage and doing put_page() on it is undefined behaviour. Besides the last part, the rest of the patch is mechanical. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm

[PATCH v3 06/24] powerpc/iommu: Move tce_xxx callbacks from ppc_md to iommu_table

2015-01-29 Thread Alexey Kardashevskiy
. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h| 17 +++ arch/powerpc/include/asm/machdep.h | 25 arch/powerpc/kernel/iommu.c | 46 +++-- arch/powerpc/kernel/vio.c

[PATCH v3 17/24] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_set_window

2015-01-29 Thread Alexey Kardashevskiy
This is a part of moving DMA window programming to an iommu_ops callback. This is a mechanical patch. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci-ioda.c | 84 --- 1 file changed, 56 insertions(+), 28 deletions(-) diff

[PATCH v3 16/24] powerpc/powernv/ioda2: Introduce pnv_pci_ioda2_create_table

2015-01-29 Thread Alexey Kardashevskiy
This is a part of moving TCE table allocation into an iommu_ops callback to support multiple IOMMU groups per one VFIO container. This is a mechanical patch. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci-ioda.c | 88 +++ 1

[PATCH v3 14/24] vfio: powerpc/spapr: Register memory

2015-01-29 Thread Alexey Kardashevskiy
-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio/vfio_iommu_spapr_tce.c | 333 include/uapi/linux/vfio.h | 29 2 files changed, 331 insertions(+), 31 deletions(-) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio

[PATCH v3 19/24] powerpc/powernv: Implement multilevel TCE tables

2015-01-29 Thread Alexey Kardashevskiy
This adds multi-level TCE tables support to pnv_pci_ioda2_create_table() and pnv_pci_ioda2_free_table() callbacks. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h | 4 + arch/powerpc/platforms/powernv/pci-ioda.c | 125

[PATCH v3 20/24] powerpc/powernv: Change prototypes to receive iommu

2015-01-29 Thread Alexey Kardashevskiy
This changes few functions to receive a powerpc_iommu pointer rather than PE as they are going to be a part of upcoming powerpc_iommu_ops callback set. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci-ioda.c | 13 - 1 file changed, 8

[PATCH v3 12/24] powerpc/iommu/powernv: Release replaced TCE

2015-01-29 Thread Alexey Kardashevskiy
. This replaces iommu_tce_build() and iommu_clear_tce() with a single iommu_tce_xchg(). Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h | 13 +--- arch/powerpc/kernel/iommu.c | 50 +++ arch/powerpc/platforms

[PATCH v3 18/24] powerpc/iommu: Split iommu_free_table into 2 helpers

2015-01-29 Thread Alexey Kardashevskiy
The iommu_free_table helper release memory it is using (the TCE table and @it_map) and release the iommu_table struct as well. We might not want the very last step as we store iommu_table in parent structures. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm

[PATCH v3 10/24] powerpc/powernv/ioda2: Rework IOMMU ownership control

2015-01-29 Thread Alexey Kardashevskiy
()/iommu_release_ownership() if needed. Next patches will remove these calls from IODA2 code. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h | 18 +-- arch/powerpc/kernel/iommu.c | 53 +++ arch/powerpc/platforms/powernv/pci

[PATCH v3 24/24] vfio: powerpc/spapr: Support Dynamic DMA windows

2015-01-29 Thread Alexey Kardashevskiy
This adds create/remove window ioctls to create and remove DMA windows. This changes VFIO_IOMMU_SPAPR_TCE_GET_INFO handler to return additional information such as a number of supported windows and maximum number levels of TCE tables. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch

[PATCH v3 23/24] vfio/spapr: Enable multiple groups in a container

2015-01-29 Thread Alexey Kardashevskiy
Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio/vfio_iommu_spapr_tce.c | 243 +++- 1 file changed, 155 insertions(+), 88 deletions(-) diff --git a/drivers/vfio/vfio_iommu_spapr_tce.c b/drivers/vfio/vfio_iommu_spapr_tce.c index d0987ae..8bcafb7

[PATCH v3 13/24] powerpc/pseries/lpar: Enable VFIO

2015-01-29 Thread Alexey Kardashevskiy
so VFIO performance in guests running under PR KVM is expected to be slower than in guests running under HV KVM or bare metal hosts. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v5: * added global lock for xchg operations * added missing be64_to_cpu(oldtce) --- arch/powerpc

[PATCH v3 21/24] powerpc/powernv/ioda: Define and implement DMA table/window management callbacks

2015-01-29 Thread Alexey Kardashevskiy
user is expected to unprogram DMA windows on PHBs before returning ownership back to the kernel. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h | 31 ++ arch/powerpc/platforms/powernv/pci-ioda.c | 98 ++- 2 files

[PATCH v3 22/24] powerpc/iommu: Get rid of ownership helpers

2015-01-29 Thread Alexey Kardashevskiy
iommu_take_ownership/iommu_release_ownership used to be used to mark bits in iommu_table::it_map. Since the IOMMU tables are recreated for VFIO, it_map is always NULL. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h | 2 - arch/powerpc/kernel/iommu.c

[PATCH v3 00/24] powerpc/iommu/vfio: Enable Dynamic DMA windows

2015-01-29 Thread Alexey Kardashevskiy
windows at all so we do not bother with iommu_table::it_map anymore * added multilevel TCE tables support to support really huge guests v2: * added missing __pa() in powerpc/powernv: Release replaced TCE * reposted to make some noise Alexey Kardashevskiy (24): vfio: powerpc/spapr: Move page

Re: [PATCH v2 13/13] vfio: powerpc/spapr: Enable Dynamic DMA windows

2014-10-10 Thread Alexey Kardashevskiy
On 09/23/2014 11:56 PM, Alex Williamson wrote: > On Tue, 2014-09-23 at 13:01 +1000, Alexey Kardashevskiy wrote: >> This defines and implements VFIO IOMMU API which lets the userspace >> create and remove DMA windows. >> >> This updates VFIO_IOMMU_SPAPR_TCE_GE

Re: [PATCH v2 13/13] vfio: powerpc/spapr: Enable Dynamic DMA windows

2014-10-10 Thread Alexey Kardashevskiy
On 09/23/2014 11:56 PM, Alex Williamson wrote: On Tue, 2014-09-23 at 13:01 +1000, Alexey Kardashevskiy wrote: This defines and implements VFIO IOMMU API which lets the userspace create and remove DMA windows. This updates VFIO_IOMMU_SPAPR_TCE_GET_INFO to return the number of available

[PATCH v3] powerpc/iommu/ddw: Fix endianness

2014-09-25 Thread Alexey Kardashevskiy
. Cc: sta...@vger.kernel.org # v3.13 Cc: Benjamin Herrenschmidt Reviewed-by: Anton Blanchard [aik: folded Anton's patch with of_property_read_u32_array] Signed-off-by: Alexey Kardashevskiy --- Changes: v3: * of_property_read_u32_array() is used for ddw_avail[] v2: * updated commit log * fixed

[PATCH v3] powerpc/iommu/ddw: Fix endianness

2014-09-25 Thread Alexey Kardashevskiy
...@vger.kernel.org # v3.13 Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Reviewed-by: Anton Blanchard an...@samba.org [aik: folded Anton's patch with of_property_read_u32_array] Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v3: * of_property_read_u32_array() is used for ddw_avail[] v2

Re: [PATCH v2 03/13] powerpc/spapr: vfio: Implement spapr_tce_iommu_ops

2014-09-24 Thread Alexey Kardashevskiy
On 09/24/2014 06:42 AM, Alex Williamson wrote: > On Tue, 2014-09-23 at 13:00 +1000, Alexey Kardashevskiy wrote: >> Modern IBM POWERPC systems support multiple IOMMU tables per PE >> so we need a more reliable way (compared to container_of()) to get >> a PE pointer from t

Re: [PATCH v2 03/13] powerpc/spapr: vfio: Implement spapr_tce_iommu_ops

2014-09-24 Thread Alexey Kardashevskiy
On 09/24/2014 06:42 AM, Alex Williamson wrote: On Tue, 2014-09-23 at 13:00 +1000, Alexey Kardashevskiy wrote: Modern IBM POWERPC systems support multiple IOMMU tables per PE so we need a more reliable way (compared to container_of()) to get a PE pointer from the iommu_table struct pointer used

[PATCH v2 01/13] powerpc/iommu: Check that TCE page size is equal to it_page_size

2014-09-22 Thread Alexey Kardashevskiy
-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index a10642a..b378f78 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc

[PATCH v2 02/13] powerpc/powernv: Make invalidate() a callback

2014-09-22 Thread Alexey Kardashevskiy
: - pnv_pci_ioda1_tce_invalidate; - pnv_pci_ioda2_tce_invalidate. Signed-off-by: Alexey Kardashevskiy --- Changes: v4: * changed commit log to explain why this change is needed --- arch/powerpc/platforms/powernv/pci-ioda.c | 35 --- arch/powerpc/platforms/powernv/pci.c | 31

[PATCH v2 03/13] powerpc/spapr: vfio: Implement spapr_tce_iommu_ops

2014-09-22 Thread Alexey Kardashevskiy
to either (depending on .get_table()): - iommu_table; - pnv_ioda_pe; This uses pnv_ioda1_iommu_get_table for both IODA1&2 but IODA2 will have own pnv_ioda2_iommu_get_table soon and pnv_ioda1_iommu_get_table will only be used for IODA1. Signed-off-by: Alexey Kardashevskiy ---

[PATCH v2 04/13] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-09-22 Thread Alexey Kardashevskiy
. 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 Reviewed-by: Gavin Shan --- arch/powerpc/include/asm/iommu.h | 1

[PATCH v2 10/13] powerpc/powernv: Implement Dynamic DMA windows (DDW) for IODA

2014-09-22 Thread Alexey Kardashevskiy
nal window if it was created. The next patch will add corresponding ioctls to VFIO SPAPR TCE driver to provide necessary support to the userspace. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/tce.h| 22 + arch/powerpc/platforms/powernv/pci-io

[PATCH v2 07/13] powerpc/powernv: Do not set "read" flag if direction==DMA_NONE

2014-09-22 Thread Alexey Kardashevskiy
Normally a bitmap from the iommu_table is used to track what TCE entry is in use. Since we are going to use iommu_table without its locks and do xchg() instead, it becomes essential not to put bits which are not implied in the direction flag. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc

[PATCH v2 13/13] vfio: powerpc/spapr: Enable Dynamic DMA windows

2014-09-22 Thread Alexey Kardashevskiy
platform DDW reset() callback when IOMMU is being disabled to reset the DMA configuration to its original state. Signed-off-by: Alexey Kardashevskiy --- drivers/vfio/vfio_iommu_spapr_tce.c | 135 ++-- include/uapi/linux/vfio.h | 25 ++- 2 files changed

[PATCH v2 09/13] powerpc/pseries/lpar: Enable VFIO

2014-09-22 Thread Alexey Kardashevskiy
to the table so VFIO performance in guests running under PR KVM is expected to be slower than in guests running under HV KVM or bare metal hosts. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/pseries/iommu.c | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions

[PATCH v2 08/13] powerpc/powernv: Release replaced TCE

2014-09-22 Thread Alexey Kardashevskiy
this patch. Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * added missing __pa() for TCE which was read from the table --- arch/powerpc/include/asm/iommu.h | 8 +++-- arch/powerpc/kernel/iommu.c | 62 arch/powerpc/platforms/powernv/

[PATCH v2 11/13] vfio: powerpc/spapr: Move locked_vm accounting to helpers

2014-09-22 Thread Alexey Kardashevskiy
There moves locked pages accounting to helpers. Later they will be reused for Dynamic DMA windows (DDW). While we are here, update the comment explaining why RLIMIT_MEMLOCK might be required to be bigger than the guest RAM. Signed-off-by: Alexey Kardashevskiy --- drivers/vfio

[PATCH v2 05/13] powerpc/iommu: Fix IOMMU ownership control functions

2014-09-22 Thread Alexey Kardashevskiy
in it_map. Clearing must be done outside of the table locks as iommu_clear_tce() called from iommu_clear_tces_and_put_pages() does this. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 36 +--- 1 file changed, 29 insertions(+), 7 deletions(-) diff

[PATCH v2 12/13] vfio: powerpc/spapr: Use it_page_size

2014-09-22 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 v2 06/13] powerpc/iommu: Move tce_xxx callbacks from ppc_md to iommu_table

2014-09-22 Thread Alexey Kardashevskiy
llbacks to fall back to tce_build_pSeriesLP/tce_free_pSeriesLP if FW_FEATURE_MULTITCE is not present. The reason for this is we still have to support "multitce=off" boot parameter in disable_multitce() and we do not want to walk through all IOMMU tables in the system and replace "multi" callbacks

[PATCH v2 00/13] powerpc/iommu/vfio: Enable Dynamic DMA windows

2014-09-22 Thread Alexey Kardashevskiy
gets maximum performance. Please comment. Thanks! Changes: v2: * added missing __pa() in "powerpc/powernv: Release replaced TCE" * reposted to make some noise :) Alexey Kardashevskiy (13): powerpc/iommu: Check that TCE page size is equal to it_page_size powerpc/powernv: Make invalidate(

[PATCH v2] powerpc/iommu/ddw: Fix endianness

2014-09-22 Thread Alexey Kardashevskiy
s rebooted, there is no much sense in caching RTAS tokens in CPU-endian. Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * updated commit log * fixed definition of ddw_query_response and ddw_create_response --- arch/powerpc/platforms/pseries/iommu.c | 38 ++ 1 file c

[PATCH v2] powerpc/iommu/ddw: Fix endianness

2014-09-22 Thread Alexey Kardashevskiy
sense in caching RTAS tokens in CPU-endian. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v2: * updated commit log * fixed definition of ddw_query_response and ddw_create_response --- arch/powerpc/platforms/pseries/iommu.c | 38 ++ 1 file changed

[PATCH v2 00/13] powerpc/iommu/vfio: Enable Dynamic DMA windows

2014-09-22 Thread Alexey Kardashevskiy
performance. Please comment. Thanks! Changes: v2: * added missing __pa() in powerpc/powernv: Release replaced TCE * reposted to make some noise :) Alexey Kardashevskiy (13): powerpc/iommu: Check that TCE page size is equal to it_page_size powerpc/powernv: Make invalidate() a callback powerpc/spapr

[PATCH v2 06/13] powerpc/iommu: Move tce_xxx callbacks from ppc_md to iommu_table

2014-09-22 Thread Alexey Kardashevskiy
/tce_free_pSeriesLP if FW_FEATURE_MULTITCE is not present. The reason for this is we still have to support multitce=off boot parameter in disable_multitce() and we do not want to walk through all IOMMU tables in the system and replace multi callbacks with single ones. Signed-off-by: Alexey

[PATCH v2 05/13] powerpc/iommu: Fix IOMMU ownership control functions

2014-09-22 Thread Alexey Kardashevskiy
in it_map. Clearing must be done outside of the table locks as iommu_clear_tce() called from iommu_clear_tces_and_put_pages() does this. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/kernel/iommu.c | 36 +--- 1 file changed, 29 insertions(+), 7

[PATCH v2 12/13] vfio: powerpc/spapr: Use it_page_size

2014-09-22 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 a...@ozlabs.ru

[PATCH v2 09/13] powerpc/pseries/lpar: Enable VFIO

2014-09-22 Thread Alexey Kardashevskiy
to the table so VFIO performance in guests running under PR KVM is expected to be slower than in guests running under HV KVM or bare metal hosts. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/platforms/pseries/iommu.c | 25 +++-- 1 file changed, 23 insertions(+), 2

[PATCH v2 08/13] powerpc/powernv: Release replaced TCE

2014-09-22 Thread Alexey Kardashevskiy
. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v2: * added missing __pa() for TCE which was read from the table --- arch/powerpc/include/asm/iommu.h | 8 +++-- arch/powerpc/kernel/iommu.c | 62 arch/powerpc/platforms/powernv/pci.c | 40

[PATCH v2 11/13] vfio: powerpc/spapr: Move locked_vm accounting to helpers

2014-09-22 Thread Alexey Kardashevskiy
There moves locked pages accounting to helpers. Later they will be reused for Dynamic DMA windows (DDW). While we are here, update the comment explaining why RLIMIT_MEMLOCK might be required to be bigger than the guest RAM. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio

[PATCH v2 13/13] vfio: powerpc/spapr: Enable Dynamic DMA windows

2014-09-22 Thread Alexey Kardashevskiy
platform DDW reset() callback when IOMMU is being disabled to reset the DMA configuration to its original state. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio/vfio_iommu_spapr_tce.c | 135 ++-- include/uapi/linux/vfio.h | 25 ++- 2

[PATCH v2 07/13] powerpc/powernv: Do not set read flag if direction==DMA_NONE

2014-09-22 Thread Alexey Kardashevskiy
Normally a bitmap from the iommu_table is used to track what TCE entry is in use. Since we are going to use iommu_table without its locks and do xchg() instead, it becomes essential not to put bits which are not implied in the direction flag. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru

[PATCH v2 10/13] powerpc/powernv: Implement Dynamic DMA windows (DDW) for IODA

2014-09-22 Thread Alexey Kardashevskiy
if it was created. The next patch will add corresponding ioctls to VFIO SPAPR TCE driver to provide necessary support to the userspace. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/include/asm/tce.h| 22 + arch/powerpc/platforms/powernv/pci-ioda.c | 159

[PATCH v2 04/13] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-09-22 Thread Alexey Kardashevskiy
. 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 a...@ozlabs.ru Reviewed-by: Gavin Shan gws...@linux.vnet.ibm.com --- arch/powerpc

[PATCH v2 02/13] powerpc/powernv: Make invalidate() a callback

2014-09-22 Thread Alexey Kardashevskiy
: - pnv_pci_ioda1_tce_invalidate; - pnv_pci_ioda2_tce_invalidate. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v4: * changed commit log to explain why this change is needed --- arch/powerpc/platforms/powernv/pci-ioda.c | 35 --- arch/powerpc/platforms/powernv/pci.c | 31

[PATCH v2 03/13] powerpc/spapr: vfio: Implement spapr_tce_iommu_ops

2014-09-22 Thread Alexey Kardashevskiy
to either (depending on .get_table()): - iommu_table; - pnv_ioda_pe; This uses pnv_ioda1_iommu_get_table for both IODA12 but IODA2 will have own pnv_ioda2_iommu_get_table soon and pnv_ioda1_iommu_get_table will only be used for IODA1. Signed-off-by: Alexey Kardashevskiy

[PATCH v2 01/13] powerpc/iommu: Check that TCE page size is equal to it_page_size

2014-09-22 Thread Alexey Kardashevskiy
-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/kernel/iommu.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index a10642a..b378f78 100644 --- a/arch/powerpc/kernel/iommu.c +++ b

Re: [PATCH] powerpc/iommu/ddw: Fix endianness

2014-09-15 Thread Alexey Kardashevskiy
On 09/15/2014 07:18 PM, Michael Ellerman wrote: > On Mon, 2014-09-15 at 18:41 +1000, Alexey Kardashevskiy wrote: >> On 09/09/2014 09:22 PM, Alexey Kardashevskiy wrote: >>> rtas_call() accepts and returns values in CPU endianness. > > Sounds right. > >>> of_rea

Re: [PATCH] powerpc/iommu/ddw: Fix endianness

2014-09-15 Thread Alexey Kardashevskiy
On 09/09/2014 09:22 PM, Alexey Kardashevskiy wrote: > rtas_call() accepts and returns values in CPU endianness. > > of_read_number() accepts big-endian values but create.addr_hi/lo returned > by rtas_call() are in CPU endiannes. > > The dynamic_dma_window_prop struct defines al

Re: [PATCH] powerpc/iommu/ddw: Fix endianness

2014-09-15 Thread Alexey Kardashevskiy
On 09/09/2014 09:22 PM, Alexey Kardashevskiy wrote: rtas_call() accepts and returns values in CPU endianness. of_read_number() accepts big-endian values but create.addr_hi/lo returned by rtas_call() are in CPU endiannes. The dynamic_dma_window_prop struct defines all members as BE so let's

Re: [PATCH] powerpc/iommu/ddw: Fix endianness

2014-09-15 Thread Alexey Kardashevskiy
On 09/15/2014 07:18 PM, Michael Ellerman wrote: On Mon, 2014-09-15 at 18:41 +1000, Alexey Kardashevskiy wrote: On 09/09/2014 09:22 PM, Alexey Kardashevskiy wrote: rtas_call() accepts and returns values in CPU endianness. Sounds right. of_read_number() accepts big-endian values

[PATCH] powerpc/iommu/ddw: Fix endianness

2014-09-09 Thread Alexey Kardashevskiy
{ __be32 liobn; /* tce table number */ __be64 dma_base; /* address hi,lo */ __be32 tce_shift; /* ilog2(tce_page_size) */ __be32 window_shift; /* ilog2(tce_window_size) */ }; Cc: Benjamin Herrenschmidt Cc: Alexander Graf Signed-off-by: Alexey

[PATCH] powerpc/iommu/ddw: Fix endianness

2014-09-09 Thread Alexey Kardashevskiy
...@suse.de Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/platforms/pseries/iommu.c | 24 +--- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index 7c1d77c..700020a

[PATCH 01/13] powerpc/iommu: Check that TCE page size is equal to it_page_size

2014-08-29 Thread Alexey Kardashevskiy
-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 28 +--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index a10642a..b378f78 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc

[PATCH 02/13] powerpc/powernv: Make invalidate() a callback

2014-08-29 Thread Alexey Kardashevskiy
: - pnv_pci_ioda1_tce_invalidate; - pnv_pci_ioda2_tce_invalidate. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/pci-ioda.c | 35 --- arch/powerpc/platforms/powernv/pci.c | 31 --- arch/powerpc/platforms/powernv/pci.h | 13 +++- 3

[PATCH 00/13] powerpc/iommu/vfio: Enable Dynamic DMA windows

2014-08-29 Thread Alexey Kardashevskiy
gets maximum performance. Please comment. Thanks! Alexey Kardashevskiy (13): powerpc/iommu: Check that TCE page size is equal to it_page_size powerpc/powernv: Make invalidate() a callback powerpc/spapr: vfio: Implement spapr_tce_iommu_ops powerpc/powernv: Convert/move set_bypas

[PATCH 08/13] powerpc/powernv: Release replaced TCE

2014-08-29 Thread Alexey Kardashevskiy
this patch. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/iommu.h | 8 +++-- arch/powerpc/kernel/iommu.c | 62 arch/powerpc/platforms/powernv/pci.c | 40 +++ 3 files changed, 67 insertions(+), 43 deletions(-)

[PATCH 04/13] powerpc/powernv: Convert/move set_bypass() callback to take_ownership()

2014-08-29 Thread Alexey Kardashevskiy
. 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 Reviewed-by: Gavin Shan --- arch/powerpc/include/asm/iommu.h | 1

[PATCH 07/13] powerpc/powernv: Do not set "read" flag if direction==DMA_NONE

2014-08-29 Thread Alexey Kardashevskiy
Normally a bitmap from the iommu_table is used to track what TCE entry is in use. Since we are going to use iommu_table without its locks and do xchg() instead, it becomes essential not to put bits which are not implied in the direction flag. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc

[PATCH 09/13] powerpc/pseries/lpar: Enable VFIO

2014-08-29 Thread Alexey Kardashevskiy
to the table so VFIO performance in guests running under PR KVM is expected to be slower than in guests running under HV KVM or bare metal hosts. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/pseries/iommu.c | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions

[PATCH 06/13] powerpc/iommu: Move tce_xxx callbacks from ppc_md to iommu_table

2014-08-29 Thread Alexey Kardashevskiy
llbacks to fall back to tce_build_pSeriesLP/tce_free_pSeriesLP if FW_FEATURE_MULTITCE is not present. The reason for this is we still have to support "multitce=off" boot parameter in disable_multitce() and we do not want to walk through all IOMMU tables in the system and replace "multi" callbacks

[PATCH 10/13] powerpc/powernv: Implement Dynamic DMA windows (DDW) for IODA

2014-08-29 Thread Alexey Kardashevskiy
nal window if it was created. The next patch will add corresponding ioctls to VFIO SPAPR TCE driver to provide necessary support to the userspace. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/tce.h| 22 + arch/powerpc/platforms/powernv/pci-io

[PATCH 03/13] powerpc/spapr: vfio: Implement spapr_tce_iommu_ops

2014-08-29 Thread Alexey Kardashevskiy
to either (depending on .get_table()): - iommu_table; - pnv_ioda_pe; This uses pnv_ioda1_iommu_get_table for both IODA1&2 but IODA2 will have own pnv_ioda2_iommu_get_table soon and pnv_ioda1_iommu_get_table will only be used for IODA1. Signed-off-by: Alexey Kardashevskiy ---

[PATCH 12/13] vfio: powerpc/spapr: Use it_page_size

2014-08-29 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 13/13] vfio: powerpc/spapr: Enable Dynamic DMA windows

2014-08-29 Thread Alexey Kardashevskiy
platform DDW reset() callback when IOMMU is being disabled to reset the DMA configuration to its original state. Signed-off-by: Alexey Kardashevskiy --- drivers/vfio/vfio_iommu_spapr_tce.c | 135 ++-- include/uapi/linux/vfio.h | 25 ++- 2 files changed

[PATCH 05/13] powerpc/iommu: Fix IOMMU ownership control functions

2014-08-29 Thread Alexey Kardashevskiy
in it_map. Clearing must be done outside of the table locks as iommu_clear_tce() called from iommu_clear_tces_and_put_pages() does this. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/iommu.c | 36 +--- 1 file changed, 29 insertions(+), 7 deletions(-) diff

[PATCH 11/13] vfio: powerpc/spapr: Move locked_vm accounting to helpers

2014-08-29 Thread Alexey Kardashevskiy
There moves locked pages accounting to helpers. Later they will be reused for Dynamic DMA windows (DDW). While we are here, update the comment explaining why RLIMIT_MEMLOCK might be required to be bigger than the guest RAM. Signed-off-by: Alexey Kardashevskiy --- drivers/vfio

[PATCH 11/13] vfio: powerpc/spapr: Move locked_vm accounting to helpers

2014-08-29 Thread Alexey Kardashevskiy
There moves locked pages accounting to helpers. Later they will be reused for Dynamic DMA windows (DDW). While we are here, update the comment explaining why RLIMIT_MEMLOCK might be required to be bigger than the guest RAM. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio

[PATCH 05/13] powerpc/iommu: Fix IOMMU ownership control functions

2014-08-29 Thread Alexey Kardashevskiy
in it_map. Clearing must be done outside of the table locks as iommu_clear_tce() called from iommu_clear_tces_and_put_pages() does this. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/kernel/iommu.c | 36 +--- 1 file changed, 29 insertions(+), 7

[PATCH 13/13] vfio: powerpc/spapr: Enable Dynamic DMA windows

2014-08-29 Thread Alexey Kardashevskiy
platform DDW reset() callback when IOMMU is being disabled to reset the DMA configuration to its original state. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio/vfio_iommu_spapr_tce.c | 135 ++-- include/uapi/linux/vfio.h | 25 ++- 2

<    8   9   10   11   12   13   14   15   16   17   >