From nobody Tue Feb 10 01:35:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=chromium.org ARC-Seal: i=1; a=rsa-sha256; t=1623825114; cv=none; d=zohomail.com; s=zohoarc; b=SDmqKwPfeGcQsaIjo6ahHnhQpyo/5U03CgUH3uz4M3I/8mEOtgghJvM0IJuxhITJ8WtOjeK2p5k2kU3qU4sfj1JS+q2U9TmTvPJ7VG2nQl4qUxy3TZVZXNSvBrs2c20/koHEXXZIJwM/bBrMJRdCix2rtWONFn4IkY3SGdrMqWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623825114; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GymVnULBeJ03m5EPo7c7VEX7DSqoBwMT6L2fMWoeeEc=; b=IW0mpbMglW6SUwzGWmLYKl1f3sGIvkuwMc1Jn/KUXx1vZp/wg00EAd0qaoanqCVTA+qNVjCCQtud4rUJjMO9ThtZXqJbrjZy6CbDTcjScCGPfCkwGfwIzJl/Z89W5Cg3Q0LkjuBDlxu1dcqyinkKUpvW0a9Upgt0vxa4IQ00hTo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1623825114041563.8466527181276; Tue, 15 Jun 2021 23:31:54 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.142667.263193 (Exim 4.92) (envelope-from ) id 1ltP5Q-0004K5-NU; Wed, 16 Jun 2021 06:31:40 +0000 Received: by outflank-mailman (output) from mailman id 142667.263193; Wed, 16 Jun 2021 06:31:40 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ltP5Q-0004Jy-KP; Wed, 16 Jun 2021 06:31:40 +0000 Received: by outflank-mailman (input) for mailman id 142667; Wed, 16 Jun 2021 06:31:39 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ltOxy-0007gS-J3 for xen-devel@lists.xenproject.org; Wed, 16 Jun 2021 06:23:58 +0000 Received: from mail-pg1-x533.google.com (unknown [2607:f8b0:4864:20::533]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ecd20f7a-d8a9-4f05-ae44-1afb6b9ba497; Wed, 16 Jun 2021 06:23:44 +0000 (UTC) Received: by mail-pg1-x533.google.com with SMTP id l184so1116931pgd.8 for ; Tue, 15 Jun 2021 23:23:44 -0700 (PDT) Received: from localhost ([2401:fa00:95:205:3d52:f252:7393:1992]) by smtp.gmail.com with UTF8SMTPSA id s37sm1040984pfg.90.2021.06.15.23.23.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Jun 2021 23:23:43 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: ecd20f7a-d8a9-4f05-ae44-1afb6b9ba497 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GymVnULBeJ03m5EPo7c7VEX7DSqoBwMT6L2fMWoeeEc=; b=U3eun+ENVyocWxLJj29G6RCpfONi9/U6hPEIyZyKw371lsv5ZvHOuZIFA51JbRET1+ Op95gA7j695YxlxlvZL3RhiG4sat3KCnGzJWEyj6V60Tnw5upJgOTBhRDMBdHFtlUqmv mWPc8X3tmbnhBe3Nq+XG0xr87l9VopnL/TOas= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GymVnULBeJ03m5EPo7c7VEX7DSqoBwMT6L2fMWoeeEc=; b=lm5BINg7YSrP52/1PXnvJGtF2QfgKiZ5Bpkrdjty4KOMb2BnjKL1Nj5UisJQNG7QdX saFGwUIR9qSikmM3RQBaHOSaaJx85dX4pXTVbqg2J+lbgXdOIUuXHE0RQrN1AVcReNDD oSEI+fLWVJ9RDij4Uq5qnoUwaxYIgnoz/IL5Ic3V0LXH0Z3IWwsjMGhKl1qdYeImTqeC enL1vGBFbxsEZihT0wWxcDCxUkOlJRNcKUGV6ByWszYEkpWaC9/vrRipMjfWBt74g+Vt UeXkUTp0encULsZ/YwYh+e/AenqJDFFxT++odYm8gvsCxu3bAB11M5FE+ROMCeobCdle b7oQ== X-Gm-Message-State: AOAM532JKjaR2VCBuxl7Yttf2TSRKE0C4GkTZAJ6IyMJqgrOuHdPCG8n +8iihbqxLb3wkfanPaVGnfSHqw== X-Google-Smtp-Source: ABdhPJzos0AE316eqwE5bukVSiSBXorK5IVepm+pS66FYVRIq/CQ/YuE4vEFUrrRi3iREp0s0X/Ddw== X-Received: by 2002:a63:6e87:: with SMTP id j129mr3484297pgc.45.1623824623702; Tue, 15 Jun 2021 23:23:43 -0700 (PDT) From: Claire Chang To: Rob Herring , mpe@ellerman.id.au, Joerg Roedel , Will Deacon , Frank Rowand , Konrad Rzeszutek Wilk , boris.ostrovsky@oracle.com, jgross@suse.com, Christoph Hellwig , Marek Szyprowski Cc: benh@kernel.crashing.org, paulus@samba.org, "list@263.net:IOMMU DRIVERS" , sstabellini@kernel.org, Robin Murphy , grant.likely@arm.com, xypron.glpk@gmx.de, Thierry Reding , mingo@kernel.org, bauerman@linux.ibm.com, peterz@infradead.org, Greg KH , Saravana Kannan , "Rafael J . Wysocki" , heikki.krogerus@linux.intel.com, Andy Shevchenko , Randy Dunlap , Dan Williams , Bartosz Golaszewski , linux-devicetree , lkml , linuxppc-dev@lists.ozlabs.org, xen-devel@lists.xenproject.org, Nicolas Boichat , Jim Quinlan , tfiga@chromium.org, bskeggs@redhat.com, bhelgaas@google.com, chris@chris-wilson.co.uk, tientzu@chromium.org, daniel@ffwll.ch, airlied@linux.ie, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com, jxgao@google.com, joonas.lahtinen@linux.intel.com, linux-pci@vger.kernel.org, maarten.lankhorst@linux.intel.com, matthew.auld@intel.com, rodrigo.vivi@intel.com, thomas.hellstrom@linux.intel.com Subject: [PATCH v12 11/12] dt-bindings: of: Add restricted DMA pool Date: Wed, 16 Jun 2021 14:21:56 +0800 Message-Id: <20210616062157.953777-12-tientzu@chromium.org> X-Mailer: git-send-email 2.32.0.272.g935e593368-goog In-Reply-To: <20210616062157.953777-1-tientzu@chromium.org> References: <20210616062157.953777-1-tientzu@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @chromium.org) Content-Type: text/plain; charset="utf-8" Introduce the new compatible string, restricted-dma-pool, for restricted DMA. One can specify the address and length of the restricted DMA memory region by restricted-dma-pool in the reserved-memory node. Signed-off-by: Claire Chang --- .../reserved-memory/reserved-memory.txt | 36 +++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/reserved-memory/reserved-mem= ory.txt b/Documentation/devicetree/bindings/reserved-memory/reserved-memory= .txt index e8d3096d922c..46804f24df05 100644 --- a/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt +++ b/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt @@ -51,6 +51,23 @@ compatible (optional) - standard definition used as a shared pool of DMA buffers for a set of devices. It can be used by an operating system to instantiate the necessary pool management subsystem if necessary. + - restricted-dma-pool: This indicates a region of memory meant to = be + used as a pool of restricted DMA buffers for a set of devices. T= he + memory region would be the only region accessible to those devic= es. + When using this, the no-map and reusable properties must not be = set, + so the operating system can create a virtual mapping that will b= e used + for synchronization. The main purpose for restricted DMA is to + mitigate the lack of DMA access control on systems without an IO= MMU, + which could result in the DMA accessing the system memory at + unexpected times and/or unexpected addresses, possibly leading t= o data + leakage or corruption. The feature on its own provides a basic l= evel + of protection against the DMA overwriting buffer contents at + unexpected times. However, to protect against general data leaka= ge and + system memory corruption, the system needs to provide way to loc= k down + the memory access, e.g., MPU. Note that since coherent allocation + needs remapping, one must set up another device coherent pool by + shared-dma-pool and use dma_alloc_from_dev_coherent instead for = atomic + coherent allocation. - vendor specific string in the form ,[-] no-map (optional) - empty property - Indicates the operating system must not create a virtual mapping @@ -85,10 +102,11 @@ memory-region-names (optional) - a list of names, one = for each corresponding =20 Example ------- -This example defines 3 contiguous regions are defined for Linux kernel: +This example defines 4 contiguous regions for Linux kernel: one default of all device drivers (named linux,cma@72000000 and 64MiB in s= ize), -one dedicated to the framebuffer device (named framebuffer@78000000, 8MiB)= , and -one for multimedia processing (named multimedia-memory@77000000, 64MiB). +one dedicated to the framebuffer device (named framebuffer@78000000, 8MiB), +one for multimedia processing (named multimedia-memory@77000000, 64MiB), a= nd +one for restricted dma pool (named restricted_dma_reserved@0x50000000, 64M= iB). =20 / { #address-cells =3D <1>; @@ -120,6 +138,11 @@ one for multimedia processing (named multimedia-memory= @77000000, 64MiB). compatible =3D "acme,multimedia-memory"; reg =3D <0x77000000 0x4000000>; }; + + restricted_dma_reserved: restricted_dma_reserved { + compatible =3D "restricted-dma-pool"; + reg =3D <0x50000000 0x4000000>; + }; }; =20 /* ... */ @@ -138,4 +161,11 @@ one for multimedia processing (named multimedia-memory= @77000000, 64MiB). memory-region =3D <&multimedia_reserved>; /* ... */ }; + + pcie_device: pcie_device@0,0 { + reg =3D <0x83010000 0x0 0x00000000 0x0 0x00100000 + 0x83010000 0x0 0x00100000 0x0 0x00100000>; + memory-region =3D <&restricted_dma_mem_reserved>; + /* ... */ + }; }; --=20 2.32.0.272.g935e593368-goog