Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp544022pxu; Tue, 5 Jan 2021 19:44:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJyL8rbZbpg500aOEGKfMtnNfZTI7cf1TlYTIcf47f5hOTb6bUSexCuluVarUBQpeVMrhivE X-Received: by 2002:a17:906:1151:: with SMTP id i17mr1682765eja.250.1609904678002; Tue, 05 Jan 2021 19:44:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609904677; cv=none; d=google.com; s=arc-20160816; b=RX16lpL9svrMP6U3ydarE7u5qRS+TiE17OjFxBy87OS7DAPJK+qnc81Gt84eF3Vo5U OUAiT6sWMozSFksup8Z4EZFNinZpVHWyinN52lrA089EVR82lMAeNx4FH49tEyFsFo6/ nr944iV18aO/rNPLr5KzDzjBZtlGSJ6PRnNF/cl86KAj5HyiFcBRoD/UTaeYPZ90gb2Y PslviAwB41NaUPkcT35ZTJpdyKEAzBb1Vc+DSOA8YEir1RiaIctKfc9AhFrKbouph0sY giDqbACbV67ZENbS7I+Nl2oU52UQnuJkZ/PVCzl6ZkY0BRnxpNG6d73knySzDnXjJfFg eAiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FZGRSIKNWZAaAhyn9I46mv2qEvPmwpxpVmXsznFggAw=; b=R+TtbB2oC1msnuSUBMjVKMfgPgmtQnQFS0QtcaN5WvIIEGBNqFQvQS6lhXUe9HjoCy 2CykZR4+GOYf5e1Jgk1SnjL/zIq5mF9I82blBrdcK3xmHz+ItFz+2RFvrF2wpWR0PkYP gtFmJXg0tKtNWc6GI4+DcIaHI/OP6aJpvxuqJ6W/RA0cvIj5s024IOsQaARJGZS8I/yo iIyHQX5y9kwF+oi+ELyt7+T7XujJOEp/g/TNSiSPyvipArNfSLhnF03aJ2D3DpI8L000 AIUudWs2ffo9fYY8Etas5kiysdE8TWrseFUnGWpgOwkhyiZhc4RVsOQKXo9A+fDrPjsZ FBYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gGxBXOih; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si489575ejd.679.2021.01.05.19.44.14; Tue, 05 Jan 2021 19:44:37 -0800 (PST) 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=@chromium.org header.s=google header.b=gGxBXOih; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726663AbhAFDnB (ORCPT + 99 others); Tue, 5 Jan 2021 22:43:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726371AbhAFDnA (ORCPT ); Tue, 5 Jan 2021 22:43:00 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A290C06135F for ; Tue, 5 Jan 2021 19:42:10 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id t6so894118plq.1 for ; Tue, 05 Jan 2021 19:42:10 -0800 (PST) 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=FZGRSIKNWZAaAhyn9I46mv2qEvPmwpxpVmXsznFggAw=; b=gGxBXOihHsm3ZVDHLv31fDSdj1SXhYQbdn9k5cmAoncGt12QQUfM/c3IHcaEnDkA5J ocQxp+U8gmPg/aUt1mhhV6zZJ8VXZG4qoywct4SKLATrpd2CnwkRGzp6iVjwWvWh4uPB 8z3i8pIB+5J9HuYE/Sxl8iNS0nIPHFjKwJX1c= 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=FZGRSIKNWZAaAhyn9I46mv2qEvPmwpxpVmXsznFggAw=; b=gbdiOAc7UetmA/k6uJKuZk9mQfUpCpdd8KQ8PJ9cWRk/QTiHaATaw4QrfpInX5HK13 2ZV+zpTorB0kwFdBrwMhqzhZuswlA+6d8wq0TLJYteINV2mv7f0g3YPn+BCbnjVOeA6E hksUAwTUgi7I6ZZRwnZd6TrKY7rv+SiLzgqE1CByweZlc30HVPckw5IZdKrOibLJnlIL gJ9+Ykl5DeMe8dkFPqicJ3p584G3EXx4XIYvUwBu5AvVL9FSn2rAamMAPjdghjG6W6go hWX3SMYnWzg4pmmImp1ZJKdottsavaLfPwXwo/pF0mSW2cEkmSpmsVAzofi1mBFyFr93 +7ng== X-Gm-Message-State: AOAM5309sm8rANfBAEKSnBlWJhYsy8pT0mSm86+VAUFkuEAj2LEdxOxo 8yJPwgrQ9YEBUjwbwE21Hw25PA== X-Received: by 2002:a17:90a:5802:: with SMTP id h2mr2368082pji.68.1609904529594; Tue, 05 Jan 2021 19:42:09 -0800 (PST) Received: from localhost ([2401:fa00:1:10:3e52:82ff:fe5e:cc9d]) by smtp.gmail.com with ESMTPSA id f7sm581725pjs.25.2021.01.05.19.42.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Jan 2021 19:42:09 -0800 (PST) From: Claire Chang To: robh+dt@kernel.org, mpe@ellerman.id.au, benh@kernel.crashing.org, paulus@samba.org, joro@8bytes.org, will@kernel.org, frowand.list@gmail.com, konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com Cc: grant.likely@arm.com, xypron.glpk@gmx.de, treding@nvidia.com, mingo@kernel.org, bauerman@linux.ibm.com, peterz@infradead.org, gregkh@linuxfoundation.org, saravanak@google.com, rafael.j.wysocki@intel.com, heikki.krogerus@linux.intel.com, andriy.shevchenko@linux.intel.com, rdunlap@infradead.org, dan.j.williams@intel.com, bgolaszewski@baylibre.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, iommu@lists.linux-foundation.org, xen-devel@lists.xenproject.org, tfiga@chromium.org, drinkcat@chromium.org, Claire Chang Subject: [RFC PATCH v3 5/6] dt-bindings: of: Add restricted DMA pool Date: Wed, 6 Jan 2021 11:41:23 +0800 Message-Id: <20210106034124.30560-6-tientzu@chromium.org> X-Mailer: git-send-email 2.29.2.729.g45daf8777d-goog In-Reply-To: <20210106034124.30560-1-tientzu@chromium.org> References: <20210106034124.30560-1-tientzu@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 device tree. Signed-off-by: Claire Chang --- .../reserved-memory/reserved-memory.txt | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt b/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt index e8d3096d922c..44975e2a1fd2 100644 --- a/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt +++ b/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt @@ -51,6 +51,20 @@ 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. The + memory region would be the only region accessible to those devices. + When using this, the no-map and reusable properties must not be set, + so the operating system can create a virtual mapping that will be used + for synchronization. The main purpose for restricted DMA is to + mitigate the lack of DMA access control on systems without an IOMMU, + which could result in the DMA accessing the system memory at + unexpected times and/or unexpected addresses, possibly leading to data + leakage or corruption. The feature on its own provides a basic level + of protection against the DMA overwriting buffer contents at + unexpected times. However, to protect against general data leakage and + system memory corruption, the system needs to provide way to restrict + the DMA to a predefined memory region. - vendor specific string in the form ,[-] no-map (optional) - empty property - Indicates the operating system must not create a virtual mapping @@ -120,6 +134,11 @@ one for multimedia processing (named multimedia-memory@77000000, 64MiB). compatible = "acme,multimedia-memory"; reg = <0x77000000 0x4000000>; }; + + restricted_dma_mem_reserved: restricted_dma_mem_reserved { + compatible = "restricted-dma-pool"; + reg = <0x50000000 0x400000>; + }; }; /* ... */ @@ -138,4 +157,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>; + /* ... */ + }; }; -- 2.29.2.729.g45daf8777d-goog