Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp875018ybe; Wed, 4 Sep 2019 09:02:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxVfZ/GeOi+nURjCtGWSL2Kmu5rUWTpPQOuCJuuyTOd2qpxB78vUltnJxXQzonb32e6x49m X-Received: by 2002:a17:902:a98b:: with SMTP id bh11mr4051861plb.40.1567612931163; Wed, 04 Sep 2019 09:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567612931; cv=none; d=google.com; s=arc-20160816; b=eJNhpGi53y0VmR/43VRlzl8hYbXm1QbX534OfWAy88Tg/6QMVq7I9LB9bdvL+72S74 Z+nDF9GMgEFrRUq/ifTGRFMYLzt0UUfo0xQoHXMwR+1FyLDFRJbWlCNV61GNIJEQ92lW igwEhpi9gI9SacdLx8WU/r/oxkuh+wYeIBe/UB4lNq1OOGijo6ZYQgGavu2tOIt7vLjv XLYAYk0RnPOHrxHVjZSf+oVdZcQb+oPd4lGRa43ozRl5X1MH3BNlJtbJjn31CMPYK2Mo SZ8cgpC3Kc1ExuM+lUkLM7jz1hl+0jfCEZHIDUCGsgxrimKA7mSl5kbYc/fP2vPYv0s8 NjDg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IxBznBOfkGqqewTTFvJ9MX1Y6zxeF9bE0VvPaSapn3E=; b=dvpjSJiZsW5PhiXEOAak15osVq2a96z8PzD/xjN+Oj7GAAYlFyYAhl6Q4roT1zwkH0 BhgZfeP/43VFwkGeAW44MUUmvOujDayj1XRNqgpyTNMfWpL9JhOcefTeCsjsntUGTGmp +7+R+vErO9x0fClhApPnHTkUBfcx/qRFeZCqdfwNnGd0T0g9Eeg8DObNrsidEnQOu+EU vS9uHW1iwn9wwM7P1Z0izejpbnVCR6fKKNLpYkJHIS9Zy0Noglh4M8EOQCbgAPoEXhNe z3/7Scfk2FpsgQH5C6zMgOo9l8eMzQK+Ltrcy0FP2YYtaNLrEO4gRooLAynKQgX/VCJ+ qlbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tbbMZn9T; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15si16901861pgm.413.2019.09.04.09.01.55; Wed, 04 Sep 2019 09:02:11 -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=tbbMZn9T; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732350AbfIDP7R (ORCPT + 99 others); Wed, 4 Sep 2019 11:59:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:33680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732336AbfIDP7Q (ORCPT ); Wed, 4 Sep 2019 11:59:16 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A4F452087E; Wed, 4 Sep 2019 15:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567612755; bh=2vjN1mTgWrVfPYXSq4C3quBd4Ijtnf7GY7w2gVNMFUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tbbMZn9T9RHvcZUkqgbqABupcvdiMlGIS7BoDSsyj5BPLyWQgiB/zxO9ht5Kz4zuM lhOH71qPmir3besBiebHf+/s9uIctd/z0fMvcIsmavVKatJ/QQA1XfL2lonnsZ+iRz NiGnqk9YVazFNwaB2/n6CdmOm13Q9U9ZIYg5gqsA= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Nagarjuna Kristam , Thierry Reding , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH AUTOSEL 5.2 64/94] usb: host: xhci-tegra: Set DMA mask correctly Date: Wed, 4 Sep 2019 11:57:09 -0400 Message-Id: <20190904155739.2816-64-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190904155739.2816-1-sashal@kernel.org> References: <20190904155739.2816-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 294158113d62c..77142f9bf26ae 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -1217,6 +1217,16 @@ static int tegra_xusb_probe(struct platform_device *pdev) tegra_xusb_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