Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1031071ybj; Fri, 20 Sep 2019 04:04:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIlP1rjqnYnQAl7stqI0/ogONqvCaq2jWbgqalDBtsT36ktcpeZU4FruciHB5zjQeqo5Et X-Received: by 2002:a17:906:4cc3:: with SMTP id q3mr10391399ejt.127.1568977497626; Fri, 20 Sep 2019 04:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568977497; cv=none; d=google.com; s=arc-20160816; b=ha35a54mjiDgo54huxuf3m3PyHU1ZDYBFZPZnsWOMU4+ViQWQPL1mU0Q+dqqJRge5Y 9GmsSZ15o24C/F6OjCgyA8vwsm0j93N5dXtDvEDHmKGRWTopgmlU2jYh0JcrYpgiYfDK iMOxAltiYyfYiA9iCpVVD6x0JfzEGGQ8VHff/tDmE+BkqPPH/Ch1lVNB8/1fq34fB4dn Mebpceue9rQp3YNacD1O75x6QRmI51oMj8fQZoOtUtpPbonZPxxSiid2gl71tGTKhpAM P1ynwTFOI1mFQ7smAl0gshxhfJdta4fVtYe6apziq+3tKX8Bb49xb0TxrqefCWadlth4 KVAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=FwZjM2/WXHUYifKqtplyi+d1nVkzS7E2ULfQwPtkJ/w=; b=dEsi2ypO4dVS78j3DKbm0T5tGQQDv4QbHJevgwZqaiwgT1eaH2+LR22MeYXRbh6bhv FIT0CRLETrBBqcR0JuEz8IIpSAiuCIKRLw/Pt/GVKoIUTbheRHz8XnqhPmNk7pjSXfku fr/ED+ES5kkf4Ll3YlvlEkRm4Q+8v07omamGT3OjuMqa6v2Yr1xfZZp/3vrYiBqnc+Qa a3U3LLQt8y7Jea2UCe7YwXZWWJ4HS7L/tPLQx+tb0VSG1TDf29jl49rq/3KQ9+kzca9k /F50wxTkP8NGyQd1nCiYPE94nn04rYtaHHxxzUcEwBvrYyjCUbRFazeTug0V+YBOoRro weGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jJ02e8Ht; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l26si1109709edb.258.2019.09.20.04.04.32; Fri, 20 Sep 2019 04:04:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jJ02e8Ht; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732668AbfISWOB (ORCPT + 99 others); Thu, 19 Sep 2019 18:14:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:53274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392058AbfISWN7 (ORCPT ); Thu, 19 Sep 2019 18:13:59 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2C9EB21907; Thu, 19 Sep 2019 22:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1568931238; bh=F5CQ1+YvvSFo1TXnBiXKLipZLDPWDY9aNPbQDEsQ2n0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jJ02e8Ht74ZxBIYDGD+/0HzddXB4vB1ygVXIhZnbfHP87tq4ETxYawLm1OgEoqk+Z Gx5iIuqnrFXipEcNe1B40tdEPA5DX50TAuLahERbGHFoRG7wg322TnoPcJ/jcKHQAp kfpZYTQKzMiUX7p3LzmU/Podjyjbfd6ZjPRQVJJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nagarjuna Kristam , Thierry Reding , Sasha Levin Subject: [PATCH 4.19 54/79] usb: host: xhci-tegra: Set DMA mask correctly Date: Fri, 20 Sep 2019 00:03:39 +0200 Message-Id: <20190919214812.225092786@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190919214807.612593061@linuxfoundation.org> References: <20190919214807.612593061@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nagarjuna Kristam [ Upstream commit 993cc8753453fccfe060a535bbe21fcf1001b626 ] The Falcon microcontroller that runs the XUSB firmware and which is responsible for exposing the XHCI interface can address only 40 bits of memory. Typically that's not a problem because Tegra devices don't have enough system memory to exceed those 40 bits. However, if the ARM SMMU is enable on Tegra186 and later, the addresses passed to the XUSB controller can be anywhere in the 48-bit IOV address space of the ARM SMMU. Since the DMA/IOMMU API starts allocating from the top of the IOVA space, the Falcon microcontroller is not able to load the firmware successfully. Fix this by setting the DMA mask to 40 bits, which will force the DMA API to map the buffer for the firmware to an IOVA that is addressable by the Falcon. Signed-off-by: Nagarjuna Kristam Signed-off-by: Thierry Reding Link: https://lore.kernel.org/r/1566989697-13049-1-git-send-email-nkristam@nvidia.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-tegra.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index b1cce989bd123..fe37dacc695fc 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -1148,6 +1148,16 @@ static int tegra_xusb_probe(struct platform_device *pdev) tegra_xusb_ipfs_config(tegra, regs); + /* + * The XUSB Falcon microcontroller can only address 40 bits, so set + * the DMA mask accordingly. + */ + err = dma_set_mask_and_coherent(tegra->dev, DMA_BIT_MASK(40)); + if (err < 0) { + dev_err(&pdev->dev, "failed to set DMA mask: %d\n", err); + goto put_rpm; + } + err = tegra_xusb_load_firmware(tegra); if (err < 0) { dev_err(&pdev->dev, "failed to load firmware: %d\n", err); -- 2.20.1