Skip to content

backport iommu关于default_domain的改动#82

Merged
sterling-teng merged 25 commits into
RVCK-Project:rvck-6.6from
uestc-gr:iommu
Aug 31, 2025
Merged

backport iommu关于default_domain的改动#82
sterling-teng merged 25 commits into
RVCK-Project:rvck-6.6from
uestc-gr:iommu

Conversation

@uestc-gr
Copy link
Copy Markdown
Contributor

@uestc-gr uestc-gr commented Jul 31, 2025

参见如下riscv iommu的合入计划,首先backport iommu关于default_domain的改动,该特性已经测试通过。
#73

这个特性在RVCK重新合入iommu功能,这个PR为RISC-V IOMMU的其中一个前置补丁,它增加了Identity Domain,并为所有的iommu提供一个default domain,主要测试方法为检查各个架构的iommu是否能正常初始化并生成default_domain。。

这个补丁的核心目的是重构IOMMU子系统默认域类型的处理方式,主要修改点如下:
1、移除 set_platform_dma_ops回调引入 identity_domain,iommu会尝试创建一个能满足设备要求和驱动能力的默认域(主要是DMA域)。如果设备需要标识映射且驱动支持,则创建标识域;如果设备需要DMA映射且驱动支持,则创建DMA域。
2、所有实现了 default_domain 的IOMMU驱动(如Intel VT-d, AMD-Vi, ARM SMMU-v1/v2, etc.)都需要进行修改以适应新的接口。

@uestc-gr
Copy link
Copy Markdown
Contributor Author

uestc-gr commented Aug 4, 2025

iommu的其中一部分前置补丁,已经重新rebase,麻烦尽快merge一下

@sterling-teng
Copy link
Copy Markdown
Contributor

iommu的其中一部分前置补丁,已经重新rebase,麻烦尽快merge一下

好的,预计要到本周晚些时候。

@wangliu-iscas
Copy link
Copy Markdown
Collaborator

/check

@oervci
Copy link
Copy Markdown

oervci commented Aug 21, 2025

开始测试

@oervci
Copy link
Copy Markdown

oervci commented Aug 21, 2025

@oervci
Copy link
Copy Markdown

oervci commented Aug 21, 2025

Kernel build success!

@oervci
Copy link
Copy Markdown

oervci commented Aug 21, 2025

@oervci
Copy link
Copy Markdown

oervci commented Aug 21, 2025

mainline inclusion
from mainline-v6.14-rc7
commit b46064a
category: feature
bugzilla: RVCK-Project#75

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

It turns out that deferred default domain creation leaves a subtle
race window during iommu_device_register() wherein a client driver may
asynchronously probe in parallel and get as far as performing DMA API
operations with dma-direct, only to be switched to iommu-dma underfoot
once the default domain attachment finally happens, with obviously
disastrous consequences. Even the wonky of_iommu_configure() path is at
risk, since iommu_fwspec_init() will no longer defer client probe as the
instance ops are (necessarily) already registered, and the "replay"
iommu_probe_device() call can see dev->iommu_group already set and so
think there's nothing to do either.

Fortunately we already have the right tool in the right place in the
form of iommu_device_use_default_domain(), which just needs to ensure
that said default domain is actually ready to *be* used. Deferring the
client probe shouldn't have too much impact, given that this only
happens while the IOMMU driver is probing, and thus due to kick the
deferred probe list again once it finishes.

Reported-by: Charan Teja Kalla <quic_charante@quicinc.com>
Fixes: 98ac73f ("iommu: Require a default_domain for all iommu drivers")
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/e88b94c9b575034a2c98a48b3d383654cbda7902.1740753261.git.robin.murphy@arm.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Gao Rui <gao.rui@zte.com.cn>
@oervci
Copy link
Copy Markdown

oervci commented Aug 29, 2025

开始测试

@oervci
Copy link
Copy Markdown

oervci commented Aug 29, 2025

@oervci
Copy link
Copy Markdown

oervci commented Aug 29, 2025

Kernel build success!

@oervci
Copy link
Copy Markdown

oervci commented Aug 29, 2025

@oervci
Copy link
Copy Markdown

oervci commented Aug 29, 2025

Lava check done! result url: https://lava.oerv.ac.cn/results/528/0_rvck_common-test_qemu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants