Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3050791pxj; Mon, 7 Jun 2021 00:29:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiVNuieuewbIxQ6CfsNH0iOu3Br/q6h070nIJltSDTGqzsPaGW5glWgwu+Y6TtcSiZSH8B X-Received: by 2002:aa7:d8d8:: with SMTP id k24mr18298649eds.253.1623050986340; Mon, 07 Jun 2021 00:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623050986; cv=none; d=google.com; s=arc-20160816; b=t5JNjXzJe+/IwnjehA+PjtH+XgGKUnsyatHQMjd2Gq3IwuWVI6nTyCjky0i1CE1HpJ vvzt87DdbTS0FXmh2NeffBK/8wxIHM47ktYAL7l2iHVTek0VofEXq9ATTxq1mvpeHXih 8pyunLw3JTIe5OSzDE8yxPd2NeKJrIlfRvBHr5wd712g8eIHre4xy0+rgpNawHcLMtRk EBmZH87wAC3UITtL/tf6jv/p46B8bqMLvrGfzA0W2yFPD8rH2zWuIexImcsZghGBuDB0 PRo4oX6ruH/do17yWZw5/dRRZmOfTd+Pc/h702CSr9v92uIvLtsYzLMYzFbJ+H1hXB/l LJvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=XvnNLbbYWDuFbiw4n1UMJ0oyoNfO0LWKlCuECIfP53c=; b=o6adD9QaOm+riBIfBH5oF13viQYxmO/D9izUNIImyOevwqsnTyH6MhqRah7PBsOfO4 fPmZCkoya/73X3CNZAaUlOvkcgdKP1IX7BB3qkHeWc63qkIaB/Hd2uVGBhZvggUGGWt2 qpUEEpli/ZZTvLwGzidEyBg0/He9y1PAoIW6+vWiD4QdBmMFq15NqyaGKB531SFa9XDt lLOepBboIhQR4EwhJZN1OpLO1xAR1FZTOGblxoo8fnLpbtOPf40OwT65gceBSem8i4gP F5VeARua10HfpmWmcfEyMatEe5HDO2VeKYtlBkkKnp/ao2h4foFkT59NVsYAz+31sST5 4ndw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si11636668ejp.248.2021.06.07.00.29.23; Mon, 07 Jun 2021 00:29:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230255AbhFGH3Y (ORCPT + 99 others); Mon, 7 Jun 2021 03:29:24 -0400 Received: from mout.kundenserver.de ([217.72.192.73]:52427 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229923AbhFGH3Y (ORCPT ); Mon, 7 Jun 2021 03:29:24 -0400 Received: from mail-wm1-f45.google.com ([209.85.128.45]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MDQqe-1lgqGI0UZq-00AWb3; Mon, 07 Jun 2021 09:27:32 +0200 Received: by mail-wm1-f45.google.com with SMTP id o127so9319871wmo.4; Mon, 07 Jun 2021 00:27:32 -0700 (PDT) X-Gm-Message-State: AOAM530W7388sFuaOsjGrn+OidP/XQvXA+ABhT3m7To4CDxCiO60vOeB XZbZBYY6csbegj/CEpgjb11ywcHh3mAekd2pJq0= X-Received: by 2002:a1c:7d15:: with SMTP id y21mr15225768wmc.120.1623050851753; Mon, 07 Jun 2021 00:27:31 -0700 (PDT) MIME-Version: 1.0 References: <20210607061751.89752-1-sven@svenpeter.dev> In-Reply-To: <20210607061751.89752-1-sven@svenpeter.dev> From: Arnd Bergmann Date: Mon, 7 Jun 2021 09:25:43 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] usb: dwc3: support 64 bit DMA in platform driver To: Sven Peter Cc: USB list , Felipe Balbi , Greg Kroah-Hartman , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:FpXRJ6RdhrGnO5lZfKdZ1EfAWrw49CWWETxRA39cqrLf0ZsaN64 M0wmHW0sI9/cEpCZ6Ca3lKEulPUpS35235ZnG3PX2jz1GHgRcswO2nq0N+iDGHptPU1wztT Qf3zXJYB4tb8WTd4XfwiKYvRy1yuYgh2bI51zi4DXXIUHWGQcBMsJFGYVpPfZG5cXUiQ9ex eK4IIfy6rpEKT49W67GXg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:GOVWqNJm5Oc=:i2w7vP8G+tZb/WmVCUJJYf xvM3zGSKW2ybqWS3GWHIA6NaPI+HJRJFz1wl6CzLWtBSK6zCXE93+Gm4VDlnl5WMfMZ9LPdWz Q8iRRr/0lBZSrlU+++r/9QDey7nhPpG6Pz+fm+zNj9u97WVfm8v/CB3lsU/yLesKaCThuiyPf eOtyfc/bQZ+aq1adh3PeMOOfsQgaBo1tbObur7h82urA3akny7ck6QtL0ldCzbXj2XwX/AVtY zYVmQuSL1hvfeo9cuOQw9tOhjD1OwlAN1kpKk6B1a3iJySUuKmpjfbX8NX1fII6fGunI4cdQR PlZGuEYPx4pQ9K9dcoOW7XmCxQlKuCVSUjnoIJrpT5v9ZtOQVqcwQwLNBbEzHeZHBNgUvkve9 k91QdfraphSGsBGD4ZEbasybEPCg0kr/7BNZDwhJ/nOLQgxes8MXx9GvERm2F2ERAi9pLsXDO quE97082toG0s2Ukx0YUofNJGotNoFhnOyh1h1DrAeU5d8UHt5S1dgnkYyYRV920o/alB9vqs oFw1s9Cgyaa/Z0ZvuxQpVYLxmunjEmY+tpb+QTLykiP4CVYATU4CTcmo1lcF2fAs98soCSGZ+ 5gjv97oflruJbKO0TmLtl776JBSUMBDfP524UFkinWB03e8jvcnulCEXRSjppP8u+RoKIlaHW q3zk= Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 7, 2021 at 8:18 AM Sven Peter wrote: > > Currently, the dwc3 platform driver does not explicitly ask for > a DMA mask. This makes it fall back to the default 32-bit mask which > breaks the driver on systems that only have RAM starting above the > first 4G like the Apple M1 SoC. > > Fix this by calling dma_set_mask_and_coherent with a 64bit mask. > > Signed-off-by: Sven Peter > --- > > Third time's a charm I hope - this time much simpler :) I think this is almost good, but there is still one small issue: > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index b6e53d8212cd..ba4792b6a98f 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -1545,6 +1545,10 @@ static int dwc3_probe(struct platform_device *pdev) > > dwc3_get_properties(dwc); > > + ret = dma_set_mask_and_coherent(dwc->sysdev, DMA_BIT_MASK(64)); > + if (ret) > + return ret; This will now fail on machines with dwc3 connected to a 32-bit bus (or a bus that is accidentally not annotated as supporting 64-bit) when there is some memory that is not addressable through that bus. If dma_set_mask_and_coherent() fails, the platform should just fall back to 32-bit addressing as it did before your change. dma_alloc_*() will do that implicitly by allocating from ZONE_DMA32, while dma_map_*() fails on any non-addressable memory, or falls back to swiotlb if that is available. Arnd