Thread (21 messages) 21 messages, 6 authors, 2022-09-04

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

From: Robin Murphy <robin.murphy@arm.com>
Date: 2022-08-30 12:22:11
Also in: lkml

On 2022-08-25 21:15, Arnd Bergmann wrote:
[...]
quoted hunk ↗ jump to hunk
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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help