dev/iommu_group/iommu_domain 三者关系的简单理解
来源:互联网 发布:中国外交有多阴险知乎 编辑:程序博客网 时间:2024/06/05 17:43
从device这个结构体中可以得到struct iommu_group *group;
例如:
struct iommu_group *iommu_group_get(struct device *dev)
{
struct iommu_group *group = dev->iommu_group;
if (group)
kobject_get(group->devices_kobj);
return group;
}
group = iommu_group_get(dev);
而iommu_group 有包含iommu_domain
例如:domain = group->domain;
总结一下:dev->iommu_group->domain.可见domain 代表一个具体的设备使用iommu的详细spec。
有了domian只有就可以通过iommu_dma_init_domain 来设定这个dev使用smmu详细的spec
int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
u64 size, struct device *dev)
{
struct iova_domain *iovad = cookie_iovad(domain);
unsigned long order, base_pfn, end_pfn;
if (!iovad)
return -ENODEV;
/* Use the smallest supported page size for IOVA granularity */
order = __ffs(domain->pgsize_bitmap);
base_pfn = max_t(unsigned long, 1, base >> order);
end_pfn = (base + size - 1) >> order;
}
例如我们会根据domain->pgsize_bitmap 来决定order等。所以说domain 代表这个dev使用iommu详细的spec.
而目前系统中的iommu_group 主要分成两个group,一个是pcie。一个是generic ,这个从下面这个函数中可以看出
static struct iommu_group *arm_smmu_device_group(struct device *dev)
{
struct iommu_group *group;
/*
* We don't support devices sharing stream IDs other than PCI RID
* aliases, since the necessary ID-to-device lookup becomes rather
* impractical given a potential sparse 32-bit stream ID space.
*/
if (dev_is_pci(dev))
group = pci_device_group(dev);
else
group = generic_device_group(dev);
return group;
}
例如:
struct iommu_group *iommu_group_get(struct device *dev)
{
struct iommu_group *group = dev->iommu_group;
if (group)
kobject_get(group->devices_kobj);
return group;
}
group = iommu_group_get(dev);
而iommu_group 有包含iommu_domain
例如:domain = group->domain;
总结一下:dev->iommu_group->domain.可见domain 代表一个具体的设备使用iommu的详细spec。
有了domian只有就可以通过iommu_dma_init_domain 来设定这个dev使用smmu详细的spec
int iommu_dma_init_domain(struct iommu_domain *domain, dma_addr_t base,
u64 size, struct device *dev)
{
struct iova_domain *iovad = cookie_iovad(domain);
unsigned long order, base_pfn, end_pfn;
if (!iovad)
return -ENODEV;
/* Use the smallest supported page size for IOVA granularity */
order = __ffs(domain->pgsize_bitmap);
base_pfn = max_t(unsigned long, 1, base >> order);
end_pfn = (base + size - 1) >> order;
}
例如我们会根据domain->pgsize_bitmap 来决定order等。所以说domain 代表这个dev使用iommu详细的spec.
而目前系统中的iommu_group 主要分成两个group,一个是pcie。一个是generic ,这个从下面这个函数中可以看出
static struct iommu_group *arm_smmu_device_group(struct device *dev)
{
struct iommu_group *group;
/*
* We don't support devices sharing stream IDs other than PCI RID
* aliases, since the necessary ID-to-device lookup becomes rather
* impractical given a potential sparse 32-bit stream ID space.
*/
if (dev_is_pci(dev))
group = pci_device_group(dev);
else
group = generic_device_group(dev);
return group;
}
0 0
- dev/iommu_group/iommu_domain 三者关系的简单理解
- Linux的/dev/shm的简单理解
- 深入学习理解 Handler HandlerThread AsyncQueryHandler 三者的关系
- 深入学习理解 Handler HandlerThread AsyncQueryHandler 三者的关系
- 深入学习理解 Handler HandlerThread AsyncQueryHandler 三者的关系
- 如何理解Activity,View,Window三者之间的关系
- map odom base_link三者关系的通俗理解
- Looper、MessageQueue、Handler三者关系理解
- 简单粗暴理解JAVA_SE 、EE、ME 三者的区别
- /dev、/sys/dev 和/sys/devices 和udev的关系
- 简单理解消息的三种模式
- 简单的理解数据库三范式
- 简单易懂的数据库三范式理解
- 第一二三范式的简单理解
- 数据库三范式的简单理解
- Android入门:深入学习理解 Handler HandlerThread AsyncQueryHandler 三者的关系
- Android入门:深入学习理解 Handler HandlerThread AsyncQueryHandler 三者的关系
- Android入门:深入学习理解 Handler HandlerThread AsyncQueryHandler 三者的关系 收藏
- STM32F103下模拟I2C的接口代码
- 清理缓存Caches路径下的文件
- C语言锁程序
- Vim升华之树形目录插件NERDTree安装图解
- MySQL事务提交过程(一)
- dev/iommu_group/iommu_domain 三者关系的简单理解
- ajax无刷新模糊查询(json)
- 1163 最高的奖励
- Git在Android Studio上的使用
- UI到底是怎么接受事件的事件
- 高通 MSM8K bootloader : SBL1
- hust 1017 Exact cover
- getContextPath、getServletPath、getRequestURI的区别
- cccc练习四