ARM SMMUv3 architecture in linux
来源:互联网 发布:淘宝新店卖啥好 编辑:程序博客网 时间:2024/06/16 11:06
ARM SMMUv3 architecture in linux
-v0.1 2017.3.12 Sherlock init
-v0.2 2017.4.17 Sherlock add usage part
In [1], we know how SMMU driver has been loaded in ACPI.
During the driver loading, arm_smmu_device_probe will be called. Most part of
this function is to initiate SMMU hardware.
Then add smmu to a global list by: iommu_device_register(&smmu->iommu)
Then bus_set_iommu(&pci_bus_type, &arm_smmu_ops), set iommu_ops for a specific
bus, and call iommu_bus_init(bus, ops) -> bus_register_notifier(bus, nb) to
register a notifier_block to above bus. the notifier callback is iommu_bus_notifier
which will call add_device in SMMU’s iommu_ops:
/* drivers/iommu/arm-smmu-v3.c */arm_smmu_device_probe --> bus_set_iommu(&pci_bus_type, &arm_smmu_ops) --> iommu_bus_init(bus, ops) /* here notifier's callback is iommu_bus_notifier */ --> bus_register_notifier(bus, nb)/* drivers/iommu/iommu.c */iommu_bus_notifier /* action == BUS_NOTIFY_ADD_DEVICE, here ops is iommu_ops */ --> ops->add_device
When a device is adding to a bus, above notifier callback will be called:
/* drivers/base/core.c */device_add(struct device *dev) --> blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_ADD_DEVICE, dev);
/* In drivers/iommu/arm-smmu-v3.c, create related iommu_group for dev */arm_smmu_add_device(struct device *dev) /* reture an iommu_group about this device */ --> iommu_group_get_for_dev(dev) --> ops->device_group(dev) /* there is a algrithm to find/create one iommu_group?? */ --> pci_device_group /* arm_smmu_domain_alloc, one iommu_group <-> one iommu_domain */ --> __iommu_domain_alloc /* add a dev to a iommu_group */ --> iommu_group_add_device(group, dev) --> __iommu_attach_device domain->ops->attach_dev(domain, dev) --> arm_smmu_domain_finalise(domain) /* important!!! */ --> arm_smmu_install_ste_for_dev(dev->iommu_fwspec) /* here is another notifier call chain call? */ --> blocking_notifier_call_chain(&group->notifier, IOMMU_GROUP_NOTIFY_ADD_DEVICE, dev);
The usage of smmu is: 1. DMA, 2. VM
DMA usage
We can go on in [1] to see how a PCIe device use SMMU to do DMA
pci_device_add /* In v4.12, this function will be moved to really_probe */ --> pci_dma_configure --> acpi_dma_configure --> arch_setup_dma_ops --> __iommu_setup_dma_ops --> do_iommu_attach /* * above __iommu_domain_alloc just allocate an * iommu_domain. here we initialize the iova domain * in it. * we do not do the map here. */ --> iommu_dma_init_domain(domain, dma_base, size, dev) --> dev->dma_ops = &iommu_dma_ops
VM usage
to do…
Reference
[1] http://blog.csdn.net/scarecrow_byr/article/details/53844162
- ARM SMMUv3 architecture in linux
- How SMP schedule work in Linux kernel? (ARM architecture)
- Alignment trap: in ARM architecture .
- ARM To Introduce 64-bit Processing in ARMv8 Architecture
- The ARM Architecture
- Memory access ordering part 3 - memory access ordering in the ARM Architecture
- linux arm programming in assembly language
- Memory related MACROs in ARM linux
- 【Learning】Thinking in Architecture
- The ARM University Program, ARM Architecture Fundamentals
- What's the difference between arm-linux- / arm-none-linux-gnueabi- / arm-fsl-linux-gnueabi- in LTIB?
- 3-tier architecture in C#
- Plug-in architecture 学习笔记
- Architecture Tools in VSTS 2010
- C# Plug-In Architecture Articles
- Great Ideas in Computer Architecture
- ARM's architecture CPU access peripheral
- An overview of the ARM architecture
- 给初学者的RxJava2.0教程(八)
- Java ConcurrentModificationException异常原因和解决方法
- 翻转链表
- hdu 1022 简单的栈应用
- Tomcat 安装以及部署网站实例
- ARM SMMUv3 architecture in linux
- 单例模式
- [BZOJ3189][Coci2011][扫描线][线段树]Slika
- 引用
- YOLO V2教程之训练自己的数据
- Jquery怎么获取select选中项 自定义属性的值
- SpringMVC3的ResponseBody返回字符串乱码问题解决
- Win10下Python的安装及相关库的安装
- python——爬虫学习——Beautiful Soup库的使用-(2)