Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp21586imb; Thu, 28 Feb 2019 14:43:47 -0800 (PST) X-Google-Smtp-Source: APXvYqzaQ42ycNFAEi6xFuerF2aanEDn6+VQ3RLDFF/7PtpRAms5TTnfQAYSVL2c+qhihv305NvZ X-Received: by 2002:a17:902:9a0b:: with SMTP id v11mr1901099plp.194.1551393827590; Thu, 28 Feb 2019 14:43:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551393827; cv=none; d=google.com; s=arc-20160816; b=uNI/i+lxDnXN0SPmViZUeLMzC2cNhZMfP1Y2PDJOQHWWL1V1CzvPZBuLpcu3w7Tyo5 ZCEzXvVQS0VWjNCYJnU/tQpPCdKkCOFIwJ91qXxwa6MLISAivp0VPqkgZSBho5oQ0EUW lbZbfTbInjNjGI1LxpbHcQhBTmY+0Ywz3ZozoI5N1ufPSD8CGSQbcErvQAd9AZsXJXAq nb58tB8AuvuX2xhYojpAV9u87/dOrgK+lO0URSN8jGiZgxdI/F5RUVpbqROkz5p2Ckxa uwgtdlQ58qzkRN4vQUOy27h6U/EWYX7x4vU6SUK3JKIweN9ZloIIbdzmaRsG6CtJJaqB xleg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=i+7cRAkPP9JEhb6ZvN+Z/CLOLbYh0oOaatgriazL8aI=; b=kTUKZ6zsK7TE9huYpBYdyrMP/CJoYkfnsorpnGzy6FSsc7YS96yQt2GgtUjdg3NPRW YH5k248ZnQIXBEUn5pjmeUmMYLk/tmg2U1qksJUDfyUp6mKyTm8RgFz2zYjCCoEh5oOC T4U78a2N18hBmQVD4op+WtHZ0zHVJ9u0/YRXSRrZ/VPJnfrgvIE01EWHQPVaczgiH1hq BFPq2AozVpPDU9mqINRX1MEAdFWUh8CW9Q1Fyjk5Q0POfp7FFSxQzL+ZCt6C1CJS4f3g h7D+Oogz0i++SwrPOrgM6MMACNwpJXeFH6/ClbYSW3CwhCuC0TzKPwY8o4d0f/nHATp0 1M4w== ARC-Authentication-Results: i=1; mx.google.com; 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 z3si15881817pfi.180.2019.02.28.14.43.31; Thu, 28 Feb 2019 14:43:47 -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; 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 S1728799AbfB1WmO (ORCPT + 99 others); Thu, 28 Feb 2019 17:42:14 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55358 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbfB1WmO (ORCPT ); Thu, 28 Feb 2019 17:42:14 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B44D8A78; Thu, 28 Feb 2019 14:42:13 -0800 (PST) Received: from [192.168.1.123] (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 611903F720; Thu, 28 Feb 2019 14:42:12 -0800 (PST) Subject: Re: [PATCH] Revert "of/device: Really only set bus DMA mask when appropriate" To: Alistair Francis , "linux-riscv@lists.infradead.org" , "robh@kernel.org" Cc: "linux-kernel@vger.kernel.org" , "alistair23@gmail.com" References: <20190228223257.6189-1-alistair.francis@wdc.com> From: Robin Murphy Message-ID: <056edacd-a998-277c-f0de-1aac256165a2@arm.com> Date: Thu, 28 Feb 2019 22:42:09 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190228223257.6189-1-alistair.francis@wdc.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-02-28 10:33 pm, Alistair Francis wrote: > This reverts commit 6778be4e520959659b27a441c06a84c9cb009085. > > Reverting the commit fixes these error messages and an non-functioning > USB bus when attaching a USB to PCIe card to a RISC-V board: > xhci_hcd 0000:03:00.0: Host took too long to start, waited 16000 microseconds. > xhci_hcd 0000:03:00.0: startup error -19 > xhci_hcd 0000:03:00.0: USB bus 2 deregistered > xhci_hcd 0000:03:00.0: WARNING: Host System Error > xhci_hcd 0000:03:00.0: remove, state 1 > > Signed-off-by: Alistair Francis > --- > I'm not sure if this is the correct fix, it's possible something else is > wrong, but I wanted to get some feedback. Given that the bug which this revert would reintroduce cripples DMA on just about every 64-bit DT system, probably not. Can you clarify what your DT looks like, and turn on the debug output for of_dma_get_range() to see what it says? Robin. > drivers/of/device.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/of/device.c b/drivers/of/device.c > index 3717f2a20d0d..8299f8055da7 100644 > --- a/drivers/of/device.c > +++ b/drivers/of/device.c > @@ -149,11 +149,9 @@ int of_dma_configure(struct device *dev, struct device_node *np, bool force_dma) > * set by the driver. > */ > mask = DMA_BIT_MASK(ilog2(dma_addr + size - 1) + 1); > + dev->bus_dma_mask = mask; > dev->coherent_dma_mask &= mask; > *dev->dma_mask &= mask; > - /* ...but only set bus mask if we found valid dma-ranges earlier */ > - if (!ret) > - dev->bus_dma_mask = mask; > > coherent = of_dma_is_coherent(np); > dev_dbg(dev, "device is%sdma coherent\n", >