Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2827250pxb; Mon, 1 Nov 2021 02:38:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpOA5uyQsvrtyUT8M4CyMxcqkaALPlpec27epcMXfkSpp8fqsnaxnIHrD1XytprvcWuId8 X-Received: by 2002:a05:6402:35c5:: with SMTP id z5mr40030731edc.388.1635759533085; Mon, 01 Nov 2021 02:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635759533; cv=none; d=google.com; s=arc-20160816; b=pPIHobLfWy2Cqd1qTJQm63FgtorpNUwj/45fhdqhHQQ5d4BVxpODdSel8X3L0kkU2k B0mPD/qblX0bF76fYqzCNL0a8QTNbVdsA7tvMyPWR6v9X0d2WmWdigK0GZ+xNPV5WHwT Ly4lX1fU6J7vsniJnuzdW07HVLrdNMNzMk88PBaBuOylhfAUDuNL5imtrdZ0ZHjk7FI8 s//nExQ0tbaLoimW6W1153XfOdH9uaynNoaLmfBpZhhBC4UeS3H2vJ6QEgpD46Lh7YyF Pv9dnvPGZQ539HYVWj0RHiyw+Xr+1PPBQ1z9vjiFNL8qG2rdX6md+t2QMRspG9EJRInT HQxA== 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=3/9CglpxNp0l9vh1WCG5hwYA1UC5DVBP0nFanF1N1o0=; b=EXjzak3k5m9PgWk4PZGSHzqes9gOAXsh4nlyOrj5Lusp9PYEvaoORtAuqdOWR67kNB 3nu1sqP9lIGP3ZuizCSGCTtX556nxUNaXik/8HIwGU9+coLZy63SigM0PvqG/dJr6omT KLiGT3gokJ+pq6tfiWHD2qJG+tF3oKLB9CnLZUeq5HQBKzcfBoh8w5QiCimzFOwEFIz7 nBKTtzSytb5B+DzE797KM/v08D5SikLvypeVFXwiKKeMQeowaoMorlOUGNFc5CnDXs8P qZ3W/LETqPi+ZcUOONQ8pld8TUpY4Jwc7x5xQCmlO+1bj4oD+AdjWlgucixGbTcydnWS oQwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="k/5FJGJB"; 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 t15si19813526ejx.503.2021.11.01.02.38.28; Mon, 01 Nov 2021 02:38:53 -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="k/5FJGJB"; 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 S233133AbhKAJjM (ORCPT + 99 others); Mon, 1 Nov 2021 05:39:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:43822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233361AbhKAJgK (ORCPT ); Mon, 1 Nov 2021 05:36:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 055496128E; Mon, 1 Nov 2021 09:26:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635758786; bh=/HvOc+x8TAj/3rog/AyJk1V73CEVmRyYwJ8FdF82/3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k/5FJGJBD85Nu8F3h4sCdVEtoe0t6SsJ8eeI9cbFqOT0WiVTbeNKLL0K2A/AUNG9Q faN+cv8yi301BOZKScWGx5U9sSNogFGJHi8QYP6Ff2brr1dAsxLd9v8xWevYDI7d8N MN5xR4iLmaQGHLlxEhE1i3A/ySSkbk/N2bRq0odw= 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.10 58/77] net: ethernet: microchip: lan743x: Fix dma allocation failure by using dma_set_mask_and_coherent Date: Mon, 1 Nov 2021 10:17:46 +0100 Message-Id: <20211101082523.850785119@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211101082511.254155853@linuxfoundation.org> References: <20211101082511.254155853@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 @@ -1770,6 +1770,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); @@ -2318,6 +2328,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);