[RFC 0/4] Raspberry Pi 4 DMA addressing support

2019-07-17 Thread Nicolas Saenz Julienne
Hi all, this series attempts to address some issues we found while bringing up the new Raspberry Pi 4 in arm64 and it's intended to serve as a follow up to this: https://www.spinics.net/lists/arm-kernel/msg740650.html The new Raspberry Pi 4 has up to 4GB of ram but most devices can only address

[RFC 3/4] dma-direct: add dma_direct_min_mask

2019-07-17 Thread Nicolas Saenz Julienne
Historically devices with ZONE_DMA32 have been assumed to be able to address at least the lower 4GB of ram for DMA. This is still the defualt behavior yet the Raspberry Pi 4 is limited to the first GB of memory. This has been observed to trigger failures in dma_direct_supported() as the 'min_mask'

Re: [PATCH v8 07/21] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-07-17 Thread Will Deacon
On Wed, Jul 17, 2019 at 08:44:19PM +0800, Yong Wu wrote: > On Mon, 2019-07-15 at 10:51 +0100, Will Deacon wrote: > > On Sun, Jul 14, 2019 at 12:41:20PM +0800, Yong Wu wrote: > > > @@ -742,7 +763,9 @@ static struct io_pgtable > > > *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg, > > > { > > >

Re: add swiotlb support to arm32

2019-07-17 Thread Vignesh Raghavendra via iommu
Hi, On 09/07/19 7:50 PM, Christoph Hellwig wrote: > Hi Russell, > > This series adds swiotlb support to the 32-bit arm port to ensure > platforms with LPAE support can support DMA mapping for all devices > using 32-bit dma masks, just like we do on other ports that support >> 32-bit physical

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

2019-07-17 Thread Alex Williamson
On Sat, 25 May 2019 13:41:33 +0800 Lu Baolu wrote: > Previously, get_valid_domain_for_dev() is used to retrieve the > DMA domain which has been attached to the device or allocate one > if no domain has been attached yet. As we have delegated the DMA > domain management to upper layer, this

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

2019-07-17 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 v3 3/6] dma-mapping: Remove dma_check_mask()

2019-07-17 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 v3 4/6] x86, s390/mm: Move sme_active() and sme_me_mask to x86-specific header

2019-07-17 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 v3 6/6] s390/mm: Remove sev_active() function

2019-07-17 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 --- arch/s390/include/asm/mem_encrypt.h | 1 - arch/s390/mm/init.c | 8 +--- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git

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

2019-07-17 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 v3 5/6] fs/core/vmcore: Move sev_active() reference to x86 arch code

2019-07-17 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 v3 0/6] Remove x86-specific code from generic headers

2019-07-17 Thread Thiago Jung Bauermann
Hello, This version is mostly about splitting up patch 2/3 into three separate patches, as suggested by Christoph Hellwig. Two other changes are a fix in patch 1 which wasn't selecting ARCH_HAS_MEM_ENCRYPT for s390 spotted by Janani and removal of sme_active and sev_active symbol exports as

Re: [RFC PATCH] virtio_ring: Use DMA API if guest memory is encrypted

2019-07-17 Thread Thiago Jung Bauermann
Hello, Just going back to this question which I wasn't able to answer. Thiago Jung Bauermann writes: > Michael S. Tsirkin writes: > >> So far so good, but now a question: >> >> how are we handling guest address width limitations? >> Is VIRTIO_F_ACCESS_PLATFORM_IDENTITY_ADDRESS subject to >>

Re: [PATCH v8 07/21] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-07-17 Thread Yong Wu
On Wed, 2019-07-17 at 15:23 +0100, Will Deacon wrote: > On Wed, Jul 17, 2019 at 08:44:19PM +0800, Yong Wu wrote: > > On Mon, 2019-07-15 at 10:51 +0100, Will Deacon wrote: > > > On Sun, Jul 14, 2019 at 12:41:20PM +0800, Yong Wu wrote: > > > > @@ -742,7 +763,9 @@ static struct io_pgtable > > > >

fix nvme performance regression due to dma_max_mapping_size()

2019-07-17 Thread Christoph Hellwig
Hi all, the new dma_max_mapping_size function is a little to eager to limit the I/O size if the swiotlb buffer is present, but the device is not addressing limited. Fix this by adding an additional check. ___ iommu mailing list

[PATCH 2/2] dma-direct: only limit the mapping size if swiotlb could be used

2019-07-17 Thread Christoph Hellwig
Don't just check for a swiotlb buffer, but also if buffering might be required for this particular device. Fixes: 133d624b1cee ("dma: Introduce dma_max_mapping_size()") Reported-by: Benjamin Herrenschmidt Signed-off-by: Christoph Hellwig Tested-by: Benjamin Herrenschmidt ---

Re: [PATCH v8 07/21] iommu/io-pgtable-arm-v7s: Extend MediaTek 4GB Mode

2019-07-17 Thread Yong Wu
On Mon, 2019-07-15 at 10:51 +0100, Will Deacon wrote: > On Sun, Jul 14, 2019 at 12:41:20PM +0800, Yong Wu wrote: > > On Thu, 2019-07-11 at 13:31 +0100, Will Deacon wrote: > > > This looks like the right sort of idea. Basically, I was thinking that you > > > can use the oas in conjunction with the