From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 896F2C433F5 for ; Fri, 24 Sep 2021 12:55:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7099261351 for ; Fri, 24 Sep 2021 12:55:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344744AbhIXM5N (ORCPT ); Fri, 24 Sep 2021 08:57:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:51296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344800AbhIXMzc (ORCPT ); Fri, 24 Sep 2021 08:55:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 099E461107; Fri, 24 Sep 2021 12:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632487862; bh=1E3rpQWxKiZTxXGpPvptV8BtqPwPaouT2/KeUgxNOto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xNouj73WXEdUn4U+y8tLKdy1s6p/V5uI33dWP8yDkBWgNpq4r7lKCkvehugxHHXrd T7Q6i3xJ2IKPKoreuTehRaMZV8p0S7D7LdGp13B9tklmJ4mqR6Z2ey9xBQv1e5cxua VWI5A2TGcmgd49E1zt2Auiy116gfMSr4Llt71pV4= 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.4 09/50] ARM: Qualify enabling of swiotlb_init() Date: Fri, 24 Sep 2021 14:43:58 +0200 Message-Id: <20210924124332.547892561@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210924124332.229289734@linuxfoundation.org> References: <20210924124332.229289734@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: stable@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 @@ -469,7 +469,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);