From patchwork Wed Sep 11 11:50:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11140995 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 29CAA112B for ; Wed, 11 Sep 2019 11:50:50 +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 1164320872 for ; Wed, 11 Sep 2019 11:50:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1164320872 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 C8ADB6EABD; Wed, 11 Sep 2019 11:50:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-eopbgr780088.outbound.protection.outlook.com [40.107.78.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFC026EABB; Wed, 11 Sep 2019 11:50:44 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ic6jkbTM6OvgraH0IvX2iy/zxqLPp2Lk0gonHJ7+Em6zqUUaYGBSHugArQCicXw9z0suJVn5CJiea47C6Ub4peu9InjTbxNGifW2p8zUFckpDjGal9TerX2HCoiROHAeP7VUzzCTdxfHJKazz3AFVDONTXt5d4urm0H3/Axx2iUP2igIinAhwH+JGWetz6bFsb2mUqu1Cfb/x8EFlW8K90rnljJtDPRgwqzDBcJtzb5a0EVQrDpYiRbsJG7Gi3w6FdAYF1OgOWaoTTufJsYTco1VWoH13GQKRi7UH/pUGobJ67x01kf/FAkEqsbTSQYCqLXhoNzyCbYi8UBPMK9yRQ== 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=5aB/3agu4o24sR5vhp7NVmf7Dz00oiSqUf5mB/a1+yI=; b=FT7u3gw8hLkB2e4zYQI6j3DsjixC6Q1eChg8zGDsfWY1YXV55DMIiyYkMWd2KsIhYx0+e2aXsPcTOyvX6SPLZfjISykSlf7L6sfSbroqNWtScxZBZi1lAqOgn0WdGd0fGpV/b75C6CGOMO4XAijzyXeWXeCVzvBwF/vyZco5fOLt8MYSqqKWoCxKSutPPB0nqsQIimWXEojYUrD/kGzGEq5rmBSWfrAwT1HZRxyjRLHHSTn60twG0ynrGgQxO2YBNIN8pfOAS+iWybtGLPd48Fcmb0EbnQJaSro3GV6rEnMzYex4pqmrd1yPmSv9+4i04VtCee+BaGY5HkANZVT6SA== 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:43 +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:43 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH 12/14] drm/amdgpu: set trusted mode while the job is under secure context (v2) Thread-Topic: [PATCH 12/14] drm/amdgpu: set trusted mode while the job is under secure context (v2) Thread-Index: AQHVaJcjgTT88gakVk20R05UTrUn9Q== Date: Wed, 11 Sep 2019 11:50:42 +0000 Message-ID: <1568202584-14471-13-git-send-email-ray.huang@amd.com> References: <1568202584-14471-1-git-send-email-ray.huang@amd.com> In-Reply-To: <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: 0bf492bf-0fbd-41a3-4b42-08d736ae4645 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:792; x-forefront-prvs: 0157DEB61B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(396003)(39860400002)(136003)(376002)(366004)(199004)(189003)(6436002)(4326008)(25786009)(450100002)(6486002)(486006)(11346002)(446003)(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)(256004)(99286004)(53936002)(5660300002)(76176011)(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: P1K9mVy4dCDQWF8gM21LDok4jmAIjyB92zFfHpZOyrHFdF8kAyqFA1QXanJSw+4bJLDhGDuWEVgE6GDJjE5SlChbqeE3YJj8UgKIbQJSO3f2os0mDJaDH8EzhfWNtLSw7gJ2xdgwxOxXIppm4sBHGQ/oBGQUyf4WMUeR7pbetZO7qP/sa0VzK5A4EKa1ObzyQ8j3WusXgDLI85Yw+2e45vkU3yRwI5hCTXqC0HUFro9SgG47WHTJI2wTaeXwBwFyiv/K1QA2OrEfpMzT0B68qXKenGyU7j3lkNRwLGZIVmz4PDby/Jrb3A2VpBWOISYJ3WWqz4jzWMWtbCTl996qSvM7HOXITaFJlTJPUFNgrd1/9FZfj4r6gQZD0uMeAqKuv1uSCtKhEmqkHL23KtDLPG7BnNmAsKY51Lgsqsob6pM= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0bf492bf-0fbd-41a3-4b42-08d736ae4645 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Sep 2019 11:50:43.0358 (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: hmOEUD0G7Xv21/1dicWtXW5AwzbuFCB0pRJJnUU54wFH7y8e+H9OmZYk6YokL1cOLKYlyMPFJlSy7mIqpI7Sjg== 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=5aB/3agu4o24sR5vhp7NVmf7Dz00oiSqUf5mB/a1+yI=; b=FoIxsc0e+IpAjfY3aT2jLasniwAJuyw6Odhb4bOQcnORwlAR6eiZk0Oysvh8bOwhZEOtA98lcnqNaa+z2oH6Kr0j2/6zisnTlqlK4BQwRQi99Y+H782O3uvvE5MsldBpJjpMKQ7lF8cfcX6Xj1WPfQQItYm8EyfQFpGrfzBiRNM= 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" While user mode submit a command with secure context, we should set the command buffer with trusted mode. v2: fix the null job pointer while in vmid 0 submission. Signed-off-by: Huang Rui Reviewed-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 51f3db0..60e7b79 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1252,6 +1252,7 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, p->ctx->preamble_presented = true; } + job->secure = p->ctx->is_secure; cs->out.handle = seq; job->uf_sequence = seq; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index e1dc229..cb9b650 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c @@ -210,7 +210,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, if (job && ring->funcs->emit_cntxcntl) { status |= job->preamble_status; status |= job->preemption_status; - amdgpu_ring_emit_cntxcntl(ring, status, false); + amdgpu_ring_emit_cntxcntl(ring, status, job->secure); } for (i = 0; i < num_ibs; ++i) { @@ -229,7 +229,7 @@ int amdgpu_ib_schedule(struct amdgpu_ring *ring, unsigned num_ibs, } if (ring->funcs->emit_tmz) - amdgpu_ring_emit_tmz(ring, false, false); + amdgpu_ring_emit_tmz(ring, false, job ? job->secure : false); #ifdef CONFIG_X86_64 if (!(adev->flags & AMD_IS_APU)) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h index dc7ee93..59f1dbc 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.h @@ -63,6 +63,8 @@ struct amdgpu_job { uint64_t uf_addr; uint64_t uf_sequence; + /* the job is under secure context */ + bool secure; }; int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,