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=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 00BEEC4707F for ; Thu, 27 May 2021 12:49:34 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 98DEC610A2 for ; Thu, 27 May 2021 12:49:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98DEC610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.133178.248297 (Exim 4.92) (envelope-from ) id 1lmFS0-0002h9-UE; Thu, 27 May 2021 12:49:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 133178.248297; Thu, 27 May 2021 12:49:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lmFS0-0002h2-Ov; Thu, 27 May 2021 12:49:24 +0000 Received: by outflank-mailman (input) for mailman id 133178; Thu, 27 May 2021 12:49:24 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lmFS0-0002ge-2a for xen-devel@lists.xenproject.org; Thu, 27 May 2021 12:49:24 +0000 Received: from mail-pf1-x42d.google.com (unknown [2607:f8b0:4864:20::42d]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2cb6396f-143e-4d30-9ff0-52ed772ddf1a; Thu, 27 May 2021 12:49:23 +0000 (UTC) Received: by mail-pf1-x42d.google.com with SMTP id f22so537372pfn.0 for ; Thu, 27 May 2021 05:49:23 -0700 (PDT) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com. [209.85.210.173]) by smtp.gmail.com with ESMTPSA id x19sm1765169pgj.66.2021.05.27.05.49.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 May 2021 05:49:21 -0700 (PDT) Received: by mail-pf1-f173.google.com with SMTP id p39so490407pfw.8 for ; Thu, 27 May 2021 05:49:21 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2cb6396f-143e-4d30-9ff0-52ed772ddf1a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=t9nQbEpq5kzp2vshpX/2KDY0MEdzNS47SlLJX4RAhzA=; b=XnDncQEfy0WK93TP5b5iaOvQy6p3tli5hK7U2lnqkRYfpimdp+9WScU0B/bVffV6lu KHvuv/cILlR7hwxjPwG4fSm8TLb0M0uiiQtfQGCy1lJiDeCNSlZdr9ro+4UoS7qK25VN Vwx6crrIG7NXb3xhmTS0AaKdDSprMjL64yAgA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t9nQbEpq5kzp2vshpX/2KDY0MEdzNS47SlLJX4RAhzA=; b=GF+M6rtH0gCPc7HlgOvao3urIcOcRuPlUmEPPdeYP77P/QuszLc71gQs6+GSJPKV4B 35MaKvUjGMbl8yZsGu/j20F+k3soRfcavB1rdMdXe24xsooFzj+khqAcVWx69kJ5MMZg BR7bNvLBieTEQHMB7E2J+Y6YST0cFr2DA6z700rJ2Lw2Yox6R6u3UNxYAIAP5e6l+hFJ nwEM8p0ykJ7s/wnE5maoHs/kpMtBTu0Zzl7lmw1ewqbi+ntQe8pt0b7oElnLHpOdEr6k EU9ksdW/v8KP4/9wLzta0vnH4gQXIlc4hAEzmP81L8d/OpJ3wE5+OMlvDsvMlTOWJxhi CK+A== X-Gm-Message-State: AOAM530HIiHZ+wWqU5/0zC6DXhEldfp4sMZLUOcmmVZKV2BOnAHzUPQK xDV2ep6n846TObO2+eOhyn68zXyeFPUE0w== X-Google-Smtp-Source: ABdhPJwcOoooqpJVylmkhZjQnlm1irgkO2N17Sw+W5Zt9spC+SnUo20D/T5CGiKAr1ze/jetG7EZdQ== X-Received: by 2002:a63:e015:: with SMTP id e21mr3574227pgh.442.1622119762184; Thu, 27 May 2021 05:49:22 -0700 (PDT) X-Received: by 2002:a92:2907:: with SMTP id l7mr2908573ilg.64.1622119750871; Thu, 27 May 2021 05:49:10 -0700 (PDT) MIME-Version: 1.0 References: <20210518064215.2856977-1-tientzu@chromium.org> <20210518064215.2856977-15-tientzu@chromium.org> <20210526121322.GA19313@willie-the-truck> <20210526155321.GA19633@willie-the-truck> <20210527113456.GA22019@willie-the-truck> In-Reply-To: <20210527113456.GA22019@willie-the-truck> From: Claire Chang Date: Thu, 27 May 2021 20:48:59 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 14/15] dt-bindings: of: Add restricted DMA pool To: Will Deacon Cc: heikki.krogerus@linux.intel.com, thomas.hellstrom@linux.intel.com, peterz@infradead.org, benh@kernel.crashing.org, joonas.lahtinen@linux.intel.com, dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk, grant.likely@arm.com, paulus@samba.org, Frank Rowand , mingo@kernel.org, sstabellini@kernel.org, Saravana Kannan , mpe@ellerman.id.au, "Rafael J . Wysocki" , Christoph Hellwig , Bartosz Golaszewski , bskeggs@redhat.com, linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, Thierry Reding , intel-gfx@lists.freedesktop.org, matthew.auld@intel.com, linux-devicetree , Jianxiong Gao , Daniel Vetter , Konrad Rzeszutek Wilk , maarten.lankhorst@linux.intel.com, airlied@linux.ie, Dan Williams , linuxppc-dev@lists.ozlabs.org, jani.nikula@linux.intel.com, Rob Herring , rodrigo.vivi@intel.com, Bjorn Helgaas , boris.ostrovsky@oracle.com, Andy Shevchenko , jgross@suse.com, Nicolas Boichat , Greg KH , Randy Dunlap , lkml , "list@263.net:IOMMU DRIVERS" , Jim Quinlan , xypron.glpk@gmx.de, Robin Murphy , bauerman@linux.ibm.com Content-Type: text/plain; charset="UTF-8" On Thu, May 27, 2021 at 7:35 PM Will Deacon wrote: > > On Thu, May 27, 2021 at 07:29:20PM +0800, Claire Chang wrote: > > On Wed, May 26, 2021 at 11:53 PM Will Deacon wrote: > > > > > > On Wed, May 26, 2021 at 01:13:22PM +0100, Will Deacon wrote: > > > > On Tue, May 18, 2021 at 02:42:14PM +0800, Claire Chang wrote: > > > > > @@ -138,4 +160,9 @@ one for multimedia processing (named multimedia-memory@77000000, 64MiB). > > > > > memory-region = <&multimedia_reserved>; > > > > > /* ... */ > > > > > }; > > > > > + > > > > > + pcie_device: pcie_device@0,0 { > > > > > + memory-region = <&restricted_dma_mem_reserved>; > > > > > + /* ... */ > > > > > + }; > > > > > > > > I still don't understand how this works for individual PCIe devices -- how > > > > is dev->of_node set to point at the node you have above? > > > > > > > > I tried adding the memory-region to the host controller instead, and then > > > > I see it crop up in dmesg: > > > > > > > > | pci-host-generic 40000000.pci: assigned reserved memory node restricted_dma_mem_reserved > > > > > > > > but none of the actual PCI devices end up with 'dma_io_tlb_mem' set, and > > > > so the restricted DMA area is not used. In fact, swiotlb isn't used at all. > > > > > > > > What am I missing to make this work with PCIe devices? > > > > > > Aha, looks like we're just missing the logic to inherit the DMA > > > configuration. The diff below gets things working for me. > > > > I guess what was missing is the reg property in the pcie_device node. > > Will update the example dts. > > Thanks. I still think something like my diff makes sense, if you wouldn't mind including > it, as it allows restricted DMA to be used for situations where the PCIe > topology is not static. > > Perhaps we should prefer dev->of_node if it exists, but then use the node > of the host bridge's parent node otherwise? Sure. Let me add in the next version. > > Will