Re: [PATCH 4/7] ALSA: pcm: use dma_can_mmap() to check if a device supports dma_mmap_*

2019-08-05 Thread Christoph Hellwig
On Mon, Aug 05, 2019 at 11:22:03AM +0200, Takashi Iwai wrote: > This won't work as expected, unfortunately. It's a bit tricky check, > since the driver may have its own mmap implementation via > substream->ops->mmap, and the dma_buffer.dev.dev might point to > another object depending on the

Re: [PATCH] dma-direct: don't truncate dma_required_mask to bus addressing capabilities

2019-08-05 Thread Christoph Hellwig
On Mon, Aug 05, 2019 at 05:51:53PM +0200, Lucas Stach wrote: > The dma required_mask needs to reflect the actual addressing capabilities > needed to handle the whole system RAM. When truncated down to the bus > addressing capabilities dma_addressing_limited() will incorrectly signal > no

[PATCH v4 5/6] fs/core/vmcore: Move sev_active() reference to x86 arch code

2019-08-05 Thread Thiago Jung Bauermann
Secure Encrypted Virtualization is an x86-specific feature, so it shouldn't appear in generic kernel code because it forces non-x86 architectures to define the sev_active() function, which doesn't make a lot of sense. To solve this problem, add an x86 elfcorehdr_read() function to override the

[PATCH v4 3/6] dma-mapping: Remove dma_check_mask()

2019-08-05 Thread Thiago Jung Bauermann
sme_active() is an x86-specific function so it's better not to call it from generic code. Christoph Hellwig mentioned that "There is no reason why we should have a special debug printk just for one specific reason why there is a requirement for a large DMA mask.", so just remove dma_check_mask().

[PATCH v4 6/6] s390/mm: Remove sev_active() function

2019-08-05 Thread Thiago Jung Bauermann
All references to sev_active() were moved to arch/x86 so we don't need to define it for s390 anymore. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Christoph Hellwig Reviewed-by: Halil Pasic --- arch/s390/include/asm/mem_encrypt.h | 1 - arch/s390/mm/init.c | 7 +-- 2

[PATCH v4 2/6] swiotlb: Remove call to sme_active()

2019-08-05 Thread Thiago Jung Bauermann
sme_active() is an x86-specific function so it's better not to call it from generic code. There's no need to mention which memory encryption feature is active, so just use a more generic message. Besides, other architectures will have different names for similar technology. Signed-off-by: Thiago

[PATCH v4 1/6] x86,s390: Move ARCH_HAS_MEM_ENCRYPT definition to arch/Kconfig

2019-08-05 Thread Thiago Jung Bauermann
powerpc is also going to use this feature, so put it in a generic location. Signed-off-by: Thiago Jung Bauermann Reviewed-by: Thomas Gleixner Reviewed-by: Christoph Hellwig --- arch/Kconfig | 3 +++ arch/s390/Kconfig | 4 +--- arch/x86/Kconfig | 4 +--- 3 files changed, 5 insertions(+),

[PATCH v4 4/6] x86,s390/mm: Move sme_active() and sme_me_mask to x86-specific header

2019-08-05 Thread Thiago Jung Bauermann
Now that generic code doesn't reference them, move sme_active() and sme_me_mask to x86's . Also remove the export for sme_active() since it's only used in files that won't be built as modules. sme_me_mask on the other hand is used in arch/x86/kvm/svm.c (via __sme_set() and __psp_pa()) which can

[PATCH v4 0/6] Remove x86-specific code from generic headers

2019-08-05 Thread Thiago Jung Bauermann
Hello, This version has only a small change in the last patch as requested by Christoph and Halil, and collects Reviewed-by's. These patches are applied on top of v5.3-rc2. I don't have a way to test SME, SEV, nor s390's PEF so the patches have only been build tested. Changelog Since v3: -

Re: [PATCH] iommu/iova: wait 'fq_timer' handler to finish before destroying 'fq'

2019-08-05 Thread Xiongfeng Wang
+ (Robin) Hi Robin, Sorry to ping you... What's your suggestion for this patch? I'm looking forward to your reply. Thanks, Xiongfeng. On 2019/7/27 17:21, Xiongfeng Wang wrote: > Fix following crash that occurs when 'fq_flush_timeout()' access > 'fq->lock' while 'iovad->fq' has been cleared.

[PATCH 2/2] iommu/vt-d: Fix possible use-after-free of private domain

2019-08-05 Thread Lu Baolu
Multiple devices might share a private domain. One real example is a pci bridge and all devices behind it. When remove a private domain, make sure that it has been detached from all devices to avoid use-after-free case. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Alex Williamson Fixes:

[PATCH 1/2] iommu/vt-d: Detach domain before using a private one

2019-08-05 Thread Lu Baolu
When the default domain of a group doesn't work for a device, the iommu driver will try to use a private domain. The domain which was previously attached to the device must be detached. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Alex Williamson Fixes: 942067f1b6b97 ("iommu/vt-d: Identify

Re: [PATCH v4 12/15] iommu/vt-d: Cleanup get_valid_domain_for_dev()

2019-08-05 Thread Lu Baolu
Hi Alex, On 8/3/19 12:54 AM, Alex Williamson wrote: On Fri, 2 Aug 2019 15:17:45 +0800 Lu Baolu wrote: Hi Alex, Thanks for reporting this. I will try to find a machine with a pcie-to-pci bridge and get this issue fixed. I will update you later. Further debug below... On 8/2/19 9:30 AM,

Re: [PATCH v4 11/22] iommu: Introduce guest PASID bind function

2019-08-05 Thread Jacob Pan
On Tue, 16 Jul 2019 18:44:56 +0200 Auger Eric wrote: > > +struct gpasid_bind_data { > other structs in iommu.h are prefixed with iommu_? Good point, will add iommu_ prefix. Thanks, Jacob ___ iommu mailing list iommu@lists.linux-foundation.org

Re: [PATCH v3 1/4] firmware: qcom_scm-64: Add atomic version of qcom_scm_call

2019-08-05 Thread Bjorn Andersson
On Wed 19 Jun 04:34 PDT 2019, Vivek Gautam wrote: > On Tue, Jun 18, 2019 at 11:25 PM Will Deacon wrote: > > > > On Wed, Jun 12, 2019 at 12:45:51PM +0530, Vivek Gautam wrote: > > > There are scnenarios where drivers are required to make a > > > scm call in atomic context, such as in one of the

Re: [PATCH v3 4/4] arm64: dts/sdm845: Enable FW implemented safe sequence handler on MTP

2019-08-05 Thread Bjorn Andersson
On Wed 12 Jun 00:15 PDT 2019, Vivek Gautam wrote: > Indicate on MTP SDM845 that firmware implements handler to > TLB invalidate erratum SCM call where SAFE sequence is toggled > to achieve optimum performance on real-time clients, such as > display and camera. > > Signed-off-by: Vivek Gautam >

Re: [PATCH v4 11/22] iommu: Introduce guest PASID bind function

2019-08-05 Thread Jacob Pan
On Tue, 16 Jul 2019 18:44:56 +0200 Auger Eric wrote: > Hi Jacob, > > On 6/9/19 3:44 PM, Jacob Pan wrote: > > Guest shared virtual address (SVA) may require host to shadow guest > > PASID tables. Guest PASID can also be allocated from the host via > > enlightened interfaces. In this case, guest

Re: [PATCH 3/8] of/fdt: add function to get the SoC wide DMA addressable memory size

2019-08-05 Thread Rob Herring
On Mon, Aug 5, 2019 at 10:03 AM Nicolas Saenz Julienne wrote: > > Hi Rob, > Thanks for the review! > > On Fri, 2019-08-02 at 11:17 -0600, Rob Herring wrote: > > On Wed, Jul 31, 2019 at 9:48 AM Nicolas Saenz Julienne > > wrote: > > > Some SoCs might have multiple interconnects each with their own

Re: [PATCH 3/8] of/fdt: add function to get the SoC wide DMA addressable memory size

2019-08-05 Thread Nicolas Saenz Julienne
Hi Rob, Thanks for the review! On Fri, 2019-08-02 at 11:17 -0600, Rob Herring wrote: > On Wed, Jul 31, 2019 at 9:48 AM Nicolas Saenz Julienne > wrote: > > Some SoCs might have multiple interconnects each with their own DMA > > addressing limitations. This function parses the 'dma-ranges' on each

Re: large DMA segments vs SWIOTLB

2019-08-05 Thread Lucas Stach
Hi Christoph, Am Donnerstag, den 01.08.2019, 16:00 +0200 schrieb Christoph Hellwig: > On Thu, Aug 01, 2019 at 10:35:02AM +0200, Lucas Stach wrote: > > Hi Christoph, > > > > Am Donnerstag, den 01.08.2019, 09:29 +0200 schrieb Christoph Hellwig: > > > Hi Lukas, > > > > > > have you tried the

[PATCH] dma-direct: don't truncate dma_required_mask to bus addressing capabilities

2019-08-05 Thread Lucas Stach
The dma required_mask needs to reflect the actual addressing capabilities needed to handle the whole system RAM. When truncated down to the bus addressing capabilities dma_addressing_limited() will incorrectly signal no limitations for devices which are restricted by the bus_dma_mask. Fixes:

[PATCH v3 1/8] dma: debug: Replace strncmp with str_has_prefix

2019-08-05 Thread Chuhong Yuan
strncmp(str, const, len) is error-prone because len is easy to have typo. The example is the hard-coded len has counting error or sizeof(const) forgets - 1. So we prefer using newly introduced str_has_prefix() to substitute such strncmp to make code better. Signed-off-by: Chuhong Yuan ---

[PATCH v3 0/8] Replace strncmp with str_has_prefix

2019-08-05 Thread Chuhong Yuan
The commit 72921427d46b ("string.h: Add str_has_prefix() helper function") introduced str_has_prefix() to substitute error-prone strncmp(str, const, len). strncmp(str, const, len) is easy to have error in len because of counting error or sizeof(const) without - 1. These patches replace such

Re: [RFC,v3 6/9] media: platform: Add Mediatek ISP P1 V4L2 functions

2019-08-05 Thread Tomasz Figa
Hi Jungo, On Tue, Jul 30, 2019 at 10:45 AM Jungo Lin wrote: > > On Mon, 2019-07-29 at 19:04 +0900, Tomasz Figa wrote: > > On Mon, Jul 29, 2019 at 10:18 AM Jungo Lin wrote: > > > On Fri, 2019-07-26 at 14:49 +0900, Tomasz Figa wrote: > > > > On Wed, Jul 24, 2019 at 1:31 PM Jungo Lin > > > >

Re: [PATCH 4/7] ALSA: pcm: use dma_can_mmap() to check if a device supports dma_mmap_*

2019-08-05 Thread Takashi Iwai
On Mon, 05 Aug 2019 11:11:56 +0200, Christoph Hellwig wrote: > > Replace the local hack with the dma_can_mmap helper to check if > a given device supports mapping DMA allocations to userspace. > > Signed-off-by: Christoph Hellwig > --- > sound/core/pcm_native.c | 5 ++--- > 1 file changed, 2

[PATCH 6/7] dma-mapping: remove ARCH_NO_COHERENT_DMA_MMAP

2019-08-05 Thread Christoph Hellwig
Now that we never use a default ->mmap implementation, and non-coherent architectures can control the presence of ->mmap support by enabling ARCH_HAS_DMA_COHERENT_TO_PFN for the dma direct implementation there is no need for a global config option to control the availability of dma_common_mmap.

[PATCH 4/7] ALSA: pcm: use dma_can_mmap() to check if a device supports dma_mmap_*

2019-08-05 Thread Christoph Hellwig
Replace the local hack with the dma_can_mmap helper to check if a given device supports mapping DMA allocations to userspace. Signed-off-by: Christoph Hellwig --- sound/core/pcm_native.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sound/core/pcm_native.c

[PATCH 7/7] dma-mapping: provide a better default ->get_required_mask

2019-08-05 Thread Christoph Hellwig
Most dma_map_ops instances are IOMMUs that work perfectly fine in 32-bits of IOVA space, and the generic direct mapping code already provides its own routines that is intelligent based on the amount of memory actually present. Wire up the dma-direct routine for the ARM direct mapping code as

[PATCH 3/7] dma-mapping: add a dma_can_mmap helper

2019-08-05 Thread Christoph Hellwig
Add a helper to check if DMA allocations for a specific device can be mapped to userspace using dma_mmap_*. Signed-off-by: Christoph Hellwig --- include/linux/dma-mapping.h | 5 + kernel/dma/mapping.c| 23 +++ 2 files changed, 28 insertions(+) diff --git

[PATCH 5/7] m68knommu: add a pgprot_noncached stub

2019-08-05 Thread Christoph Hellwig
Provide a pgprot_noncached like all the other nommu ports so that common code can rely on it being able to be present. Note that this is generally code that is not actually run on nommu, but at least we can avoid nasty ifdefs by having a stub. Signed-off-by: Christoph Hellwig ---

[PATCH 1/7] dma-mapping: move the dma_get_sgtable API comments from arm to common code

2019-08-05 Thread Christoph Hellwig
The comments are spot on and should be near the central API, not just near a single implementation. Signed-off-by: Christoph Hellwig --- arch/arm/mm/dma-mapping.c | 11 --- kernel/dma/mapping.c | 11 +++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git

remove default fallbacks in dma_map_ops v2

2019-08-05 Thread Christoph Hellwig
Hi all, we have a few places where the DMA mapping layer has non-trivial default actions that are questionable and/or dangerous. This series instead wires up the mmap, get_sgtable and get_required_mask methods explicitly and cleans up some surrounding areas. This also means we could get rid of

[PATCH 2/7] dma-mapping: explicitly wire up ->mmap and ->get_sgtable

2019-08-05 Thread Christoph Hellwig
While the default ->mmap and ->get_sgtable implementations work for the majority of our dma_map_ops impementations they are inherently safe for others that don't use the page allocator or CMA and/or use their own way of remapping not covered by the common code. So remove the defaults if these

Re: [PATCH 1/2] dma-mapping: fix page attributes for dma_mmap_*

2019-08-05 Thread Catalin Marinas
On Mon, Aug 05, 2019 at 11:01:44AM +0300, Christoph Hellwig wrote: > All the way back to introducing dma_common_mmap we've defaulyed to mark s/defaultyed/defaulted/ > the pages as uncached. But this is wrong for DMA coherent devices. > Later on DMA_ATTR_WRITE_COMBINE also got incorrect

Re: [PATCH 2/2] MIPS: remove support for DMA_ATTR_WRITE_COMBINE

2019-08-05 Thread Sergei Shtylyov
Hello! On 05.08.2019 11:01, Christoph Hellwig wrote: Mips uses the KSEG1 kernel memory segment do map dma coherent MIPS. s/do/to/? allocations for n on-coherent devices as uncachable, and does not have Uncacheable? any kind of special support for DMA_ATTR_WRITE_COMBINE in the

[PATCH 1/2] dma-mapping: fix page attributes for dma_mmap_*

2019-08-05 Thread Christoph Hellwig
All the way back to introducing dma_common_mmap we've defaulyed to mark the pages as uncached. But this is wrong for DMA coherent devices. Later on DMA_ATTR_WRITE_COMBINE also got incorrect treatment as that flag is only treated special on the alloc side for non-coherent devices. Introduce a new

[PATCH 2/2] MIPS: remove support for DMA_ATTR_WRITE_COMBINE

2019-08-05 Thread Christoph Hellwig
Mips uses the KSEG1 kernel memory segment do map dma coherent allocations for non-coherent devices as uncachable, and does not have any kind of special support for DMA_ATTR_WRITE_COMBINE in the allocation path. Thus supporting DMA_ATTR_WRITE_COMBINE in dma_mmap_attrs will lead to multiple

fix default dma_mmap_* pgprot v2

2019-08-05 Thread Christoph Hellwig
Hi all, As Shawn pointed out we've had issues with the dma mmap pgprots ever since the dma_common_mmap helper was added beyong the initial architectures - we default to uncached mappings, but for devices that are DMA coherent, or if the DMA_ATTR_NON_CONSISTENT is set (and supported) this can lead

[PATCH] arm: initialize the dma-remap atomic pool for LPAE configs

2019-08-05 Thread Christoph Hellwig
When we use the generic dma-direct + remap code we also need to initialize the atomic pool that is used for GFP_ATOMIC allocations on non-coherent devices. Fixes: ad3c7b18c5b3 ("arm: use swiotlb for bounce buffering on LPAE configs") Signed-off-by: Christoph Hellwig ---

arm swiotlb fix

2019-08-05 Thread Christoph Hellwig
Hi all, my commit to add swiotlb to arm failed to initialize the atomic pool, which is needed for GFP_ATOMIC allocations on non-coherent devices. These are fairly rare, but exist so we should wire it up. For 5.4 I plan to move the initilization to the common dma-remap code so it won't be missed