* offest calculation from the dma_address
@ 2017-04-14 10:54 alexnln
2017-04-14 14:00 ` Keith Busch
0 siblings, 1 reply; 2+ messages in thread
From: alexnln @ 2017-04-14 10:54 UTC (permalink / raw)
Hello,
In pci.c, in nvme_setup_prps() offset is calculated from the dma address:
int offset = dma_addr & (page_size - 1);
Why not to use sg->offset?
I mean, what if hypothetical dma allocator returns non-page aligned addresses?
In such case offset would be wrong.
Thanks,
Alex
^ permalink raw reply [flat|nested] 2+ messages in thread
* offest calculation from the dma_address
2017-04-14 10:54 offest calculation from the dma_address alexnln
@ 2017-04-14 14:00 ` Keith Busch
0 siblings, 0 replies; 2+ messages in thread
From: Keith Busch @ 2017-04-14 14:00 UTC (permalink / raw)
On Fri, Apr 14, 2017@01:54:51PM +0300, alexnln wrote:
> In pci.c, in nvme_setup_prps() offset is calculated from the dma address:
> int offset = dma_addr & (page_size - 1);
>
> Why not to use sg->offset?
PRP lists are constructed from DMA addresses, so the DMA address offset
is the one to use. Kernel virtual addresses don't necessarilly have the
same page offset as DMA addresses.
> I mean, what if hypothetical dma allocator returns non-page aligned addresses?
> In such case offset would be wrong.
I don't follow. If the DMA address isn't page aligned, we need to
account for that when constructing the PRP.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-14 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 10:54 offest calculation from the dma_address alexnln
2017-04-14 14:00 ` Keith Busch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.