Re: [PATCH] ARM: keystone: add bus notifier to set dma_pfn_offset for pci devices

From: Murali Karicheri
Date: Fri Oct 10 2014 - 17:37:49 EST


On 10/10/2014 02:22 PM, Arnd Bergmann wrote:
On Friday 10 October 2014 11:15:37 Murali Karicheri wrote:
@@ -54,6 +55,8 @@ static void __init keystone_init(void)
keystone_pm_runtime_init();
if (platform_nb.notifier_call)
bus_register_notifier(&platform_bus_type,&platform_nb);
+ if (platform_nb.notifier_call)
+ bus_register_notifier(&pci_bus_type,&platform_nb);
of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);


No, this looks very wrong. Santosh spent an enormous effort on obsoleting
the platform notifier block by adding the range parser to the platform
device probe path.

You should really remove platform_nb and all associated code rather than
adding more code to it.

NAK

Arnd
Arnd,

I took a look at the recent work from Santosh where he has introduced dma-range property to set the dma_pfn_offset for platform devices. Are you referring to this commit below?

commit 591c1ee465ce5372385dbc41e7d3e36cbb477bd8
Author: Santosh Shilimkar <santosh.shilimkar@xxxxxx>
Date: Thu Apr 24 11:30:04 2014 -0400

of: configure the platform device dma parameters

Retrieve DMA configuration from DT and setup platform device's DMA
parameters. The DMA configuration in DT has to be specified using
"dma-ranges" and "dma-coherent" properties if supported.

We setup dma_pfn_offset using "dma-ranges" and dma_coherent_ops
using "dma-coherent" device tree properties.

The set_arch_dma_coherent_ops macro has to be defined by arch if
it supports coherent dma_ops. Otherwise, set_arch_dma_coherent_ops() is
declared as nop.

Based on this, dma configuration parameters get set for the device which is probed through DT.

As PCI devices are attached to the PCI bus during scan, and we don't have DT nodes, we could use similar mechanism to pass the dma-range info from parent host platform device to the PCI devices by adding an of_pci_dma_configure() API and hook it to the PCI probe path some where?
Please comment on this so that I can work on the right solution to address this issue for Keystone.

--
Murali Karicheri
Linux Kernel, Texas Instruments
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/