Re: Bug 205201 - Booting halts if Dawicontrol DC-2976 UW SCSI board installed, unless RAM size limited to 3500M

2019-11-27 Thread Christoph Hellwig
On Wed, Nov 27, 2019 at 08:56:25AM +0200, Mike Rapoport wrote: > Maybe we'll simply force bottom up allocation before calling > swiotlb_init()? Anyway, it's the last memblock allocation. That should work, but I don't think it is the proper fix. The underlying issue here is that ZONE_DMA/DMA32

Re: [PATCH v3 09/14] iommu/arm-smmu: Prevent forced unbinding of Arm SMMU drivers

2019-11-27 Thread John Garry
On 26/11/2019 20:27, Saravana Kannan wrote: On Tue, Nov 26, 2019 at 1:13 AM John Garry wrote: On 21/11/2019 11:49, Will Deacon wrote: Forcefully unbinding the Arm SMMU drivers is a pretty dangerous operation, since it will likely lead to catastrophic failure for any DMA devices mastering

Re: [PATCH v3 09/14] iommu/arm-smmu: Prevent forced unbinding of Arm SMMU drivers

2019-11-27 Thread John Garry
On 27/11/2019 11:04, John Garry wrote: On 26/11/2019 20:27, Saravana Kannan wrote: On Tue, Nov 26, 2019 at 1:13 AM John Garry wrote: On 21/11/2019 11:49, Will Deacon wrote: Forcefully unbinding the Arm SMMU drivers is a pretty dangerous operation, since it will likely lead to catastrophic

Re: [PATCH] iommu/arm-smmu: support SMMU module probing from the IORT

2019-11-27 Thread John Garry
On 25/11/2019 16:04, Lorenzo Pieralisi wrote: On Fri, Nov 22, 2019 at 06:41:25PM +0100, Ard Biesheuvel wrote: Add support for SMMU drivers built as modules to the ACPI/IORT device probing path, by deferring the probe of the master if the SMMU driver is known to exist but has not been loaded

Re: [PATCH 2/2] iommu: dma: Use of_iommu_get_resv_regions()

2019-11-27 Thread Robin Murphy
On 27/11/2019 2:16 pm, Thierry Reding wrote: [...] Nevermind that, I figured out that I was missingthe initialization of some of the S2CR variables. I've got something that I think is working now, though I don't know yet how to go about cleaning up the initial mapping and "recycling" it. I'll

Re: [PATCH 2/2] iommu: dma: Use of_iommu_get_resv_regions()

2019-11-27 Thread Thierry Reding
On Wed, Nov 27, 2019 at 01:16:54PM +0100, Thierry Reding wrote: > On Tue, Sep 17, 2019 at 06:59:50PM +0100, Will Deacon wrote: > > On Mon, Sep 02, 2019 at 04:52:45PM +0200, Thierry Reding wrote: > > > On Mon, Sep 02, 2019 at 03:22:35PM +0100, Robin Murphy wrote: > > > > On 29/08/2019 12:14,

[PATCH 1/2] dma-mapping: move dma_addressing_limited out of line

2019-11-27 Thread Christoph Hellwig
This function isn't used in the fast path, and moving it out of line will reduce include clutter with the next change. Signed-off-by: Christoph Hellwig --- include/linux/dma-mapping.h | 14 +- kernel/dma/mapping.c| 15 +++ 2 files changed, 16 insertions(+), 13

make dma_addressing_limited work for memory encryption setups

2019-11-27 Thread Christoph Hellwig
Hi all, this little series fixes dma_addressing_limited to return true for systems that use bounce buffers due to memory encryption. ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

[PATCH 2/2] dma-mapping: force unencryped devices are always addressing limited

2019-11-27 Thread Christoph Hellwig
Devices that are forced to DMA through unencrypted bounce buffers need to be treated as if they are addressing limited. Signed-off-by: Christoph Hellwig --- kernel/dma/mapping.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/dma/mapping.c b/kernel/dma/mapping.c index

Re: Bug 205201 - Booting halts if Dawicontrol DC-2976 UW SCSI board installed, unless RAM size limited to 3500M

2019-11-27 Thread Christian Zigotzky
On 27 November 2019 at 07:56 am, Mike Rapoport wrote: Maybe we'll simply force bottom up allocation before calling swiotlb_init()? Anyway, it's the last memblock allocation. diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 62f74b1b33bd..771e6cf7e2b9 100644 ---

[PATCH v3 2/2] PCI: Add DMA alias quirk for PLX PEX NTB

2019-11-27 Thread James Sewart via iommu
The PLX PEX NTB forwards DMA transactions using Requester ID's that don't exist as PCI devices. The devfn for a transaction is used as an index into a lookup table storing the origin of a transaction on the other side of the bridge. This patch aliases all possible devfn's to the NTB device so

[PATCH v3 1/2] PCI: Add parameter nr_devfns to pci_add_dma_alias

2019-11-27 Thread James Sewart via iommu
pci_add_dma_alias can now be used to create a dma alias for a range of devfns. Signed-off-by: James Sewart --- drivers/pci/pci.c| 21 - drivers/pci/quirks.c | 14 +++--- include/linux/pci.h | 2 +- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git

Re: [PATCH 1/3] iommu: match the original algorithm

2019-11-27 Thread Qian Cai
> On Nov 27, 2019, at 1:01 PM, John Garry wrote: > > I haven't gone into the details, but this patch alone is giving this: > > root@(none)$ [ 123.857024] kmemleak: 8 new suspected memory leaks (see > /sys/kernel/debug/kmemleak) > > root@(none)$ cat /sys/kernel/debug/kmemleak >

Re: [PATCH v3 0/7] Raspberry Pi 4 PCIe support

2019-11-27 Thread Nicolas Saenz Julienne
Hi Bjorn, On Tue, 2019-11-26 at 15:50 -0600, Bjorn Helgaas wrote: > On Tue, Nov 26, 2019 at 10:19:38AM +0100, Nicolas Saenz Julienne wrote: > > This series aims at providing support for Raspberry Pi 4's PCIe > > controller, which is also shared with the Broadcom STB family of > > devices. > > Jim

Re: [PATCH v3 1/7] linux/log2.h: Add roundup/rounddown_pow_two64() family of functions

2019-11-27 Thread Nicolas Saenz Julienne
On Wed, 2019-11-27 at 18:06 +, Robin Murphy wrote: > On 26/11/2019 12:51 pm, Leon Romanovsky wrote: > > On Tue, Nov 26, 2019 at 10:19:39AM +0100, Nicolas Saenz Julienne wrote: > > > Some users need to make sure their rounding function accepts and returns > > > 64bit long variables regardless

Re: [PATCH v3 1/7] linux/log2.h: Add roundup/rounddown_pow_two64() family of functions

2019-11-27 Thread Robin Murphy
On 27/11/2019 6:24 pm, Nicolas Saenz Julienne wrote: On Wed, 2019-11-27 at 18:06 +, Robin Murphy wrote: On 26/11/2019 12:51 pm, Leon Romanovsky wrote: On Tue, Nov 26, 2019 at 10:19:39AM +0100, Nicolas Saenz Julienne wrote: Some users need to make sure their rounding function accepts and

Re: [PATCH v3 1/7] linux/log2.h: Add roundup/rounddown_pow_two64() family of functions

2019-11-27 Thread Nicolas Saenz Julienne
On Wed, 2019-11-27 at 19:06 +, Robin Murphy wrote: > On 27/11/2019 6:24 pm, Nicolas Saenz Julienne wrote: > > On Wed, 2019-11-27 at 18:06 +, Robin Murphy wrote: > > > On 26/11/2019 12:51 pm, Leon Romanovsky wrote: > > > > On Tue, Nov 26, 2019 at 10:19:39AM +0100, Nicolas Saenz Julienne

Re: [PATCH 2/2] dma-mapping: force unencryped devices are always addressing limited

2019-11-27 Thread Thomas Hellstrom via iommu
Hi, On Wed, 2019-11-27 at 15:40 +0100, Christoph Hellwig wrote: > Devices that are forced to DMA through unencrypted bounce buffers > need to be treated as if they are addressing limited. > > Signed-off-by: Christoph Hellwig > --- > kernel/dma/mapping.c | 2 ++ > 1 file changed, 2

Re: [PATCH v3 1/7] linux/log2.h: Add roundup/rounddown_pow_two64() family of functions

2019-11-27 Thread Leon Romanovsky
On Wed, Nov 27, 2019 at 07:06:12PM +, Robin Murphy wrote: > On 27/11/2019 6:24 pm, Nicolas Saenz Julienne wrote: > > On Wed, 2019-11-27 at 18:06 +, Robin Murphy wrote: > > > On 26/11/2019 12:51 pm, Leon Romanovsky wrote: > > > > On Tue, Nov 26, 2019 at 10:19:39AM +0100, Nicolas Saenz

Re: [PATCH v3 1/7] linux/log2.h: Add roundup/rounddown_pow_two64() family of functions

2019-11-27 Thread Nicolas Saenz Julienne
On Tue, 2019-11-26 at 10:19 +0100, Nicolas Saenz Julienne wrote: > Some users need to make sure their rounding function accepts and returns > 64bit long variables regardless of the architecture. Sadly > roundup/rounddown_pow_two() takes and returns unsigned longs. Create a > new generic 64bit

Re: [PATCH 1/3] iommu: match the original algorithm

2019-11-27 Thread John Garry
On 21/11/2019 00:13, Cong Wang wrote: The IOVA cache algorithm implemented in IOMMU code does not exactly match the original algorithm described in the paper. Particularly, it doesn't need to free the loaded empty magazine when trying to put it back to global depot. This patch makes it exactly

Re: [PATCH v3 1/2] PCI: Add parameter nr_devfns to pci_add_dma_alias

2019-11-27 Thread Logan Gunthorpe
On 2019-11-27 6:27 a.m., James Sewart wrote: > * This helper encodes an 8-bit devfn as a bit number in dma_alias_mask > * which is used to program permissible bus-devfn source addresses for DMA > @@ -5873,8 +5874,12 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode, > * cannot be

Re: [PATCH v3 1/7] linux/log2.h: Add roundup/rounddown_pow_two64() family of functions

2019-11-27 Thread Robin Murphy
On 26/11/2019 12:51 pm, Leon Romanovsky wrote: On Tue, Nov 26, 2019 at 10:19:39AM +0100, Nicolas Saenz Julienne wrote: Some users need to make sure their rounding function accepts and returns 64bit long variables regardless of the architecture. Sadly roundup/rounddown_pow_two() takes and

Re: [bug] __blk_mq_run_hw_queue suspicious rcu usage

2019-11-27 Thread Christoph Hellwig
On Wed, Nov 27, 2019 at 02:11:28PM -0800, David Rientjes wrote: > So we're left with making dma_pool_alloc(GFP_ATOMIC) actually be atomic > even when the DMA needs to be unencrypted for SEV. Christoph's suggestion > was to wire up dmapool in kernel/dma/remap.c for this. Is that necessary > to

Re: [PATCH 2/2] dma-mapping: force unencryped devices are always addressing limited

2019-11-27 Thread h...@lst.de
On Wed, Nov 27, 2019 at 06:22:57PM +, Thomas Hellstrom wrote: > > bool dma_addressing_limited(struct device *dev) > > { > > + if (force_dma_unencrypted(dev)) > > + return true; > > return min_not_zero(dma_get_mask(dev), dev->bus_dma_limit) < > >

How to read BIOS'es memory from IOMMU

2019-11-27 Thread Aaron Gray
Hi, I am interested in writing a program to verify BIOS integrity via SHA512. Most modern BIOS'es seem to be accessible through IOMMU. I'm wondering if there is a device driver for IOMMU or whether one could be created for the purposes of accessing BIOS memory. If anyone has any leads or advice

Re: [bug] __blk_mq_run_hw_queue suspicious rcu usage

2019-11-27 Thread David Rientjes via iommu
On Wed, 18 Sep 2019, Christoph Hellwig wrote: > On Tue, Sep 17, 2019 at 06:41:02PM +, Lendacky, Thomas wrote: > > > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > > > --- a/drivers/nvme/host/pci.c > > > +++ b/drivers/nvme/host/pci.c > > > @@ -1613,7 +1613,8 @@ static int

[PATCH v2 7/8] iommu/vt-d: Identify domains using first level page table

2019-11-27 Thread Lu Baolu
This checks whether a domain should use first level page table for map/unmap. And if so, we should attach the domain to the device in first level translation mode. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Yi Sun Cc: Sanjay Kumar Signed-off-by: Lu Baolu ---

[PATCH v2 5/8] iommu/vt-d: Add first level page table interfaces

2019-11-27 Thread Lu Baolu
This adds functions to manipulate first level page tables which could be used by a scalale mode capable IOMMU unit. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Yi Sun Signed-off-by: Lu Baolu --- drivers/iommu/Makefile | 2 +- drivers/iommu/intel-iommu.c

[PATCH v2 3/8] iommu/vt-d: Implement second level page table ops

2019-11-27 Thread Lu Baolu
This adds the implementation of page table callbacks for the second level page table. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Yi Sun Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 81 + 1 file changed, 81 insertions(+)

[PATCH v2 0/8] Use 1st-level for DMA remapping

2019-11-27 Thread Lu Baolu
Intel VT-d in scalable mode supports two types of page talbes for DMA translation: the first level page table and the second level page table. The first level page table uses the same format as the CPU page table, while the second level page table keeps compatible with previous formats. The

[PATCH v2 2/8] iommu/vt-d: Move domain_flush_cache helper into header

2019-11-27 Thread Lu Baolu
So that it could be used in other source files as well. Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 7 --- include/linux/intel-iommu.h | 7 +++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index

[PATCH v2 4/8] iommu/vt-d: Apply per domain second level page table ops

2019-11-27 Thread Lu Baolu
This applies per domain page table ops to various domain mapping and unmapping interfaces. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 118 1 file changed, 52 insertions(+), 66 deletions(-) diff

[PATCH v2 1/8] iommu/vt-d: Add per domain page table ops

2019-11-27 Thread Lu Baolu
The Intel VT-d in scalable mode supports two types of page talbes for DMA translation: the first level page table and the second level page table. The IOMMU driver is able to choose one of them for DMA remapping according to the use case. The first level page table uses the same format as the CPU

[PATCH v2 8/8] iommu/vt-d: Add set domain DOMAIN_ATTR_NESTING attr

2019-11-27 Thread Lu Baolu
This adds the Intel VT-d specific callback of setting DOMAIN_ATTR_NESTING domain attribution. It is necessary to let the VT-d driver know that the domain represents a virutual machine which requires the IOMMU hardware to support nested translation mode. Return success if the IOMMU hardware suports

[PATCH v2 6/8] iommu/vt-d: Implement first level page table ops

2019-11-27 Thread Lu Baolu
This adds the implementation of page table callbacks for the first level page table. Cc: Ashok Raj Cc: Jacob Pan Cc: Kevin Tian Cc: Liu Yi L Cc: Yi Sun Signed-off-by: Lu Baolu --- drivers/iommu/intel-iommu.c | 56 + 1 file changed, 56 insertions(+) diff

Re: [PATCH 2/2] iommu: dma: Use of_iommu_get_resv_regions()

2019-11-27 Thread Thierry Reding
On Tue, Sep 17, 2019 at 06:59:50PM +0100, Will Deacon wrote: > On Mon, Sep 02, 2019 at 04:52:45PM +0200, Thierry Reding wrote: > > On Mon, Sep 02, 2019 at 03:22:35PM +0100, Robin Murphy wrote: > > > On 29/08/2019 12:14, Thierry Reding wrote: > > > > From: Thierry Reding > > > > > > > > For