Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1179256yba; Tue, 2 Apr 2019 04:05:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzI6I4qJ9Eu2yYSr3yfgL69eSWQo1RRPl7r9QFusPEfxRYE+nckCfew6f3ykQztgoJwlwEJ X-Received: by 2002:a63:614c:: with SMTP id v73mr66738116pgb.395.1554203101898; Tue, 02 Apr 2019 04:05:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554203101; cv=none; d=google.com; s=arc-20160816; b=ShYoP29z48viVD0wHxUnMsNMbWFlkCKehStPFYq2SD8zhZqfsVe8ehMCM8DfgX6/5A 6pTJpl5yzgfbRVwIJTTGTRoyy6oxbm3efAYKGh/MW6mafKAJTKxvaXySIGSMh3tYd0hb GP1q8E0bEj8z7QouUKifa9vqOAXlec89a3hOrWPR+EUgf2QvNrasHHJU3ttpzEjzU90T tHK9j38EAhhOMoYHjk7oRoXV2ZE23pRD5G9BTyNDkOZPCCBKC5JCwoP2D1aBOY2yVKLt HJSxGpDg2tbgyJHkuf3fHH0GtxVhWXlPqb+Ks89Ohprgls9exAuUxEDu3H6ZEi01Vm6K vW6Q== 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=eXCmRyYUkBm/hVjYTq5OHyFXqkOQ1CHQm/B0+iql744=; b=z58Pth7rnQvtzqFCQLBvQgkIiOxQCCOWDDkMYOIHt84uMlHtURJJRz5FIJ98ZJeW8e mhLtnkdwHq4ommYXFGePM5SRJsAHCpdKlGYROINLU9N6ugB7hpgignXYYaGdWYxO8Llq 7/9Fpun4t4z+czuUGlXNrE1xdI09lB+3NEOY3sAR8GQF9XZWYRbuEvYvHAi9RKiTpgTv P/U9jrQGB6BtGqC9cP3GMXWyRTds3/ZIrV3C6Zr46v4cPSS2IlJeZkwdYiG4XTVaGZhl Oz8xu7X9/d1b9h8NT2aBiCfW/DxGwcxRjXI2RWSJMC23AGb993bwSFpfOkpAgfHip+RJ I0OA== 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 76si11526844pge.555.2019.04.02.04.04.46; Tue, 02 Apr 2019 04:05:01 -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; 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 S1729779AbfDBKCp (ORCPT + 99 others); Tue, 2 Apr 2019 06:02:45 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:47680 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726716AbfDBKCo (ORCPT ); Tue, 2 Apr 2019 06:02:44 -0400 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 EA60615AD; Tue, 2 Apr 2019 03:02:43 -0700 (PDT) Received: from [10.1.196.75] (e110467-lin.cambridge.arm.com [10.1.196.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A9393F59C; Tue, 2 Apr 2019 03:02:42 -0700 (PDT) Subject: Re: [PATCH] usb: xhci: inherit dma_mask from bus if set correctly To: Pankaj Dubey , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mathias.nyman@intel.com, gregkh@linuxfoundation.org, jingoohan1@gmail.com, krzk@kernel.org, mgautam@codeaurora.org, felipe.balbi@linux.intel.com, Sriram Dash References: <1554198011-24342-1-git-send-email-pankaj.dubey@samsung.com> From: Robin Murphy Message-ID: <0d3e8992-06e1-57e4-edd5-ba230caaa189@arm.com> Date: Tue, 2 Apr 2019 11:02:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <1554198011-24342-1-git-send-email-pankaj.dubey@samsung.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 02/04/2019 10:40, Pankaj Dubey wrote: > From: Sriram Dash > > The xhci forcefully converts the dma_mask to either 64 or 32 and the > dma-mask set by the bus is somewhat ignored. If the platform sets the > correct dma_mask, then respect that. It's expected for dma_mask to be larger than bus_dma_mask if the latter is set - conceptually, the device mask represents what the device is inherently capable of, while the bus mask represents external interconnect restrictions which individual drivers should not have to care about. The DMA API backend should take care of combining the two to find the intersection. Are you seeing an actual problem here, and if so on which platform? (If the bus mask is set at all then it wouldn't seem to be the DT PCI issue that I'm still trying to fix). Robin. > Signed-off-by: Pankaj Dubey > Signed-off-by: Sriram Dash > --- > drivers/usb/host/xhci.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > index 005e659..55cf89e 100644 > --- a/drivers/usb/host/xhci.c > +++ b/drivers/usb/host/xhci.c > @@ -5119,6 +5119,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) > dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); > } > > + /* > + * A platform may require coherent masks other than 64/32 bit, and we > + * should respect that. If the firmware has already requested for a > + * dma-range, we inherit the dma_mask presuming the platform knows > + * what it is doing. > + */ > + > + if (dev->bus_dma_mask) > + dma_set_mask_and_coherent(dev, dev->bus_dma_mask); > + > xhci_dbg(xhci, "Calling HCD init\n"); > /* Initialize HCD and host controller data structures. */ > retval = xhci_init(hcd); >