mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
VT-d: adapt device attach and detach functions for IOMMU API
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
5d450806eb
commit
4c5478c94e
2 changed files with 15 additions and 16 deletions
|
@ -2992,9 +2992,11 @@ static void intel_iommu_domain_destroy(struct iommu_domain *domain)
|
||||||
vm_domain_exit(dmar_domain);
|
vm_domain_exit(dmar_domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
int intel_iommu_attach_device(struct dmar_domain *domain,
|
static int intel_iommu_attach_device(struct iommu_domain *domain,
|
||||||
struct pci_dev *pdev)
|
struct device *dev)
|
||||||
{
|
{
|
||||||
|
struct dmar_domain *dmar_domain = domain->priv;
|
||||||
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
struct intel_iommu *iommu;
|
struct intel_iommu *iommu;
|
||||||
int addr_width;
|
int addr_width;
|
||||||
u64 end;
|
u64 end;
|
||||||
|
@ -3006,7 +3008,7 @@ int intel_iommu_attach_device(struct dmar_domain *domain,
|
||||||
|
|
||||||
old_domain = find_domain(pdev);
|
old_domain = find_domain(pdev);
|
||||||
if (old_domain) {
|
if (old_domain) {
|
||||||
if (domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE)
|
if (dmar_domain->flags & DOMAIN_FLAG_VIRTUAL_MACHINE)
|
||||||
vm_domain_remove_one_dev_info(old_domain, pdev);
|
vm_domain_remove_one_dev_info(old_domain, pdev);
|
||||||
else
|
else
|
||||||
domain_remove_dev_info(old_domain);
|
domain_remove_dev_info(old_domain);
|
||||||
|
@ -3021,28 +3023,29 @@ int intel_iommu_attach_device(struct dmar_domain *domain,
|
||||||
addr_width = agaw_to_width(iommu->agaw);
|
addr_width = agaw_to_width(iommu->agaw);
|
||||||
end = DOMAIN_MAX_ADDR(addr_width);
|
end = DOMAIN_MAX_ADDR(addr_width);
|
||||||
end = end & VTD_PAGE_MASK;
|
end = end & VTD_PAGE_MASK;
|
||||||
if (end < domain->max_addr) {
|
if (end < dmar_domain->max_addr) {
|
||||||
printk(KERN_ERR "%s: iommu agaw (%d) is not "
|
printk(KERN_ERR "%s: iommu agaw (%d) is not "
|
||||||
"sufficient for the mapped address (%llx)\n",
|
"sufficient for the mapped address (%llx)\n",
|
||||||
__func__, iommu->agaw, domain->max_addr);
|
__func__, iommu->agaw, dmar_domain->max_addr);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = domain_context_mapping(domain, pdev);
|
ret = domain_context_mapping(dmar_domain, pdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = vm_domain_add_dev_info(domain, pdev);
|
ret = vm_domain_add_dev_info(dmar_domain, pdev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(intel_iommu_attach_device);
|
|
||||||
|
|
||||||
void intel_iommu_detach_device(struct dmar_domain *domain,
|
static void intel_iommu_detach_device(struct iommu_domain *domain,
|
||||||
struct pci_dev *pdev)
|
struct device *dev)
|
||||||
{
|
{
|
||||||
vm_domain_remove_one_dev_info(domain, pdev);
|
struct dmar_domain *dmar_domain = domain->priv;
|
||||||
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
|
||||||
|
vm_domain_remove_one_dev_info(dmar_domain, pdev);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(intel_iommu_detach_device);
|
|
||||||
|
|
||||||
int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova,
|
int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova,
|
||||||
u64 hpa, size_t size, int prot)
|
u64 hpa, size_t size, int prot)
|
||||||
|
|
|
@ -330,10 +330,6 @@ extern int qi_flush_iotlb(struct intel_iommu *iommu, u16 did, u64 addr,
|
||||||
|
|
||||||
extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
|
extern void qi_submit_sync(struct qi_desc *desc, struct intel_iommu *iommu);
|
||||||
|
|
||||||
int intel_iommu_attach_device(struct dmar_domain *domain,
|
|
||||||
struct pci_dev *pdev);
|
|
||||||
void intel_iommu_detach_device(struct dmar_domain *domain,
|
|
||||||
struct pci_dev *pdev);
|
|
||||||
int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova,
|
int intel_iommu_map_address(struct dmar_domain *domain, dma_addr_t iova,
|
||||||
u64 hpa, size_t size, int prot);
|
u64 hpa, size_t size, int prot);
|
||||||
void intel_iommu_unmap_address(struct dmar_domain *domain,
|
void intel_iommu_unmap_address(struct dmar_domain *domain,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue