Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp518194pxj; Thu, 27 May 2021 05:54:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKa4pemRxIDtyEs7qQIg5D5GACtwQ2vczyCQ4iZ22YCKgjIS9uGB0VeDdJdMRy3nSPMrB9 X-Received: by 2002:a05:6e02:1d0b:: with SMTP id i11mr2860341ila.36.1622120076480; Thu, 27 May 2021 05:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622120076; cv=none; d=google.com; s=arc-20160816; b=RykPUpHqRselvVq6kzvQzCb0b5l/SmC9T4gpwE429Ibm6Umm7DVnnVSWB/SRMPOrUy XierLl2lS2am+Pd+u8Lj1sYNmN8aF058OEWcBNyIqnuuWc5upwMXG1ZZjdhwyjYAgrcm hod0QlRHIjtv2/bwNyGsqaFXUAd4TbLE02QOmSHs/+vOr4hqTinQ4haRosbceFfUGwGn YsXfGSO4NPf+YuVhApj9lxoD1RiVYzH0PmO85W5PsjdWU1Dyj5hqpdsZKyinNPZ7taQ0 uHaY4Ry3f0NFskopGSJhshsB7AyoXLeT2j5dmwc82ePP0PbBgP+6AGfkBkkiAIfZZOVR 8UUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=w4vdg60VKfS/G/tXZTQo6tscsfgHGxJbAwhM2zJrcRs=; b=KF08/RDMjpeBJsb9TpAq1XMcl3GlwooICRCcwEu2PEFDmQHFL5nzXe+9x1G4Mde/MH eEFYtAA1ZlmgUnXXpFyeM9Sj5jPqtPxA6ktSDvLnoZwacR9r65hHPkUwXqNOThgCuCyv H0RrV92wBU17HSGvBR7GGBJwzioTAwbDQjOqNViUVqV3aHGZQaZslya0K4iE3MzT3HsF fcMRV1JB87QntaaBBgga/6xJ7/uik2RDAsErmnoTX65KSAfXnjSdO11OGJtUYZ9bQLVA FJoCKYGQGZfD9BaJH0I6JDi4Izn/wPCa5ypK78tAfJrp9b5UUm15xQze2XlfAA3T1TFn DJTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T2Q+xyFZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y19si2103699ili.67.2021.05.27.05.54.21; Thu, 27 May 2021 05:54:36 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T2Q+xyFZ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235811AbhE0MzM (ORCPT + 99 others); Thu, 27 May 2021 08:55:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:33820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235714AbhE0MzL (ORCPT ); Thu, 27 May 2021 08:55:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B984D6109F; Thu, 27 May 2021 12:53:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622120018; bh=mnHenbEzMbQdhDrGu816+dyeKu927RlHNDgNBf8bfNk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=T2Q+xyFZywvya0fPBfvK4sRdbR/bde8Rq8P4FN21AACPVaQSQsdEc0x2+0v5r+abP 3/8E7TEJSHcMhmUgcHo1bhdAA9AfzEMLppzT6/0P8DePbBmTljtDkX4NEtYRaHLEM1 Gnn3YP4aa748IT6RrSs7VU9Pqy8c4Xvink86bWS+UgwCuEehm3hOhTqBJaoQ8WPXJq ulYWtbHvYOw84jAR1SH3F2sv+RGThyTfyzG8N3saQSkF5BsBVg+8LW53nliUGD6EFQ 5/RBGn2iLBX38fmxUgOxq5fMNgVhtClQMCVzqiJ/tPC3LfS/b2F3cV49KGjPHavT/f X+zziZDTtPkzw== Date: Thu, 27 May 2021 13:53:28 +0100 From: Will Deacon To: Claire Chang 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 Subject: Re: [PATCH v7 14/15] dt-bindings: of: Add restricted DMA pool Message-ID: <20210527125328.GA22352@willie-the-truck> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 27, 2021 at 08:48:59PM +0800, Claire Chang wrote: > 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. Brill, thanks! I'll take it for a spin once it lands on the list. Will