Re: [PATCH v9] block: Add n64 cart driver

Keith Busch
2021-01-22T17:26:00Z

On Fri, Jan 22, 2021 at 06:56:19PM +0200, Lauri Kasanen wrote:
> On Fri, 22 Jan 2021 16:39:13 +0000
> Christoph Hellwig <hch@infradead.org> wrote:
>
> > On Fri, Jan 22, 2021 at 06:23:49PM +0200, Lauri Kasanen wrote:
> > > > Your driver can communicate the required alignment using the
> > > > blk_queue_update_dma_alignment API.
> > >
> > > Is it guaranteed to be physically contiguous?
> >
> > The alignment requirement applies to each bio_vec.
> >
> > What alignment does the hardware require?
>
> It requires 8-byte alignment, but the buffer must also be physically
> contiguous.

Each bio_vec segment is physically contiguous.

> I grepped around, but apparently no driver under drivers/block does
> direct DMA to the bio buffer. They all use their own buffer and memcpy,
> like this patch. ps3vram, ps3disk, amiflop, etc etc.

block/brd.c

> If all existing drivers use their own buffer, why is a different
> approach required for new drivers?

It's certainly more efficient to send the data directly to the
destination without an unnecessary middle-man. And 64k seems like quite
a lot of memory to sequestor considering how little you have to start
with.