From: Joerg Roedel
Convert the OMAP IOMMU driver to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code
does the group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/omap-iommu.c | 49 ++
1 file
From: Joerg Roedel
Implement the new def_domain_type call-back for the AMD IOMMU driver.
Signed-off-by: Joerg Roedel
---
drivers/iommu/amd_iommu.c | 15 +++
1 file changed, 15 insertions(+)
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index
From: Joerg Roedel
Convert the Mediatek IOMMU driver to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code
does the group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/mtk_iommu.c | 24 ++--
1 file changed, 6
From: Joerg Roedel
This makes it easier to remove to old code-path when all drivers are
converted. As a side effect that it also fixes the error cleanup
path.
Signed-off-by: Joerg Roedel
---
drivers/iommu/iommu.c | 69 ---
1 file changed, 46
From: Joerg Roedel
When a bus is initialized with iommu-ops, all devices on the bus are
scanned and iommu-groups are allocated for them, and each groups will
also get a default domain allocated.
Until now this happened as soon as the group was created and the first
device added to it. When
These have non-static aliases called map_kernel_range_noflush and
unmap_kernel_range_noflush that just differ slightly in the calling
conventions that pass addr + size instead of an end.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
mm/vmalloc.c | 98
alloc_vm_stack can use a slightly higher level vmalloc function.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
arch/powerpc/kernel/irq.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index
From: Joerg Roedel
Add call-backs to 'struct iommu_ops' as an alternative to the
add_device() and remove_device() call-backs, which will be removed when
all drivers are converted.
The new call-backs will not setupt IOMMU groups and domains anymore,
so also add a probe_finalize() call-back where
From: Joerg Roedel
Convert the arm-smmu and arm-smmu-v3 drivers to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code does the
group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/arm-smmu-v3.c | 38
From: Joerg Roedel
When check_device() fails on the device, it is not handled by the
IOMMU and amd_iommu_add_device() needs to return -ENODEV.
Signed-off-by: Joerg Roedel
---
drivers/iommu/amd_iommu.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git
stack_alloc can use a slightly higher level vmalloc function.
Signed-off-by: Christoph Hellwig
Acked-by: Christian Borntraeger
Acked-by: Peter Zijlstra (Intel)
---
arch/s390/kernel/setup.c | 9 +++--
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/s390/kernel/setup.c
From: Joerg Roedel
All drivers are converted to use the probe/release_device()
call-backs, so the add_device/remove_device() pointers are unused and
the code using them can be removed.
Signed-off-by: Joerg Roedel
---
drivers/iommu/iommu.c | 149 --
Just use __vmalloc_node instead which gets and extra argument. To be
able to to use __vmalloc_node in all caller make it available outside
of vmalloc and implement it in nommu.c.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
include/linux/vmalloc.h | 4 ++--
From: Joerg Roedel
Move the code out of iommu_group_get_for_dev() into a separate
function.
Signed-off-by: Joerg Roedel
---
drivers/iommu/iommu.c | 74 ++-
1 file changed, 45 insertions(+), 29 deletions(-)
diff --git a/drivers/iommu/iommu.c
From: Joerg Roedel
Convert the Intel IOMMU driver to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code
does the group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/intel-iommu.c | 67 -
1 file
From: Joerg Roedel
Remove the tracking of device which could not be probed because
their IOMMU is not probed yet. Replace it with a call to
bus_iommu_probe() when a new IOMMU is probed.
Signed-off-by: Joerg Roedel
---
drivers/iommu/omap-iommu.c | 54 +++---
1
From: Joerg Roedel
Add a check to the bus_iommu_probe() call-path to make sure it ignores
devices which have already been successfully probed. Then export the
bus_iommu_probe() function so it can be used by IOMMU drivers.
Signed-off-by: Joerg Roedel
---
drivers/iommu/iommu.c | 6 +-
From: Joerg Roedel
Convert the Mediatek-v1 IOMMU driver to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code
does the group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/mtk_iommu_v1.c | 50 +++-
1
There are no modular users of this function.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
mm/vmalloc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index d1534d610b48..3375f9508ef6 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@
From: Joerg Roedel
Convert the S390 IOMMU driver to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code
does the group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/s390-iommu.c | 22 ++
1 file changed, 6
From: Joerg Roedel
The check was only needed for the DMA-API implementation in the AMD
IOMMU driver, which no longer exists.
Signed-off-by: Joerg Roedel
---
drivers/iommu/amd_iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/amd_iommu.c
Rename the Kconfig variable to clarify the scope.
Signed-off-by: Christoph Hellwig
Acked-by: Minchan Kim
Acked-by: Peter Zijlstra (Intel)
---
arch/arm/configs/omap2plus_defconfig | 2 +-
include/linux/zsmalloc.h | 2 +-
mm/Kconfig | 2 +-
mm/zsmalloc.c
These helpers are only used for remapping the ISA I/O base. Replace
the mapping side with a remap_isa_range helper in isa-bridge.c that
hard codes all the known arguments, and just remove __iounmap_at in
favour of open coding it in the only caller.
Signed-off-by: Christoph Hellwig
Acked-by:
From: Joerg Roedel
Convert the AMD IOMMU Driver to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code
does the group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/amd_iommu.c | 71 ---
1 file
From: Joerg Roedel
Convert the VirtIO IOMMU driver to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code
does the group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/virtio-iommu.c | 41 +---
1 file
Just use vmap instead of messing with vmalloc internals.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
drivers/staging/media/ipu3/ipu3-css-pool.h | 4 +--
drivers/staging/media/ipu3/ipu3-dmamap.c | 30 ++
2 files changed, 9 insertions(+), 25
The pgprot argument to __vmalloc is always PROT_KERNEL now, so remove
it.
Signed-off-by: Christoph Hellwig
Reviewed-by: Michael Kelley [hyperv]
Acked-by: Gao Xiang [erofs]
Acked-by: Peter Zijlstra (Intel)
---
arch/x86/hyperv/hv_init.c | 3 +--
arch/x86/include/asm/kvm_host.h
From: Joerg Roedel
Well, not really. The call to iommu_alloc_default_domain() in
iommu_group_get_for_dev() has to stay around as long as there are
IOMMU drivers using the add/remove_device() call-backs instead of
probe/release_device().
Those drivers expect that iommu_group_get_for_dev()
Switch the two remaining callers to use __get_vm_area_caller instead.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
arch/powerpc/kernel/pci_64.c | 3 ++-
arch/sh/kernel/cpu/sh4/sq.c | 3 ++-
include/linux/vmalloc.h | 2 --
mm/vmalloc.c | 8
To help enforcing the W^X protection don't allow remapping existing
pages as executable.
x86 bits from Peter Zijlstra ,
arm64 bits from Mark Rutland .
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
arch/arm64/include/asm/pgtable.h | 3 +++
From: Joerg Roedel
Convert the PAMU IOMMU driver to use the probe_device() and
release_device() call-backs of iommu_ops, so that the iommu core code
does the group and sysfs setup.
Signed-off-by: Joerg Roedel
---
drivers/iommu/fsl_pamu_domain.c | 22 +-
1 file changed, 5
From: Joerg Roedel
This is needed to defer default_domain allocation for new IOMMU groups
until all devices have been added to the group.
Signed-off-by: Joerg Roedel
---
drivers/iommu/iommu.c | 9 +++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/iommu/iommu.c
This is always PAGE_KERNEL now.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
mm/vmalloc.c | 35 ++-
1 file changed, 14 insertions(+), 21 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 466a449b3a15..de7952959e82 100644
---
Switch all callers to map_kernel_range, which symmetric to the unmap
side (as well as the _noflush versions).
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
Documentation/core-api/cachetlb.rst | 2 +-
include/linux/vmalloc.h | 10 --
mm/vmalloc.c
This matches the map_kernel_range_noflush API. Also change to pass
a size instead of the end, similar to the noflush version.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
mm/vmalloc.c | 11 +--
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git
None of the callers needs the number of pages, and a 0 / -errno return
value is a lot more intuitive.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
mm/vmalloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index
This allows to unexport map_vm_area and unmap_kernel_range, which are
rather deep internal and should not be available to modules, as they for
example allow fine grained control of mapping permissions, and also
allow splitting the setup of a vmalloc area and the actual mapping and
thus expose
arch_alloc_vmap_stack can use a slightly higher level vmalloc function.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
arch/arm64/include/asm/vmap_stack.h | 6 ++
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/include/asm/vmap_stack.h
The real version just had a few callers that can open code it and
remove one layer of indirection. The nommu stub was public but only
had a single caller, so remove it and avoid a CONFIG_MMU ifdef in
vmalloc.h.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
Ever use of addr in vb_free casts to unsigned long first, and the caller
has an unsigned long version of the address available anyway. Just pass
that and avoid all the casts.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
mm/vmalloc.c | 16 +++-
1 file
Factor code shared between pci_64 and electra_cf into a ioremap_pbh
helper that follows the normal ioremap semantics, and returns a
useful __iomem pointer. Note that it opencodes __ioremap_at as
we know from the callers the slab is available. Switch pci_64
to also store the result as __iomem
Use the designated helper for allocating executable kernel memory, and
remove the now unused PAGE_KERNEL_RX define.
Signed-off-by: Christoph Hellwig
Reviewed-by: Michael Kelley
Acked-by: Wei Liu
Acked-by: Peter Zijlstra (Intel)
---
arch/x86/hyperv/hv_init.c| 2 +-
vm_map_ram can keep mappings around after the vm_unmap_ram. Using that
with non-PAGE_KERNEL mappings can lead to all kinds of aliasing issues.
Signed-off-by: Christoph Hellwig
Acked-by: Greg Kroah-Hartman
Acked-by: Peter Zijlstra (Intel)
---
drivers/staging/android/ion/ion_heap.c | 4 ++--
1
vmap does not take a gfp_t, the flags argument is for VM_* flags.
Signed-off-by: Christoph Hellwig
---
arch/x86/kernel/irq_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
index 12df3a4abfdd..6b32ab009c19 100644
---
Replace the open coded instance of vmap with the actual function. In
the non-contiguous (IOMMU) case this requires an extra find_vm_area,
but given that this isn't a fast path function that is a small price
to pay.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
Hi all,
Peter noticed that with some dumb luck you can toast the kernel address
space with exported vmalloc symbols.
I used this as an opportunity to decruft the vmalloc.c API and make it
much more systematic. This also removes any chance to create vmalloc
mappings outside the designated areas
On Tue, Apr 14, 2020 at 02:25:05PM +0200, Christoph Hellwig wrote:
> Several IOMMU drivers have a bypass mode where they can use a direct
> mapping if the devices DMA mask is large enough. Add generic support
> to the core dma-mapping code to do that to switch those drivers to
> a common
Inline the single page map/unmap/sync dma-direct calls into the now
out of line generic wrappers. This restores the behavior of a single
function call that we had before moving the generic calls out of line.
Besides the dma-mapping callers there are just a few callers in IOMMU
drivers that have a
Hi all,
I've recently beeing chatting with Lu about using dma-iommu and
per-device DMA ops in the intel IOMMU driver, and one missing feature
in dma-iommu is a bypass mode where the direct mapping is used even
when an iommu is attached to improve performance. The powerpc
code already has a
For a long time the DMA API has been implemented inline in dma-mapping.h,
but the function bodies can be quite large. Move them all out of line.
Signed-off-by: Christoph Hellwig
---
include/linux/dma-direct.h | 58 +
include/linux/dma-mapping.h | 247
Use the DMA API bypass mechanism for direct window mappings. This uses
common code and speed up the direct mapping case by avoiding indirect
calls just when not using dma ops at all. It also fixes a problem where
the sync_* methods were using the bypass check for DMA allocations, but
those are
Several IOMMU drivers have a bypass mode where they can use a direct
mapping if the devices DMA mask is large enough. Add generic support
to the core dma-mapping code to do that to switch those drivers to
a common solution.
Signed-off-by: Christoph Hellwig
---
include/linux/device.h | 6
On Mon, Apr 13, 2020 at 04:21:29PM -0600, Alex Williamson wrote:
> Is the objection to a global version or to any version fields? I don't
> really understand the global version, I'd think a mechanism to check
> extensions plus a per structure flags/version would be preferred. The
> former should
On Mon, Apr 13, 2020 at 01:41:57PM -0700, Jacob Pan wrote:
> Hi All,
>
> Just a gentle reminder, any feedback on the options I listed below? New
> ideas will be even better.
>
> Christoph, does the explanation make sense to you? We do have the
> capability/flag based scheme for IOMMU API
On Fri, Apr 10, 2020 at 12:37:20PM -0700, David Rientjes wrote:
> I'll rely on Christoph to determine whether it makes sense to add some
> periodic scavening of the atomic pools, whether that's needed for this to
> be merged, or wheter we should enforce some maximum pool size.
I don't really
> + /*
> + * Unencrypted memory must come directly from DMA atomic pools if
> + * blocking is not allowed.
> + */
> + if (IS_ENABLED(CONFIG_DMA_COHERENT_POOL) &&
> + force_dma_unencrypted(dev) && !gfpflags_allow_blocking(gfp)) {
> + ret =
On Wed, Apr 08, 2020 at 02:21:03PM -0700, David Rientjes wrote:
> +++ b/kernel/dma/pool.c
> @@ -0,0 +1,125 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2012 ARM Ltd.
> + * Copyright (c) 2014 The Linux Foundation
> + * Copyright (C) 2020 Google LLC
Of the old copyrights the
On Tue, Apr 14, 2020 at 04:21:27PM +1000, Alexey Kardashevskiy wrote:
> > Good points, I'll post revised version when you post your v3 of this.
>
>
>
> Any plans on posting v3 of this? Thanks,
Just back from a long weekend. I'll take a stab at it soon.
On 07/04/2020 20:12, Alexey Kardashevskiy wrote:
>
>
> On 07/04/2020 03:17, Christoph Hellwig wrote:
>> On Mon, Apr 06, 2020 at 11:25:09PM +1000, Alexey Kardashevskiy wrote:
> Do you see any serious problem with this approach? Thanks!
Do you have a link to the whole branch? The
101 - 159 of 159 matches
Mail list logo