mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
swiotlb: bail out of swiotlb_init_late() if swiotlb is already allocated
If swiotlb is allocated, immediately return 0, so callers do not have to check io_tlb_default_mem.nslabs explicitly. Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
parent
3fa6456ebe
commit
0c6874a6ac
2 changed files with 7 additions and 6 deletions
|
@ -125,12 +125,10 @@ static int __init xen_mm_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* we can work with the default swiotlb */
|
/* we can work with the default swiotlb */
|
||||||
if (!io_tlb_default_mem.nslabs) {
|
|
||||||
rc = swiotlb_init_late(swiotlb_size_or_default(),
|
rc = swiotlb_init_late(swiotlb_size_or_default(),
|
||||||
xen_swiotlb_gfp(), NULL);
|
xen_swiotlb_gfp(), NULL);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
|
||||||
|
|
||||||
cflush.op = 0;
|
cflush.op = 0;
|
||||||
cflush.a.dev_bus_addr = 0;
|
cflush.a.dev_bus_addr = 0;
|
||||||
|
|
|
@ -384,6 +384,9 @@ int swiotlb_init_late(size_t size, gfp_t gfp_mask,
|
||||||
bool retried = false;
|
bool retried = false;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
if (io_tlb_default_mem.nslabs)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (swiotlb_force_disable)
|
if (swiotlb_force_disable)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue