n64cart: fix the dma address in n64cart_do_bvec
PATCH 1/1 n64cart: fix the dma address in n64cart_do_bvec
dma_map_bvec already takes bv_offset into account.
--- drivers/block/n64cart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/n64cart.c +1 -1
@@ -74,7 +74,7 @@ static bool n64cart_do_bvec(struct device *dev, struct bio_vec *bv, u32 pos)n64cart_wait_dma (); -n64cart_write_reg (PI_DRAM_REG , dma_addr + bv->bv_offset); +n64cart_write_reg (PI_DRAM_REG , dma_addr);n64cart_write_reg (PI_CART_REG , (bstart |CART_DOMAIN ) &CART_MAX );n64cart_write_reg (PI_WRITE_REG , bv->bv_len -1 );
Signature · 1 line
2.30.2
Quoted 13 lines · On Wed, 4 Aug 2021 11:49:58 +0200 Christoph Hellwig <[email protected]> wrote:
dma_map_bvecalready takesbv_offsetinto account.Fixes 9b2a2bbbb4d0 ("block: Add n64 cart driver")Signed-off-by Christoph Hellwig <[email protected]>--- drivers/block/n64cart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/block/n64cart.c +0
-0
drivers/block/n64cart.c static bool n64cart_do_bvec(struct device *dev, struct bio_vec *bv, u32 pos) · line 79
Quoted 7 lines
drivers/block/n64cart.c +1
-1@@ -74,7 +74,7 @@ static bool n64cart_do_bvec(struct device *dev, struct bio_vec *bv, u32 pos)n64cart_wait_dma (); -n64cart_write_reg (PI_DRAM_REG , dma_addr + bv->bv_offset); +n64cart_write_reg (PI_DRAM_REG , dma_addr);n64cart_write_reg (PI_CART_REG , (bstart |CART_DOMAIN ) &CART_MAX );n64cart_write_reg (PI_WRITE_REG , bv->bv_len -1 );
Hm, then how did it work? Does it always happen to be zero?
Have you tested this? I don't have the equipment currently.
- Lauri
Quoted 6 lines · Lauri Kasanen
Quoted 6 lines
drivers/block/n64cart.c +0
-0@@ -74,7 +74,7 @@ static bool n64cart_do_bvec(struct device *dev, struct bio_vec *bv, u32 pos)
Quoted 8 lines
drivers/block/n64cart.c static bool n64cart_do_bvec(struct device *dev, struct bio_vec *bv, u32 pos) · line 79
Quoted 6 lines
drivers/block/n64cart.c +1
-1n64cart_wait_dma (); -n64cart_write_reg (PI_DRAM_REG , dma_addr + bv->bv_offset); +n64cart_write_reg (PI_DRAM_REG , dma_addr);n64cart_write_reg (PI_CART_REG , (bstart |CART_DOMAIN ) &CART_MAX );n64cart_write_reg (PI_WRITE_REG , bv->bv_len -1 );Hm, then how did it work? Does it always happen to be zero?
It isn't always zero, but for your use cases it might. That is if you have a page aligned buffer (e.g. the page cache) it tends to be zero.
Quoted 1 line
Have you tested this? I don't have the equipment currently.
No, I don't. I'm just auditing uses of bv_offset and this one is clearly bogus.
Quoted 4 lines · On Wed, 4 Aug 2021 12:02:03 +0200 Christoph Hellwig <[email protected]> wrote:
Quoted 1 line
Have you tested this? I don't have the equipment currently.
No, I don't. I'm just auditing uses of
bv_offsetand this one is clearly bogus.
I won't have the chance to test until about two months from now. So I can't ack it until then. But it's probably fine to apply now.
- Lauri
Quoted 1 line · Christoph Hellwig
dma_map_bvecalready takesbv_offsetinto account.
Applied, thanks.
Signature · 1 line
Jens Axboe