[PATCH] ARM: Qualify enabling of swiotlb_init()

Florian Fainelli f.fainelli at gmail.com
Fri Mar 19 17:43:22 GMT 2021



On 3/19/2021 6:07 AM, 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.

It gets assigned to either 0xffffffff or PHYS_OFFSET + arm_dma_zone_size
- 1 which is obtained from the machine descriptor, so I expect it to do
the right thing, it works for a Pi 4 in 32-bit mode for instance. This
is conditional upon enabling CONFIG_ZONE_DMA for ARM, and will otherwise
keep its original value of 0, so this should be safe AFAICT.

> 
>> +		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.
Agreed.
-- 
Florian



More information about the linux-arm-kernel mailing list