On Mon, Jan 04, 2021 at 07:56:11PM +0200, Lauri Kasanen wrote: > +static blk_status_t get_seg(struct request *req) > +{ > + u32 bstart = blk_rq_pos(req) * 512; > + u32 len = blk_rq_cur_bytes(req); > + void *dst = bio_data(req->bio); > + > + if (bstart + len > size) > + return BLK_STS_IOERR; > + > + bstart += start; > + > + while (len) { > + const u32 curlen = len < BUFSIZE ? len : BUFSIZE; > + > + dma_cache_inv((unsigned long) buf, curlen); > + > + n64cart_wait_dma(); > + > + barrier(); > + n64cart_write_reg(PI_DRAM_REG, dma_addr); > + barrier(); > + n64cart_write_reg(PI_CART_REG, (bstart | 0x10000000) & 0x1FFFFFFF); > + barrier(); > + n64cart_write_reg(PI_WRITE_REG, curlen - 1); > + barrier(); > + > + n64cart_wait_dma(); > + > + memcpy(dst, buf, curlen); Is there a reason for using a bounce buffer rather than reading directly into the destination?