From: Sai Praneeth Prakhya
Some devices are reqired to use a specific type (identity or dma)
of default domain when they are used with a vendor iommu. When the
system level default domain type is different from it, the vendor
iommu driver has to request a new default domain with
iommu_request_dma
This function just has a single caller, open code it there.
Signed-off-by: Christoph Hellwig
Acked-by: Peter Zijlstra (Intel)
---
mm/vmalloc.c | 10 +-
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index b0c7cdc8701a..258220b203f1 100644
--- a/
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 ch
From: Joerg Roedel
Convert the QCOM 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/qcom_iommu.c | 24 +++-
1 file changed, 7 inser
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 20cce366e951..73b4
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 in
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 insertions(+
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 other
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 1
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 a/drivers/iommu/amd_iom
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 b/a
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 --
inclu
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 ++--
kernel/bpf
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 b/drivers/io
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 c
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 fi
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 +-
includ
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
@@ -2029,7
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 inserti
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 b/drivers/iommu/a
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: Pete
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
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 cha
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 deleti
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() returns
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 in
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 b/d
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 +++
arch/x86/include/asm/pgtabl
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 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
--- a/
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 a/mm/vm
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 a3d8
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 vmall
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
b/arch
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)
---
include/linux
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 change
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 poin
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 +-
arch/x86/include
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
--- a/ar
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)
---
kernel/dm
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 o
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 solution.
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 simila
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 pa
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 extensio
101 - 157 of 157 matches
Mail list logo