From patchwork Wed Sep 25 13:45:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160717 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 DDCF414DB for ; Wed, 25 Sep 2019 13:45:31 +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 C55EE21D7F for ; Wed, 25 Sep 2019 13:45:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C55EE21D7F 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 07B926EBB9; Wed, 25 Sep 2019 13:45:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730068.outbound.protection.outlook.com [40.107.73.68]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BBE56EBB3; Wed, 25 Sep 2019 13:45:13 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IVCoyShZF+Kt3KkGrEt8J7fmKqGbBKLYUopV/4eJN4e78McqnRBNmaY3rR6dyj5lpXp6h/vry4kBBESxROorHKLfFP9P4+J75aHF6s41T8t6JAfqi6FuUwytt4jzdcRvyt82bJQ5sFBT91FvtY2g0SnbBrFo5RXleARl0k0yE+DI3s0ca6GHY7wABgTavmaQy5dFk/k1NrWXF1eTzbrCpkYmogu7yuZojWBKDNXTWPvOvb1ItLS4RvTx15rkwxjVfYEKHPnp0PhsowfW8Ic73IM8xh2fHe2c0Ht1z8mXqGBpxAveJo51VZrSThvF6c+Z+SzGGFuDZDZTNsF7M+yIYA== 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=f3bAjAulClvu9ph2kT/jW3gO6vlZITV00+33w8bnlXw=; b=fPOTZp88lzHyW0tSCeP3s8OsZcX3eNK86CtmctHqYYgvd5HZxuct+85pYXK1lN5Y+P+LykGv36urtfUbN3lypMTpbtyhMiWiCd527EiaYHJ+Wx/uKqqeXeNYhXhqT3c4hAWeQzQFogEOS1P31LsQsVot5CSfgENRkgPXpHOqBtNJbIpOdWXDXhFmxu/ekxPXC3itsV7PW6FpRyk+2TqQtBS74m6Cy9UlUnS3xieGmPRKREcWmyjZFcCyZISMsLjDvEv1rHrcRTlLo8vBr8TZIlHikkvp4rBPZEubOBGdMQ8iJd9lwZJxtMNTrBNzYGtbnumLb/RrvWPpA64GefwNeg== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:11 +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.016; Wed, 25 Sep 2019 13:45:11 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 01/11] drm/amdgpu: add UAPI for creating encrypted buffers Thread-Topic: [PATCH v2 01/11] drm/amdgpu: add UAPI for creating encrypted buffers Thread-Index: AQHVc6dzBSlURytWtU+KU92WjhXpBA== Date: Wed, 25 Sep 2019 13:45:11 +0000 Message-ID: <1569419090-5304-2-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 0fe246a8-62e2-4a0e-b979-08d741be95f0 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(14444005)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(66574012)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(4744005)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: LMli6ol8rwj6RlDePqpttZ78usrxCf4epIUQI3D8Uo5RPQWeHuIlL1gibI5dMs52CX4JjaGJj0Q5Gz1drhvqVGImRzlNxhJw09d6w425Pk01JPOlBXgx20DIms2qD2gd79iRAonMAOuE0yLGrFioZ5AKkfj0f/JEo465Hzf8k7DknpPjg31YW7UeTa/1NEWs3kdtivUcBfHO0Cf1PAqLRmKZAWx/0u/22ZM+qJ4YN1WKMqdYu2R290P7bTK+oZLhWXwjQrFI/+/6M3JR8HQhZm2oqw6LC+cColHmmEpe1asYNuUyVJrGGtqozxbd0xmiK5LgXa8h/64zzyxAOimr+7zzKUyYTxvx18caT9yeXGiLgcus2m6qH2yXEMdUKG5tmv5+UxlFKGlPk9eW18hVx6ge5sahk2AvvNl3ThvJ5eo= Content-ID: <8099FBBC75C83A4B8A2D7BD1CFF9D698@namprd12.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fe246a8-62e2-4a0e-b979-08d741be95f0 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:11.6434 (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: QvfE3fBGeUgNLhMNGh/s5SZvmOd+Iw1kdMKFwmcW64TxvDTcAfuIavd2phJjdWwXFf5BDyq1AVJUB4c2c3kXIA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=f3bAjAulClvu9ph2kT/jW3gO6vlZITV00+33w8bnlXw=; b=XrR/BhVEf4GyGPzZSUa06Xk2z4U2SJfNxtVxyI2587cmAzPgpHKXdG9bm/4Nvr5tR+2GjWAucM+tw4Dq/2jF7GcsV9YuU9Pu41jR+mK2nQcCUD1j45PcZAzZu/gVP9CsyoEXW9BWmmXmhUTfiGKP1XVNrkutZucKCVS12ENNj2Q= 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" , "Koenig, Christian" , "Liu, Aaron" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Alex Deucher Add a flag to the GEM_CREATE ioctl to create encrypted buffers. Buffers with this flag set will be created with the TMZ bit set in the PTEs or engines accessing them. This is required in order to properly access the data from the engines. Signed-off-by: Alex Deucher Reviewed-by: Huang Rui Reviewed-by: Christian König --- include/uapi/drm/amdgpu_drm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index f3ad429..f90b453 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -135,6 +135,11 @@ extern "C" { * releasing the memory */ #define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9) +/* Flag that BO will be encrypted and that the TMZ bit should be + * set in the PTEs when mapping this buffer via GPUVM or + * accessing it with various hw blocks + */ +#define AMDGPU_GEM_CREATE_ENCRYPTED (1 << 10) struct drm_amdgpu_gem_create_in { /** the requested memory size */ From patchwork Wed Sep 25 13:45:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160713 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 9840A924 for ; Wed, 25 Sep 2019 13:45:20 +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 7FC0221D7E for ; Wed, 25 Sep 2019 13:45:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7FC0221D7E 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 50E276EBB4; Wed, 25 Sep 2019 13:45:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730043.outbound.protection.outlook.com [40.107.73.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 39C5E6EBB4; Wed, 25 Sep 2019 13:45:16 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A/gDGN1erXgNcsXsZHg7Hp+fTDE8sXDmwsr7/gW7G7XP0uNyAdxk2sGnRwOsOl1kO6DzDg8ixnHOBz9B69mj18PqVtjhGxGZESsb+/WZCFnevN1qjrGggQcjvnEFCD/6BqoOLSnRar9lt6hPbe0vq4q89tuvpU7AVzbayoKdtybzaM0ZsYcn4yfUyp3rhV9ILIu2IR3t2JOUgIJjauXBe8DefVtIHRm7EtbSVCM2Qy9tRDU6XZVAyJ7xJbHmQ5FlAHv5eq5V7blh1/T4Ckiq4Hp3nCN31o3x8exvAmWyXa5TuHnUGUb1bZOk2lXOFWeDBibfTwYPxdJfU6lwISpbmw== 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=Y7C/RC5RtGVLy8OJkRfIh2NRaO3HbeXqIYNBFA5Npi8=; b=UblH5xeGNl5jfeNXBoXqUhjQDGI05uLfn5u+PRjPWtOM1kqwiCBnbGceuS9vdtQMDsaGSTVsPyVlLDsd3m8XS2h55bnqW+L20Dm0QYVOiPxh+FPSDhcF0quhgmr4efvZsUosVXTedXkCPXGIKfvw8WBnATFNprquoCBzjh6sRxC392xZIEObVnxqfq32bUiRAnv6/7aeke1j6UN8DQ0Yo/BUdxufcDnezkoSooP4NcQ3KrPQnkuKUDjwJ5stwF/Jb6lf+0hYtGafZvvgR933f+5RIJf9FV3rZPGMECQpVK52rEL3QnGihxZgV1lxI1IF54xCLUB53gDJhMO0q4Sa1Q== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:14 +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.016; Wed, 25 Sep 2019 13:45:14 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 02/11] drm/amdgpu: add UAPI to create secure commands (v3) Thread-Topic: [PATCH v2 02/11] drm/amdgpu: add UAPI to create secure commands (v3) Thread-Index: AQHVc6d1rU9yy3AEaEGVypePID0RsQ== Date: Wed, 25 Sep 2019 13:45:14 +0000 Message-ID: <1569419090-5304-3-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 62d174fe-a5bf-45e4-5dc5-08d741be97e7 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(14444005)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: RnQ0PpLk9Z+uAy6J0J/MPTQkmxrkvjCJ9gjVcXth3AGqV6YbPxciYFJx/l0nRFxIxa2hqSOJJ4JmMgt/N2GXlL890hKL3dzGgzQRKQyrgtrxV9tELn8O8tLw/LaG/HJFy12Txa9WpwHHV3y9GF2oKTcIMqqsYZA9+sf7vWabPy/Q+BH7YK+Ao8AxHB3OvqUGYNiQvFRXndC3tMVRNcfOf5nDKAAzooARUY8aU0zAdTTHNiXf3lVaIWu85ak8bdPUk3oIcJDWGjxvoEH7Md2InqLXUJWn+jTRkWRuercXjhRLsJm4LNK9B+1QLAM9xmYgRMBLTA/zb5ZIiXduVCUC2vhXPw8dMT3qIhxoYD6thay59RFEyfXNgsx2ZDEA9DUPPKlvVzwVL+PqlWvAncNNwqDWSbvYj3n7kytQ8wZgAYs= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 62d174fe-a5bf-45e4-5dc5-08d741be97e7 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:14.7516 (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: TvNJYUgWLWNWMz4EAAe0+VMYodoLorxkd+XNRzrOXfFAXPxvAYW1qg+uIUc2+qlWRuEGu9Ywr6MYRVyTPJpFDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=Y7C/RC5RtGVLy8OJkRfIh2NRaO3HbeXqIYNBFA5Npi8=; b=1af7G7r4zHXuC67L9qXXj71tQhACmS1Mws/mEPHJGxebd2DPwdctw1xTpNaBqYDPAdowpMs65FiyIKyc4naoaZbJkWV/cAuhibege4KvJva5nhJqA17+VhvcmVZrkIzP4aW0wmmdS6Ab0gSPudwxlVRgKtGUzDakO96sn1G7wcE= 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" , "Koenig, Christian" , "Liu, Aaron" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Luben Tuikov Add a flag to the command submission IOCTL structure which when present indicates that this command submission should be treated as secure. The kernel driver uses this flag to determine whether the engine should be transitioned to secure or unsecure, or the work can be submitted to a secure queue depending on the IP. v3: the flag is now at command submission IOCTL Signed-off-by: Luben Tuikov Reviewed-by: Alex Deucher --- include/uapi/drm/amdgpu_drm.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index f90b453..a101eea 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -207,6 +207,9 @@ union drm_amdgpu_bo_list { #define AMDGPU_CTX_OP_QUERY_STATE 3 #define AMDGPU_CTX_OP_QUERY_STATE2 4 +/* Flag the command submission as secure */ +#define AMDGPU_CS_FLAGS_SECURE (1 << 0) + /* GPU reset status */ #define AMDGPU_CTX_NO_RESET 0 /* this the context caused it */ @@ -562,7 +565,7 @@ struct drm_amdgpu_cs_in { /** Handle of resource list associated with CS */ __u32 bo_list_handle; __u32 num_chunks; - __u32 _pad; + __u32 flags; /** this points to __u64 * which point to cs chunks */ __u64 chunks; }; From patchwork Wed Sep 25 13:45:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160721 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 D136D14DB for ; Wed, 25 Sep 2019 13:45:36 +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 B911520640 for ; Wed, 25 Sep 2019 13:45:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B911520640 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 246766EBBD; Wed, 25 Sep 2019 13:45:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-dm3nam05on0613.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe51::613]) by gabe.freedesktop.org (Postfix) with ESMTPS id CDB9E6EBB5; Wed, 25 Sep 2019 13:45:19 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TyasxYAb+peSYnTVOAQ/t9XPUNLLMmy4EGN0GQXrNLCLe7u/IGubaXLfm67CWNG8B0jJ5IwWwYTobUoqPwQrDGLmwoSDU8sCl/V5inE/rJuaxmwi8+9P0UPhYSKcDCKUUuf3r8jFRthUu7G1wLg43DE864thQBff+bVNo+TJHp8T6mGh2woyZPBQRM7ktdEXJEMXcxlFtOzbR6h9LIMGUpN4WJp2Jlj4ItF7jgy08NZmyaNAb6rqr+xsfBsRPps4/P17D2R6dgirLAfxc8IRUTnoNtBSneSrZrpgGDrGUKtucb8q9OwbSgOHk3HRqFg/n6U8CJPqFC61Ys53lzFnNg== 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=Tk7TfjXhdSzKCsW/N/u3FOvs26+TdhdULz4alZknL5A=; b=XqtQAcQ/0QhKZ57d4bTzWGAdk144t2Bvn0lHGm3WD3l/h9pyTCwJQusXFsVcpbQfKNO1FNpqNUSj+zmtlqq7K9v96jGnmPT3XxSlYre7qgBS+bvTCgJzeNhn95FTL5cnKGMCKUpzo9riR9pyzgNmy4tdhPplt5Q3GRgnpApTp2uLHTFTnP5L++EGRyPP3dat9E6Si4jvV8Au0XuoL11no+8V4JLJcr4hX6n+npEuhQscUSe+jQr8Xf4pxnjg9D6dZ8buTHVqEGhc2jm/UULcaNUKA3VwpxO2L+cKXpDE4kAADl5xph1ZWRXfrxm3OZvAgXUc4nydOemgCIDvMUaieg== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:18 +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.016; Wed, 25 Sep 2019 13:45:18 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 03/11] drm/amdgpu: define the TMZ bit for the PTE Thread-Topic: [PATCH v2 03/11] drm/amdgpu: define the TMZ bit for the PTE Thread-Index: AQHVc6d3mr4p1eZadEKDwG2eAv3bYw== Date: Wed, 25 Sep 2019 13:45:18 +0000 Message-ID: <1569419090-5304-4-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: a80ff704-0b56-40fd-5af9-08d741be99bf x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3044; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(4744005)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: TbJjNoseS5QMzpIy294OcTl65Sb0SCUH2d/B+mbAEER4CsE+r/mfTc2lv18uWHsl+hBVAmvoVkH6YYv3i6mGWbTM+rLeKi724bUHj0zYoYBAMKvTIthmtC21fo6mLGbVyNRiN/Zirdse+xyFijoDremkC9VEA7pZOKxy8cNHr9pnS10spEFK7ftgsn33vLvpsRPKgFcrFwrzEVpNkJFREZt+Tvi566MgxRFMrIUo08bboQCUGUPCJHmjPyqZ2YMM5a0SoQgUIsMevyXVvLMwK9bgEWsFd7GoYWmtdVNC3p0f8DAsf9OHP6px26FEUeN/GcisWJJYoaU+Y2KC6zJPfHX674ks+TrYJ95+Kef9NuQk2kG0WJHjEDMk+iHxnr4Z78QK6LXYWk7uGwWoq669xTFCxkr3ufo5bKHmlAPpAbc= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a80ff704-0b56-40fd-5af9-08d741be99bf X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:18.1297 (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: ZpCbReaeIAz0ngkv7r5d7w/9uLCwo4wPXa4ydpNzJVA5NgE7nwfgQ2z62Mmx5tBtkgyWXBx0LC4z5MN3Qj67uw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=Tk7TfjXhdSzKCsW/N/u3FOvs26+TdhdULz4alZknL5A=; b=JLD9OVN/gKyR/kQMn1E2rrfhur/MkgDGuc5j+MXq1GXK32TGmyzN7OXwNncniO2t8k75vzRhgBcyFuMsDW2p25uRDXPfw0XMwMYirfXQwhpySQWaqBxs2N0V6hRLyrPaQrrq2GqEMi/HHBpcVs5hZlPsqcQLvBs0XfOmOZYdwj8= 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" , "Koenig, Christian" , "Liu, Aaron" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Alex Deucher Define the TMZ (encryption) bit in the page table entry (PTE) for Raven and newer asics. Signed-off-by: Alex Deucher Reviewed-by: Huang Rui --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h index 3352a87..4b5d283 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h @@ -53,6 +53,9 @@ struct amdgpu_bo_list_entry; #define AMDGPU_PTE_SYSTEM (1ULL << 1) #define AMDGPU_PTE_SNOOPED (1ULL << 2) +/* RV+ */ +#define AMDGPU_PTE_TMZ (1ULL << 3) + /* VI only */ #define AMDGPU_PTE_EXECUTABLE (1ULL << 4) From patchwork Wed Sep 25 13:45:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160715 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 102A514DB for ; Wed, 25 Sep 2019 13:45:26 +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 EB04421D7F for ; Wed, 25 Sep 2019 13:45:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB04421D7F 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 0ACDB6EBB8; Wed, 25 Sep 2019 13:45:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-dm3nam05on0615.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe51::615]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26CFC6EBB5; Wed, 25 Sep 2019 13:45:23 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H3dQSCLMkfwv8fJYb1XFx6x0NuO1/BOKtA+HbostBw0yCCbfuduzOUE1MEj1iP8HpLzkURygsCxNkvKPEGXsbJYWuOzI5T898AT9dgqL6FNUDQKB6IGddMPhBmgjzG4cFZH1ST2KNfw0noRpgUpi9lDRwylCcSclw6PiMfKMi0qXdRLiQd3NrF/0P/Zt/4QAfheqafJz8p6ARukpQX3LDQeeGEab5KAGKDz0RNuFvwHG1qJw7HaWMOY143PYK2WBtXpL4R436sagGzXQZwEQzEVxZeaz5xkzoGFAUr1IDsp0GvPNpIOsU/C5RxWMPrBfcRANjxlJjSxtTPE1Ft2DSg== 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=hmeqChAxyqwO6NZ57JnGwuzmZVA61vyphC0q9AzXQBQ=; b=VI3pulX9du8lZ1xy8RhLKKjir3dVcE08euRxwgV0srXZ9tG3e4Vh+qFyDHdbnvmfR5TsVbeYLApb5JPxreDwLTG33ZI4dvHb8ouRrXXf8Jrx4yJQKzYYy97o3pawEtgQr8VYbHJ6eOq4mBgOO0sUwojcitC1GSGybU8dwPCmNMNEqjWupc5Ogje4dE4HnfE8+d1sOvBk4yB8ohxBYBnZDdgDLW8quoAr4CArPMfxEW4OYNFe51EltgSljRKr7uKeYLbYltq31ZrQAA9xDNrR2ePh4JLGVNddgpJmFdeJUjENdqE3/QI3vsbU2MSUyt2zqbDycrSrtt+2jXcj8zp9MQ== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:21 +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.016; Wed, 25 Sep 2019 13:45:21 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 04/11] drm/amdgpu: add tmz feature parameter (v2) Thread-Topic: [PATCH v2 04/11] drm/amdgpu: add tmz feature parameter (v2) Thread-Index: AQHVc6d5LDMLCCkjDkuRHVizXsCgBw== Date: Wed, 25 Sep 2019 13:45:21 +0000 Message-ID: <1569419090-5304-5-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 970b6585-b1ce-49f6-227c-08d741be9bec x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: /GsgYH95H5H81Oc8htWRS+AgY9v9/gnZR5Bz0CU/drzcijVK0JRm467yz9MY43fZo/us2Ct0u/9blvfW7y/IIRAFu1a6KH9ajmkLDle0YsSRWre7bDnEPem/tp0LmBXj2GhFPBRg1B45GGRN7TkkaZlegSAuM8d7K8HcDyFVrjkVjOBnsYkQ3ToPR24MsqnWmTZDo21U70OQAtveRaEdPgzMCsSoKtfOY+M29tUZxybgoig0iD/M7yiT0uidRN4I7+uT3r+l3mM0BIX7AwqH/+BHh/Id2UTsQ0ykxh0HNf8QqWRnol6ZjifvF8UGoPjLxUyMp3T37pTc5j9lVoKcHQvXnEhQhCo5rcXIytNHZj2IrXmsuvCQrAcgH/ZMmhixDe18nGIdgg1ALPju4IxFxb9VN6xNYQIXi2pnIE2rui4= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 970b6585-b1ce-49f6-227c-08d741be9bec X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:21.4928 (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: /tWIgWEf2XhtDEzNbe5s4GLNCYw9g4pG8Wi/GVDT3HjZwpZuOwdGeXNGm3ItJFc5Oc/FFVCFauWCxOOAlK793w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=hmeqChAxyqwO6NZ57JnGwuzmZVA61vyphC0q9AzXQBQ=; b=aNy3Gk5E3sFY66d3K0P5vhLN0Rl0KwfwwrsoW5rGo/mllJ4sBtm5kovRM0fuImZnBAJ07v1X2/X50DmYJ4tRkEKaVrRX+vXkvPZ/ODs1NjLy7D2FuKcB5sNXYiGGHjVrzg2hy74nukU3Op8YWSBKN+vNdkEpmB+VsXmLRK7qwws= 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" This patch adds tmz parameter to enable/disable the feature in the amdgpu kernel module. Nomally, by default, it should be auto (rely on the hardware capability). But right now, it need to set "off" to avoid breaking other developers' work because it's not totally completed. Will set "auto" till the feature is stable and completely verified. v2: add "auto" option for future use. Signed-off-by: Huang Rui Reviewed-by: Alex Deucher Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index a1516a3..930643c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -172,6 +172,7 @@ extern int amdgpu_force_asic_type; #ifdef CONFIG_HSA_AMD extern int sched_policy; #endif +extern int amdgpu_tmz; #ifdef CONFIG_DRM_AMDGPU_SI extern int amdgpu_si_support; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 6978d17..606f1d3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -145,6 +145,7 @@ int amdgpu_discovery = -1; int amdgpu_mes = 0; int amdgpu_noretry = 1; int amdgpu_force_asic_type = -1; +int amdgpu_tmz = 0; struct amdgpu_mgpu_info mgpu_info = { .mutex = __MUTEX_INITIALIZER(mgpu_info.mutex), @@ -752,6 +753,16 @@ uint amdgpu_dm_abm_level = 0; MODULE_PARM_DESC(abmlevel, "ABM level (0 = off (default), 1-4 = backlight reduction level) "); module_param_named(abmlevel, amdgpu_dm_abm_level, uint, 0444); +/** + * DOC: tmz (int) + * Trust Memory Zone (TMZ) is a method to protect the contents being written to + * and read from memory. + * + * The default value: 0 (off). TODO: change to auto till it is completed. + */ +MODULE_PARM_DESC(tmz, "Enable TMZ feature (-1 = auto, 0 = off (default), 1 = on)"); +module_param_named(tmz, amdgpu_tmz, int, 0444); + static const struct pci_device_id pciidlist[] = { #ifdef CONFIG_DRM_AMDGPU_SI {0x1002, 0x6780, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_TAHITI}, From patchwork Wed Sep 25 13:45:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160719 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 DE51914DB for ; Wed, 25 Sep 2019 13:45:34 +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 C60BE20640 for ; Wed, 25 Sep 2019 13:45:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C60BE20640 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 2E7186EBBE; Wed, 25 Sep 2019 13:45:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730045.outbound.protection.outlook.com [40.107.73.45]) by gabe.freedesktop.org (Postfix) with ESMTPS id CDA6C6EBB7; Wed, 25 Sep 2019 13:45:27 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H9YKVNF3/8Ch+2eeimpvCHOT3JUGyw/yGOVB4gEimuHtPsFOM0TjhNMCGp50qpcuT8rFpzTedMp4/GfkN4YCzYpI7F6/3EYGZk9OO6vp6HbR9zdZI9dYeg+K9OMLsDDiEIc+rGWPbHBcLZDAIyZo/RWDOMT0IYv5LleB3d6gAu32UTKwTYkAUR3Rjsj9b8PKwfrf1lEbRjd6yTiOLwt9wsi30+HW5BvEiRDP2a0Kix2shGMyCCV4KlYSGDiMVuFjNUTZho/DzPzK6fbUbSF/vICHdmbPBX1AnL2xC/WYM3tisRy6Mu2iQhPQugiO5RYwRV9YMCPrujbGQ0Q2MNWgRw== 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=cZ1jaQjF39AyHi7EdHAgCUHusSy6xrpliVoWsokXikc=; b=ORh+HQfGnoQgV/s05BaIvbWy8dpPyfxfMeqcyHF0oFzcJpCoOhY/nHKHfoJ8aKz+j9x7FTATUa7iQjgrNBLwrs2mBf17Z9YX4hqLIc6X70AbIKliRhwya+WvBZFHvOewHBBvK2xr7HnWzoQyprurCmqXocYiD+0ZFsxyZnOKjdWEscaIpO+hYGwWLVmWkQKT5t+CwKU9rr53jzOp9ESSsbP/bFo3swKdGQK59Gp/Sw8N3QvHaxaUAZULKAlJmVpmgwpClxuo1u1T0+5RWS1rx9AOLMpYVedjZU3l7L2D5LXddFRdri7hbyf87RrrGpTO+5PulQWCKDKi2slnSYcDXA== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:25 +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.016; Wed, 25 Sep 2019 13:45:25 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 05/11] drm/amdgpu: add amdgpu_tmz data structure Thread-Topic: [PATCH v2 05/11] drm/amdgpu: add amdgpu_tmz data structure Thread-Index: AQHVc6d7W+4CEWlNOkuX2UYHluHGbw== Date: Wed, 25 Sep 2019 13:45:24 +0000 Message-ID: <1569419090-5304-6-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 352831ed-8727-4dc6-06d2-08d741be9df2 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(14444005)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: 5zje9vq7LLaxvGsbLan6sbFPyBjRfW/wUpq1PcBJqyyQ+zrYqqvJaN3aXXlQv88/TRuWbLTqvyGL23gUNConCS+IT3JsC1HygUHvs30+ZLV8zhKOWF8V4o+XY/zIpkNpBYdGpucLraacI1DUgGG7s3Y6I0ky7LMFwpNh1lYaZyzthLq43yruVWhgPnAEFFgxXGbDxbHvrsH29aE0fONlCtpJjKDllSJnlPX0UFrfr6OAIBDkKTFR3yNDGkTVl2dwcBzt/WZ/GUi0HNkbE3iR+gK8QoEXXbJm/QS2tmtixMoROiPb/x1pSNOeGvT1UtWQ7dOWg249pqP/KcZNsUzu1FXrWv9j2P3hy8LBfh4NAWWu76oZ67UjtT+JqVznUu9KRzxlw7enaHzXEaQbsprU49nJCzQhO636A0v9TOmUBU0= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 352831ed-8727-4dc6-06d2-08d741be9df2 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:25.0227 (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: BB2scM7MQBXPsRF/qcyfL+Y3PAZDbL4TtxKWx/K+OVfUgPvQ3MRbdyHDzWpbyV+5weGNkkmv0BVRASekEstubw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=cZ1jaQjF39AyHi7EdHAgCUHusSy6xrpliVoWsokXikc=; b=Ca4+o3vFUXuUkBA8/TWRskTXIUOFJwU5kkr7BuEWmOUB0lqTG49XonlBzPgX/44KlvNwrpuNBGH4Tzoi90NwDVeDbybfbbOIDEw0uV/6hN2pVbeNOPcVY+OE5GAc9/QH4M9tPl/4pwzKl9PQLDKysVyZQVVJM79WWZgGtoqo++g= 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" This patch to add amdgpu_tmz structure which stores all tmz related fields. Signed-off-by: Huang Rui Reviewed-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 6 +++++- drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h | 36 +++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 930643c..697e8e5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -89,6 +89,7 @@ #include "amdgpu_mes.h" #include "amdgpu_umc.h" #include "amdgpu_mmhub.h" +#include "amdgpu_tmz.h" #define MAX_GPU_INSTANCE 16 @@ -916,6 +917,9 @@ struct amdgpu_device { bool enable_mes; struct amdgpu_mes mes; + /* tmz */ + struct amdgpu_tmz tmz; + struct amdgpu_ip_block ip_blocks[AMDGPU_MAX_IP_NUM]; int num_ip_blocks; struct mutex mn_lock; @@ -927,7 +931,7 @@ struct amdgpu_device { atomic64_t gart_pin_size; /* soc15 register offset based on ip, instance and segment */ - uint32_t *reg_offset[MAX_HWIP][HWIP_MAX_INSTANCE]; + uint32_t *reg_offset[MAX_HWIP][HWIP_MAX_INSTANCE]; const struct amdgpu_df_funcs *df_funcs; const struct amdgpu_mmhub_funcs *mmhub_funcs; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h new file mode 100644 index 0000000..24bbbc2 --- /dev/null +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h @@ -0,0 +1,36 @@ +/* + * Copyright 2019 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#ifndef __AMDGPU_TMZ_H__ +#define __AMDGPU_TMZ_H__ + +#include "amdgpu.h" + +/* + * Trust memory zone stuff + */ +struct amdgpu_tmz { + bool enabled; +}; + +#endif From patchwork Wed Sep 25 13:45:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160723 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 E29EE924 for ; Wed, 25 Sep 2019 13:45:39 +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 CA63620640 for ; Wed, 25 Sep 2019 13:45:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA63620640 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 9B6176EBBC; Wed, 25 Sep 2019 13:45:38 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730077.outbound.protection.outlook.com [40.107.73.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC3FB6EBBD; Wed, 25 Sep 2019 13:45:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=APnpRiAc8AyqHDIfHw9HAenTB1NN+kFlp7/ikhGKp7naaPn3nXghEvutteLKXKg3ruDhSJ0AQpN9NlQ20XJ7qkcfa5efdYM+LuhPVfubQ1aXonCOwDvlKdZYKpMABeeWFhUqFIpg3rixu4JOdl9n/+8/gDY6ysJ6dNOSicJik5OJVEYrDyOqXIXaM4+B04/wm5vs1XP0FAgWFSqZ35W28n0LX6Jk8+YmRFTRoyVtPTsDhquJW7ZsRcneorngC8a7Duyu4+T4c2LR3YqRMv3uaO/EwIDJ84IpqJXvmng6pTjOZyYwDSZ5vTS9BQ5ONX7TB+04P/7uLRW4TBNB/Et7kw== 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=j5ZCWdumQ1m47v1W2RSr5NlSa7eKBAn3F/H4TuqXe6o=; b=Y46YQy8ENW7V8I7JmsgVJmJjwM6tIBwDmbYPNByPH9T+JHTP57dLLnU2vszJBb76WpM5TAsJS6V6lNo4D2GOz4pr/Rw/++Z57EWUAMG1e4envUPVyGNhAEBeM5ILuRJLHh6TPd/QtwGfMj+WeyyxOYO/YAkXKi/v8Q5MpmqhHYzSrRq/3W5euxDm3f8tokoSUPKZGFXnruWuHv50lnAnSscy2rntI9F3n/2cAjAuQDVMOJdGILpAATohLh4MUSRmsquqnhmJnIVvnkCQDd4Ly0WKqSEjOV0pp/DUxqgCyAb5VLk8nLlZeGaaYYg05Otf5pTHc+c7L6TdeqLrcOopUw== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:28 +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.016; Wed, 25 Sep 2019 13:45:28 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 06/11] drm/amdgpu: add function to check tmz capability (v4) Thread-Topic: [PATCH v2 06/11] drm/amdgpu: add function to check tmz capability (v4) Thread-Index: AQHVc6d9hS+lKNsGN0yoqrJ3DVQn3w== Date: Wed, 25 Sep 2019 13:45:28 +0000 Message-ID: <1569419090-5304-7-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 82c35f37-0055-4464-dd0b-08d741bea006 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(14444005)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: lpTIZt22PNt8JFvKHaUnRvat610FMKS7QzxnSDda3OuXNTM3WRdUFMUUbd4fPLdlR3/cMsuuVgsa2bfnL4d68UgMQlImQU8iFRazrc8s49II13dqefhnV90TgkyE7V+rEpa+7sQ91Vzy88jjgOUXSkF4VAc+QmZshalNyYGNPueM/zgQWEIWoHLbrSIAcwxUh7WwJNSBXjKi12fxaKuyeL39ycQ+MeyJeM/oPZDwQm5u2hJzk8DU4Z3fVYjgF15torBRWGncqoGTqQmeHNyxHTVYLk9ai5uVhKvcPQoEMBH0fJqdPor1St4QldteA/dBvjJFbSwqvPkJTFDa9dhTdmhWhC6SSyGjv3eQks5qd84Ss/Ixe+xSSO+wO4QlwO8xV7lGNeAvWjA254Ml5H+aM3Uy9hGbdT8b9gW5oTjhx6k= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82c35f37-0055-4464-dd0b-08d741bea006 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:28.3668 (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: TYDQOCofOHX/PIk8S2S9rIB7j/YwZ+3WpDnGbTfAXRFUGVO+yCWwOXBFLvhI3ECU3P5LmEO3D6Oig/rMaIdcMg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=j5ZCWdumQ1m47v1W2RSr5NlSa7eKBAn3F/H4TuqXe6o=; b=hQE6eVBlVkoNUJZxELWxpu7U84eNYlB5qc6huRXx/6LbVlDQ1Uh4fWq3lqct3f+bG5DGW9IuNPskPQe268o0XsBz4cjlyGqs9DEV2p5kziRiJDXMB5lohsVNrsT1yU6zK00nu+PrVgxG890ndsNQrKHNFd2JXX+7GjVfpe0hdVE= 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" Add a function to check tmz capability with kernel parameter and ASIC type. v2: use a per device tmz variable instead of global amdgpu_tmz. v3: refine the comments for the function. (Luben) v4: add amdgpu_tmz.c/h for future use. Signed-off-by: Huang Rui Reviewed-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/Makefile | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.c | 49 ++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h | 3 ++ 4 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.c diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index 91369c8..270ce82 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -55,7 +55,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o \ amdgpu_vf_error.o amdgpu_sched.o amdgpu_debugfs.o amdgpu_ids.o \ amdgpu_gmc.o amdgpu_mmhub.o amdgpu_xgmi.o amdgpu_csa.o amdgpu_ras.o amdgpu_vm_cpu.o \ amdgpu_vm_sdma.o amdgpu_pmu.o amdgpu_discovery.o amdgpu_ras_eeprom.o amdgpu_nbio.o \ - amdgpu_umc.o smu_v11_0_i2c.o + amdgpu_umc.o smu_v11_0_i2c.o amdgpu_tmz.o amdgpu-$(CONFIG_PERF_EVENTS) += amdgpu_pmu.o diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 2535db2..e376fe5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -63,6 +63,7 @@ #include "amdgpu_xgmi.h" #include "amdgpu_ras.h" #include "amdgpu_pmu.h" +#include "amdgpu_tmz.h" #include @@ -1032,6 +1033,8 @@ static int amdgpu_device_check_arguments(struct amdgpu_device *adev) adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type); + adev->tmz.enabled = amdgpu_is_tmz(adev); + return ret; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.c new file mode 100644 index 0000000..14a5500 --- /dev/null +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.c @@ -0,0 +1,49 @@ +/* + * Copyright 2019 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include "amdgpu.h" +#include "amdgpu_tmz.h" + + +/** + * amdgpu_is_tmz - validate trust memory zone + * + * @adev: amdgpu_device pointer + * + * Return true if @dev supports trusted memory zones (TMZ), and return false if + * @dev does not support TMZ. + */ +bool amdgpu_is_tmz(struct amdgpu_device *adev) +{ + if (!amdgpu_tmz) + return false; + + if (adev->asic_type < CHIP_RAVEN || adev->asic_type == CHIP_ARCTURUS) { + dev_warn(adev->dev, "doesn't support trusted memory zones (TMZ)\n"); + return false; + } + + dev_info(adev->dev, "TMZ feature is enabled\n"); + + return true; +} diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h index 24bbbc2..28e0517 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_tmz.h @@ -33,4 +33,7 @@ struct amdgpu_tmz { bool enabled; }; + +extern bool amdgpu_is_tmz(struct amdgpu_device *adev); + #endif From patchwork Wed Sep 25 13:45:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160727 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 9BFE614DB for ; Wed, 25 Sep 2019 13:45:44 +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 8387220640 for ; Wed, 25 Sep 2019 13:45:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8387220640 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 80BA26EBC3; Wed, 25 Sep 2019 13:45:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730043.outbound.protection.outlook.com [40.107.73.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 000B36EBC1; Wed, 25 Sep 2019 13:45:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OisRJ9AIw+A9t05I8nQDP6PNCC/25cFvQgaCngKwbc6jCw9Satpoxiumdg0JwW8KFgQPNXNI+MS4ZhHWeb814YPusC7gKF9Hf8wIE3FQWaXwG+6pDBlYOY/L9W5WgNUJuNJs+E+lPLYbVqpernpI2v/HdrLed7L8H3E4VcXKpHDPBzDLPNWBhciPu80C2H5PY9X2GEXb0fKqJZjTAdKUO9/7FWm2Tw3aeyu6ieGpdjkmsbQS3HSJzvhc4MWgH6egnWirRuvSCjgudjlJC0vf4xv0H6MVLLrf7w+obpLc1fgnpL+kKIk3exMvaePGxb/d5kWgKSlz5PPesy3iYUJUYA== 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=7Z6VLfz+YpSTznlSLu70AJ4pOVJrHNucy74VHXpxvL4=; b=JSdJA6LdH+MDRgJwCYs88g8kNcYVQyzSVcF9whBD92idoQCikOT9CMNQaaVoHB0JoonqTTw5q0RE+OV6SlwEg1ZYDeg5welHI7q175RK65Q+9Accu3DPjqdtwRy9VoJPzIHiJMXe9Fhd+H5z/cqrxfScOAqaVdyYPGevldUK0FjVjaR02q0ASgySeMs+lNS36GLSkObge3cKjEehCJRpIxJ0Qk2B4Q4TcRe6aex+Qo+8sn2ataVRwqb9NJAu1KheewwCv7bNoYyeMck/7Q8PeTYErqR6gz1fan2bvTO8qRunxi9WhN1vsEupJZnyL4ZNpZrC4SfCp3JptDA3sAl7UA== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:32 +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.016; Wed, 25 Sep 2019 13:45:32 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 07/11] drm/amdgpu: add tmz bit in frame control packet Thread-Topic: [PATCH v2 07/11] drm/amdgpu: add tmz bit in frame control packet Thread-Index: AQHVc6d/ZPsYtQ4lsUiGWg8fffj+kg== Date: Wed, 25 Sep 2019 13:45:31 +0000 Message-ID: <1569419090-5304-8-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 22f0e632-0855-4651-6af5-08d741bea207 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:820; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(979002)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(256004)(19627235002)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: 2DuJnD6Lf4KkBZt9nXv/crobF62mKOQ0y6Pxzn6JvLFG4dQPRLoAJpA7+e++WrzKYuo+VCRQNKDgM0Cdn7ulRWQw8wXsYrsRaKUUFcHTsTCFxlTPwUYC5Er6EWTFSqTkR6j+Whq2qAqjdHgwx/ybT8C9yLAwDNBu3oLaWCgIXYJGwpJkUH7WDlSaCEWuQSokUlW0lUnUmHAd5jBaiJUXxoJ87f7R/Y9G9/Ript5tzbnOgLnpIFemvGnn4E5SRDjiO8KPAETmEYSpKEjRkOAFVJJNtPVd4n0z43K/Onmrb36DqDfyUXx7Hk3mqWj5kG2fZ3V1oCyoOapQ14kKuknJdV0qs91xHfk/o/wkUgQyUtHAdXg6uxqrIzALGLISIoWyT4QaN2PY7CtVIMW3oureMfKq2E8nW+77zal46wC+1PY= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22f0e632-0855-4651-6af5-08d741bea207 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:31.9408 (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: qgfeZum+/AQZdvGL3umLVbf4iT9sOrJk//1TDfXTFRGRYIy1fFGlzlvIBFiQQfXTBcsiIfIGZHtKsrnwvn4ePQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=7Z6VLfz+YpSTznlSLu70AJ4pOVJrHNucy74VHXpxvL4=; b=itf8bfc9c793nHA3SPpbmQ8cUiwKVNeOlWgZfg5bf6ZCz2VQKyjcC6486etBZu9nb4ANpwV7/cok4DeITn0NtjyrgyKX0Z+n/2D5/qXd1UUnGXnuU+tFgs34V+rAXWr1S0MUB+JZ58c+4DawwabevOyPU2hE4z8g2A2c4hNR4yg= 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" This patch adds tmz bit in frame control pm4 packet, and it will used in future. Signed-off-by: Huang Rui Reviewed-by: Alex Deucher Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/nvd.h | 1 + drivers/gpu/drm/amd/amdgpu/soc15d.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/nvd.h b/drivers/gpu/drm/amd/amdgpu/nvd.h index 1de9846..f3d8771 100644 --- a/drivers/gpu/drm/amd/amdgpu/nvd.h +++ b/drivers/gpu/drm/amd/amdgpu/nvd.h @@ -306,6 +306,7 @@ #define PACKET3_GET_LOD_STATS 0x8E #define PACKET3_DRAW_MULTI_PREAMBLE 0x8F #define PACKET3_FRAME_CONTROL 0x90 +# define FRAME_TMZ (1 << 0) # define FRAME_CMD(x) ((x) << 28) /* * x=0: tmz_begin diff --git a/drivers/gpu/drm/amd/amdgpu/soc15d.h b/drivers/gpu/drm/amd/amdgpu/soc15d.h index edfe508..295d68c 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15d.h +++ b/drivers/gpu/drm/amd/amdgpu/soc15d.h @@ -286,6 +286,7 @@ #define PACKET3_WAIT_ON_DE_COUNTER_DIFF 0x88 #define PACKET3_SWITCH_BUFFER 0x8B #define PACKET3_FRAME_CONTROL 0x90 +# define FRAME_TMZ (1 << 0) # define FRAME_CMD(x) ((x) << 28) /* * x=0: tmz_begin From patchwork Wed Sep 25 13:45:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160725 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 AF01814DB for ; Wed, 25 Sep 2019 13:45:42 +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 96AB520640 for ; Wed, 25 Sep 2019 13:45:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 96AB520640 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 E1AAF6EBC1; Wed, 25 Sep 2019 13:45:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-dm3nam05on0614.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe51::614]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E5F76EBBB; Wed, 25 Sep 2019 13:45:38 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gb869IZB22ccZQe8BHlOyr5PHRZc6W+pLWu9tRotpT16vg2sDetb4xUb5WxUGtfRtg/KO5cGBYgGIEnoBlhDTNHwLd7MULTggl5JjrEcpNoos3mzxZz+v5HE2lD5BSmMmbre4A9lt1uqXDxAsfLY3QiIxMn4R77pBLYcbwxp38rUJFlkL6VcThlJKtFgNEoSkvLObPGyT0nn4JuFyxqQpPEPr5JMtVPN4cMuY3htHt/glQNGBS5l3E+5GgDj8RJvx8Y9yDNXU/SK8GV/NJ10O/gyXuNMKEZGYCvY+03dnAEAc72aOZ87W1av3ulJ7mYrjgSA6dL09zxZF1jWmCeOgQ== 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=RPZH1Y7KJqraORhHNAKkIouS49QYVkTc3ozFrliQbio=; b=HuZ31WUw3he1yu7uU1vyStvvYqQdPoSCgMEMjulwpnwTu+o5Qi4wYYweSPAqQsFV/eOgmy0f1zL8q6AjTvix2TfP6/Lma3nc//tHWWtII06hBM2Tau0MMeAuSxha+MzftMG04WZT+vpe/aCAyH+AQlny9gFg7h5boLrQl7vPZ8iT8v3RLgu8UwDe6gdtY9QqsSl/JSwTUSrXicbKFi4vn3pOCoZCkrFiPNhZh75ELNJCbkZHWo6IQFDbPRZNwdgqnMWTX0QT7cZgVcN7YrLK2wxs4zqZTLtb01eQQQv1M4xFV6BCtOwh0/aUm9pIbrGYHeK8SHSHga8l9AwMc672tg== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:35 +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.016; Wed, 25 Sep 2019 13:45:35 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 08/11] drm/amdgpu: expand the emit tmz interface with trusted flag Thread-Topic: [PATCH v2 08/11] drm/amdgpu: expand the emit tmz interface with trusted flag Thread-Index: AQHVc6eBFmT1jj9ld0uJomvkFAb+TQ== Date: Wed, 25 Sep 2019 13:45:35 +0000 Message-ID: <1569419090-5304-9-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 726b7612-f0d6-4909-3140-08d741bea446 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:356; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: dnSiFOpGhFObaeKvCTuCnU4hKNXl7JyG+5v/trlIA7GKxarZkulBXR6fUTA2adYDGo5xj/oHB5PlfYsPywNhKhdjSP5v7DYIwAcWUSqIWh9j7Fyjs4e6MfYa577rQ1Cq/OhI1fLVDqalsakm8nBKNdJsKmU6pDon+MEY1FFjR5jdJkBw+ujMUhH/hP+bIo5vCc7+nSZn3TYITlWOP2LJMED4nEwjokRSAC5FR29hA6wIWH+GFeaMINbLz48AfkSTF3SzYPQkM2aRAYzujfXMGG0Zxq+8OfbSYM6O+D4y4cuadNkaEFS19xW6oOipL85P5ERNHa22UR7Ce4t/n+aetTSQfRSBQYJbqv0uyzOfEk7YNFNG9O4r3BfHk+cY9O2aGptVTCrjKA7Tg1P08PfewBJlMtafSaa0p55tKsIrNB4= Content-ID: <3713D2B3176E704DA5831F90217C92F0@namprd12.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 726b7612-f0d6-4909-3140-08d741bea446 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:35.4308 (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: WuTIu+jeTwn/6Cm2E3a9q8+iZXLm/ajlKS1lx2cd6pbfbLU6vwHsIQiZ5rWcY67Z+UsTXFidw2O72+18RISr5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=RPZH1Y7KJqraORhHNAKkIouS49QYVkTc3ozFrliQbio=; b=MqPbijp0PCDydxGuqLa+8qWYwRuWCcKg72HjbtxI1JoERwUckxyfav69AXRDXi8AGSUm/QSf1fHbiLXQZ+KiyYCqPxZs5m3FwyC3gJ+TosWTSpN1qHtDhumg4nsN0t7TBEkcg7gL3XAYVl0HSdsnM7uU+eqJEvwG1YaHJkQeUJw= 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" This patch expands the emit_tmz function to support trusted flag while we want to set command buffer in trusted mode. Signed-off-by: Huang Rui Reviewed-by: Alex Deucher Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 4 ++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 16 ++++++++++++---- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 13 ++++++++++--- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 6882eeb..54741ba 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c @@ -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); + amdgpu_ring_emit_tmz(ring, false, false); #ifdef CONFIG_X86_64 if (!(adev->flags & AMD_IS_APU)) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h index 930316e..34aa63a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h @@ -166,7 +166,7 @@ struct amdgpu_ring_funcs { void (*emit_reg_write_reg_wait)(struct amdgpu_ring *ring, uint32_t reg0, uint32_t reg1, uint32_t ref, uint32_t mask); - void (*emit_tmz)(struct amdgpu_ring *ring, bool start); + void (*emit_tmz)(struct amdgpu_ring *ring, bool start, bool trusted); /* priority functions */ void (*set_priority) (struct amdgpu_ring *ring, enum drm_sched_priority priority); @@ -247,7 +247,7 @@ struct amdgpu_ring { #define amdgpu_ring_emit_wreg(r, d, v) (r)->funcs->emit_wreg((r), (d), (v)) #define amdgpu_ring_emit_reg_wait(r, d, v, m) (r)->funcs->emit_reg_wait((r), (d), (v), (m)) #define amdgpu_ring_emit_reg_write_reg_wait(r, d0, d1, v, m) (r)->funcs->emit_reg_write_reg_wait((r), (d0), (d1), (v), (m)) -#define amdgpu_ring_emit_tmz(r, b) (r)->funcs->emit_tmz((r), (b)) +#define amdgpu_ring_emit_tmz(r, b, s) (r)->funcs->emit_tmz((r), (b), (s)) #define amdgpu_ring_pad_ib(r, ib) ((r)->funcs->pad_ib((r), (ib))) #define amdgpu_ring_init_cond_exec(r) (r)->funcs->init_cond_exec((r)) #define amdgpu_ring_patch_cond_exec(r,o) (r)->funcs->patch_cond_exec((r),(o)) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index a2f4ff1..18f741b 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -243,7 +243,8 @@ static int gfx_v10_0_rlc_backdoor_autoload_enable(struct amdgpu_device *adev); static int gfx_v10_0_wait_for_rlc_autoload_complete(struct amdgpu_device *adev); static void gfx_v10_0_ring_emit_ce_meta(struct amdgpu_ring *ring, bool resume); static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume); -static void gfx_v10_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start); +static void gfx_v10_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start, + bool trusted); static void gfx10_kiq_set_resources(struct amdgpu_ring *kiq_ring, uint64_t queue_mask) { @@ -4521,7 +4522,7 @@ static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flag gfx_v10_0_ring_emit_ce_meta(ring, flags & AMDGPU_IB_PREEMPTED ? true : false); - gfx_v10_0_ring_emit_tmz(ring, true); + gfx_v10_0_ring_emit_tmz(ring, true, false); dw2 |= 0x80000000; /* set load_enable otherwise this package is just NOPs */ if (flags & AMDGPU_HAVE_CTX_SWITCH) { @@ -4679,10 +4680,17 @@ static void gfx_v10_0_ring_emit_de_meta(struct amdgpu_ring *ring, bool resume) sizeof(de_payload) >> 2); } -static void gfx_v10_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start) +static void gfx_v10_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start, + bool trusted) { amdgpu_ring_write(ring, PACKET3(PACKET3_FRAME_CONTROL, 0)); - amdgpu_ring_write(ring, FRAME_CMD(start ? 0 : 1)); /* frame_end */ + /* + * cmd = 0: frame begin + * cmd = 1: frame end + */ + amdgpu_ring_write(ring, + ((ring->adev->tmz.enabled && trusted) ? FRAME_TMZ : 0) + | FRAME_CMD(start ? 0 : 1)); } static void gfx_v10_0_ring_emit_rreg(struct amdgpu_ring *ring, uint32_t reg) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index 90348fb29..fa264d5 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -5240,10 +5240,17 @@ static void gfx_v9_0_ring_emit_de_meta(struct amdgpu_ring *ring) amdgpu_ring_write_multiple(ring, (void *)&de_payload, sizeof(de_payload) >> 2); } -static void gfx_v9_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start) +static void gfx_v9_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start, + bool trusted) { amdgpu_ring_write(ring, PACKET3(PACKET3_FRAME_CONTROL, 0)); - amdgpu_ring_write(ring, FRAME_CMD(start ? 0 : 1)); /* frame_end */ + /* + * cmd = 0: frame begin + * cmd = 1: frame end + */ + amdgpu_ring_write(ring, + ((ring->adev->tmz.enabled && trusted) ? FRAME_TMZ : 0) + | FRAME_CMD(start ? 0 : 1)); } static void gfx_v9_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) @@ -5253,7 +5260,7 @@ static void gfx_v9_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) if (amdgpu_sriov_vf(ring->adev)) gfx_v9_0_ring_emit_ce_meta(ring); - gfx_v9_0_ring_emit_tmz(ring, true); + gfx_v9_0_ring_emit_tmz(ring, true, false); dw2 |= 0x80000000; /* set load_enable otherwise this package is just NOPs */ if (flags & AMDGPU_HAVE_CTX_SWITCH) { From patchwork Wed Sep 25 13:45:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160729 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 B943F924 for ; Wed, 25 Sep 2019 13:45:47 +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 A142520640 for ; Wed, 25 Sep 2019 13:45:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A142520640 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 D79EE6EBC8; Wed, 25 Sep 2019 13:45:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-dm3nam05on0617.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe51::617]) by gabe.freedesktop.org (Postfix) with ESMTPS id E56006EBCA; Wed, 25 Sep 2019 13:45:41 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S5zg7MdiOffAu28SqqE/uKSqHekfzlZf6p3rjk5HTYEWRciEz7t40w33L+LRsqFq8ZZdAQQiTYusPFqqLK9Lk+nPnYkSlCBK130BdYHifBWYG4UR73sAKtIkp43LOd+r0b1+Be30EsIIXmLbt5cNMPYw0uGessVW4yMUzwMvSouhk+mnUCFf2XLyDxL1vviJmvaFSPWyQgjfALMtk0ndwerMTdcqWaMcNqRyQi69Sn5GO2RUYT7lMhTEdPMBzmqItJHwKrpmW7J8+akO7bXg2Yg7qLZwfCDYejVbntBwPjE1rY7tlhBSHIzJLYyz3DE2GbXVpWxPtFvHJI5f5qrz0Q== 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=YGE/iRY95VQl17s2DH3u2vWS8VWEdWXjz/qqaPhaeiM=; b=XlwPevLEcHil6287KzZbyQptWBNHTm0/VLHq1cjOFWaPRFWC/bTXUx+w0883ZBryTNYWrWZyHyic2aDuN7q3DfYMGfIUuZP758q5Cv3SJgjpe8gCmP6pyDyj3TFvSRujulQd9iMm+nkoHjl6+kEcRRn88stOEvDCTnJJiXPSSGA4+kjZ5ZfdUO6B6dV/J/TDXQ+WbTIgH+GBK7IBogLAIf9sE3eAl8FkWmhdl3BikTVrG+boTBnEXDuijff3YcHN6WTOQh0fLOniLWOVon4NBtvGit27HHCV0+IQoOsc3nSjWTYIlj4tBfsPi2m4E5BqdLSy18F8bLHd94G57R7EOQ== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:39 +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.016; Wed, 25 Sep 2019 13:45:39 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 09/11] drm/amdgpu: expand the context control interface with trust flag Thread-Topic: [PATCH v2 09/11] drm/amdgpu: expand the context control interface with trust flag Thread-Index: AQHVc6eDxqARTAv000ih97V+IZTkwQ== Date: Wed, 25 Sep 2019 13:45:38 +0000 Message-ID: <1569419090-5304-10-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: adf5d892-a8d9-475b-04e7-08d741bea642 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:81; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: wxrWwr3BXw9ENoJFO4ZrvoOQoBoZUJ03CI8rbJiav1VBKT3CnPo+YuGxFwD/4nVTpYA+j3nBygnkrxJNzTGq+6xfo7QDKJFGZ3b8NfjYT22POZpGjVXhWnSOw3PQPfOuPUg1umZn3mFFu8kY/klg5dBy6RXJM+SoCMXHsTx58QqgIrLnYAssAZv/Z3ULORZQLOWAGVYjKEr+vBrewUjjPs74aaZ6cYaHj0p3bDz3u5lsLdRU0aZF8aA5irDbmJFZIV3IzmtMqjd8a75k4yFd0DIy47IS5t9T98z5GipE3ygKOfCthQHEkEmOdACkrjZ5gql8gLspt6Em8EQJUC93j+zXlKEE7JLRPQrymnwuYmQKriztDWzD4MJxuur5WbRh9j5XsmtgzO1rMBymA0AfGOX/QIUNS5/dilWuEaCyxBg= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: adf5d892-a8d9-475b-04e7-08d741bea642 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:38.9488 (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: WavW5COM1UcRH0M9OEPzfBHvS3Tfb8J6OuXyHzSqKpIe/DcIN962i3lYTUDlq7KFyHjdeWwBf0igp6SDdjxRZw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=YGE/iRY95VQl17s2DH3u2vWS8VWEdWXjz/qqaPhaeiM=; b=KoUtjbVDwklml7QckROBl1hBX14CM0RNIbU4PysHk4filM14YAMjV9ID3/VhDC71dagQ7UQGSRi///ZRzfqHPFc1ydY0u7/LGkMnNYDsy6x8NcTzbhToVupkjD2hcwGFWw+H4FfgI7LxbMlmQ9lSSlBQBblUk3Ny7XA+M1SbH4w= 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" This patch expands the context control function to support trusted flag while we want to set command buffer in trusted mode. Signed-off-by: Huang Rui Reviewed-by: Alex Deucher Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h | 5 +++-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 4 +++- 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 | 5 +++-- 7 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c index 54741ba..e1dc229 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); + amdgpu_ring_emit_cntxcntl(ring, status, false); } for (i = 0; i < num_ibs; ++i) { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h index 34aa63a..5134d0d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.h @@ -158,7 +158,8 @@ struct amdgpu_ring_funcs { void (*begin_use)(struct amdgpu_ring *ring); void (*end_use)(struct amdgpu_ring *ring); void (*emit_switch_buffer) (struct amdgpu_ring *ring); - void (*emit_cntxcntl) (struct amdgpu_ring *ring, uint32_t flags); + void (*emit_cntxcntl) (struct amdgpu_ring *ring, uint32_t flags, + bool trusted); void (*emit_rreg)(struct amdgpu_ring *ring, uint32_t reg); void (*emit_wreg)(struct amdgpu_ring *ring, uint32_t reg, uint32_t val); void (*emit_reg_wait)(struct amdgpu_ring *ring, uint32_t reg, @@ -242,7 +243,7 @@ struct amdgpu_ring { #define amdgpu_ring_emit_gds_switch(r, v, db, ds, wb, ws, ab, as) (r)->funcs->emit_gds_switch((r), (v), (db), (ds), (wb), (ws), (ab), (as)) #define amdgpu_ring_emit_hdp_flush(r) (r)->funcs->emit_hdp_flush((r)) #define amdgpu_ring_emit_switch_buffer(r) (r)->funcs->emit_switch_buffer((r)) -#define amdgpu_ring_emit_cntxcntl(r, d) (r)->funcs->emit_cntxcntl((r), (d)) +#define amdgpu_ring_emit_cntxcntl(r, d, s) (r)->funcs->emit_cntxcntl((r), (d), (s)) #define amdgpu_ring_emit_rreg(r, d) (r)->funcs->emit_rreg((r), (d)) #define amdgpu_ring_emit_wreg(r, d, v) (r)->funcs->emit_wreg((r), (d), (v)) #define amdgpu_ring_emit_reg_wait(r, d, v, m) (r)->funcs->emit_reg_wait((r), (d), (v), (m)) diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c index 18f741b..06698c2 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c @@ -4514,7 +4514,9 @@ static void gfx_v10_0_ring_emit_sb(struct amdgpu_ring *ring) amdgpu_ring_write(ring, 0); } -static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) +static void gfx_v10_0_ring_emit_cntxcntl(struct amdgpu_ring *ring, + uint32_t flags, + bool trusted) { uint32_t dw2 = 0; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c index 8c27c30..b4af1b5 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c @@ -2972,7 +2972,8 @@ static uint64_t gfx_v6_0_get_gpu_clock_counter(struct amdgpu_device *adev) return clock; } -static void gfx_v6_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) +static void gfx_v6_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags, + bool trusted) { if (flags & AMDGPU_HAVE_CTX_SWITCH) gfx_v6_0_ring_emit_vgt_flush(ring); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c index 48796b68..c08f5c5 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c @@ -2309,7 +2309,8 @@ static void gfx_v7_0_ring_emit_ib_compute(struct amdgpu_ring *ring, amdgpu_ring_write(ring, control); } -static void gfx_v7_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) +static void gfx_v7_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags, + bool trusted) { uint32_t dw2 = 0; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c index 98e5aa8..d3a23fd 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c @@ -6393,7 +6393,8 @@ static void gfx_v8_ring_emit_sb(struct amdgpu_ring *ring) amdgpu_ring_write(ring, 0); } -static void gfx_v8_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) +static void gfx_v8_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags, + bool trusted) { uint32_t dw2 = 0; diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c index fa264d5..872d100 100644 --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c @@ -5253,14 +5253,15 @@ static void gfx_v9_0_ring_emit_tmz(struct amdgpu_ring *ring, bool start, | FRAME_CMD(start ? 0 : 1)); } -static void gfx_v9_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags) +static void gfx_v9_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags, + bool trusted) { uint32_t dw2 = 0; if (amdgpu_sriov_vf(ring->adev)) gfx_v9_0_ring_emit_ce_meta(ring); - gfx_v9_0_ring_emit_tmz(ring, true, false); + gfx_v9_0_ring_emit_tmz(ring, true, trusted); dw2 |= 0x80000000; /* set load_enable otherwise this package is just NOPs */ if (flags & AMDGPU_HAVE_CTX_SWITCH) { From patchwork Wed Sep 25 13:45: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: 11160731 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 7044C924 for ; Wed, 25 Sep 2019 13:45: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 57F272146E for ; Wed, 25 Sep 2019 13:45:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 57F272146E 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 E8FD96EBCE; Wed, 25 Sep 2019 13:45:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730053.outbound.protection.outlook.com [40.107.73.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9BB8D6EBCA; Wed, 25 Sep 2019 13:45:45 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UX8VHZcBVrk3c3j0JhefltDRsViSZXM5tUqWAFTWE6mmY0snaQHNHc3N8c/GralHnX1H80/6CTDf0DQs2Tp/BLZkRgnsrSiZa7YHXOn6Agh4mNm0JnOUSdw7imDkbyVRBBsjiokt0N8+vZFwkrGy0n67G0XItA11q0hSWlpTHeX0FqKyJYOJQjtMpcX1LuunwWjyC8vmAngIvEyXNUSeEnEM0dsvlkef0lDdsVZ6Uav8PQHo6cMvmjl3xQ4hndBpfMnm8CXvJa3JSmUUVB+z/q9Abs4/uTB+Z7XI7ywIt8Ma2JIOtQ5/G3SfNT2dp4/1o0uEFFCpdYwdRoBP08yQ4A== 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=/rOya0AF4FSBiumuaycpfz+1FkTp0kfeBO1CGsL/DDA=; b=gNP3JQP7zpbyUM9xKG4EfHnq/CuskdP+VCdMiCf9lihgJI5+xU/wV9v/Tgt8MK1UY/U4lWXtLlDPb7plrLMFwT0lJuXuPIZE2i60FVhrW1VvYBBMRkBfbWyXsWj4NpOwYCXzrq/qam0PcDnaM3rAXPFphokMGnv4FZVRsYQsTlDiy5Jnsc5Vd1UEaPJafXhf9ZuTk/iTEV/Z7thRj6m5C+X+/8X8UgNCpgowySnsEFDdbZRWVIz370p76hGfihr3QlN9+6WjwLg28Nu5A0oaauuU1WP+sq12cm0SglfXUJh9gQ43wX2ME58ked5fMiM+km/pc82qsKtu9wJjEp8OHQ== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:42 +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.016; Wed, 25 Sep 2019 13:45:42 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 10/11] drm/amdgpu: job is secure iff CS is secure (v3) Thread-Topic: [PATCH v2 10/11] drm/amdgpu: job is secure iff CS is secure (v3) Thread-Index: AQHVc6eGQ8fsYXuB3USvmI2hDudFAQ== Date: Wed, 25 Sep 2019 13:45:42 +0000 Message-ID: <1569419090-5304-11-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 15a13e70-585d-4718-f56c-08d741bea853 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: SeDfoS+Qn8LBbjrkODdnxsmx0cD+oavHWEClYhHwyRAvonA9nXrJ+iI0wg5NLzpAyA+XAenWczpMCwg5EQtESIzSIoIO/42ekkIDPdDN9hE0LQ3jTazLcQbHuzDWzTBFV7BPSZpredbpr3VEqQJWARO8HpfqJvdlov890npCg2DOsLj7AqjYqYbA9BbSciXOctbByrjnudasuUcYcxD2G+s5OQMnsfap/kh8Tavij57sF+uX99Oo5WqW2biJVRdb9TgdJobE06XU6KAmmEiZ7vKuErA4BWreE2OZO1I66qhLN3o3XbucZhub1a6Pw5zsctq/owkSouQOTxQd6aXtNcaByA+0V6JU4yN1AdHy8sr2mxBhfEblX8IpL2eG9IgBrIbldn5KbJM6aCUBvBabIzXAR8WlfQtmOZ2l+DUOY+8= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15a13e70-585d-4718-f56c-08d741bea853 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:42.3218 (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: p7JO7XmlX9dK12m8ighMO251vjscunZcYdHlTZcywODhW+VFh7xSmoqed6xKv4aLKZ9urt3FDYSHQ8w/F7k+hw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=/rOya0AF4FSBiumuaycpfz+1FkTp0kfeBO1CGsL/DDA=; b=qpg99ES79TE9a7PNrWGGP392cIvf7ZLMCMGgS+Y41cf81iq1m8hGw4XcIlFxtVcoq4e1FIdB8A0p+5PcU6YkhBIHcQDXDw28q/XMVk50+C6XMxzne6lNA5JG8VujIJtf4po1xT/9CHePBwpg5PM128/d0LTJqMrTJncq0PpUx/E= 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. 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 | 8 +++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ib.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.h | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c index 51f3db0..0077bb3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1252,8 +1252,14 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p, p->ctx->preamble_presented = true; } - cs->out.handle = seq; + /* The command submission (cs) is a union, so an assignment to + * 'out' is destructive to the cs (at least the first 8 + * bytes). For this reason, inquire about the flags before the + * assignment to 'out'. + */ + job->secure = cs->in.flags & AMDGPU_CS_FLAGS_SECURE; job->uf_sequence = seq; + cs->out.handle = seq; amdgpu_job_free_resources(job); 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..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, From patchwork Wed Sep 25 13:45:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 11160733 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 84D0C1747 for ; Wed, 25 Sep 2019 13:45:53 +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 6CC9C2146E for ; Wed, 25 Sep 2019 13:45:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CC9C2146E 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 83FD16EBBA; Wed, 25 Sep 2019 13:45:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-DM3-obe.outbound.protection.outlook.com (mail-eopbgr730085.outbound.protection.outlook.com [40.107.73.85]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C1A26EBCD; Wed, 25 Sep 2019 13:45:47 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mMEoRxwZazmIJs9KYu7OqLpfZemxFUaXGIYthbFVLjZyM9blFUvDwCba5jElMS3SacFTiLeTBQqahrwB/ZwCg52U1wKuv6kGq3xrux0nNO/fdkcpmR7embGjE4AaHzxv1J+zSYZjVEN3G9ztxmk5U+l4gQnOFJwwP8xACYsCavzj67gT4d+MwKGo/wW97pN4Jrxwj8Y9hOVELGYgS/dQ1mddPhCAIe8zJMcfZRqdBHaqUmDrTWfNfKZCox0PLYAw3bmafFM8yAE5KPpYaqqyB820W+ch9CkElmGY1hKaKHplMYlWtSSJWfYcmbTVWiV7bPRP+CfLMrCoOgHETSfA/Q== 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=mWfqDO7YTemPIScxEfza/VZXafHJ6u1OmcRS3ig87aY=; b=WBi7vRX7+0HMDQz6XTaFTRVM/eNXiuOLJPnAulnLGqlSr5X4lBKnozBr9GAUnyp0ttNCVzj7+YdqIeL2NO2j/MtmfsfgWgtYcwO9xVXUbNg3qOd29TWsTc1RlJPxbEvgbKoxAW29zMh0HtgQRHg/kcKNrh/ru6ALyGHi2LPPqC3mxaLRihg4DvmGAprKW89M+UCP00VIAEf/jplC6BJYwK8SBGUKDiiHlBIfI79k5GWjwmk18bWdK9CBhEYZZpGAl9iXLPp9e6M3ts4vDs/dLL17BcaiIsd0UeQw0qSGOl58iwBU63g6yeRxvlrKIBgmWWpx4XnSlOh8ACfvLfxwDA== 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 MN2PR12MB4304.namprd12.prod.outlook.com (10.255.224.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2284.20; Wed, 25 Sep 2019 13:45:46 +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.016; Wed, 25 Sep 2019 13:45:45 +0000 From: "Huang, Ray" To: "amd-gfx@lists.freedesktop.org" , "dri-devel@lists.freedesktop.org" , "Deucher, Alexander" Subject: [PATCH v2 11/11] drm/amdgpu: set TMZ bits in PTEs for secure BO (v4) Thread-Topic: [PATCH v2 11/11] drm/amdgpu: set TMZ bits in PTEs for secure BO (v4) Thread-Index: AQHVc6eI1d3ghHPBckefwNlAIA9rmQ== Date: Wed, 25 Sep 2019 13:45:45 +0000 Message-ID: <1569419090-5304-12-git-send-email-ray.huang@amd.com> References: <1569419090-5304-1-git-send-email-ray.huang@amd.com> In-Reply-To: <1569419090-5304-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: HK2PR02CA0186.apcprd02.prod.outlook.com (2603:1096:201:21::22) 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: 57b4a1d7-b5f5-487f-2b10-08d741beaa6a x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:MN2PR12MB4304; x-ms-traffictypediagnostic: MN2PR12MB4304: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-forefront-prvs: 01713B2841 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(189003)(199004)(86362001)(8936002)(305945005)(2501003)(50226002)(6636002)(14444005)(256004)(6486002)(6116002)(3846002)(6436002)(6512007)(2906002)(4326008)(66066001)(102836004)(26005)(186003)(52116002)(76176011)(486006)(476003)(2616005)(11346002)(66946007)(66476007)(66556008)(64756008)(66446008)(446003)(99286004)(5660300002)(81156014)(6506007)(81166006)(450100002)(25786009)(36756003)(316002)(478600001)(386003)(8676002)(71190400001)(71200400001)(110136005)(54906003)(7736002)(14454004)(21314003); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR12MB4304; 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-message-info: qghEaAZAm/8MmJerLu1oHP6nOE3alHC5036KghR91ba82kQKkeslTgo+rdtwACfYYCrDORJnEW2WyMcAfC4//vHIi9pJligwo6vsIBZg/iL1HhP9gS1hclGTcGJcX5dWtGgjHx7ISS48PLXsv+ZsLtSLIpzRBv9CE1Nc19DEXF7lduHU7CLQXrdbKL2M4zqfAzMlBAPLkLxp609b1zPIfS7EUs9Q3//QvRQO7K1cXWaecORg7+6nQwpJNNYL58h/OAqshCuy9F9XPIlVxgvBdpvoz4jED5M5JQ93K9ulyKKr7pYnCHHH0MZ7XsqsiYOnOGHjGBXS+KdaBazFlddwVFEWS53ZJCPVvwg5b9V8ZC7LwtN5toPItbPHfy3UEEd7y2mePftAdAoKBZ85T3s0KmEvHv5ZPrGAb9wC/Buio34= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57b4a1d7-b5f5-487f-2b10-08d741beaa6a X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Sep 2019 13:45:45.8168 (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: DU/eco+EK8dFmfgBYG0dNmA12WPHgYhB2+KxffiXEhwsj+5LZp3oNrL9zUZIJtzoSLGrgg13VAoE52XxzzGlVA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4304 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=mWfqDO7YTemPIScxEfza/VZXafHJ6u1OmcRS3ig87aY=; b=iKghWPiEOG/TtuikLf1RAuq8c3/rYeaikDzn6VkJibO9rTQOeon8FcUSVmV9TJUE6iVBWNyuMZwopiJ4c1IV98KctzppsOmH3RyDSjjk7YAv+ookr1MrXDvc+BbKe3c6Lz9VRNRaJgrZrdfnHKjcAGmBeEQyvYbEpG7J8oSrUcY= 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" From: Alex Deucher If a buffer object is secure, i.e. created with AMDGPU_GEM_CREATE_ENCRYPTED, then the TMZ bit of the PTEs that belong the buffer object should be set. v1: design and draft the skeletion of TMZ bits setting on PTEs (Alex) v2: return failure once create secure BO on non-TMZ platform (Ray) v3: amdgpu_bo_encrypted() only checks the BO (Luben) v4: move TMZ flag setting into amdgpu_vm_bo_update (Christian) Signed-off-by: Alex Deucher Reviewed-by: Huang Rui Signed-off-by: Huang Rui Signed-off-by: Luben Tuikov Reviewed-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 12 +++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 11 +++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 5 +++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 22eab74..5332104 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -222,7 +222,8 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, AMDGPU_GEM_CREATE_CPU_GTT_USWC | AMDGPU_GEM_CREATE_VRAM_CLEARED | AMDGPU_GEM_CREATE_VM_ALWAYS_VALID | - AMDGPU_GEM_CREATE_EXPLICIT_SYNC)) + AMDGPU_GEM_CREATE_EXPLICIT_SYNC | + AMDGPU_GEM_CREATE_ENCRYPTED)) return -EINVAL; @@ -230,6 +231,11 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, if (args->in.domains & ~AMDGPU_GEM_DOMAIN_MASK) return -EINVAL; + if (!adev->tmz.enabled && (flags & AMDGPU_GEM_CREATE_ENCRYPTED)) { + DRM_ERROR("Cannot allocate secure buffer while tmz is disabled\n"); + return -EINVAL; + } + /* create a gem object to contain this object in */ if (args->in.domains & (AMDGPU_GEM_DOMAIN_GDS | AMDGPU_GEM_DOMAIN_GWS | AMDGPU_GEM_DOMAIN_OA)) { @@ -251,6 +257,10 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, resv = vm->root.base.bo->tbo.resv; } + if (flags & AMDGPU_GEM_CREATE_ENCRYPTED) { + /* XXX: pad out alignment to meet TMZ requirements */ + } + r = amdgpu_gem_object_create(adev, size, args->in.alignment, (u32)(0xffffffff & args->in.domains), flags, ttm_bo_type_device, resv, &gobj); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h index 5a3c177..75c7392 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.h @@ -224,6 +224,17 @@ static inline bool amdgpu_bo_explicit_sync(struct amdgpu_bo *bo) return bo->flags & AMDGPU_GEM_CREATE_EXPLICIT_SYNC; } +/** + * amdgpu_bo_encrypted - test if the BO is encrypted + * @bo: pointer to a buffer object + * + * Return true if the buffer object is encrypted, false otherwise. + */ +static inline bool amdgpu_bo_encrypted(struct amdgpu_bo *bo) +{ + return bo->flags & AMDGPU_GEM_CREATE_ENCRYPTED; +} + bool amdgpu_bo_is_amdgpu_bo(struct ttm_buffer_object *bo); void amdgpu_bo_placement_from_domain(struct amdgpu_bo *abo, u32 domain); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index b285ab2..8e13b1fd3 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -1688,6 +1688,11 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev, if (bo) { flags = amdgpu_ttm_tt_pte_flags(adev, bo->tbo.ttm, mem); + + if (amdgpu_bo_encrypted(bo)) { + flags |= AMDGPU_PTE_TMZ; + } + bo_adev = amdgpu_ttm_adev(bo->tbo.bdev); } else { flags = 0x0;