mirror of https://gitee.com/openkylin/linux.git
iommu/fsl: Convert to device_group call-back
Convert the fsl pamu driver to make use of the new device_group call-back. Cc: Varun Sethi <Varun.Sethi@freescale.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:
parent
a960fadbe6
commit
d5e5829715
|
@ -923,7 +923,7 @@ static struct iommu_group *get_pci_device_group(struct pci_dev *pdev)
|
||||||
pci_endpt_partioning = check_pci_ctl_endpt_part(pci_ctl);
|
pci_endpt_partioning = check_pci_ctl_endpt_part(pci_ctl);
|
||||||
/* We can partition PCIe devices so assign device group to the device */
|
/* We can partition PCIe devices so assign device group to the device */
|
||||||
if (pci_endpt_partioning) {
|
if (pci_endpt_partioning) {
|
||||||
group = iommu_group_get_for_dev(&pdev->dev);
|
group = pci_device_group(&pdev->dev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PCIe controller is not a paritionable entity
|
* PCIe controller is not a paritionable entity
|
||||||
|
@ -956,44 +956,34 @@ static struct iommu_group *get_pci_device_group(struct pci_dev *pdev)
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fsl_pamu_add_device(struct device *dev)
|
static struct iommu_group *fsl_pamu_device_group(struct device *dev)
|
||||||
{
|
{
|
||||||
struct iommu_group *group = ERR_PTR(-ENODEV);
|
struct iommu_group *group = ERR_PTR(-ENODEV);
|
||||||
struct pci_dev *pdev;
|
int len;
|
||||||
const u32 *prop;
|
|
||||||
int ret = 0, len;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For platform devices we allocate a separate group for
|
* For platform devices we allocate a separate group for
|
||||||
* each of the devices.
|
* each of the devices.
|
||||||
*/
|
*/
|
||||||
if (dev_is_pci(dev)) {
|
if (dev_is_pci(dev))
|
||||||
pdev = to_pci_dev(dev);
|
group = get_pci_device_group(to_pci_dev(dev));
|
||||||
/* Don't create device groups for virtual PCI bridges */
|
else if (of_get_property(dev->of_node, "fsl,liodn", &len))
|
||||||
if (pdev->subordinate)
|
group = get_device_iommu_group(dev);
|
||||||
return 0;
|
|
||||||
|
|
||||||
group = get_pci_device_group(pdev);
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
static int fsl_pamu_add_device(struct device *dev)
|
||||||
prop = of_get_property(dev->of_node, "fsl,liodn", &len);
|
{
|
||||||
if (prop)
|
struct iommu_group *group;
|
||||||
group = get_device_iommu_group(dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
group = iommu_group_get_for_dev(dev);
|
||||||
if (IS_ERR(group))
|
if (IS_ERR(group))
|
||||||
return PTR_ERR(group);
|
return PTR_ERR(group);
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if device has already been added to an iommu group.
|
|
||||||
* Group could have already been created for a PCI device in
|
|
||||||
* the iommu_group_get_for_dev path.
|
|
||||||
*/
|
|
||||||
if (!dev->iommu_group)
|
|
||||||
ret = iommu_group_add_device(group, dev);
|
|
||||||
|
|
||||||
iommu_group_put(group);
|
iommu_group_put(group);
|
||||||
return ret;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fsl_pamu_remove_device(struct device *dev)
|
static void fsl_pamu_remove_device(struct device *dev)
|
||||||
|
@ -1072,6 +1062,7 @@ static const struct iommu_ops fsl_pamu_ops = {
|
||||||
.domain_get_attr = fsl_pamu_get_domain_attr,
|
.domain_get_attr = fsl_pamu_get_domain_attr,
|
||||||
.add_device = fsl_pamu_add_device,
|
.add_device = fsl_pamu_add_device,
|
||||||
.remove_device = fsl_pamu_remove_device,
|
.remove_device = fsl_pamu_remove_device,
|
||||||
|
.device_group = fsl_pamu_device_group,
|
||||||
};
|
};
|
||||||
|
|
||||||
int __init pamu_domain_init(void)
|
int __init pamu_domain_init(void)
|
||||||
|
|
Loading…
Reference in New Issue