Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1419353
| From | Tomasz Nowicki <tn@semihalf.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH v2 13/15] drivers: acpi: iort: introduce iort_iommu_configure |
| Date | 2016-06-10 14:50 +0200 |
| Message-ID | <rIu2S-4CJ-15@gated-at.bofh.it> (permalink) |
| References | <rHpoB-3hJ-3@gated-at.bofh.it> <rHpoB-3hJ-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 07.06.2016 15:31, Lorenzo Pieralisi wrote:
> +static int __get_pci_rid(struct pci_dev *pdev, u16 alias, void *data)
> +{
> + u32 *rid = data;
> +
> + *rid = alias;
> + return 0;
> +}
> +
> +/**
> + * iort_iommu_configure - Set-up IOMMU configuration for a device.
> + *
> + * @dev: device to configure
> + *
> + * Returns: iommu_ops pointer on configuration success
> + * NULL on configuration failure
> + */
> +const struct iommu_ops *iort_iommu_configure(struct device *dev)
> +{
> + struct acpi_iort_node *node, *parent;
> + const struct iort_ops_node *iort_ops;
> + u32 rid = 0, devid = 0;
> +
> + if (dev_is_pci(dev)) {
> + struct pci_bus *bus = to_pci_dev(dev)->bus;
> +
> + pci_for_each_dma_alias(to_pci_dev(dev), __get_pci_rid,
> + &rid);
I think we should find here the root bus which is connected to RC IORT node.
> +
> + node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
> + iort_find_dev_callback, &bus->dev);
> + } else {
> + node = iort_scan_node(ACPI_IORT_NODE_NAMED_COMPONENT,
> + iort_find_dev_callback, dev);
> + }
> +
> + if (!node)
> + return NULL;
> +
> + parent = iort_find_parent_node(node);
> +
> + if (!parent)
> + return NULL;
> +
> + iort_ops = iort_smmu_get_ops_node(parent);
> +
> + if (iort_ops && iort_ops->iommu_xlate) {
> + iort_dev_map_rid(node, rid, &devid, parent->type);
> + iort_ops->iommu_xlate(dev, devid, parent);
> + return iort_ops->ops;
> + }
> +
> + return NULL;
> +}
> +
Thanks,
Tomasz
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[RFC PATCH v2 13/15] drivers: acpi: iort: introduce iort_iommu_configure Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> - 2016-06-07 15:40 +0200 Re: [RFC PATCH v2 13/15] drivers: acpi: iort: introduce iort_iommu_configure Tomasz Nowicki <tn@semihalf.com> - 2016-06-10 14:50 +0200
csiph-web