From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AB96ECE566 for ; Thu, 20 Sep 2018 21:04:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EA87321532 for ; Thu, 20 Sep 2018 21:04:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linaro.org header.i=@linaro.org header.b="fTCv6lYY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA87321532 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388611AbeIUCuB (ORCPT ); Thu, 20 Sep 2018 22:50:01 -0400 Received: from mail-io1-f66.google.com ([209.85.166.66]:39626 "EHLO mail-io1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728787AbeIUCuB (ORCPT ); Thu, 20 Sep 2018 22:50:01 -0400 Received: by mail-io1-f66.google.com with SMTP id l7-v6so9753196iok.6 for ; Thu, 20 Sep 2018 14:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qWwMtFbMgJEvWyXamWqeaLEKVTryX6c3VKmhcjSLaQM=; b=fTCv6lYYDO1VjgBAr7a6feDdQ1Y1N0l0t0kqyFhFYRZRt6SqjjaYdki6LZTt1yLyH1 NFIfnVUrFzucJhvG9RfSuIav9dZogdjpVTqHTflpe3ojGzS3Cv2D//7w/gFYCXNHI7zH OCqigbD3XxXzJ4mHAtLVX8OyLERTxcnk7aj8Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qWwMtFbMgJEvWyXamWqeaLEKVTryX6c3VKmhcjSLaQM=; b=dL2yQWdBZWsIb+8G8A5jn/Q5TZX6FLbPcl5+J7yoOLhARm88wOoYQPzkEysMsuG/C/ NemT1VDda+wM0NzRO/n80F9EX3pxBwpR5ddEbOmHmga+mnc8L+L+9NsUfBoj3oYKWfbZ m+CpVWV0eE9K4SZ28Hk8FChhIniajsXPkXdyd0Cia8/BIVnBQo4PuVvgt2p4LjA9qO7q ZsZXuzrfl0338k6NMqLLgunijK0cnuc8q0W/McM6ZhMYvWe0dWDhZ8/e6wgr2HSEGHWV FSxcmoUTBDXPQqm58+hHx13k6RwG73VVCVSmzglgCToFhn6TqyUWfMbqxOpxeBH1yD5t 9b8g== X-Gm-Message-State: APzg51AaIE8Ly9fojGRxU0GN4pKD+GwYi9NjoWJo+mXZOBRhlVyDVN3i cV2swbq03nlmjGykL6j/QaZLk1EqmCQDsu5/Cs7P0w== X-Google-Smtp-Source: ANB0VdasWs075OXXu6eH1AOhcqp4hPtHk1FAtF52+JF1KM/sXSJVlnxj2Xr2LGVDWnMTyiCNBkPbQIi2MXKtC2Ph6cs= X-Received: by 2002:a6b:ba86:: with SMTP id k128-v6mr33820907iof.170.1537477476732; Thu, 20 Sep 2018 14:04:36 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:2848:0:0:0:0:0 with HTTP; Thu, 20 Sep 2018 14:04:36 -0700 (PDT) In-Reply-To: <7fa897cf-4d58-c63f-afdd-a3ec5a6a56bf@gmail.com> References: <1537367527-20773-1-git-send-email-jim2101024@gmail.com> <1537367527-20773-5-git-send-email-jim2101024@gmail.com> <7fa897cf-4d58-c63f-afdd-a3ec5a6a56bf@gmail.com> From: Ard Biesheuvel Date: Thu, 20 Sep 2018 14:04:36 -0700 Message-ID: Subject: Re: [PATCH v5 04/12] PCI: brcmstb: add dma-range mapping for inbound traffic To: Florian Fainelli Cc: Jim Quinlan , Linux Kernel Mailing List , Lorenzo Pieralisi , linux-pci , BCM Kernel Feedback , Gregory Fong , Bjorn Helgaas , Brian Norris , Christoph Hellwig , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20 September 2018 at 13:55, Florian Fainelli wrote: > On 09/19/2018 07:19 PM, Ard Biesheuvel wrote: >> On 19 September 2018 at 07:31, Jim Quinlan wrote: >>> The Broadcom STB PCIe host controller is intimately related to the >>> memory subsystem. This close relationship adds complexity to how cpu >>> system memory is mapped to PCIe memory. Ideally, this mapping is an >>> identity mapping, or an identity mapping off by a constant. Not so in >>> this case. >>> >>> Consider the Broadcom reference board BCM97445LCC_4X8 which has 6 GB >>> of system memory. Here is how the PCIe controller maps the >>> system memory to PCIe memory: >>> >>> memc0-a@[ 0....3fffffff] <=> pci@[ 0....3fffffff] >>> memc0-b@[100000000...13fffffff] <=> pci@[ 40000000....7fffffff] >>> memc1-a@[ 40000000....7fffffff] <=> pci@[ 80000000....bfffffff] >>> memc1-b@[300000000...33fffffff] <=> pci@[ c0000000....ffffffff] >>> memc2-a@[ 80000000....bfffffff] <=> pci@[100000000...13fffffff] >>> memc2-b@[c00000000...c3fffffff] <=> pci@[140000000...17fffffff] >>> >> >> So is describing this as >> >> dma-ranges = <0x0 0x0 0x0 0x0 0x0 0x40000000>, >> <0x0 0x40000000 0x1 0x0 0x0 0x40000000>, >> <0x0 0x80000000 0x0 0x40000000 0x0 0x40000000>, >> <0x0 0xc0000000 0x3 0x0 0x0 0x40000000>, >> <0x1 0x0 0x0 0x80000000 0x0 0x40000000>, >> <0x1 0x40000000 0x0 0xc0000000 0x0 0x40000000>; >> >> not working for you? I haven't tried this myself, but since DT permits >> describing the inbound mappings this way, we should fix the code if it >> doesn't work at the moment. > > You mean encoding the memory controller index in the first cell? If that > works, that's indeed a much cleaner solution, though is it standard > compliant in any form? No those are just memory addresses (although I may have screwed up the order). From Documentation/devicetree/booting-without-of.txt: """ Optional property: - dma-ranges: encoded as arbitrary number of triplets of (child-bus-address, parent-bus-address, length). Each triplet specified describes a contiguous DMA address range. """