[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 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 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 a...@ozlabs.ru

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

2014-08-29 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 10/13] powerpc/powernv: Implement Dynamic DMA windows (DDW) for IODA

2014-08-29 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 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 a...@ozlabs.ru

[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 a...@ozlabs.ru --- arch/powerpc/platforms/pseries/iommu.c | 25 +++-- 1 file changed, 23 insertions(+), 2

[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 a...@ozlabs.ru Reviewed-by: Gavin Shan gws...@linux.vnet.ibm.com --- arch/powerpc

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

2014-08-29 Thread Alexey Kardashevskiy
. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- 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 00/13] powerpc/iommu/vfio: Enable Dynamic DMA windows

2014-08-29 Thread Alexey Kardashevskiy
. 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_bypass() callback to take_ownership

[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 a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci-ioda.c | 35 --- arch/powerpc/platforms/powernv/pci.c | 31 --- arch/powerpc/platforms/powernv/pci.h | 13

[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 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 v2] PC, KVM, CMA: Fix regression caused by wrong get_order() use

2014-08-14 Thread Alexey Kardashevskiy
On 08/14/2014 11:40 PM, Alexander Graf wrote: > > On 14.08.14 07:13, Aneesh Kumar K.V wrote: >> Alexey Kardashevskiy writes: >> >>> fc95ca7284bc54953165cba76c3228bd2cdb9591 claims that there is no >>> functional change but this is not true as it calls get_o

Re: [PATCH v2] PC, KVM, CMA: Fix regression caused by wrong get_order() use

2014-08-14 Thread Alexey Kardashevskiy
On 08/14/2014 11:40 PM, Alexander Graf wrote: On 14.08.14 07:13, Aneesh Kumar K.V wrote: Alexey Kardashevskiy a...@ozlabs.ru writes: fc95ca7284bc54953165cba76c3228bd2cdb9591 claims that there is no functional change but this is not true as it calls get_order() (which takes bytes) where

[PATCH v2] PC, KVM, CMA: Fix regression caused by wrong get_order() use

2014-08-13 Thread Alexey Kardashevskiy
). Suggested-by: Paul Mackerras Cc: Alexander Graf Cc: Aneesh Kumar K.V Cc: Joonsoo Kim Cc: Benjamin Herrenschmidt Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * s/ilog2/order_base_2/ * removed cc: as I got wrong impression that v3.16 is broken --- arch/powerpc/kvm/book3s_hv_builtin.c

[PATCH v2] PC, KVM, CMA: Fix regression caused by wrong get_order() use

2014-08-13 Thread Alexey Kardashevskiy
). Suggested-by: Paul Mackerras pau...@samba.org Cc: Alexander Graf ag...@suse.de Cc: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Cc: Joonsoo Kim iamjoonsoo@lge.com Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v2: * s

[PATCH] PC, KVM, CMA: Fix regression caused by wrong get_order() use

2014-08-12 Thread Alexey Kardashevskiy
: Alexander Graf Cc: Aneesh Kumar K.V Cc: Joonsoo Kim Cc: Benjamin Herrenschmidt Cc: Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kvm/book3s_hv_builtin.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm

[PATCH] PC, KVM, CMA: Fix regression caused by wrong get_order() use

2014-08-12 Thread Alexey Kardashevskiy
...@samba.org Cc: Alexander Graf ag...@suse.de Cc: Aneesh Kumar K.V aneesh.ku...@linux.vnet.ibm.com Cc: Joonsoo Kim iamjoonsoo@lge.com Cc: Benjamin Herrenschmidt b...@kernel.crashing.org Cc: sta...@vger.kernel.org Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- arch/powerpc/kvm

Re: [RFC PATCH] mm: Add helpers for locked_vm

2014-07-30 Thread Alexey Kardashevskiy
On 07/30/2014 08:31 PM, Davidlohr Bueso wrote: > On Wed, 2014-07-30 at 19:28 +1000, Alexey Kardashevskiy wrote: >> This adds 2 helpers to change the locked_vm counter: >> - try_increase_locked_vm - may fail if new locked_vm value will be greater >> than the

[RFC PATCH] mm: Add helpers for locked_vm

2014-07-30 Thread Alexey Kardashevskiy
if it can lock DMA memory or PPC-KVM can use it to check if it can lock memory for TCE tables. Signed-off-by: Alexey Kardashevskiy --- include/linux/mm.h | 3 +++ mm/mlock.c | 49 + 2 files changed, 52 insertions(+) diff --git a/include

[RFC PATCH] mm: Add helpers for locked_vm

2014-07-30 Thread Alexey Kardashevskiy
if it can lock DMA memory or PPC-KVM can use it to check if it can lock memory for TCE tables. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- include/linux/mm.h | 3 +++ mm/mlock.c | 49 + 2 files changed, 52 insertions(+) diff

Re: [RFC PATCH] mm: Add helpers for locked_vm

2014-07-30 Thread Alexey Kardashevskiy
On 07/30/2014 08:31 PM, Davidlohr Bueso wrote: On Wed, 2014-07-30 at 19:28 +1000, Alexey Kardashevskiy wrote: This adds 2 helpers to change the locked_vm counter: - try_increase_locked_vm - may fail if new locked_vm value will be greater than the RLIMIT_MEMLOCK limit; - decrease_locked_vm

Re: [PATCH 2/2] libata: Fix NULL pointer of scsi_host in ata_port

2014-07-23 Thread Alexey Kardashevskiy
On 07/23/2014 06:11 AM, Tejun Heo wrote: > Hello, > > Can you please test the following patch? Tested-by: Alexey Kardashevskiy on POWER8 + IBM IPR SCSI. > > diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c > index d19c37a7..773f4e6 100644 > ---

Re: [PATCH 2/2] libata: Fix NULL pointer of scsi_host in ata_port

2014-07-23 Thread Alexey Kardashevskiy
On 07/23/2014 06:11 AM, Tejun Heo wrote: Hello, Can you please test the following patch? Tested-by: Alexey Kardashevskiy a...@ozlabs.ru on POWER8 + IBM IPR SCSI. diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index d19c37a7..773f4e6 100644 --- a/drivers/ata

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

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 pau...@samba.org 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

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: [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. This implements an extended version of KVM_CREATE_SPAPR_TCE_64 ioctl

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: [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 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/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/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
e 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, > > Cheers, > Ben. > >> Alex >> >>>&

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

2014-06-24 Thread Alexey Kardashevskiy
-by: Benjamin Herrenschmidt b...@kernel.crashing.org Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio/pci/vfio_pci_rdwr.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c

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 an accident may be a matter of perspective

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: On Thu, 2014-06-19 at 21:21 -0600, Alex Williamson

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: On 06/24/2014 08:41 PM, Alexander Graf 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 wrote: On 06/24/2014 10:52 PM

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(). No. Both are slightly wrong

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: [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 Williamson wrote: On Wed, 2014-06-18 at 21:36

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

2014-06-19 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-19 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, 2014 9:18 AM To: Alex Williamson Cc: k

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

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

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 iommu_table. Please comment

[PATCH] vfio: Fix endianness handling for emulated BARs

2014-06-18 Thread Alexey Kardashevskiy
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 b...@kernel.crashing.org Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- drivers/vfio/pci/vfio_pci_rdwr.c | 20

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 swapping and simply return values

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()/pwrite(). Since this is a byte stream, VFIO

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()/pwrite(). Since this is a byte stream, VFIO

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 a byte stream so userspace can read it using

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

[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 4/6] powerpc/powernv: Add @it_owner to iommu_table struct

2014-06-06 Thread Alexey Kardashevskiy
. This 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 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 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 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 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 a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci-ioda.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions

[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 a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h| 4 arch/powerpc

[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/powernv: use

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

2014-06-06 Thread Alexey Kardashevskiy
. This 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 a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h| 6

[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 a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci-ioda.c | 5 +++-- arch/powerpc/platforms/powernv/pci-p5ioc2.c | 3 ++- arch/powerpc/platforms/powernv/pci.c

[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 a...@ozlabs.ru --- arch/powerpc/include/asm/iommu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[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 a...@ozlabs.ru --- arch/powerpc/platforms/powernv/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms

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

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

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

[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 Kardashevskiy (3

[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 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 +- arch

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

2014-06-05 Thread Alexey Kardashevskiy
the 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 1/3] PPC: KVM: Reserve KVM_CAP_SPAPR_TCE_VFIO capability number

2014-06-05 Thread Alexey Kardashevskiy
the 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 a...@ozlabs.ru --- include/uapi/linux/kvm.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/uapi

[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 a...@ozlabs.ru --- Documentation/virtual/kvm/api.txt | 46 + arch/powerpc/include/asm/kvm_host.h | 4 +++- arch/powerpc/include/asm/kvm_ppc.h

[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 a...@ozlabs.ru --- 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

[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 Kardashevskiy (3

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 addresses used in virtual I/O

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 TCE

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 patches as I suspect that first two should go via

Re: [PATCH] PPC: KVM: fix VCPU run for HV KVM

2014-02-04 Thread Alexey Kardashevskiy
On 01/13/2014 02:44 AM, Alexander Graf wrote: > > On 10.01.2014, at 08:21, Alexey Kardashevskiy wrote: > >> When write to MMIO happens and there is an ioeventfd for that and >> is handled successfully, ioeventfd_write() returns 0 (success) and >> kvmppc_handle_s

Re: [PATCH] PPC: KVM: fix VCPU run for HV KVM

2014-02-04 Thread Alexey Kardashevskiy
On 01/13/2014 02:44 AM, Alexander Graf wrote: On 10.01.2014, at 08:21, Alexey Kardashevskiy a...@ozlabs.ru wrote: When write to MMIO happens and there is an ioeventfd for that and is handled successfully, ioeventfd_write() returns 0 (success) and kvmppc_handle_store() returns EMULATE_DONE

[PATCH] PPC: KVM: fix VCPU run for HV KVM

2014-01-09 Thread Alexey Kardashevskiy
of RESUME_GUEST_NV in kvmppc_vcpu_run_hv(). Cc: Michael S. Tsirkin Suggested-by: Paul Mackerras Signed-off-by: Alexey Kardashevskiy --- This definitely needs a better commit message. Please, help. ps. it seems like ioeventfd never worked on ppc64. hm. --- arch/powerpc/kvm/book3s_hv.c | 2 +- 1

[PATCH] PPC: KVM: fix VCPU run for HV KVM

2014-01-09 Thread Alexey Kardashevskiy
of RESUME_GUEST_NV in kvmppc_vcpu_run_hv(). Cc: Michael S. Tsirkin m...@redhat.com Suggested-by: Paul Mackerras pau...@samba.org Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- This definitely needs a better commit message. Please, help. ps. it seems like ioeventfd never worked on ppc64. hm

Re: [PATCH] iommu: Add empty stub for iommu_group_get_by_id()

2013-12-23 Thread Alexey Kardashevskiy
On 11/21/2013 05:41 PM, Alexey Kardashevskiy wrote: > Almost every function in include/linux/iommu.h has an empty stub > but the iommu_group_get_by_id() did not get one by mistake. > > This adds an empty stub for iommu_group_get_by_id() for IOMMU_API > disabled config. Ping?

Re: [PATCH] iommu: Add empty stub for iommu_group_get_by_id()

2013-12-23 Thread Alexey Kardashevskiy
On 11/21/2013 05:41 PM, Alexey Kardashevskiy wrote: Almost every function in include/linux/iommu.h has an empty stub but the iommu_group_get_by_id() did not get one by mistake. This adds an empty stub for iommu_group_get_by_id() for IOMMU_API disabled config. Ping? Signed-off-by: Alexey

ext4: crash in ext4_superblock_csum_set

2013-12-18 Thread Alexey Kardashevskiy
Hi! While debugging some kernel stuff, I got a series crashes and got my root FS broken, this happens, no big deal. But once I got a file system so damaged so EXT4 driver crashed on mount, as below. The broken kernel is quite old and the issue might have been fixed already but I am still sending

ext4: crash in ext4_superblock_csum_set

2013-12-18 Thread Alexey Kardashevskiy
Hi! While debugging some kernel stuff, I got a series crashes and got my root FS broken, this happens, no big deal. But once I got a file system so damaged so EXT4 driver crashed on mount, as below. The broken kernel is quite old and the issue might have been fixed already but I am still sending

[PATCH v12] PPC: POWERNV: move iommu_add_device earlier

2013-12-17 Thread Alexey Kardashevskiy
() and iommu_del_device() are public now. Signed-off-by: Alexey Kardashevskiy --- Changes: v12: * removed redundant bus notifier from common POWERPC code v11: * rebased on upstream v10: * fixed linker error when IOMMU_API is not enabled v9: * removed "KVM" from the subject as it is not really a KVM pa

[PATCH v12] PPC: POWERNV: move iommu_add_device earlier

2013-12-17 Thread Alexey Kardashevskiy
() and iommu_del_device() are public now. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v12: * removed redundant bus notifier from common POWERPC code v11: * rebased on upstream v10: * fixed linker error when IOMMU_API is not enabled v9: * removed KVM from the subject as it is not really a KVM patch

Re: [1/3] powerpc/vfio: Enable on POWERNV platform

2013-12-12 Thread Alexey Kardashevskiy
On 12/13/2013 10:35 AM, Scott Wood wrote: > On Tue, May 21, 2013 at 01:33:09PM +1000, Alexey Kardashevskiy wrote: >> +static int iommu_add_device(struct device *dev) >> +{ >> +struct iommu_table *tbl; >> +int ret = 0; >> + >> +if (WARN_ON(dev-&

Re: [1/3] powerpc/vfio: Enable on POWERNV platform

2013-12-12 Thread Alexey Kardashevskiy
On 12/13/2013 10:35 AM, Scott Wood wrote: On Tue, May 21, 2013 at 01:33:09PM +1000, Alexey Kardashevskiy wrote: +static int iommu_add_device(struct device *dev) +{ +struct iommu_table *tbl; +int ret = 0; + +if (WARN_ON(dev-iommu_group)) { +pr_warn(iommu_tce: device

[PATCH v11] PPC: POWERNV: move iommu_add_device earlier

2013-12-11 Thread Alexey Kardashevskiy
() and iommu_del_device() are public now. Signed-off-by: Alexey Kardashevskiy --- Changes: v11: * rebased on upstream v10: * fixed linker error when IOMMU_API is not enabled v9: * removed "KVM" from the subject as it is not really a KVM patch so PPC mainainter (hi Ben!) can review/include it into hi

[PATCH v11] PPC: POWERNV: move iommu_add_device earlier

2013-12-11 Thread Alexey Kardashevskiy
() and iommu_del_device() are public now. Signed-off-by: Alexey Kardashevskiy a...@ozlabs.ru --- Changes: v11: * rebased on upstream v10: * fixed linker error when IOMMU_API is not enabled v9: * removed KVM from the subject as it is not really a KVM patch so PPC mainainter (hi Ben!) can review/include it into his tree

Re: [PATCH] powernv: fix VFIO support with PHB3

2013-12-06 Thread Alexey Kardashevskiy
On 12/06/2013 11:21 PM, Thadeu Lima de Souza Cascardo wrote: > I have recently found out that no iommu_groups could be found under > /sys/ on a P8. That prevents PCI passthrough from working. > > During my investigation, I found out there seems to be a missing > iommu_register_group for PHB3. The

Re: [PATCH] powernv: fix VFIO support with PHB3

2013-12-06 Thread Alexey Kardashevskiy
On 12/06/2013 11:21 PM, Thadeu Lima de Souza Cascardo wrote: I have recently found out that no iommu_groups could be found under /sys/ on a P8. That prevents PCI passthrough from working. During my investigation, I found out there seems to be a missing iommu_register_group for PHB3. The

[PATCH v4] KVM: PPC: vfio kvm device: support spapr tce

2013-11-25 Thread Alexey Kardashevskiy
uses kvm_vfio_find_group_by_liobn() once per KVM run and caches the result in kvm_arch. iommu_group_put() for all groups will be called when KVM finishes (in the SPAPR TCE in KVM enablement patch). Signed-off-by: Alexey Kardashevskiy --- Changes: v4: * fixed few bugs * changed

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