Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1830881pxb; Fri, 24 Sep 2021 13:00:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeLhMCZZvLeVefgnXFRo88uiehM6FYPyHRyYTCnsevFGroPKA4+wanpFMY0/0WJ29Ac+VP X-Received: by 2002:a05:6402:2917:: with SMTP id ee23mr7178809edb.207.1632513611391; Fri, 24 Sep 2021 13:00:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632513611; cv=none; d=google.com; s=arc-20160816; b=PAKmV9RsSqifHrAcfdHnBWgQXxOfkx1ndGOQrk5UWCPVYJkir94Vawi/7d0+yCHYCU F9hTeSGmshP72lR6beg+EHws+Bp8y6r5dYZTvE+gEttd8WzFf+HAvIt+ER5Vgf4E5SDd 9ZN85j4IYiQMUCP1QXbmwwv5n8z9/iGdTauwSXEwO/zB6+nSs+pssuZtT1EeY1iH0o4Z f+gKw5Sz/tOTGOhnnTe3sZ+v7ysIGFLwhBwQfbcsBbXHI9/WX6eXV9FlcxfhtlLKm+pL l9rVrnBoOY49x40GYETWzQNdOJpwBenRV0da7TJ7ychKLdCTCHCncokZD0fieywS7BC1 /TZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ewad7WdioNb7KxbCukIupMpEigVitse4tLQ/SqD2lJo=; b=vsRg/pQkU0KuVdz6dSJQEll7erk7/OrgPGLQ8ay14ZEwSDIwlWnd9gYpDraLTjRwra naWvZ3WBEETgODk8VyUQJShzsRxaeoc/++2PG1KzOskYD+Q/6dc/zh48uiiveCq8hG13 YqUrtL4kIvZGgC8u2Ts9zasil6SK0rjtYPLGATa3u43jIqKpaa+5TwMu24nslF6FG7K1 QmuT+5HHwQJTboe/RIxSO595JK98u+Ugrn++Rrp3U1AVEyA58ysIv2EUSlSQxVloabO0 Od42aZ+PxbsrE6zALZNDJqMobUEHi/5M6z8of/c1luZtsswv2HO8FL35t6HDnH/JJGso UglA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sxg90uSX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si9707600ejg.618.2021.09.24.12.59.44; Fri, 24 Sep 2021 13:00:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Sxg90uSX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345798AbhIXNLV (ORCPT + 99 others); Fri, 24 Sep 2021 09:11:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:38878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346872AbhIXNIO (ORCPT ); Fri, 24 Sep 2021 09:08:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4D8276139D; Fri, 24 Sep 2021 12:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632488234; bh=W+/ygml748//L5OIXZiYqLeLU0RcpORDj2I0wbz2cBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sxg90uSXbHrn+Fm83f4WuGzr2LMmzQsId7EX9E3s+q6TlbTEx7X5ZQokWBZFWRwp7 4FMe81j2IG/JJFu+BahN3NtK2FX1Cqwl8TBM+Xa3HJg45+6c4QDoyd3c0A/Rw16HB/ YUM26QHM0msc6eAhLJaxKnJg5wtAJ4OQaA7eZMXo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Konrad Rzeszutek Wilk Subject: [PATCH 5.10 05/63] ARM: Qualify enabling of swiotlb_init() Date: Fri, 24 Sep 2021 14:44:05 +0200 Message-Id: <20210924124334.414480774@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210924124334.228235870@linuxfoundation.org> References: <20210924124334.228235870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Fainelli commit fcf044891c84e38fc90eb736b818781bccf94e38 upstream. We do not need a SWIOTLB unless we have DRAM that is addressable beyond the arm_dma_limit. Compare max_pfn with arm_dma_pfn_limit to determine whether we do need a SWIOTLB to be initialized. Fixes: ad3c7b18c5b3 ("arm: use swiotlb for bounce buffering on LPAE configs") Signed-off-by: Florian Fainelli Signed-off-by: Konrad Rzeszutek Wilk Signed-off-by: Greg Kroah-Hartman --- arch/arm/mm/init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -378,7 +378,11 @@ static void __init free_highpages(void) void __init mem_init(void) { #ifdef CONFIG_ARM_LPAE - swiotlb_init(1); + if (swiotlb_force == SWIOTLB_FORCE || + max_pfn > arm_dma_pfn_limit) + swiotlb_init(1); + else + swiotlb_force = SWIOTLB_NO_FORCE; #endif set_max_mapnr(pfn_to_page(max_pfn) - mem_map);