OSDN Git Service

swiotlb: search the software IO TLB only if the device makes use of it
authorPetr Tesarik <petr.tesarik.ext@huawei.com>
Tue, 1 Aug 2023 06:24:04 +0000 (08:24 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 1 Aug 2023 16:02:32 +0000 (18:02 +0200)
commit1395706a14904f2593debecf20f827e72d7392a7
tree196190ece0128e3baafd308d626f6563bf277060
parent1aaa736815eb04f4dae3f0b3e977b2a0677a4cfb
swiotlb: search the software IO TLB only if the device makes use of it

Skip searching the software IO TLB if a device has never used it, making
sure these devices are not affected by the introduction of multiple IO TLB
memory pools.

Additional memory barrier is required to ensure that the new value of the
flag is visible to other CPUs after mapping a new bounce buffer. For
efficiency, the flag check should be inlined, and then the memory barrier
must be moved to is_swiotlb_buffer(). However, it can replace the existing
barrier in swiotlb_find_pool(), because all callers use is_swiotlb_buffer()
first to verify that the buffer address belongs to the software IO TLB.

Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
include/linux/device.h
include/linux/swiotlb.h
kernel/dma/swiotlb.c