Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2833882pxb; Mon, 1 Nov 2021 02:49:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr8COK/j2selLJvbhQd1394CZaWESCOSg4tsGbRPyLyYiCHzq3tGMe+WTXMtZvxoR5MFo7 X-Received: by 2002:a6b:650f:: with SMTP id z15mr14446935iob.27.1635760159735; Mon, 01 Nov 2021 02:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635760159; cv=none; d=google.com; s=arc-20160816; b=AmfoU4Mv6Ws8BdKyqWdGxhOK53PyKKESc5lp90jZOjNi2ZLvQ6bh1j9Eftd23s23t2 869TCFAB8yDXErkZ0APPdn7b+MMJgqLGWYGp/1r1C9bX50C4MVe/N1biGSvTmiP7sL+S V73FTWjWq0/7xDy45vJid0uCyxOeGbwN+E0xQUvC91uCcwU8eV09ml/vHidQCCxJDWun Uk1mjdANhh3mq9qwZsCQO1EHBDzVaLyNe2utMDg1mn+3BonB5AFZnw/41IARRggDBzdV 1A0o89icQxVtpFZkGChLSHMZgNX9wQTPTulA+E5nXmK1g8F0SQEpgisQG9B8ABTdoKbJ Qchg== 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=sm/TZRtEjyPpWM/IG5nohUByGNw63aHItP2MeIe4fJA=; b=y9g07nIJotPGHpDFwM0qUnxCUNozNTfe55s9QothkMWzozpA/pmVtlwHoAd9f3DTYE Yo3UiKQmGcweZNUwzCpZS49w9QtDuNDpc9hJzX3+nTAEqyN14F0Ke74O9iUDh0YBTz7H zyKBbUvQdkd95KAvXIMHyzWYF+G+sXS2K2tJrQVdVyvG0KyEQDsQXiMthP+DrYFMJPCP ynqcwO7N6tBEkGzJQ3lIolxj7X2q5z8a2kqt8dHB7icfE0AW3GmGbQrWT9WBgR72Apbb eIO2AlIBL+XoAhb4rC6AYustoTb/KPwVPoZnhxcrmtmnsnVB3u4CmbH1gBGiXLrvhFB7 TgGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OoEN0k7p; 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 k13si6760919ilv.35.2021.11.01.02.49.08; Mon, 01 Nov 2021 02:49:19 -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=OoEN0k7p; 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 S233590AbhKAJuk (ORCPT + 99 others); Mon, 1 Nov 2021 05:50:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:52288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234147AbhKAJrK (ORCPT ); Mon, 1 Nov 2021 05:47:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id C0D2E61247; Mon, 1 Nov 2021 09:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635759031; bh=8JqsWLZ3i07OUooU4D0y7iw/4XEaK2ehfjncA5i4PyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OoEN0k7pJgSyjKzENfk2Xo1T5cs+ca6Kj1xYDDavY39L0ziRRmpXLpKVgB+gbSz24 orqlVPnJxOEmSM5KjfruCudeW4DYy7YGKbZu99lpa2MxUHuue5NKQlb+zlw78LkxJu NWyOF36t76lThoiMmNSGVtNbOc/09s2Rf63QXnLc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuiko Oshino , "David S. Miller" Subject: [PATCH 5.14 086/125] net: ethernet: microchip: lan743x: Fix dma allocation failure by using dma_set_mask_and_coherent Date: Mon, 1 Nov 2021 10:17:39 +0100 Message-Id: <20211101082549.497178576@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082533.618411490@linuxfoundation.org> References: <20211101082533.618411490@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: Yuiko Oshino commit 95a359c9553342d36d408d35331ff0bfce75272f upstream. The dma failure was reported in the raspberry pi github (issue #4117). https://github.com/raspberrypi/linux/issues/4117 The use of dma_set_mask_and_coherent fixes the issue. Tested on 32/64-bit raspberry pi CM4 and 64-bit ubuntu x86 PC with EVB-LAN7430. Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver") Signed-off-by: Yuiko Oshino Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/microchip/lan743x_main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -1743,6 +1743,16 @@ static int lan743x_tx_ring_init(struct l ret = -EINVAL; goto cleanup; } + if (dma_set_mask_and_coherent(&tx->adapter->pdev->dev, + DMA_BIT_MASK(64))) { + if (dma_set_mask_and_coherent(&tx->adapter->pdev->dev, + DMA_BIT_MASK(32))) { + dev_warn(&tx->adapter->pdev->dev, + "lan743x_: No suitable DMA available\n"); + ret = -ENOMEM; + goto cleanup; + } + } ring_allocation_size = ALIGN(tx->ring_size * sizeof(struct lan743x_tx_descriptor), PAGE_SIZE); @@ -2276,6 +2286,16 @@ static int lan743x_rx_ring_init(struct l ret = -EINVAL; goto cleanup; } + if (dma_set_mask_and_coherent(&rx->adapter->pdev->dev, + DMA_BIT_MASK(64))) { + if (dma_set_mask_and_coherent(&rx->adapter->pdev->dev, + DMA_BIT_MASK(32))) { + dev_warn(&rx->adapter->pdev->dev, + "lan743x_: No suitable DMA available\n"); + ret = -ENOMEM; + goto cleanup; + } + } ring_allocation_size = ALIGN(rx->ring_size * sizeof(struct lan743x_rx_descriptor), PAGE_SIZE);