[PATCH] powerpc/8xx: Allow pinning IMMR TLB when using early debug console

2018-12-19 Thread Christophe Leroy
CONFIG_EARLY_DEBUG_CPM requires IMMR area TLB to be pinned otherwise it doesn't survive MMU_init, and the boot fails. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 799

Re: [PATCH V4 5/5] arch/powerpc/mm/hugetlb: NestMMU workaround for hugetlb mprotect RW upgrade

2018-12-19 Thread Christoph Hellwig
On Thu, Dec 20, 2018 at 11:30:12AM +1100, Benjamin Herrenschmidt wrote: > On Wed, 2018-12-19 at 08:50 +0530, Aneesh Kumar K.V wrote: > > Christoph Hellwig writes: > > > > > On Tue, Dec 18, 2018 at 03:11:37PM +0530, Aneesh Kumar K.V wrote: > > > > +EXPORT_SYMBOL(huge_ptep_modify_prot_start); > > >

[RFC PATCH v2 3/3] powerpc/nohash32: Add KASAN support

2018-12-19 Thread Christophe Leroy
This patch adds KASAN support for nohash PPC32. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/kasan.h | 22 + arch/powerpc/include/asm/nohash/32/pgtable.h | 2 + arch/powerpc/include/asm/ppc_asm.h

[RFC PATCH v2 2/3] powerpc/32: Move early_init() in a separate file

2018-12-19 Thread Christophe Leroy
In preparation of KASAN, move early_init() into a separate file in order to allow deactivation of KASAN for that function. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/Makefile | 2 +- arch/powerpc/kernel/early_32.c | 35 +++ arch/powerpc/kernel/setu

[RFC PATCH v2 0/3] KASAN for nohash PPC32

2018-12-19 Thread Christophe Leroy
This serie adds KASAN support to nohash PPC32 Tested on 8xx Changes in v2: - Rebased. - Using __set_pte_at() to build the early table. - Worked around and got rid of the patch adding asm/page.h in asm/pgtable-types.h ==> might be fixed independently but needed for this serie. In principle,

[RFC PATCH v2 1/3] powerpc/mm: prepare kernel for KAsan on PPC32

2018-12-19 Thread Christophe Leroy
In kernel/cputable.c, explicitly use memcpy() in order to allow GCC to replace it with __memcpy() when KASAN is selected. Since commit 400c47d81ca38 ("powerpc32: memset: only use dcbz once cache is enabled"), memset() can be used before activation of the cache, so no need to use memset_io() for ze

Re: [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate

2018-12-19 Thread Aneesh Kumar K.V
On 12/20/18 11:50 AM, Alexey Kardashevskiy wrote: On 20/12/2018 16:52, Aneesh Kumar K.V wrote: On 12/20/18 11:18 AM, Alexey Kardashevskiy wrote: On 20/12/2018 16:22, Aneesh Kumar K.V wrote: On 12/20/18 9:49 AM, Alexey Kardashevskiy wrote: On 19/12/2018 14:40, Aneesh Kumar K.V wrote: Th

Re: [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate

2018-12-19 Thread Alexey Kardashevskiy
On 20/12/2018 16:52, Aneesh Kumar K.V wrote: > On 12/20/18 11:18 AM, Alexey Kardashevskiy wrote: >> >> >> On 20/12/2018 16:22, Aneesh Kumar K.V wrote: >>> On 12/20/18 9:49 AM, Alexey Kardashevskiy wrote: On 19/12/2018 14:40, Aneesh Kumar K.V wrote: > This helper does a get_use

Re: [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate

2018-12-19 Thread Aneesh Kumar K.V
On 12/20/18 11:18 AM, Alexey Kardashevskiy wrote: On 20/12/2018 16:22, Aneesh Kumar K.V wrote: On 12/20/18 9:49 AM, Alexey Kardashevskiy wrote: On 19/12/2018 14:40, Aneesh Kumar K.V wrote: This helper does a get_user_pages_fast and if it find pages in the CMA area it will try to migrate th

Re: [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate

2018-12-19 Thread Alexey Kardashevskiy
On 20/12/2018 16:22, Aneesh Kumar K.V wrote: > On 12/20/18 9:49 AM, Alexey Kardashevskiy wrote: >> >> >> On 19/12/2018 14:40, Aneesh Kumar K.V wrote: >>> This helper does a get_user_pages_fast and if it find pages in the >>> CMA area >>> it will try to migrate them before taking page reference.

[PATCH] powerpc/8xx: Map a second 8M text page at startup when needed.

2018-12-19 Thread Christophe Leroy
Some debug setup like CONFIG_KASAN generate huge kernels with text size over the 8M limit. This patch maps a second 8M page when _einittext is over 8M. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/head_8xx.S | 27 +-- arch/powerpc/mm/8xx_mmu.c | 4

[RFC/WIP] powerpc: Fix 32-bit handling of MSR_EE on exceptions

2018-12-19 Thread Benjamin Herrenschmidt
Hi folks ! Why trying to figure out why we had occasionally lockdep barf about interrupt state on ppc32 (440 in my case but I could reproduce on e500 as well using qemu), I realized that we are still doing something rather gothic and wrong on 32-bit which we stopped doing on 64-bit a while ago. W

Re: [PATCH kernel v5 14/20] powerpc/powernv/npu: Add compound IOMMU groups

2018-12-19 Thread Michael Ellerman
Alexey Kardashevskiy writes: > On 19/12/2018 21:00, Michael Ellerman wrote: >> Alexey Kardashevskiy writes: >>> On 19/12/2018 11:17, Michael Ellerman wrote: Alexey Kardashevskiy writes: > diff --git a/arch/powerpc/platforms/powernv/npu-dma.c > b/arch/powerpc/platforms/powernv/npu-d

Re: [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate

2018-12-19 Thread Aneesh Kumar K.V
On 12/20/18 9:49 AM, Alexey Kardashevskiy wrote: On 19/12/2018 14:40, Aneesh Kumar K.V wrote: This helper does a get_user_pages_fast and if it find pages in the CMA area it will try to migrate them before taking page reference. This makes sure that we don't keep non-movable pages (due to page

Re: [PATCH V5 2/3] powerpc/mm/iommu: Allow migration of cma allocated pages during mm_iommu_get

2018-12-19 Thread Alexey Kardashevskiy
On 19/12/2018 14:40, Aneesh Kumar K.V wrote: > Current code doesn't do page migration if the page allocated is a compound > page. > With HugeTLB migration support, we can end up allocating hugetlb pages from > CMA region. Also THP pages can be allocated from CMA region. This patch > updates >

Re: [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate

2018-12-19 Thread Alexey Kardashevskiy
On 19/12/2018 14:40, Aneesh Kumar K.V wrote: > This helper does a get_user_pages_fast and if it find pages in the CMA area > it will try to migrate them before taking page reference. This makes sure that > we don't keep non-movable pages (due to page reference count) in the CMA area. > Not able

Re: [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate

2018-12-19 Thread Alexey Kardashevskiy
On 19/12/2018 14:40, Aneesh Kumar K.V wrote: > This helper does a get_user_pages_fast and if it find pages in the CMA area > it will try to migrate them before taking page reference. This makes sure that > we don't keep non-movable pages (due to page reference count) in the CMA area. > Not able

Re: [PATCH -next] powerpc/eeh: Fix debugfs_simple_attr.cocci warnings

2018-12-19 Thread Russell Currey
On Thu, 2018-12-20 at 02:42 +, YueHaibing wrote: > Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE > for debugfs files. > > Semantic patch information: > Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() > imposes some significant overhead as compared to > DEFINE_DEBU

[PATCH -next] powerpc/eeh: Fix debugfs_simple_attr.cocci warnings

2018-12-19 Thread YueHaibing
Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE for debugfs files. Semantic patch information: Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() imposes some significant overhead as compared to DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe(). Generated by: script

Re: [PATCH kernel v6 14/20] powerpc/powernv/npu: Add compound IOMMU groups

2018-12-19 Thread Alexey Kardashevskiy
On 19/12/2018 19:52, Alexey Kardashevskiy wrote: > At the moment the powernv platform registers an IOMMU group for each PE. > There is an exception though: an NVLink bridge which is attached to > the corresponding GPU's IOMMU group making it a master. > > Now we have POWER9 systems with GPUs co

Re: [PATCH kernel v5 14/20] powerpc/powernv/npu: Add compound IOMMU groups

2018-12-19 Thread Alexey Kardashevskiy
On 19/12/2018 21:00, Michael Ellerman wrote: > Alexey Kardashevskiy writes: >> On 19/12/2018 11:17, Michael Ellerman wrote: >>> Alexey Kardashevskiy writes: diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c index dc629ee..3468eaa 1

[PATCH kernel v6.1 20/20 REPOST] vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver

2018-12-19 Thread Alexey Kardashevskiy
POWER9 Witherspoon machines come with 4 or 6 V100 GPUs which are not pluggable PCIe devices but still have PCIe links which are used for config space and MMIO. In addition to that the GPUs have 6 NVLinks which are connected to other GPUs and the POWER9 CPU. POWER9 chips have a special unit on a die

Re: [PATCH V4 5/5] arch/powerpc/mm/hugetlb: NestMMU workaround for hugetlb mprotect RW upgrade

2018-12-19 Thread Benjamin Herrenschmidt
On Wed, 2018-12-19 at 08:50 +0530, Aneesh Kumar K.V wrote: > Christoph Hellwig writes: > > > On Tue, Dec 18, 2018 at 03:11:37PM +0530, Aneesh Kumar K.V wrote: > > > +EXPORT_SYMBOL(huge_ptep_modify_prot_start); > > > > The only user of this function is the one you added in the last patch > > in m

Re: [PATCH v2 2/2] kgdb/treewide: constify struct kgdb_arch arch_kgdb_ops

2018-12-19 Thread Daniel Thompson
On Thu, Dec 06, 2018 at 08:07:40PM +, Christophe Leroy wrote: > checkpatch.pl reports the following: > > WARNING: struct kgdb_arch should normally be const > #28: FILE: arch/mips/kernel/kgdb.c:397: > +struct kgdb_arch arch_kgdb_ops = { > > This report makes sense, as all other ops struc

Re: [PATCH v2 1/2] mips/kgdb: prepare arch_kgdb_ops for constness

2018-12-19 Thread Daniel Thompson
On Thu, Dec 06, 2018 at 08:07:38PM +, Christophe Leroy wrote: > MIPS is the only architecture modifying arch_kgdb_ops during init. > This patch makes the init static, so that it can be changed to > const in following patch, as recommended by checkpatch.pl > > Suggested-by: Paul Burton > Acked

Re: [REPOST PATCH v6 2/4] kgdb: Fix kgdb_roundup_cpus() for arches who used smp_call_function()

2018-12-19 Thread Daniel Thompson
On Tue, Dec 04, 2018 at 07:38:26PM -0800, Douglas Anderson wrote: > When I had lockdep turned on and dropped into kgdb I got a nice splat > on my system. Specifically it hit: > DEBUG_LOCKS_WARN_ON(current->hardirq_context) > > Specifically it looked like this: > sysrq: SysRq : DEBUG > -

Re: [REPOST PATCH v6 1/4] kgdb: Remove irq flags from roundup

2018-12-19 Thread Daniel Thompson
On Tue, Dec 04, 2018 at 07:38:25PM -0800, Douglas Anderson wrote: > The function kgdb_roundup_cpus() was passed a parameter that was > documented as: > > > the flags that will be used when restoring the interrupts. There is > > local_irq_save() call before kgdb_roundup_cpus(). > > Nobody used tho

Re: [PATCH kernel v6 20/20] vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver

2018-12-19 Thread Alex Williamson
[cc +kvm, +lkml] Ditto list cc comment from 18/20, and doubly so on this with updates to the vfio uapi. Also comment below... On Wed, 19 Dec 2018 19:52:32 +1100 Alexey Kardashevskiy wrote: > POWER9 Witherspoon machines come with 4 or 6 V100 GPUs which are not > pluggable PCIe devices but still

Re: [PATCH kernel v6 19/20] vfio_pci: Allow regions to add own capabilities

2018-12-19 Thread Alex Williamson
[cc +kvm, +lkml] Ditto list cc comment from 18/20 On Wed, 19 Dec 2018 19:52:31 +1100 Alexey Kardashevskiy wrote: > VFIO regions already support region capabilities with a limited set of > fields. However the subdriver might have to report to the userspace > additional bits. > > This adds an ad

Re: [PATCH kernel v6 18/20] vfio_pci: Allow mapping extra regions

2018-12-19 Thread Alex Williamson
[cc +kvm, +lkml] Sorry, just noticed these are only visible on ppc lists or for those directly cc'd. vfio's official development list is the kvm list. I'll let spapr specific changes get away without copying this list, but changes like this really need to be visible to everyone. Thanks, Alex

Re: [PATCH 3/8] crypto4xx_core: don't abuse __dma_sync_page

2018-12-19 Thread Christian Lamparter
On Sunday, December 16, 2018 6:19:46 PM CET Christoph Hellwig wrote: > This function is internal to the DMA API implementation. Instead use the > DMA API to properly unmap. Note that the DMA API usage in this driver > is a disaster and urgently needs some work - it is missing all the unmaps, > se

Re: [PATCH kernel v5 14/20] powerpc/powernv/npu: Add compound IOMMU groups

2018-12-19 Thread Michael Ellerman
Alexey Kardashevskiy writes: > On 19/12/2018 11:17, Michael Ellerman wrote: >> Alexey Kardashevskiy writes: >>> diff --git a/arch/powerpc/platforms/powernv/npu-dma.c >>> b/arch/powerpc/platforms/powernv/npu-dma.c >>> index dc629ee..3468eaa 100644 >>> --- a/arch/powerpc/platforms/powernv/npu-dma.

Re: [PATCH kernel v5 10/20] powerpc/iommu_api: Move IOMMU groups setup to a single place

2018-12-19 Thread Michael Ellerman
Alexey Kardashevskiy writes: > On 19/12/2018 10:35, Michael Ellerman wrote: >> Alexey Kardashevskiy writes: >> >>> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c >>> b/arch/powerpc/platforms/powernv/pci-ioda.c >>> index b86a6e0..1168b185 100644 >>> --- a/arch/powerpc/platforms/powernv/p

Re: [PATCH] powerpc/32: Include .branch_lt in data section

2018-12-19 Thread Michael Ellerman
Alan Modra writes: > On Thu, Nov 15, 2018 at 11:47:52PM +1100, Michael Ellerman wrote: >> Alan Modra writes: >> >> > On Wed, Nov 14, 2018 at 01:32:18PM +1030, Joel Stanley wrote: >> >> I wasn't sure where this should go or if the ordering matters. >> > >> > The usual answer is: "Look at where th

Re: [PATCH 07/11] powerpc/fsl: Flush the branch predictor at each kernel entry (32 bit)

2018-12-19 Thread kbuild test robot
Hi Diana, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on powerpc/next] [also build test WARNING on v4.20-rc7 next-20181218] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/

RE: [PATCHv3 4/4] misc: pci_endpoint_test: Add the layerscape EP device support

2018-12-19 Thread Xiaowei Bao
-Original Message- From: Greg KH Sent: 2018年12月19日 17:21 To: Xiaowei Bao Cc: bhelg...@google.com; robh...@kernel.org; mark.rutl...@arm.com; shawn...@kernel.org; Leo Li ; kis...@ti.com; lorenzo.pieral...@arm.com; a...@arndb.de; M.h. Lian ; Mingkai Hu ; Roy Zang ; kstew...@linuxfound

Re: [PATCHv3 4/4] misc: pci_endpoint_test: Add the layerscape EP device support

2018-12-19 Thread Greg KH
On Mon, Dec 03, 2018 at 06:35:05PM +0800, Xiaowei Bao wrote: > Add the layerscape EP device support in pci_endpoint_test driver. > > Signed-off-by: Xiaowei Bao > --- > v2: > - no change > v3: > - no change > > drivers/misc/pci_endpoint_test.c |2 ++ > 1 files changed, 2 insertions(+), 0 d

[PATCH kernel v6 18/20] vfio_pci: Allow mapping extra regions

2018-12-19 Thread Alexey Kardashevskiy
So far we only allowed mapping of MMIO BARs to the userspace. However there are GPUs with on-board coherent RAM accessible via side channels which we also want to map to the userspace. The first client for this is NVIDIA V100 GPU with NVLink2 direct links to a POWER9 NPU-enabled CPU; such GPUs have

[PATCH kernel v6 16/20] powerpc/powernv/npu: Check mmio_atsd array bounds when populating

2018-12-19 Thread Alexey Kardashevskiy
A broken device tree might contain more than 8 values and introduce hard to debug memory corruption bug. This adds the boundary check. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/platforms/powernv/npu-dma.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/po

[PATCH kernel v6 12/20] powerpc/powernv/npu: Move single TVE handling to NPU PE

2018-12-19 Thread Alexey Kardashevskiy
Normal PCI PEs have 2 TVEs, one per a DMA window; however NPU PE has only one which points to one of two tables of the corresponding PCI PE. So whenever a new DMA window is programmed to PEs, the NPU PE needs to release old table in order to use the new one. Commit d41ce7b1bcc3e ("powerpc/powernv

[PATCH kernel v6 10/20] powerpc/iommu_api: Move IOMMU groups setup to a single place

2018-12-19 Thread Alexey Kardashevskiy
Registering new IOMMU groups and adding devices to them are separated in code and the latter is dug in the DMA setup code which it does not really belong to. This moved IOMMU groups setup to a separate helper which registers a group and adds devices as before. This does not make a difference as IO

[PATCH kernel v6 20/20] vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver

2018-12-19 Thread Alexey Kardashevskiy
POWER9 Witherspoon machines come with 4 or 6 V100 GPUs which are not pluggable PCIe devices but still have PCIe links which are used for config space and MMIO. In addition to that the GPUs have 6 NVLinks which are connected to other GPUs and the POWER9 CPU. POWER9 chips have a special unit on a die

[PATCH kernel v6 09/20] powerpc/powernv/pseries: Rework device adding to IOMMU groups

2018-12-19 Thread Alexey Kardashevskiy
The powernv platform registers IOMMU groups and adds devices to them from the pci_controller_ops::setup_bridge() hook except one case when virtual functions (SRIOV VFs) are added from a bus notifier. The pseries platform registers IOMMU groups from the pci_controller_ops::dma_bus_setup() hook and

[PATCH kernel v6 19/20] vfio_pci: Allow regions to add own capabilities

2018-12-19 Thread Alexey Kardashevskiy
VFIO regions already support region capabilities with a limited set of fields. However the subdriver might have to report to the userspace additional bits. This adds an add_capability() hook to vfio_pci_regops. Signed-off-by: Alexey Kardashevskiy Acked-by: Alex Williamson --- Changes: v3: * rem

[PATCH kernel v6 08/20] powerpc/pseries: Remove IOMMU API support for non-LPAR systems

2018-12-19 Thread Alexey Kardashevskiy
The pci_dma_bus_setup_pSeries and pci_dma_dev_setup_pSeries hooks are registered for the pseries platform which does not have FW_FEATURE_LPAR; these would be pre-powernv platforms which we never supported PCI pass through for anyway so remove it. Signed-off-by: Alexey Kardashevskiy Reviewed-by: D

[PATCH kernel v6 17/20] powerpc/powernv/npu: Fault user page into the hypervisor's pagetable

2018-12-19 Thread Alexey Kardashevskiy
When a page fault happens in a GPU, the GPU signals the OS and the GPU driver calls the fault handler which populated a page table; this allows the GPU to complete an ATS request. On the bare metal get_user_pages() is enough as it adds a pte to the kernel page table but under KVM the partition sco

[PATCH kernel v6 15/20] powerpc/powernv/npu: Add release_ownership hook

2018-12-19 Thread Alexey Kardashevskiy
In order to make ATS work and translate addresses for arbitrary LPID and PID, we need to program an NPU with LPID and allow PID wildcard matching with a specific MSR mask. This implements a helper to assign a GPU to LPAR and program the NPU with a wildcard for PID and a helper to do clean-up. The

[PATCH kernel v6 04/20] powerpc/powernv: Move npu struct from pnv_phb to pci_controller

2018-12-19 Thread Alexey Kardashevskiy
The powernv PCI code stores NPU data in the pnv_phb struct. The latter is referenced by pci_controller::private_data. We are going to have NPU2 support in the pseries platform as well but it does not store any private_data in in the pci_controller struct; and even if it did, it would be a different

[PATCH kernel v6 14/20] powerpc/powernv/npu: Add compound IOMMU groups

2018-12-19 Thread Alexey Kardashevskiy
At the moment the powernv platform registers an IOMMU group for each PE. There is an exception though: an NVLink bridge which is attached to the corresponding GPU's IOMMU group making it a master. Now we have POWER9 systems with GPUs connected to each other directly bypassing PCI. At the moment we

[PATCH kernel v6 13/20] powerpc/powernv/npu: Convert NPU IOMMU helpers to iommu_table_group_ops

2018-12-19 Thread Alexey Kardashevskiy
At the moment NPU IOMMU is manipulated directly from the IODA2 PCI PE code; PCI PE acts as a master to NPU PE. Soon we will have compound IOMMU groups with several PEs from several different PHB (such as interconnected GPUs and NPUs) so there will be no single master but a one big IOMMU group. Thi

[PATCH kernel v6 02/20] powerpc/mm/iommu/vfio_spapr_tce: Change mm_iommu_get to reference a region

2018-12-19 Thread Alexey Kardashevskiy
Normally mm_iommu_get() should add a reference and mm_iommu_put() should remove it. However historically mm_iommu_find() does the referencing and mm_iommu_get() is doing allocation and referencing. We are going to add another helper to preregister device memory so instead of having mm_iommu_new()

[PATCH kernel v6 11/20] powerpc/powernv: Reference iommu_table while it is linked to a group

2018-12-19 Thread Alexey Kardashevskiy
The iommu_table pointer stored in iommu_table_group may get stale by accident, this adds referencing and removes a redundant comment about this. Signed-off-by: Alexey Kardashevskiy Reviewed-by: David Gibson --- arch/powerpc/platforms/powernv/pci-ioda-tce.c | 3 ++- arch/powerpc/platforms/powern

[PATCH kernel v6 07/20] powerpc/pseries/npu: Enable platform support

2018-12-19 Thread Alexey Kardashevskiy
We already changed NPU API for GPUs to not to call OPAL and the remaining bit is initializing NPU structures. This searches for POWER9 NVLinks attached to any device on a PHB and initializes an NPU structure if any found. Signed-off-by: Alexey Kardashevskiy --- Changes: v5: * added WARN_ON_ONCE

[PATCH kernel v6 06/20] powerpc/pseries/iommu: Use memory@ nodes in max RAM address calculation

2018-12-19 Thread Alexey Kardashevskiy
We might have memory@ nodes with "linux,usable-memory" set to zero (for example, to replicate powernv's behaviour for GPU coherent memory) which means that the memory needs an extra initialization but since it can be used afterwards, the pseries platform will try mapping it for DMA so the DMA windo

[PATCH kernel v6 05/20] powerpc/powernv/npu: Move OPAL calls away from context manipulation

2018-12-19 Thread Alexey Kardashevskiy
When introduced, the NPU context init/destroy helpers called OPAL which enabled/disabled PID (a userspace memory context ID) filtering in an NPU per a GPU; this was a requirement for P9 DD1.0. However newer chip revision added a PID wildcard support so there is no more need to call OPAL every time

[PATCH kernel v6 03/20] powerpc/vfio/iommu/kvm: Do not pin device memory

2018-12-19 Thread Alexey Kardashevskiy
This new memory does not have page structs as it is not plugged to the host so gup() will fail anyway. This adds 2 helpers: - mm_iommu_newdev() to preregister the "memory device" memory so the rest of API can still be used; - mm_iommu_is_devmem() to know if the physical address is one of thise new

[PATCH kernel v6 01/20] powerpc/ioda/npu: Call skiboot's hot reset hook when disabling NPU2

2018-12-19 Thread Alexey Kardashevskiy
The skiboot firmware has a hot reset handler which fences the NVIDIA V100 GPU RAM on Witherspoons and makes accesses no-op instead of throwing HMIs: https://github.com/open-power/skiboot/commit/fca2b2b839a67 Now we are going to pass V100 via VFIO which most certainly involves KVM guests which are

[PATCH kernel v6 00/20] powerpc/powernv/npu, vfio: NVIDIA V100 + P9 passthrough

2018-12-19 Thread Alexey Kardashevskiy
This is for passing through NVIDIA V100 GPUs on POWER9 systems. 20/20 has the details of hardware setup. This implements support for NVIDIA V100 GPU with coherent memory and NPU/ATS support available in the POWER9 CPU. The aim is to support unmodified vendor driver in the guest. This is pushed

Re: [PATCH v3] powerpc: implement CONFIG_DEBUG_VIRTUAL

2018-12-19 Thread Michael Ellerman
Christophe Leroy writes: > On 12/19/2018 06:57 AM, Christophe Leroy wrote: ... > > In fact the solution is the following: > > diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c > index 4fc77a99c9bf..60401af2bc8f 100644 > --- a/arch/powerpc/mm/pgtable_32.c > +++ b/arch/powerpc