From patchwork Fri Dec 4 06:25:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chunming Zhou X-Patchwork-Id: 7765771 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 537BCBEEE1 for ; Fri, 4 Dec 2015 06:46:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 55590205E4 for ; Fri, 4 Dec 2015 06:46:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 5C53920552 for ; Fri, 4 Dec 2015 06:46:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9E1436EDB2; Thu, 3 Dec 2015 22:46:17 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0060.outbound.protection.outlook.com [157.56.111.60]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E4A86EDB2 for ; Thu, 3 Dec 2015 22:46:16 -0800 (PST) Received: from DM3PR12MB0859.namprd12.prod.outlook.com (10.164.7.141) by DM3PR12MB0843.namprd12.prod.outlook.com (10.164.7.29) with Microsoft SMTP Server (TLS) id 15.1.331.20; Fri, 4 Dec 2015 06:31:27 +0000 Received: from CY1PR12CA0084.namprd12.prod.outlook.com (10.163.230.52) by DM3PR12MB0859.namprd12.prod.outlook.com (10.164.7.141) with Microsoft SMTP Server (TLS) id 15.1.331.20; Fri, 4 Dec 2015 06:31:27 +0000 Received: from CO1NAM03FT034.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::206) by CY1PR12CA0084.outlook.office365.com (2a01:111:e400:c42b::52) with Microsoft SMTP Server (TLS) id 15.1.337.19 via Frontend Transport; Fri, 4 Dec 2015 06:31:27 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) 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 atltwp01.amd.com (165.204.84.221) by CO1NAM03FT034.mail.protection.outlook.com (10.152.80.177) with Microsoft SMTP Server id 15.1.346.13 via Frontend Transport; Fri, 4 Dec 2015 06:31:26 +0000 X-WSS-ID: 0NYTM4C-07-O59-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 20843CAF041 for ; Fri, 4 Dec 2015 01:31:23 -0500 (EST) Received: from SATLEXDAG01.amd.com (10.181.40.3) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 4 Dec 2015 00:31:40 -0600 Received: from SCYBEXDAG02.amd.com (10.34.11.12) by SATLEXDAG01.amd.com (10.181.40.3) with Microsoft SMTP Server (TLS) id 14.3.266.1; Fri, 4 Dec 2015 01:31:23 -0500 Received: from zhoucm1.amd.com (10.237.74.94) by SCYBEXDAG02.amd.com (10.34.11.12) with Microsoft SMTP Server id 14.3.266.1; Fri, 4 Dec 2015 14:31:21 +0800 From: Chunming Zhou To: Subject: [PATCH] drm/amdgpu: return bo itself if userptr is cpu addr of bo V2 Date: Fri, 4 Dec 2015 14:25:52 +0800 Message-ID: <1449210353-24082-2-git-send-email-David1.Zhou@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449210353-24082-1-git-send-email-David1.Zhou@amd.com> References: <1449210353-24082-1-git-send-email-David1.Zhou@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(92566002)(105586002)(86362001)(23676002)(2950100001)(50226001)(19580395003)(106466001)(5003600100002)(77096005)(19580405001)(50466002)(50986999)(586003)(47776003)(229853001)(101416001)(87936001)(97736004)(2351001)(189998001)(53416004)(1096002)(76176999)(36756003)(5820100001)(110136002)(5008740100001)(450100001)(11100500001)(1220700001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR12MB0859; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0859; 2:/xrso7FWpYyi2BWYYJicmTEvkkf+BqIemZkTHDOGCwp3a8nq1IJhix853gW8c9+7HfaAUAV5DqdHnc+vnuxmgTWrCP4BbI9o+8Rks6X6FrmxLlCU6Yz9lLttV29ml1lpHhl/UCqBsI3aSOrpo8gSpg==; 3:pn5ZLj0G7uGJ+7koS01+X4JQwiW3BiEGYjD7W6txUy+HPA5+bZAlGPspb2Wcf5enOVClFVx3L6Q5LTk/kQFrFkHEYVF89JByReArRPMCq1+SHZonU3poSvibHkZJ/z/jfTVPt9BxrElere8C+WRvJPb9ndUzLe/dhPNMQv3Qg811VFKOf9InXjPrn46ceK5qXNDF/m60TX2My72nWQZAeyavF/2L4LU7LGX3Od4AhZk=; 25:zurYVcNrEN4JHRPlTi6S/Mm6+Niy2LAl88bMYGAKzaBbZSbemyzQUwTrfCKbb2LIfL0zLkRc70cYrKhzW1tAnVKVC48Hc+8euYGBYmnJVLP77rGtIN++LpOkZgcX+E0E9bTeBv97z7c2/wTmm8AC56UmktcgyMtFv8l923f35lbd2bNihUYTcA3QNI6D0sZ1VL/zqtNGlVNr60cACeMPWxRmBtLajAawiHD1+VftJiOCRMIN51hxgEcQZs7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ispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:DM3PR12MB0859; BCL:0; PCL:0; RULEID:; SRVR:DM3PR12MB0859; X-Forefront-PRVS: 07807C55DC X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTNQUjEyTUIwODU5OzIzOnFGRitiWjV0VHh4SzIxTXJ2WTBHTnN6YmhJ?= =?utf-8?B?cnpSdWtmT2pwM0R5RGJqTnBZdHV5bThPY1NoeGRZUzJxRFBBUm0vY3E4cnNJ?= =?utf-8?B?WWR6WlpoWnNoNDBsT253dFVobzVSMmwzTi8rZDN4QXZsUUxHdkpDWk9EL3Zz?= =?utf-8?B?cGtVVTRXUUR2VHphWFF0YzdWd2RvL2lSK05UdWwraTRsSFVNT0ZRZ1pXVWw2?= =?utf-8?B?WUNUcmZ4RVJJNlZrdng4eU5HMTEwVDc5M1NkK2NBQm5IUHdhZWFiVXh5Vjkz?= =?utf-8?B?bW5pZjh4Yjk2b281MTNWbitLSkxPWWVIaEY3S3VTclZBVGl4UDVSMlhiUmZm?= =?utf-8?B?ZW5iVno3YkNqVVc0QlkwYks2R1ArMEVLQmloN2hLcmxNVmpkd1BuWmtqaVpj?= =?utf-8?B?dXZaZjZ6cW9tS0JQUlRZbnp6ZmkzdEc0YU5IZ3YxTVFRaHcwYm5WL1IzTmdZ?= =?utf-8?B?N2pwWUsyMVpTaG8wb0s5enlKYit2M0JZNXR6YzRhQ1F2TUJSajFkOHJaT0lB?= =?utf-8?B?RHAxQTRBSFJSa2NxNXNPejlCNU0zVDRkWUpXRU4wbzNVL1I4S2RXZWFIOUNj?= =?utf-8?B?SnZRZGpERmowQWtRL3g2R01RekRhczdiYXJQbm5oVHU2d1gvL0Q2T0MyZXd4?= =?utf-8?B?NCtqWmJueThvZXpYdkN4a0NMZ2prMGdmbU15ZHdRMVRDR2N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m+LDhPvFFbR1Qu3W4gIpzse/ezquaCGptwcCNyenLWKDs99R14rOFiHVd/nAauCrzMBBioY2c1XN2yXIGbS7AQw6miTLFjCiCpQKGVBwwSrxZF4YG1QR1psWNpfx78CI/mHH9lozFyqXBnep5xQqmCzKHXa250UsHXf2vy3yB1UDsO7ifSkaC2Af5CebLpkmA7NFk/GyRpA6eL+sAcYFJA6wQZGch6BiB0TRyfMh0sVsH1wFxzDWc24FZrr SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2015 06:31:26.6300 (UTC) 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.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB0859 X-Microsoft-Exchange-Diagnostics: 1; DM3PR12MB0843; 2:gBGCweYV6ZAz6MUvWbnJ6ktMCTetBmuZbZE8jamfe/gWZL0tHtSLV2BVtVyyb6CEoOeTl2ZE0a2oc3+zylro1KSc5yM4W7a9C3Dv3GWiKvTzHDDznUvdFjCeCa53GhPD7GzHCkAU6/JtNQ86ZGHK0w==; 23:Ei58c3sq3TLw/gU4W5l+EyfKpzyTvtVvYQATGfCENjj/wsn04DuHYHwBj3i1Lt6JC/Jkdc5RgpYM7NTu3QdSqKiZLAaZf34zz1LdgKRI9LEDT/c6kgaG9LlaxpJ/hH8R+mUqwIZHPE4vHeprwNkpSzL3aUhH33pJeQm/6uDF7xpSDN/NDBPTBbNHJcVZkqak X-OriginatorOrg: amd.com Cc: 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP V2: get original gem handle from gobj Change-Id: I705eadfe03cd85c75bff252563d69f3c8a536868 Signed-off-by: Chunming Zhou Reviewed-by: Christian König Reviewed-by: Jammy Zhou --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 59 +++++++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 1 + include/uapi/drm/amdgpu_drm.h | 12 +++++++ 4 files changed, 74 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 5b4f39c..1ffcbc1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -1842,6 +1842,8 @@ int amdgpu_gem_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp); int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *filp); +int amdgpu_gem_find_bo_by_cpu_mapping_ioctl(struct drm_device *dev, void *data, + struct drm_file *filp); int amdgpu_gem_mmap_ioctl(struct drm_device *dev, void *data, struct drm_file *filp); int amdgpu_gem_wait_idle_ioctl(struct drm_device *dev, void *data, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index fc32fc0..e461357 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -216,6 +216,65 @@ error_unlock: return r; } +static int amdgpu_gem_get_handle_from_object(struct drm_file *filp, + struct drm_gem_object *obj) +{ + int i; + struct drm_gem_object *tmp; + spin_lock(&filp->table_lock); + idr_for_each_entry(&filp->object_idr, tmp, i) { + if (obj == tmp) { + drm_gem_object_reference(obj); + spin_unlock(&filp->table_lock); + return i; + } + } + spin_unlock(&filp->table_lock); + return 0; +} + + +int amdgpu_gem_find_bo_by_cpu_mapping_ioctl(struct drm_device *dev, void *data, + struct drm_file *filp) +{ + struct drm_amdgpu_gem_find_bo *args = data; + struct drm_gem_object *gobj; + struct amdgpu_bo *bo; + struct ttm_buffer_object *tbo; + struct vm_area_struct *vma; + uint32_t handle; + int r; + + if (offset_in_page(args->addr | args->size)) + return -EINVAL; + + down_read(¤t->mm->mmap_sem); + vma = find_vma(current->mm, args->addr); + if (!vma || vma->vm_file != filp->filp || + (args->size > (vma->vm_end - args->addr))) { + args->handle = 0; + up_read(¤t->mm->mmap_sem); + return -EINVAL; + } + tbo = vma->vm_private_data; + bo = container_of(tbo, struct amdgpu_bo, tbo); + amdgpu_bo_ref(bo); + gobj = &bo->gem_base; + handle = amdgpu_gem_get_handle_from_object(filp, gobj); + if (handle == 0) { + r = drm_gem_handle_create(filp, gobj, &handle); + if (r) { + DRM_ERROR("create gem handle failed\n"); + up_read(¤t->mm->mmap_sem); + return r; + } + } + args->handle = handle; + args->offset = args->addr - vma->vm_start; + up_read(¤t->mm->mmap_sem); + return 0; +} + int amdgpu_gem_userptr_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) { diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index ff8f099..2c4c059 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -709,5 +709,6 @@ const struct drm_ioctl_desc amdgpu_ioctls_kms[] = { DRM_IOCTL_DEF_DRV(AMDGPU_GEM_VA, amdgpu_gem_va_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(AMDGPU_GEM_OP, amdgpu_gem_op_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(AMDGPU_GEM_USERPTR, amdgpu_gem_userptr_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(AMDGPU_GEM_FIND_BO, amdgpu_gem_find_bo_by_cpu_mapping_ioctl, DRM_AUTH|DRM_UNLOCKED|DRM_RENDER_ALLOW), }; int amdgpu_max_kms_ioctl = ARRAY_SIZE(amdgpu_ioctls_kms); diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h index 6dcaa79..c9c01d58 100644 --- a/include/uapi/drm/amdgpu_drm.h +++ b/include/uapi/drm/amdgpu_drm.h @@ -47,6 +47,7 @@ #define DRM_AMDGPU_GEM_OP 0x10 #define DRM_AMDGPU_GEM_USERPTR 0x11 #define DRM_AMDGPU_WAIT_FENCES 0x12 +#define DRM_AMDGPU_GEM_FIND_BO 0x13 #define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create) #define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap) @@ -61,6 +62,7 @@ #define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op) #define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr) #define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences) +#define DRM_IOCTL_AMDGPU_GEM_FIND_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_FIND_BO, struct drm_amdgpu_gem_find_bo) #define AMDGPU_GEM_DOMAIN_CPU 0x1 #define AMDGPU_GEM_DOMAIN_GTT 0x2 @@ -199,6 +201,16 @@ struct drm_amdgpu_gem_userptr { uint32_t handle; }; +struct drm_amdgpu_gem_find_bo { + uint64_t addr; + uint64_t size; + uint32_t flags; + /* Resulting GEM handle */ + uint32_t handle; + /* offset in bo */ + uint64_t offset; +}; + /* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */ #define AMDGPU_TILING_ARRAY_MODE_SHIFT 0 #define AMDGPU_TILING_ARRAY_MODE_MASK 0xf