Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3472594imu; Sun, 11 Nov 2018 15:54:24 -0800 (PST) X-Google-Smtp-Source: AJdET5dSyyl7Ak6F7goRnaKf+J3W2eLRmLcpnY4k+nNXwe9Mgh7IHuR+00yBY2+wROOW/TUATFt7 X-Received: by 2002:a17:902:f208:: with SMTP id gn8mr13253718plb.6.1541980464933; Sun, 11 Nov 2018 15:54:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980464; cv=none; d=google.com; s=arc-20160816; b=U2KIljGvsHI1vIeRSVyuH+eBu9eCNO08aiBFZWr4JJIpn7Te7WOhXq/Iv7lVFXoKMT WT46zN/IT+JGEDXxrKAsHsmkJ9NxxRco9dCCgJUAs305xHFMxSqHXSqAk4v7DHGQV8yv BcwhxSZKpj2XBZb5a5N7Bp8N/IoTAcnEapFw2FxiAnERP04HOeNN3HDLZszx5knM7DRz ywRaFgy/8FRjqM3K9yVqHlQ5goT7+DS6CqkbW/z+0mkeiW117FrLEfyhfTKz5DKrmSUX Rehm/fO0q0T4ejjbGhpHYrlxdPn2jqS0CvjFjq28ISORR7QMcL8BBhqnc7hZbdosdVbv 3yAw== 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=tFxDUHUG7fhpXULwNFEBO8nkEqP9uVvYhLY4ZkQuQF8=; b=teCKIThef6sX57TiHrMsRJJuQhfvZA0gDaUZegYpZvq7sVTbecIOCe+AXki7Ux6s1S g8FRi8ngIWtwZE/2WeojdjDtvLIz4qNiRE8N3QGTTZttNyycUz5SSH1F+XreU4gZhvNB +VacaBX8UitGex4QxW0+0i/n/1gRdiw/LOmvfRD24sdxx1EDkpZiABn7N2MZwKUGntnw VkgTpxTL68TFnNf7O9jFKZcMqypoAjxiknjpXCiAt6eMLibosoxbcs0CRTQGnsfRwgRk aRDogRRvkdHsUbi7HIEPrXzCzNjAEOmp22NuBjo3EezBithDYvZDT8+/yiGd2RzAXR4T CBmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="XNJTz/Wu"; 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 bi11-v6si16000277plb.20.2018.11.11.15.54.09; Sun, 11 Nov 2018 15:54:24 -0800 (PST) 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="XNJTz/Wu"; 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 S1733199AbeKLJm6 (ORCPT + 99 others); Mon, 12 Nov 2018 04:42:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:37518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732805AbeKLIS1 (ORCPT ); Mon, 12 Nov 2018 03:18:27 -0500 Received: from localhost (unknown [206.108.79.134]) (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 4E5A421527; Sun, 11 Nov 2018 22:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975311; bh=cQiOIVaIunyTI7qN9LneTKQnkhBz737PqGh7nYQ5Qm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNJTz/WuNh3BkBFjWcRVGBV2C3Ei3n8MDORw33U9ESEQ/0mh/OvJcJqVAHkhZyfOI X87e1E084bNUbfCFYo5edlsD5TrWEc1O/Z+ecstaHXa6mDdcblpfWqVIrRJtOAbxXG CcVfpfS3o0j8ARyfREZV8hwQhqDcr/4a68BioPMk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Paul Burton , Ralf Baechle Subject: [PATCH 4.19 291/361] TC: Set DMA masks for devices Date: Sun, 11 Nov 2018 14:20:38 -0800 Message-Id: <20181111221656.705609150@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maciej W. Rozycki commit 3f2aa244ee1a0d17ed5b6c86564d2c1b24d1c96b upstream. Fix a TURBOchannel support regression with commit 205e1b7f51e4 ("dma-mapping: warn when there is no coherent_dma_mask") that caused coherent DMA allocations to produce a warning such as: defxx: v1.11 2014/07/01 Lawrence V. Stefani and others tc1: DEFTA at MMIO addr = 0x1e900000, IRQ = 20, Hardware addr = 08-00-2b-a3-a3-29 ------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at ./include/linux/dma-mapping.h:516 dfx_dev_register+0x670/0x678 Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.0-rc6 #2 Stack : ffffffff8009ffc0 fffffffffffffec0 0000000000000000 ffffffff80647650 0000000000000000 0000000000000000 ffffffff806f5f80 ffffffffffffffff 0000000000000000 0000000000000000 0000000000000001 ffffffff8065d4e8 98000000031b6300 ffffffff80563478 ffffffff805685b0 ffffffffffffffff 0000000000000000 ffffffff805d6720 0000000000000204 ffffffff80388df8 0000000000000000 0000000000000009 ffffffff8053efd0 ffffffff806657d0 0000000000000000 ffffffff803177f8 0000000000000000 ffffffff806d0000 9800000003078000 980000000307b9e0 000000001e900000 ffffffff80067940 0000000000000000 ffffffff805d6720 0000000000000204 ffffffff80388df8 ffffffff805176c0 ffffffff8004dc78 0000000000000000 ffffffff80067940 ... Call Trace: [] show_stack+0xa0/0x130 [] __warn+0x128/0x170 ---[ end trace b1d1e094f67f3bb2 ]--- This is because the TURBOchannel bus driver fails to set the coherent DMA mask for devices enumerated. Set the regular and coherent DMA masks for TURBOchannel devices then, observing that the bus protocol supports a 34-bit (16GiB) DMA address space, by interpreting the value presented in the address cycle across the 32 `ad' lines as a 32-bit word rather than byte address[1]. The architectural size of the TURBOchannel DMA address space exceeds the maximum amount of RAM any actual TURBOchannel system in existence may have, hence both masks are the same. This removes the warning shown above. References: [1] "TURBOchannel Hardware Specification", EK-369AA-OD-007B, Digital Equipment Corporation, January 1993, Section "DMA", pp. 1-15 -- 1-17 Signed-off-by: Maciej W. Rozycki Signed-off-by: Paul Burton Patchwork: https://patchwork.linux-mips.org/patch/20835/ Fixes: 205e1b7f51e4 ("dma-mapping: warn when there is no coherent_dma_mask") Cc: stable@vger.kernel.org # 4.16+ Cc: Ralf Baechle Signed-off-by: Greg Kroah-Hartman --- drivers/tc/tc.c | 8 +++++++- include/linux/tc.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) --- a/drivers/tc/tc.c +++ b/drivers/tc/tc.c @@ -2,7 +2,7 @@ * TURBOchannel bus services. * * Copyright (c) Harald Koerfgen, 1998 - * Copyright (c) 2001, 2003, 2005, 2006 Maciej W. Rozycki + * Copyright (c) 2001, 2003, 2005, 2006, 2018 Maciej W. Rozycki * Copyright (c) 2005 James Simmons * * This file is subject to the terms and conditions of the GNU @@ -10,6 +10,7 @@ * directory of this archive for more details. */ #include +#include #include #include #include @@ -92,6 +93,11 @@ static void __init tc_bus_add_devices(st tdev->dev.bus = &tc_bus_type; tdev->slot = slot; + /* TURBOchannel has 34-bit DMA addressing (16GiB space). */ + tdev->dma_mask = DMA_BIT_MASK(34); + tdev->dev.dma_mask = &tdev->dma_mask; + tdev->dev.coherent_dma_mask = DMA_BIT_MASK(34); + for (i = 0; i < 8; i++) { tdev->firmware[i] = readb(module + offset + TC_FIRM_VER + 4 * i); --- a/include/linux/tc.h +++ b/include/linux/tc.h @@ -84,6 +84,7 @@ struct tc_dev { device. */ struct device dev; /* Generic device interface. */ struct resource resource; /* Address space of this device. */ + u64 dma_mask; /* DMA addressable range. */ char vendor[9]; char name[9]; char firmware[9];