Skip to content

sync: rvck #287: iommu, dma-mapping: Simplify arch_setup_dma_ops#238

Merged
xmzzz merged 4 commits into
RVCK-Project:OLK-6.6from
ieiao:PR287@rvck
Jun 11, 2026
Merged

sync: rvck #287: iommu, dma-mapping: Simplify arch_setup_dma_ops#238
xmzzz merged 4 commits into
RVCK-Project:OLK-6.6from
ieiao:PR287@rvck

Conversation

@ieiao

@ieiao ieiao commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Sync commits from rvck PR 287.
Source PR: RVCK-Project/rvck#287

原始提交共7个commit,其中前4个当前源码树中已存在,同步剩余3个commit。
新增一个revert补丁,移除了riscv iommu驱动中的probe_finalize实现,解决编译报错问题。

mainline inclusion
from Linux 6.10-rc1
commit ad4750b07d3462ce29a0c9b1e88b2a1f9795290e
category: feature
bugzilla: RVCK-Project/rvck#286

--------------------------------

It's now easy to retrieve the device's DMA limits if we want to check
them against the domain aperture, so do that ourselves instead of
relying on them being passed through the callchain.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
[sync from rvck.]
Signed-off-by: WeiHao Li <cn.liweihao@gmail.com>
mainline inclusion
from Linux 6.10-rc1
commit b67483b3c44eaef2f771fa4c712e13f452675a67
category: feature
bugzilla: RVCK-Project/rvck#286

--------------------------------

It's somewhat hard to see, but arm64's arch_setup_dma_ops() should only
ever call iommu_setup_dma_ops() after a successful iommu_probe_device(),
which means there should be no harm in achieving the same order of
operations by running it off the back of iommu_probe_device() itself.
This then puts it in line with the x86 and s390 .probe_finalize bodges,
letting us pull it all into the main flow properly. As a bonus this lets
us fold in and de-scope the PCI workaround setup as well.

At this point we can also then pull the call up inside the group mutex,
and avoid having to think about whether iommu_group_store_type() could
theoretically race and free the domain if iommu_setup_dma_ops() ran just
*before* iommu_device_use_default_domain() claims it... Furthermore we
replace one .probe_finalize call completely, since the only remaining
implementations are now one which only needs to run once for the initial
boot-time probe, and two which themselves render that path unreachable.

This leaves us a big step closer to realistically being able to unpick
the variety of different things that iommu_setup_dma_ops() has been
muddling together, and further streamline iommu-dma into core API flows
in future.

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> # For Intel IOMMU
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Niklas Schnelle <schnelle@linux.ibm.com> # for s390
Tested-by: Niklas Schnelle <schnelle@linux.ibm.com> # for s390
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
[sync from rvck.]
Signed-off-by: WeiHao Li <cn.liweihao@gmail.com>
mainline inclusion
from Linux 6.10-rc1
commit f091e93306e0429ebb7589b9874590b6a9705e64
category: feature
bugzilla: RVCK-Project/rvck#286

--------------------------------

The dma_base, size and iommu arguments are only used by ARM, and can
now easily be deduced from the device itself, so there's no need to pass
them through the callchain as well.

Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Michael Kelley <mhklinux@outlook.com> # For Hyper-V
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Tested-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
[sync from rvck.]
Signed-off-by: WeiHao Li <cn.liweihao@gmail.com>
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck-olk/actions/runs/27118087805

参数解析结果
args value
repository RVCK-Project/rvck-olk
head ref pull/238/head
base ref OLK-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test failure
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

kunit test failed

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 0

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck-olk/238_27118087805_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck-olk/238_27118087805_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck-olk_pull_request_target_238__common-test_qemu

result: Lava check done!

…ver"

driver inclusion
category: cleanup
bugzilla: RVCK-Project/rvck#286

--------------------------------

This reverts commit cc4640f.

Starting with 3ced95f,
iommu_setup_dma_ops() has been centralized and is no longer exported.
riscv_iommu_ops also no longer requires the probe_finalize callback.
Therefore, we need to revert the patch that added the probe_finalize
callback.

Signed-off-by: WeiHao Li <cn.liweihao@gmail.com>
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

开始测试 log: https://github.com/RVCK-Project/rvck-olk/actions/runs/27184171656

参数解析结果
args value
repository RVCK-Project/rvck-olk
head ref pull/238/head
base ref OLK-6.6
LAVA repo RVCK-Project/lavaci
LAVA hardware ['qemu']
LAVA Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:
check result
kunit-test failure
kernel-build success
check-patch success
lava-trigger-qemu success
lava-trigger-sg2042 skipped
lava-trigger-k1 skipped
lava-trigger-lpi4a skipped

Kunit Test Result

kunit test failed

Kernel Build Result

Check Patch Result

Total Errors 0
Total Warnings 0

LAVA Check (qemu)

args value
testcase_repo RVCK-Project/lavaci
lava_template lava-job-template/qemu/qemu-ltp.yaml
testcase_path lava-testcases/common-test/ltp/ltp.yaml
kernel_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck-olk/238_27184171656_1/Image
initramfs_download_url http://10.30.190.110/openEuler-RISC-V/RVCK/OERV-RVCI/RVCK-Project/rvck-olk/238_27184171656_1/initramfs.img
rootfs_download_url https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/openEuler24.03-LTS-SP1/openeuler-rootfs.img.zst
testcase_ref main
testitem_name RVCK-Project_rvck-olk_pull_request_target_238__common-test_qemu

result: Lava check done!

@xmzzz
xmzzz merged commit cea8b73 into RVCK-Project:OLK-6.6 Jun 11, 2026
51 of 53 checks passed
@ieiao
ieiao deleted the PR287@rvck branch June 25, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants