From patchwork Fri Oct 27 15:09:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 10030109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 282756034B for ; Fri, 27 Oct 2017 15:09:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1478F28794 for ; Fri, 27 Oct 2017 15:09:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06AFF287A3; Fri, 27 Oct 2017 15:09:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4CF3E28790 for ; Fri, 27 Oct 2017 15:09:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DAE476E963; Fri, 27 Oct 2017 15:09:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0089.outbound.protection.outlook.com [104.47.33.89]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1865D6E963; Fri, 27 Oct 2017 15:09:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=agnOlHRaIocKvn0bnRV1ayNZdysDkjptekz/86RWqJ0=; b=QZph41WPJx1P73sdnOxLb2c5sunekv2+4nTIvzk8VP4s3p8WpHb4/7IB0Cz3ZG92fHpCs0pRVgVwr3uB4hpn7zty9i+sA43vhhNuHPJ1FDb2pyjUAJ/DrIUTG0/J5X/cWwocM6rgl2qsH2sdLv3yIcZw/RDkU5U7yjmfjL0dxbc= Received: from MWHPR1201CA0009.namprd12.prod.outlook.com (10.174.253.19) by BN6PR12MB1443.namprd12.prod.outlook.com (10.172.24.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6; Fri, 27 Oct 2017 15:09:30 +0000 Received: from BY2NAM03FT006.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::203) by MWHPR1201CA0009.outlook.office365.com (2603:10b6:301:4a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.178.6 via Frontend Transport; Fri, 27 Oct 2017 15:09:29 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by BY2NAM03FT006.mail.protection.outlook.com (10.152.84.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.178.5 via Frontend Transport; Fri, 27 Oct 2017 15:09:29 +0000 Received: from SCYBEXDAG01.amd.com (10.34.11.11) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server (TLS) id 14.3.361.1; Fri, 27 Oct 2017 10:09:27 -0500 Received: from ubuntu-1604-test.amd.com (172.27.225.147) by SCYBEXDAG01.amd.com (10.34.11.11) with Microsoft SMTP Server id 14.3.361.1; Fri, 27 Oct 2017 23:09:21 +0800 From: Andrey Grodzovsky To: , Subject: [PATCH libdrm v2 1/2] amdgpu: Add wrappers for AMDGPU_VM IOCTL. Date: Fri, 27 Oct 2017 11:09:10 -0400 Message-ID: <1509116951-1250-1-git-send-email-andrey.grodzovsky@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(2980300002)(428002)(199003)(189002)(6666003)(305945005)(97736004)(47776003)(110136005)(16586007)(2950100002)(356003)(316002)(77096006)(72206003)(54906003)(5003940100001)(86362001)(39060400002)(5660300001)(53416004)(101416001)(106466001)(575784001)(8936002)(81166006)(76176999)(48376002)(189998001)(50986999)(68736007)(105586002)(4326008)(50466002)(478600001)(81156014)(2906002)(8676002)(33646002)(53936002)(36756003)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1443; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT006; 1:S82b1kZaEnTEJ6FPbRpFqeqtovkLh2YqR9d+HMOefJzrre9P+H957JcfJo29giCi4x6jI3vCHzMJY6jCIw2Ky8UmQBNdN4/1lcUckrmPXQRRt2/flLdLADu/V3bV1SIn X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5474e87c-f548-48e1-ee93-08d51d4cb8d2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627075)(201703031133081)(201702281549075)(2017052603199); SRVR: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=; 20:i6fpvT6SreOK9Yn/cDmA/8/qbddbfGXPIcGZpHyIX7qNfq1ByhBkEQUuJaF6m6m0V3TBvHJNDNaJviTpusRUS1vqskXov2CM6+DPGQamKLL2CsKa40e1v2QSEYSkgCWJSiISgyVuUM1kBZ6ix4A7w1MemDJwjY6FKd5FwSOfJZH0uXLk3OagLgRjLk9QYAAS89KlU23SKoTCnTDPVdWiZCIQQetaTX7+91bKCOcYUNXi8QRIZ2Kxn3T4ioUN/AvLvohIBsAGAP4WQlPCARh1+E1ndmYH+oERIdk90bztuBzXEy73TQt9nEIqAhZZb69xVypNp8OX5/plaDwELgCiHE/7kIhZS/B9cPG8VPFoirACGNpNDE8/RGyPdfrJTfbxLcrQlChi6ZHTOeI5TJWx3gVbsZcqP5LqmaiKwWmg214RDvaSta/atI2VjumQM+fi3tL9cn7ZmhP/omZgNpcbmg7HZwx9FSkyAFtgzzbrphUBjIOe3REkdOv2exNMQoAQ X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(93006095)(93003095)(100000703101)(100105400095)(10201501046)(3231020)(3002001)(6055026)(6041248)(20161123555025)(20161123558100)(20161123560025)(20161123562025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR12MB1443; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR12MB1443; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1443; 4:pUYdrgadUI1hmpk+wSrhK+4ujdMG/ntGl9QTXk2JXD2kppNa8U9gjwlGFz+lRufSQhGJMLc5cDCFlhTj4KssUbpF+YSVY34nOesmZqypffTo4EBJfiOR4BHf5JXshSKteZ0AxL+Y5yLzOcN4uLec2E6WZ3r6dnJTY9NimApKoDCupyqJ7vwAobUGIjfw87I+hVxG4acZA++2RGNIRweahUwhjQ7nHvQYSBxOe1w+YyCZfjWjejH7TI7gdp081JUu0A+FP9IBB5vNGfinr/5n03T7DYAyMG+8ugB3CXQljtofj/R8hP5IyoqVgcVyiApn X-Forefront-PRVS: 0473A03F3F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR12MB1443; 23:DhRfP8PA/rb/bTwuJYOCjhfpgBtuojRJOkj22afmJ?= =?us-ascii?Q?8zOP1GAY2i01T/cGP7aDMAJ+kVle15VPJKV8341qhyPvM6/N/0NwIuQOryZp?= =?us-ascii?Q?yP2x0fDlMMqosVJYkKbJpzqAwbc5F+Ab08X73gvhKgkdTNOq/JSIv5GNUH6J?= =?us-ascii?Q?Hb+Op0byTuVFpzJDHkDnqrr8nm4lSWC4gORa0mszvOhAe1YNg8J49AjFRhwY?= =?us-ascii?Q?bNycct0XFuYpDtLlbn0g8WAYAuvLuivHiKCDTe8jJ0+XIgkbLoKlXevek8ij?= =?us-ascii?Q?fUKxMdG6VwdnUUOeeltE5/frJFAGi8tl2f0vOuJj4cWUKHueAluV1cj/51vH?= =?us-ascii?Q?fOMqWYuA50/Zs8NXamS4Q2SlI07PURSAtI8U5baGT7sdkhvElnGugCmZS+oV?= =?us-ascii?Q?SWkoYtk8pSEC+NFPTSQCbQgaZ8bEoW65xsCT9QOwPzvoDH9adh7qn+jAnipf?= =?us-ascii?Q?ACHju08y8VY312wmph04HhZG8zPTrHw9NLEyDF5LB2lrrHfSMiGw/esU0qgR?= =?us-ascii?Q?CZ+yDB8t5HP1P7JP0HLNRzY+19H1VT9CB3pWv1Po8hoSLb3JH1IqPXQYo/2O?= =?us-ascii?Q?Ux+Bax+L0nEVOiEYwkzarGjZdgX4NRyktnF7mW4Hl5VF7qWnd6PLa3AuwSFJ?= =?us-ascii?Q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i5TktPACyQOb0P/Ja/tulIUnfTbVL9xtYPGOEYk/zzTSE/zep/m6kmHrxC4dFv8DsIYZkKO/RdoPWhnQgiFFn8RxJZyI0+U0gDEKjIkm3VXCAYps=; 24:6M6LtNzL5mPkZFFyvFCEPvBRMgBDluYWBJk6yCAHRH1rAmvgRn3F1BHNiFuUiWPcYv5v3yEhfON4rfkUDpW4akxxHRzBhQCZDqdIO1Zu/L0=; 7:7kWYF9PHFawQq8vkwDn0hjv2DjwFvbFDpqoY7KRVs81kcjSiPGXLH+g63jjklHL5vgjXWoohdpWDEH8KFIRJhiRFmZYNb4uDyH5IdMF5/yvaoOATyWiP3AkPsT9TQOnRh+Ohyao16WmtQ0V3UAXl+oEEAfPQFWUkWHx/KKKrg29Zx2fnIG7oj6GrvudfB78jcMLBr3ISLOPJw8PBIfDAiX8K1mkjgqyJtPLxXz53fmid/3WBG4ETzYsFhTsVNjN/ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1443; 20:1gc3e4JNsGl1CUlX/5vweZHwh0EwIrZXaj2byQE0l9Z4abC7qgK4uIlOIsdMCAXb3Ivm1dcNW3hXNO1NJ+2tp1pmN/tm12JUhCoEaw+GEUJ35CRcDb7YOdcBmbZtFOtTIaYfUCQwXQf3742LkbmDCCPobg9tfrb9ax+PJoZ+KxXtjeYgt9WZ+JjlbnnwdBHl05zg2afwpVMdK+U8awbNyNTMBivsHXqb8wmhIG5OKd2rll2rfPHwrNI8G2OnFQGC X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2017 15:09:29.6625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5474e87c-f548-48e1-ee93-08d51d4cb8d2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1443 Cc: emil.l.velikov@gmail.com, Christian.Koenig@amd.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Andrey Grodzovsky v2: Rename wrappers to match the IOCTL naming, fix identation and fix make check error. Signed-off-by: Andrey Grodzovsky Reviewed-by: Christian König for both. --- amdgpu/Makefile.sources | 1 + amdgpu/amdgpu-symbol-check | 2 ++ amdgpu/amdgpu.h | 18 +++++++++++++++++ amdgpu/amdgpu_vm.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 amdgpu/amdgpu_vm.c diff --git a/amdgpu/Makefile.sources b/amdgpu/Makefile.sources index bc3abaa..498b64c 100644 --- a/amdgpu/Makefile.sources +++ b/amdgpu/Makefile.sources @@ -6,6 +6,7 @@ LIBDRM_AMDGPU_FILES := \ amdgpu_gpu_info.c \ amdgpu_internal.h \ amdgpu_vamgr.c \ + amdgpu_vm.c \ util_hash.c \ util_hash.h \ util_hash_table.c \ diff --git a/amdgpu/amdgpu-symbol-check b/amdgpu/amdgpu-symbol-check index 095c3a0..d476038 100755 --- a/amdgpu/amdgpu-symbol-check +++ b/amdgpu/amdgpu-symbol-check @@ -64,6 +64,8 @@ amdgpu_read_mm_registers amdgpu_va_range_alloc amdgpu_va_range_free amdgpu_va_range_query +amdgpu_vm_reserve_vmid +amdgpu_vm_unreserve_vmid EOF done) diff --git a/amdgpu/amdgpu.h b/amdgpu/amdgpu.h index ecc975f..597fc2b 100644 --- a/amdgpu/amdgpu.h +++ b/amdgpu/amdgpu.h @@ -1489,6 +1489,24 @@ void amdgpu_cs_chunk_fence_to_dep(struct amdgpu_cs_fence *fence, void amdgpu_cs_chunk_fence_info_to_data(struct amdgpu_cs_fence_info *fence_info, struct drm_amdgpu_cs_chunk_data *data); +/** + * Reserve VMID + * \param context - \c [in] GPU Context + * \param flags - \c [in] TBD + * + * \return 0 on success otherwise POSIX Error code +*/ +int amdgpu_vm_reserve_vmid(amdgpu_context_handle context, uint32_t flags); + +/** + * Free reserved VMID + * \param context - \c [in] GPU Context + * \param flags - \c [in] TBD + * + * \return 0 on success otherwise POSIX Error code +*/ +int amdgpu_vm_unreserve_vmid(amdgpu_context_handle context, uint32_t flags); + #ifdef __cplusplus } #endif diff --git a/amdgpu/amdgpu_vm.c b/amdgpu/amdgpu_vm.c new file mode 100644 index 0000000..8a9a0a1 --- /dev/null +++ b/amdgpu/amdgpu_vm.c @@ -0,0 +1,50 @@ +/* + * Copyright 2017 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 "amdgpu.h" +#include "amdgpu_drm.h" +#include "xf86drm.h" +#include "amdgpu_internal.h" + +int amdgpu_vm_reserve_vmid(amdgpu_context_handle context, uint32_t flags) +{ + union drm_amdgpu_vm vm; + + vm.in.op = AMDGPU_VM_OP_RESERVE_VMID; + vm.in.flags = flags; + + return drmCommandWriteRead(context->dev->fd, DRM_AMDGPU_VM, + &vm, sizeof(vm)); +} + +int amdgpu_vm_unreserve_vmid(amdgpu_context_handle context, uint32_t flags) +{ + union drm_amdgpu_vm vm; + + vm.in.op = AMDGPU_VM_OP_UNRESERVE_VMID; + vm.in.flags = flags; + + return drmCommandWriteRead(context->dev->fd, DRM_AMDGPU_VM, + &vm, sizeof(vm)); +}