From patchwork Wed Sep 11 11:50:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11140971 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CE4D614E5 for ; Wed, 11 Sep 2019 11:50:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 B581720872 for ; Wed, 11 Sep 2019 11:50:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B581720872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 878666E24E; Wed, 11 Sep 2019 11:50:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-eopbgr750078.outbound.protection.outlook.com [40.107.75.78]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7C1186E24E; Wed, 11 Sep 2019 11:50:05 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BsrbuFdVwVKEp0JyEcE1rkNJ4XMuzZKGUxggUpQXanjjLh8BDBkTD4JI5QeCdpJg/eqeB37Uof9Ypb/Cw/IXu0WMYfAzegSnvgfohUa6ZSu0u8lPS04nz8duVf0JapRBoMRbbfyC7T3pi90l5oI0aU5Lcl34sTWApLCEklVmF0aQBqrO5EuzSvUWOuRqxb20hELQ4cTiokASH++oIe/2Hy08TZaTh9cEUoLytVyBVjCCD9yWaOLAoBa6eD88u22wVjp/i71ho1S0yFKD2cZKWZjVDbyfknRNmDEjhlu23WkrTtYdKfNrEYxkLBxwYQW7pvwO47rGaxODZdBDGf/OWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pLNspTKWflSNGy947WcvD6Zbelfa9wNPW5Fy13J3nAE=; b=EWtZPES8cvwUfyNTvRjKbhWdReSF/vhk0dbcauELEnY/jk7JR2mngyQQu3yC8DbHBbuEHgEZh200yKnIaQuI0DbaG/QrnIQxIHhRMTc6cmbdCz5G6VbzZty7XFMzxuSi1eyto4pt6KZIEER7vKRGa0MUfBwoWbQmPmsqJyJMg5h0fgtjX7QaHFSrY/U/R4uXawwm6IH2+9cfWr0K/vQ261z2YT6Hr/xBfme+OLkeqBN9hGoTgTlupnnhwWm+21ZWy+RaluKcSoFZmJRQTGfFrPa2lx88NocqqA4F13olI2KN0qmAz1PRJMfbn9GRh881vJsI4NADQA82ULyZVzqpqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none Received: from MN2PR12MB3309.namprd12.prod.outlook.com (20.179.83.157) by MN2PR12MB3421.namprd12.prod.outlook.com (20.178.243.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17; Wed, 11 Sep 2019 11:50:02 +0000 Received: from MN2PR12MB3309.namprd12.prod.outlook.com ([fe80::e105:cd24:c71d:c38d]) by MN2PR12MB3309.namprd12.prod.outlook.com ([fe80::e105:cd24:c71d:c38d%4]) with mapi id 15.20.2241.022; Wed, 11 Sep 2019 11:50:02 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH 00/14] drm/amdgpu: introduce secure buffer object support (trusted memory zone) Thread-Topic: [PATCH 00/14] drm/amdgpu: introduce secure buffer object support (trusted memory zone) Thread-Index: AQHVaJcL6qF1r2/r6EufMx2zmHu1dQ== Date: Wed, 11 Sep 2019 11:50:02 +0000 Message-ID: <1568202584-14471-1-git-send-email-ray.huang@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [180.167.199.189] x-clientproxiedby: HK2PR04CA0046.apcprd04.prod.outlook.com (2603:1096:202:14::14) To MN2PR12MB3309.namprd12.prod.outlook.com (2603:10b6:208:106::29) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.7.4 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f74a8a59-d18f-4c1e-d640-08d736ae2df6 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:MN2PR12MB3421; x-ms-traffictypediagnostic: MN2PR12MB3421: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 0157DEB61B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(396003)(39860400002)(136003)(376002)(366004)(53754006)(199004)(189003)(6436002)(4326008)(25786009)(450100002)(6486002)(486006)(2616005)(305945005)(7736002)(50226002)(8936002)(316002)(110136005)(54906003)(8676002)(6116002)(3846002)(2906002)(81166006)(81156014)(36756003)(14454004)(71190400001)(71200400001)(86362001)(66446008)(478600001)(66476007)(64756008)(66556008)(66946007)(14444005)(256004)(99286004)(53936002)(5660300002)(52116002)(6512007)(6636002)(386003)(6506007)(66066001)(102836004)(26005)(186003)(476003)(2501003); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB3421; H:MN2PR12MB3309.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: jtVbn5MW0p3Y9gtAN36FUs4esnxydTscSLDRhDgp14L6GaxScEUHU+PxDwWKs0aI0ImDsBT3JlCoPNdkbXdp5hBTQtcnSsde1VBM0ZOcjYd8VndQ5llXeQWF6eoZNJlbZNFmgTy6WMpVrkiSI8vdJl+cvXSfCIYjTTAcvXV+z9mdiqL01I4MiWR5HOqGhGeC7TNNrqQ5oVkNDVxXmRaP4wiwCryRIUN2NK1zZyqu9jcg7s7OM86nhltR6/264vQLrXyeKRJ9ugRs7C4ZeIH+XnIsXnvfx9akH6+951pSLHHjOlKpaEd/fdktULvak/KwQKtqFp2K9fjsvOWm0703lZ6SvNgmPj41nI98RPwp7OrzQo6kAN9V6wRIS3V/ErTnbfnVngFTCTngd7kZ18Oo732q8x5Yqu+3JR+fokaedqI= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: f74a8a59-d18f-4c1e-d640-08d736ae2df6 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2019 11:50:02.2073 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: IbBvz/kZ1iN3AmNy/DrKslT4s8Pi2NmH5w18Ouv09SGJ/jq9Rrn+8ExcFMg9IXn3a4qG6K2WROC95HiqhYeh4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3421 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pLNspTKWflSNGy947WcvD6Zbelfa9wNPW5Fy13J3nAE=; b=BhQWUlq9CjF9Sk4k/YUFjPLrhY8fNRSuea0PBPXGyPotIVVzxN/0k4KOTpmblXtAZitkbZLIq9fkDOdKBNwJqNdOmxJgFLEHmJHQ067xRcwFs+iOr8qyHVrxXlDePd9G6UMWI8frcqZ3/C8bPl5zKvm5KNiIQu+NC9+hU27s8fU= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ray.Huang@amd.com; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Tuikov, Luben" , "Huang, Ray" , "Koenig, Christian" , "Liu, Aaron" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi all, These series of patches introduce a feature to support secure buffer object. The Trusted Memory Zone (TMZ) is a method to protect the contents being written to and read from memory. We use TMZ hardware memory protection scheme to implement the secure buffer object support. TMZ is the page-level protection that hardware will detect the TMZ bit in the page table entry to set the current page is encrypted. With this hardware feature, we design a BO-level protection in kernel driver to provide a new flag AMDGPU_GEM_CREATE_ENCRYPTED to gem create ioctl to libdrm for the secure buffer allocation. And also provide the AMDGPU_CTX_ALLOC_FLAGS_SECURE to indicate the context is trusted or not. If the BO is secure, then the data is encrypted, only the trusted IP blocks such as gfx, sdma, vcn are able to decrypt. CPU as the un-trusted IP are unable to read the secure buffer. We will submit the new secure context interface later for libdrm, and create a new test suite to verify the security feature in the libdrm unit tests. Suite id = 11: Name 'Security Tests status: ENABLED' Test id 1: Name: 'allocate secure buffer test status: ENABLED' Test id 2: Name: 'graphics command submission under secure context status: ENABLED' Thanks, Ray Alex Deucher (4): drm/amdgpu: add UAPI for creating encrypted buffers drm/amdgpu: add UAPI for creating secure contexts (v2) drm/amdgpu: define the TMZ bit for the PTE drm/amdgpu: set TMZ bits in PTEs for secure bo (v2) Huang Rui (10): drm/amdgpu: add tmz feature parameter (v2) drm/amdgpu: add amdgpu_tmz data structure drm/amdgpu: add function to check tmz capability (v4) drm/ttm: add helper to get buffer object with ttm_mem_reg drm/amdgpu: revise the function to allocate secure context (v2) drm/amdgpu: add tmz bit in frame control packet drm/amdgpu: expand the emit tmz interface with trusted flag drm/amdgpu: expand the context control interface with trust flag drm/amdgpu: set trusted mode while the job is under secure context (v2) drm/amdgpu: modify the method to use mem under buffer object for amdgpu_ttm_tt_pte_flags drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 7 ++++- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 19 +++++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 12 +++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 10 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 9 +++--- drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.c | 49 ++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h | 39 ++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 23 +++++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 ++ drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 20 +++++++++--- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 3 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 16 +++++++--- drivers/gpu/drm/amd/amdgpu/nvd.h | 1 + drivers/gpu/drm/amd/amdgpu/soc15d.h | 1 + include/drm/ttm/ttm_bo_driver.h | 13 ++++++++ include/uapi/drm/amdgpu_drm.h | 9 +++++- 25 files changed, 230 insertions(+), 34 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h