A simple understanding of the relationship between Dev/iommu_group/iommu_domain and the three people

Source: Internet
Author: User
Tags to domain
The struct Iommu_group *group can be obtained from the device structure;
For example:
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);
And Iommu_group has included Iommu_domain
For example: domain = group->domain;
To sum up: dev->iommu_group->domain. Visible domain represents a specific device using Iommu's detailed spec.
With Domian, only you can set up this dev using Smmu detailed spec by Iommu_dma_init_domain.
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;
}
For example, we will decide the order and so on according to Domain->pgsize_bitmap. Therefore, domain represents this dev using Iommu detailed spec.
At present, the Iommu_group in the system is mainly divided into two groups, one is PCIe. One is generic, which can be seen from the following function
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 RIDs
* 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;
}



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.