Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1772562ybn; Thu, 26 Sep 2019 01:54:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbKMT8mWvBOOqYDFgO39mQaY+yRTsWWAAI3L1eV+C/EjFzPpHy3S1nOklH2EEA8OLo7GOw X-Received: by 2002:aa7:d803:: with SMTP id v3mr2336189edq.146.1569488064057; Thu, 26 Sep 2019 01:54:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569488064; cv=none; d=google.com; s=arc-20160816; b=Lh94L0fQT0LUx00oiTW3JbVo5K1XUVayhWMJKTNuHwnCljJ+qUSMuY4591Lh/6Umhk xgCcrMS5rmsTgCzfdku6NlBKzkHhS1/4TkMZoM0ICTwJ8AmaxW5VFaTFpbP/SzkJ277P X+04dmE0bljqQr2W86MPx5Y2AllOFe3iR5Ln5ShwhCqf+16Fel56a42GvdU3Sr39ebH+ nAY402HgbsfEdPg/O151WaC9Bw96lZHZC7SucKn8rAEPx8YspprAduRQ/xXuDLTsXlI4 Oqra8n+M7z+nVEZ44TfA7WohWvVpiWW4zIArnXRxS+Savt14GpyrQYFR4DJOz0dSgJUA ptzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7EnBQLGJXbJ0krx6sf9eAXMt0SpVcFYHvJ4Ffxc+GEI=; b=vAP0gt5DG1swotFlZy5GWkt1kwCpzTlPVETclL844b8xEuVI1eAB35ScdgSp2pL1Ul HCa+xSX4BUcNR9tbP3rA+0RWM5HFM3tP/yayYN5gKtRqtmUtTAd547ewFQfs8YV+3IvI 2SQ3dhr2h0kuW2ksFVOiAFDeWb4vKAj44vCQe3RbK4ifUzALw7FMYWldZJm5K3sBpSIW NKKgvse3IYsaawOAnBofNMTicoLtTIR5j67syw+X5EUU7tmu2Lk/cbaNMt43d5uK+7Al WvlV69cfP+b25Abz9q9JP5ZaZVzeWUalaiJ+R18yeo2bq4hEivqNJGpKAtU8u2fMEQjj CtDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZUjBfJ5y; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-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 i38si899370eda.64.2019.09.26.01.53.53; Thu, 26 Sep 2019 01:54:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-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=ZUjBfJ5y; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-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 S2633605AbfIXV7e (ORCPT + 99 others); Tue, 24 Sep 2019 17:59:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:60378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387723AbfIXV7d (ORCPT ); Tue, 24 Sep 2019 17:59:33 -0400 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (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 6156D217D7; Tue, 24 Sep 2019 21:59:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569362372; bh=7EnBQLGJXbJ0krx6sf9eAXMt0SpVcFYHvJ4Ffxc+GEI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=ZUjBfJ5y+ysHUqZVHvVQV6vmXEF5m5l7X/D3o8MMo6T+fnXCBe1Len91UdIVSmNm8 1+IgmCK2yWkyLXKdLfON0wTF2uVY6/Zj+z4CbqBQ8S1mTFhTzxJ4K+kIhlIbeitlp5 qXtcO6SJzhSJ74/8s14mN0YBxYms1LJJP0SwTimA= Received: by mail-qt1-f179.google.com with SMTP id x4so4100980qtq.8; Tue, 24 Sep 2019 14:59:32 -0700 (PDT) X-Gm-Message-State: APjAAAUSipfNLAs0r3iY98Oq51rlrlAyRzY6XaLme2e9ZLFqmU4bXOcs y3XFqQogK86HIUelflV99P3yYhl0p6JxbjmCsw== X-Received: by 2002:ac8:6982:: with SMTP id o2mr5274643qtq.143.1569362371529; Tue, 24 Sep 2019 14:59:31 -0700 (PDT) MIME-Version: 1.0 References: <20190924181244.7159-1-nsaenzjulienne@suse.de> In-Reply-To: <20190924181244.7159-1-nsaenzjulienne@suse.de> From: Rob Herring Date: Tue, 24 Sep 2019 16:59:20 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 00/11] of: Fix DMA configuration for non-DT masters To: Nicolas Saenz Julienne Cc: devicetree@vger.kernel.org, Frank Rowand , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , linux-wireless , "linux-kernel@vger.kernel.org" , linux-arm-msm , "open list:DMA GENERIC OFFLOAD ENGINE SUBSYSTEM" , etnaviv@lists.freedesktop.org, dri-devel , xen-devel@lists.xenproject.org, linux-tegra@vger.kernel.org, Linux Media Mailing List , linux-pci@vger.kernel.org, Matthias Brugger , Robin Murphy , Florian Fainelli , james.quinlan@broadcom.com, Stefan Wahren , Dan Williams , freedreno Content-Type: text/plain; charset="UTF-8" Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Tue, Sep 24, 2019 at 1:12 PM Nicolas Saenz Julienne wrote: > > Hi All, > this series tries to address one of the issues blocking us from > upstreaming Broadcom's STB PCIe controller[1]. Namely, the fact that > devices not represented in DT which sit behind a PCI bus fail to get the > bus' DMA addressing constraints. > > This is due to the fact that of_dma_configure() assumes it's receiving a > DT node representing the device being configured, as opposed to the PCIe > bridge node we currently pass. This causes the code to directly jump > into PCI's parent node when checking for 'dma-ranges' and misses > whatever was set there. > > To address this I create a new API in OF - inspired from Robin Murphys > original proposal[2] - which accepts a bus DT node as it's input in > order to configure a device's DMA constraints. The changes go deep into > of/address.c's implementation, as a device being having a DT node > assumption was pretty strong. > > On top of this work, I also cleaned up of_dma_configure() removing its > redundant arguments and creating an alternative function for the special cases > not applicable to either the above case or the default usage. > > IMO the resulting functions are more explicit. They will probably > surface some hacky usages that can be properly fixed as I show with the > DT fixes on the Layerscape platform. > > This was also tested on a Raspberry Pi 4 with a custom PCIe driver and > on a Seattle AMD board. Humm, I've been working on this issue too. Looks similar though yours has a lot more churn and there's some other bugs I've found. Can you test out this branch[1]. I don't have any h/w needing this, but wrote a unittest and tested with modified QEMU. Rob [1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git dma-masks