Re: [PATCH v2 3/3] arch/*/: remove CONFIG_VIRT_TO_BUS

From: Michael Schmitz
Date: Tue Jun 28 2022 - 17:04:00 EST


Hi Geert,

On 28/06/22 19:03, Geert Uytterhoeven wrote:

Leaving the bounce buffer handling in place, and taking a few other
liberties - this is what converting the easiest case (a3000 SCSI) might
look like. Any obvious mistakes? The mvme147 driver would be very
similar to handle (after conversion to a platform device).
Thanks, looks reasonable.
Thanks, I'll take care of Arnd's comments and post a corrected version later.
The driver allocates bounce buffers using kmalloc if it hits an
unaligned data buffer - can such buffers still even happen these days?
No idea.
Hmmm - I think I'll stick a WARN_ONCE() in there so we know whether this code path is still being used.

If I understand dma_map_single() correctly, the resulting dma handle
would be equally misaligned?

To allocate a bounce buffer, would it be OK to use dma_alloc_coherent()
even though AFAIU memory used for DMA buffers generally isn't consistent
on m68k?

Thinking ahead to the other two Amiga drivers - I wonder whether
allocating a static bounce buffer or a DMA pool at driver init is likely
to succeed if the kernel runs from the low 16 MB RAM chunk? It certainly
won't succeed if the kernel runs from a higher memory address, so the
present bounce buffer logic around amiga_chip_alloc() might still need
to be used here.

Leaves the question whether converting the gvp11 and a2091 drivers is
actually worth it, if bounce buffers still have to be handled explicitly.
A2091 should be straight-forward, as A3000 is basically A2091 on the
motherboard (comparing the two drivers, looks like someone's been
sprinkling mb()s over the A3000 driver).

Yep, and at least the ones in the dma_setup() function are there for no reason (the compiler won't reorder stores around the cache flush calls, I hope?).

Just leaves the 24 bit DMA mask there (and likely need for bounce buffers).

I don't have any of these SCSI host adapters (not counting the A590
(~A2091) expansion of the old A500, which is not Linux-capable, and
hasn't been powered on for 20 years).

I wonder whether kullervo has survived - that one was an A3000. Should have gone to Adrian a few years ago...

Cheers,

    Michael



Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds