of/acpi: Configure dma operations at probe time for platform/amba/pci bus devices
Configuring DMA ops at probe time will allow deferring device probe when the IOMMU isn't available yet. The dma_configure for the device is now called from the generic device_attach callback just before the bus/driver probe is called. This way, configuring the DMA ops for the device would be called at the same place for all bus_types, hence the deferred probing mechanism should work for all buses as well. pci_bus_add_devices (platform/amba)(_device_create/driver_register) | | pci_bus_add_device (device_add/driver_register) | | device_attach device_initial_probe | | __device_attach_driver __device_attach_driver | driver_probe_device | really_probe | dma_configure Similarly on the device/driver_unregister path __device_release_driver is called which inturn calls dma_deconfigure. This patch changes the dma ops configuration to probe time for both OF and ACPI based platform/amba/pci bus devices. Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Hanjun Guo <hanjun.guo@linaro.org> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci part) Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Joerg Roedel <jroedel@suse.de>
This commit is contained in:

committed by
Joerg Roedel

parent
efc8551a27
commit
09515ef5dd
@@ -1893,33 +1893,6 @@ static void pci_set_msi_domain(struct pci_dev *dev)
|
||||
dev_set_msi_domain(&dev->dev, d);
|
||||
}
|
||||
|
||||
/**
|
||||
* pci_dma_configure - Setup DMA configuration
|
||||
* @dev: ptr to pci_dev struct of the PCI device
|
||||
*
|
||||
* Function to update PCI devices's DMA configuration using the same
|
||||
* info from the OF node or ACPI node of host bridge's parent (if any).
|
||||
*/
|
||||
static void pci_dma_configure(struct pci_dev *dev)
|
||||
{
|
||||
struct device *bridge = pci_get_host_bridge_device(dev);
|
||||
|
||||
if (IS_ENABLED(CONFIG_OF) &&
|
||||
bridge->parent && bridge->parent->of_node) {
|
||||
of_dma_configure(&dev->dev, bridge->parent->of_node);
|
||||
} else if (has_acpi_companion(bridge)) {
|
||||
struct acpi_device *adev = to_acpi_device_node(bridge->fwnode);
|
||||
enum dev_dma_attr attr = acpi_get_dma_attr(adev);
|
||||
|
||||
if (attr == DEV_DMA_NOT_SUPPORTED)
|
||||
dev_warn(&dev->dev, "DMA not supported.\n");
|
||||
else
|
||||
acpi_dma_configure(&dev->dev, attr);
|
||||
}
|
||||
|
||||
pci_put_host_bridge_device(bridge);
|
||||
}
|
||||
|
||||
void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
|
||||
{
|
||||
int ret;
|
||||
@@ -1933,7 +1906,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
|
||||
dev->dev.dma_mask = &dev->dma_mask;
|
||||
dev->dev.dma_parms = &dev->dma_parms;
|
||||
dev->dev.coherent_dma_mask = 0xffffffffull;
|
||||
pci_dma_configure(dev);
|
||||
|
||||
pci_set_dma_max_seg_size(dev, 65536);
|
||||
pci_set_dma_seg_boundary(dev, 0xffffffff);
|
||||
|
Reference in New Issue
Block a user