Re: [PATCH] ARM: Qualify enabling of swiotlb_init()

From: Konrad Rzeszutek Wilk
Date: Fri Mar 19 2021 - 16:01:04 EST


On Fri, Mar 19, 2021 at 02:07:31PM +0100, Christoph Hellwig wrote:
> On Thu, Mar 18, 2021 at 09:03:33PM -0700, Florian Fainelli wrote:
> > #ifdef CONFIG_ARM_LPAE
> > + if (swiotlb_force == SWIOTLB_FORCE ||
> > + max_pfn > arm_dma_pfn_limit)
>
> Does arm_dma_pfn_limit do the right thing even with the weirdest
> remapping ranges? Maybe a commen here would be useful.
>
> > + swiotlb_init(1);
> > + else
> > + swiotlb_force = SWIOTLB_NO_FORCE;
>
> Konrad: what do you think of setting swiotlb_force to SWIOTLB_NO_FORCE
> and only switching it to SWIOTLB_NORMAL when swiotlb_init* is called?
> That kind makes more sense than forcing the callers to do it.
>
> While we're at it, I think swiotlb_force should probably be renamed to
> swiotlb_mode or somethng like that.

swiotlb_mode sounds good.

Also it got me thinking - ARM on Xen at some point was a bit strange, so not sure how
the logic works here, Stefano?