[PATCH v2 5/4] ARM: footbridge: remove custom DMA address handling

Robin Murphy robin.murphy at arm.com
Tue Aug 30 05:21:37 PDT 2022


On 2022-08-25 21:15, Arnd Bergmann wrote:
[...]
> diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c
> index 372600bc15c8..f8920d0010de 100644
> --- a/arch/arm/mach-footbridge/dc21285.c
> +++ b/arch/arm/mach-footbridge/dc21285.c
> @@ -5,6 +5,7 @@
>    *  Copyright (C) 1998-2001 Russell King
>    *  Copyright (C) 1998-2000 Phil Blundell
>    */
> +#include <linux/dma-map-ops.h>
>   #include <linux/kernel.h>
>   #include <linux/pci.h>
>   #include <linux/interrupt.h>
> @@ -241,6 +242,22 @@ static irqreturn_t dc21285_parity_irq(int irq, void *dev_id)
>   	return IRQ_HANDLED;
>   }
>   
> +static int dc21285_pci_bus_notifier(struct notifier_block *nb,
> +				    unsigned long action,
> +				    void *data)
> +{
> +	if (action != BUS_NOTIFY_ADD_DEVICE)
> +		return NOTIFY_DONE;
> +
> +	dma_direct_set_offset(data, PHYS_OFFSET, BUS_OFFSET, SZ_256M);

FWIW I've always had it in mind that for this kind of special case the 
platform could just statically allocate the dma_range_map and assign it 
to all devices. However in practice that needs some kfree_const() tweaks 
in the driver core, which I'm sure are out-of-scope for this series, so 
I'm mostly flagging this up to help myself remember that it might be 
worth doing a dma_direct_set_offset() cleanup sweep soon.

As-is the patch at least makes things a lot clearer, and presumably 
there aren't likely to be enough PCI devices for the extra allocations 
to have noticeable impact in the meantime.

Cheers,
Robin.



More information about the linux-arm-kernel mailing list