From patchwork Thu Apr 12 10:09:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 10338129 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 73E5F60134 for ; Thu, 12 Apr 2018 10:11:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 604D728765 for ; Thu, 12 Apr 2018 10:11:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 552A228769; Thu, 12 Apr 2018 10:11:01 +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=-5.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, MAILING_LIST_MULTI, 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 442BC28765 for ; Thu, 12 Apr 2018 10:11:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3DF8B6E3C4; Thu, 12 Apr 2018 10:10:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0055.outbound.protection.outlook.com [104.47.38.55]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D6FF6E1A8; Thu, 12 Apr 2018 10:10:58 +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=6ews3XA41rfGLfQB0ca7RgnZpTtktFhohzQjc4Ar8Ig=; b=zpDF54d+7POEcTBPRb98T7j5Hp+wcrLNXzV2kEVBbEu0b3tn7weqGeS5Axt8GwRHR9FzmEHvBSZOLZc+1T5d3D829XRruv6QziRCQOkxXj4Y1BLYJQ/++e5tcchujunj2lEzMRxRKMhstsDBRU3ZejVzZW+TTMesfMmnKj3tu9Y= Received: from BN6PR1201CA0024.namprd12.prod.outlook.com (2603:10b6:405:4c::34) by CY1PR12MB0759.namprd12.prod.outlook.com (2a01:111:e400:59d1::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.12; Thu, 12 Apr 2018 10:10:56 +0000 Received: from CO1NAM03FT061.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::207) by BN6PR1201CA0024.outlook.office365.com (2603:10b6:405:4c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.675.9 via Frontend Transport; Thu, 12 Apr 2018 10:10:55 +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 SATLEXCHOV02.amd.com (165.204.84.17) by CO1NAM03FT061.mail.protection.outlook.com (10.152.81.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.653.8 via Frontend Transport; Thu, 12 Apr 2018 10:10:54 +0000 Received: from zhoucm1.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.382.0; Thu, 12 Apr 2018 05:10:53 -0500 From: Chunming Zhou To: , Subject: [PATCH 04/11] drm/amdgpu: pass process to tbo Date: Thu, 12 Apr 2018 18:09:33 +0800 Message-ID: <20180412100940.25039-5-david1.zhou@amd.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180412100940.25039-1-david1.zhou@amd.com> References: <20180412100940.25039-1-david1.zhou@amd.com> 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)(376002)(39380400002)(346002)(39860400002)(396003)(2980300002)(428003)(199004)(189003)(105586002)(47776003)(53416004)(106466001)(2906002)(1076002)(68736007)(446003)(53936002)(36756003)(11346002)(4326008)(110136005)(2616005)(476003)(5660300001)(48376002)(336012)(478600001)(97736004)(426003)(316002)(16586007)(50466002)(450100002)(54906003)(86362001)(126002)(8936002)(50226002)(8676002)(486006)(81166006)(81156014)(72206003)(104016004)(51416003)(77096007)(356003)(26005)(7696005)(6666003)(186003)(76176011)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0759; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; CO1NAM03FT061; 1:LaNIBJMGjF1OXjcZMLXxugmS97JP3692JEwYbl+teYMhozlPsU+sPtAJJ29C688yDwom2PlfkL3paIG9NcQ6h7nGwHv1TcSbeYvwecoanV0NIZPN0HU7kd9JX14TdGpv X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060); SRVR:CY1PR12MB0759; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0759; 3:FRTysYRj8urSuVO3NPPxQP2W2m2ViDnb5FP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QQf2cpN+Inbh8zlMUqDP31U//IO90W/1go7/njNMQlqICWa8qUBycKo89BiO6TOPsc70Gp7HN/Zmb+RyWt2TLl7jA0iASKiph0j4w7o619Igioe67WvYwaDW1lKu2k9KHp0tm+x3hPea7hjR7WWljafVm4ok7mxcUVAnGK5Rw7zHIGn3D+SGQjH8VunyN026Htgr6q/PN2PUiaC2FUEPJaQ7qi9TRenev85PsDfe4z2iPIxBfsqW/puGuIHwYr+zb9bNIlvWCVUXfBH9bJURRhVrmmCY4wcA3wS6WU04Su0497VUO+t7IJDc4zbTJb2hMQQa/B5VkqCWB+w2SiARDVBHOaiXZQueL/3f3Bf0SoRiy0okk+a/ScHX0X2y35uz2SFQXrj9fhFZcBVUJY/QwcITwuBj5EWGkvW2gGz0Zdyo3GT/ejBfqPhjP X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93003095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY1PR12MB0759; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0759; X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0759; 4:hCsNz80oOdceHAQtADLHPfrIGsPJx9CwB5Cnt1HJR1JKZ7faKxENc9QqaOxR/ZHzJ1KnIsAen2SjSDWO882XE81V7889wV/Xlr/bKYpsSbvKQW2k9q6VxzF0VFoNjC88dg/tc4GILrxkadT4xN4NGSBKj/f5eYsFqJNSYE9wfR5LHmxwP/nksbZw5bN57wOEoHobS3mBP1oz5FjFzQxf2ZuKLD6yIZOmKmT3fjHEB5gqGQDBOak4FrX9hJylGigJahBEiV7axC/ZRrQysEeZRsQXvptQucqiecwFIXV9KH5AsTrAsbtYTjI2FgHa2uR3 X-Forefront-PRVS: 06400060E1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR12MB0759; 23:g1+3dV1wP0J+AdCApoGMujN5HWbtfARhQ5kbdJhvD?= =?us-ascii?Q?n3BAB2ppf5JMaxPFV6RFUJvn39SdoXH846wlgE6ApNHYA9/SCYpUxMIKLVVx?= =?us-ascii?Q?/ZMtfEP8pXDp7/WkbpELRMKm/pBX5Ybga/thgvNcnZUxLDb167zutnPjwjSY?= =?us-ascii?Q?qmRwps1Xpsz8trNHQJ+fRXTD2EHQAFYDCIdkzIa7wVodM7WwY5f9BZf2PQqq?= =?us-ascii?Q?CgQ0KJc9IOkQ4yZB4+aUdpwytkMq8fP1SQaAIU3gB5ZV/M7soZopclqcl4Pw?= =?us-ascii?Q?HAI3oRMsziumrejAVtJLF8TnnEy1zXylg6ejWB/eNLv1o1m7WXX3DS3I2v+N?= =?us-ascii?Q?1Ss8ZiDTVUIhlcdEYaS74A+aJWjpl21Ba7x3ffL5U0rjTSCasauAMb2id8Xe?= =?us-ascii?Q?ZPEw+UEcDcE8sS3h10SrCxNsHy/T24wmawv6MRyjTvlcvHRjAqueuw2ze6me?= =?us-ascii?Q?CluTRrbh47e5C1Vm1jFtd6fBzaInH4IW2uKIc1OMJOwVovOcPaY214zbWGMr?= =?us-ascii?Q?BeKKOyXB66L5YJNDtUwuFVpwtHjWM0tmED5UgqNvw6FhJOyF+uqKhhJH/SHn?= =?us-ascii?Q?wc64AHvpuBe0v0NKN2uqmdwzDtklpb7KUln+Vqb3F7jmcWT8t96OSiuuL42G?= =?us-ascii?Q?vySYBmHRVNYFzU1yRI7y7GYZThtgAmAADHftM4NcpxwqE0VlwBr+IfwYhsaS?= =?us-ascii?Q?Bpx+RPLlAbmlz/N/57iD+hu44ETrU7y63xpKcB0ExL4dj5qT9Y8IEc/yKpFm?= =?us-ascii?Q?NvPI4uU/JCeAP5inmop/IHocO9Z0VLwTkk25egwAI4b5djq7dYwJOwtZ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08d5a05dad9a X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2018 10:10:54.5917 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85418394-8775-4685-b344-08d5a05dad9a 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=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0759 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: Kai.Guo@amd.com, christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Change-Id: I4de8146567b858ae07a8a27cadf71d13d490e8ac Signed-off-by: Chunming Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 +++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 28c2706e48d7..37b19ce97699 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -195,6 +195,7 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, uint64_t size = args->in.bo_size; struct reservation_object *resv = NULL; struct drm_gem_object *gobj; + struct amdgpu_bo *abo; uint32_t handle; int r; @@ -243,10 +244,12 @@ int amdgpu_gem_create_ioctl(struct drm_device *dev, void *data, r = amdgpu_gem_object_create(adev, size, args->in.alignment, (u32)(0xffffffff & args->in.domains), flags, false, resv, &gobj); + if (!r) { + abo = gem_to_amdgpu_bo(gobj); + abo->tbo.process = &vm->ttm_vm; + } if (flags & AMDGPU_GEM_CREATE_VM_ALWAYS_VALID) { if (!r) { - struct amdgpu_bo *abo = gem_to_amdgpu_bo(gobj); - abo->parent = amdgpu_bo_ref(vm->root.base.bo); } amdgpu_bo_unreserve(vm->root.base.bo); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c index 9e23d6f6f3f3..e911db2d1945 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -447,8 +447,10 @@ static int amdgpu_bo_do_create(struct amdgpu_device *adev, unsigned long size, else amdgpu_cs_report_moved_bytes(adev, ctx.bytes_moved, 0); - if (type == ttm_bo_type_kernel) + if (type == ttm_bo_type_kernel) { bo->tbo.priority = 1; + bo->tbo.process = &adev->kernel_process; + } if (flags & AMDGPU_GEM_CREATE_VRAM_CLEARED && bo->tbo.mem.placement & TTM_PL_FLAG_VRAM) {