[PATCH 4/5] powerpc: Add support for swiotlb on 32-bit

Kumar Gala galak at kernel.crashing.org
Tue Apr 21 06:04:34 EST 2009


On Apr 20, 2009, at 2:06 PM, Becky Bruce wrote:

>
> On Apr 20, 2009, at 1:31 PM, Kumar Gala wrote:
>
>>
>> On Apr 20, 2009, at 11:26 AM, Becky Bruce wrote:
>>
>>> +static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
>>> +				  unsigned long action, void *data)
>>> +{
>>> +	struct device *dev = data;
>>> +
>>> +	/* We are only intereted in device addition */
>>> +	if (action != BUS_NOTIFY_ADD_DEVICE)
>>> +		return 0;
>>> +
>>> +	if (dma_get_mask(dev) < DMA_BIT_MASK(36))
>>> +		set_dma_ops(dev, &swiotlb_dma_ops);
>>> +
>>> +	return NOTIFY_DONE;
>>> +}
>>> +
>>> +static struct notifier_block ppc_swiotlb_plat_bus_notifier = {
>>> +	.notifier_call = ppc_swiotlb_bus_notify,
>>> +	.priority = 0,
>>> +};
>>> +
>>> +static struct notifier_block ppc_swiotlb_of_bus_notifier = {
>>> +	.notifier_call = ppc_swiotlb_bus_notify,
>>> +	.priority = 0,
>>> +};
>>> +
>>> +static int __init setup_bus_notifier(void)
>>> +{
>>> +	bus_register_notifier(&platform_bus_type,
>>> +			      &ppc_swiotlb_plat_bus_notifier);
>>> +	bus_register_notifier(&of_platform_bus_type,
>>> +			      &ppc_swiotlb_of_bus_notifier);
>>> +
>>> +	return 0;
>>> +}
>>
>> I think we should move all this into the platform code for now.  I  
>> don't like having to duplicate it but that gives us the proper  
>> flexibility for now.
>
> Ugh, gross.  I'd like to think about this some more.

I'm suggesting we do it one for FSL in fsl_soc.c, the 4xx guys can do  
it once, etc.  Since the behavior desired is going to be a bit unique  
to SoCs/chipsets.

- k



More information about the Linuxppc-dev mailing list