Re: [PATCH v2] swiotlb: Make SWIOTLB_NO_FORCE perform no allocation

From: Christoph Hellwig
Date: Mon Mar 22 2021 - 03:47:20 EST


On Sat, Mar 20, 2021 at 08:37:40PM -0700, Florian Fainelli wrote:
> - if (!strcmp(str, "force")) {
> + if (!strcmp(str, "force"))
> swiotlb_force = SWIOTLB_FORCE;
> - } else if (!strcmp(str, "noforce")) {
> + else if (!strcmp(str, "noforce"))
> swiotlb_force = SWIOTLB_NO_FORCE;
> - default_nslabs = 1;
> - }
>
> return 0;
> }
> @@ -211,6 +209,9 @@ swiotlb_init(int verbose)
> size_t bytes = PAGE_ALIGN(default_nslabs << IO_TLB_SHIFT);
> void *tlb;
>
> + if (swiotlb_force == SWIOTLB_NO_FORCE)
> + return;

We'll also need this in the other callers of swiotlb_init_with_tbl
and swiotlb_late_init_with_tbl.

I actually had a plan to mostly kill them, but that can better
way until more support for multiple io_tlb structures is merged.