From patchwork Sun Sep 29 07:40:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11165627 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 B30171599 for ; Sun, 29 Sep 2019 07:40:11 +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 9B16A21882 for ; Sun, 29 Sep 2019 07:40:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9B16A21882 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 3E6066E0EB; Sun, 29 Sep 2019 07:40:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM04-BN3-obe.outbound.protection.outlook.com (mail-eopbgr680048.outbound.protection.outlook.com [40.107.68.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id 86C7C6E0DE; Sun, 29 Sep 2019 07:40:07 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iNdQlHzgX3IIjyxiCeTZaSj6QCnvjzzfnbbFf8y8GG4sINDNboSXD55sdiqSMbgU3cTV6kc9G6I8AbrigiUzgu2y6yh6felrRW1QVlsRqydu11v8qRz9P5Xgv9lyMEL6gXNT2h2vdUP3SJ3QntTZS8OKWBa1gvAkC22n//5zexujOKbMXJjYbUGJKXVfr9rUKWJY3Rq7U5B21T21SMRXQe9Wdvr0OX4IZUxN8qQWzBRmovwbO9IsFLhCvlwltbT75ZDngMMTGfHG/tJLC14OgHzMawVCZ7McmTDEt81cybJH75MN60X5dbPc0DBUJDfu3sp4SVraul2Rx3FEPc5sxg== 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=Gv4kV6yZSp0z/Lk16KSEhQLXgUhthRgEUK38z4YCzJ0=; b=TnRvFd8wFIbc/535+/PhQVQHh9gzJR7TrfOMmOYwm0ya+F6IHbE14jLxnMREKRaAG04YE+S0lvRrsK1BNnY4zugB95GN8fb1HDlbUfktepZZIiHJug3bhJ93I43BNSm4kCSdvOFbnj1hqxxlzlncmL6bIYbbx68Flnwd70KlYwENbntB/CSXMlqdmzmg5Uyn88m/ozK1HwDRcV1eGPqSaX/eeXSZqtrp54TeVZB/ap6JhlgSQAgbSVLA2CMciWVZhmQZHzY+7L6MBHh/9fTHSOl6BaIjXA1Oqh7SknhfLeoDw0pYHRDqZfnCrRnMM+jM9A7o1cyrgvFfT38Re7CLhQ== 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 MN2PR12MB3583.namprd12.prod.outlook.com (20.178.241.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Sun, 29 Sep 2019 07:40:04 +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.2305.017; Sun, 29 Sep 2019 07:40:03 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v4 10/11] drm/amdgpu: job is secure iff CS is secure (v5) Thread-Topic: [PATCH v4 10/11] drm/amdgpu: job is secure iff CS is secure (v5) Thread-Index: AQHVdpkb/kM7cMOqjkOEMc19r/BP2A== Date: Sun, 29 Sep 2019 07:40:03 +0000 Message-ID: <1569742788-22429-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: HK0PR03CA0002.apcprd03.prod.outlook.com (2603:1096:203:2e::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: c47eac87-62a9-4b0d-19db-08d744b03da1 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: MN2PR12MB3583: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3044; x-forefront-prvs: 017589626D x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(346002)(39860400002)(396003)(136003)(376002)(366004)(189003)(199004)(81166006)(2906002)(6486002)(26005)(3846002)(6636002)(6116002)(25786009)(50226002)(102836004)(6436002)(8676002)(14454004)(81156014)(4326008)(186003)(71200400001)(71190400001)(305945005)(2501003)(66446008)(256004)(316002)(66476007)(478600001)(66066001)(476003)(5660300002)(99286004)(2616005)(8936002)(450100002)(110136005)(486006)(66556008)(6506007)(386003)(66946007)(86362001)(54906003)(7736002)(52116002)(64756008)(36756003)(6512007); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB3583; H:MN2PR12MB3309.namprd12.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AQ8J/RsrlRKzC8E8tdxjTfiyG2+ZnxFXClKYrcTqjwoiY9KvUXH/uXkvLj95c0ARJyjI2WXrN7YWIuxSmNuuRS8Eur2D5EX/YzscI+Cz/i21+a9IOtC/nCzqYp3RpafJxIC2U92eIFJg96tJdgW1+vyQLHQ1RfiIAR5n7LisjR/qB65s/5lQqeEoOE0zXOgM/vr9OGN+a+86yAmbPzhVdWIVUln+fn/Ucx2Kb/ftdzG0aaup2Y50aRGjJrwvyiaj6PhPoUjrKw5E1ip8kqRyvtcP8O7jtBA9wDrRUWrIhg5GSzPYQ74YHyeCThu0wShyfcXIcbhkWUv7Zh4KU6lJb2pWUzRwUj4WSRI7slj/0oV7iErdkP/GPCXiNv0myMPhUN5sSm3jqfF6IgTFSv2uNCLwrT7NihgVJmo4x5O1Ekw= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c47eac87-62a9-4b0d-19db-08d744b03da1 X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2019 07:40:03.6604 (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: DrgEJ6lgZTk15/10oYmpwda24iKOwWvAEM1jHgbGvNa0lYRJ90qmYIQ6tfU0W2r5rRQoxqI/hu/kG5XZ0TvQvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3583 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=Gv4kV6yZSp0z/Lk16KSEhQLXgUhthRgEUK38z4YCzJ0=; b=bFeeqMgme9/bpQehKXOX3Tt3sQ9FwYNJANdYQOeNMOgelzG2tzhBjHIutkVbkucRTCXgi1EUxjsySj9VweF7lX5e1ESdgRv9Me1Ry6jpB0MTkcDq+yhkahLkSrVZpHKdqWR+AAcLsxeqpDFYfC1imMxKCvhKmWhkWOTuVmHWh1M= 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" Mark a job as secure, if and only if the command submission flag has the secure flag set. v2: fix the null job pointer while in vmid 0 submission. v3: Context --> Command submission. v4: filling cs parser with cs->in.flags v5: move the job secure flag setting out of amdgpu_cs_submit() Signed-off-by: Huang Rui Co-developed-by: Luben Tuikov Signed-off-by: Luben Tuikov Reviewed-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 49b767b..c18a153 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -231,6 +231,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p, union drm_amdgpu_cs if (ret) goto free_all_kdata; + p->job->secure = cs->in.flags & AMDGPU_CS_FLAGS_SECURE; + if (p->ctx->vram_lost_counter != p->job->vram_lost_counter) { ret = -ECANCELED; goto free_all_kdata; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 9a6dbf3..6e0f97a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c @@ -213,7 +213,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) { @@ -232,7 +232,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..aa0e375 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 due to a secure command submission */ + bool secure; }; int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,