From patchwork Fri Jun 13 23:57:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 896648 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B1062627F5 for ; Fri, 13 Jun 2025 23:57:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749859034; cv=none; b=ptqK2ByER/kYzmgjN+m8XdLMK63Fa/2H/pj8+m3dO/eZFDiTW4UZ2zCzRA/C6cAI7Rt8bodNBr6tc7WBxsgbXEk0QjKhBDAAtIZ3EECYgb2vywJ8VMtMVy9N1QTUerj9FhghZ4aU/kIrerGjCNpj4FVxvut5lP6XGjQUAk2RLg0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749859034; c=relaxed/simple; bh=/79aqH+JQa44dI4h3N7cU+cWM8XecAq4gsoOnUwZdHA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MsXom1dW2hFUwHzm/I2xy0ZzlflVutjMd5zyBJcgyg3bkT5onOKQPobEfaS4Sljs8ElY1grqxwdfnv/9tAJCUTTjAS3dOfxuE813cNwGdcGnYWySsDe7VuImPPMRYlkG63gHiJsmwhw5SMSwoGGNIx+1R8PffeJ/LDE+IT1XWfM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=M5doqY16; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="M5doqY16" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55D9Aq0A027161 for ; Fri, 13 Jun 2025 23:57:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=6n4/m7XLpgv 1bmn1KU5WILxeVGc6KBK6T1WyY0EI2mI=; b=M5doqY16KyIl5mXiMuUzorHKCki boR03cwKH0hqdP4Sm5/JDgyW5hXhN4lcZB1LTzhS/++yFUEGUAxaQ8/49CsYnwrH 8OzPTskcDLiSGpUpQHD5hPvS+OvJMZRH1kHkWw4u+8t6Hju7A1is+DJiMLUAnjyi nzE92AsQbsC4uM9YIQkTSUyw+lxtACiKRDEvcEihou9dJ3Vdhs4R7XC5eQu29JBC zGfrS7fKlLlv+TD0DCXT+0g8huMFwR8RpPxV5l2QhQqVBWgFTHFuidKuGtuqkABk NdNq3qLqnH2KmYrtj29faQDvq/E3mmFc4F3rj2YS6WF9Fhd21Rpc77a1tiw== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 474ccvmmya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Jun 2025 23:57:12 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-74841f2aee2so1530033b3a.2 for ; Fri, 13 Jun 2025 16:57:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749859031; x=1750463831; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6n4/m7XLpgv1bmn1KU5WILxeVGc6KBK6T1WyY0EI2mI=; b=kTR5hojHas4y9zOdPnsjB+N0E5UnXmdhmNdgPVZpmun2q/Kt2lFTDF8y1Y9rCWwPUG ewwlH0hLsOQE8GZxSKi/ueWEHczbL1n8Zt0LWTIw8HftbsY9yzA3tWvQu3xoolnwU1f3 dKjWg6xh9kRBGpieqW8B/SWP1S5G8gVIqgMApQTMW3MHiaNeOHYob+ZiaPp3PnIJNlMm 5gJFkpIwIH4CvwdjBYkIs1Vexc9dPLUtA4EasQwNBHQRwo/fWxogM3+i0BMw/ZrVSO1B yHMdXkgZgaT0nMkPkOaYTPsG69euMkUC6Qg0DR85whOLdz6iSPSxGeEKQu1YCDR040ty tRDg== X-Gm-Message-State: AOJu0Yx4HLJmwWZ5yEVRjsyCokMdA1bNUhXF6MZWnWshcPyYXgYn1cWP gef3UiLyI0pdFVB9LwWS/ZHwP5CZI3/umjdrC+NFwma4x1h/TpY8plgP44iIjyciOBVCjfbRE4B pQ59XKC05Hx5g5QiSqsLlH3Vceanjok7NuA05hV9DgSEci8A86OkEk7NEBZqdseyQsgET X-Gm-Gg: ASbGncsBT4wyFLfM+o1+THMQqmMDZo4e8oa23XMqfQUOvQ6KH6uowt2LVSCu4Ij7gCG EVSg53P5CqMWutnoDMjVgObONBD1G+tF5zbmgswUnDBKtI5tKoI4rmZTQkHbL62B6IdYtiQRuHG w4bPJpnrg/W0jQGoocErarHkH0fQUtUK/AGvr/hAoUY0+wbPrZHr5opBzhFPGWVE9Kz4UoTLxfL UlAdv8Mie47cGOB6NgJUH7IzntUHjEtRqDzH56EQSJwu80jkt0Ua5wKIrxfigd+2FJZCnljeTkT AyxjXpGAr73+fbAT0nuXTeshmuTk3Zbu X-Received: by 2002:aa7:8884:0:b0:736:a6e0:e66d with SMTP id d2e1a72fcca58-7489ce0c6cdmr1483736b3a.6.1749859031370; Fri, 13 Jun 2025 16:57:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCRfklBUOjp5KBQmK/hK6hjxc67A7avI5+sKeqVuyj+UT0qNB0kPJETEj0TxOCbpS0dd+Z8g== X-Received: by 2002:aa7:8884:0:b0:736:a6e0:e66d with SMTP id d2e1a72fcca58-7489ce0c6cdmr1483714b3a.6.1749859030978; Fri, 13 Jun 2025 16:57:10 -0700 (PDT) Received: from localhost ([2601:1c0:5000:d5c:5b3e:de60:4fda:e7b1]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-748900b28b7sm2330672b3a.136.2025.06.13.16.57.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 16:57:10 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Danilo Krummrich , Rob Clark , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/2] drm/gpuvm: Fix doc comments Date: Fri, 13 Jun 2025 16:57:02 -0700 Message-ID: <20250613235705.28006-2-robin.clark@oss.qualcomm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613235705.28006-1-robin.clark@oss.qualcomm.com> References: <20250613235705.28006-1-robin.clark@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: OCWGwJ3oQYDK1CCvxfw-inVziiCWAlu4 X-Authority-Analysis: v=2.4 cv=TsLmhCXh c=1 sm=1 tr=0 ts=684cbad8 cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=xqWC_Br6kY4A:10 a=6IFa9wvqVegA:10 a=EUspDBNiAAAA:8 a=A6x8cpN4-4lAvlAOjyUA:9 a=+jEqtf1s3R9VXZ0wqowq2kgwd+I=:19 a=0bXxn9q0MV6snEgNplNhOjQmxlI=:19 a=OpyuDcXvxspvyRM73sMx:22 X-Proofpoint-GUID: OCWGwJ3oQYDK1CCvxfw-inVziiCWAlu4 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjEzMDE3NyBTYWx0ZWRfXwIz6KsbmERec LyHEK+dc3CG8cidxVFdz6QqGiZoBlm2jFdn77P2ZGUSlUSHlCg8/8nZ/j4ff8Nh7rmFuiM/bQxx 9f2YbjdI79DbqM+gKBVOBM9qOj6yQFwmhBhpg3CQyPLzU8Mly3n4PA1T1w48KcSp8t1CYfTkAvX 0O6UBb8NeuVlDoaFdi1RfgaeAi1TETd1NhqPyUO+KnuyMFXWwfu/0JF4ThwI2dSyOslkVQHfpqj M2Z3T5JTDq/BQ5pAdIWnkqs04XuXFYSIpeWiLZXOl1UnGgG5YcKJYfBPmbMaCal8VmvuV9dw7f2 cDdAfkRW9c4Xe8B2RQTYNU7Gdwd4Du3j0Pr32MKJAaRzp57cVZat5C0pkKsImRMHItp+Clg5vIy 8ub1WqJWxyWPSKbOw/7c962F6E5aBQKK8I/tv0j5bEfcg6/m8GHPqK0H+hXeIBVCcYS8000h X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-13_04,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 bulkscore=0 adultscore=0 clxscore=1015 mlxscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506130177 Correctly summerize drm_gpuvm_sm_map/unmap, and fix the parameter order and names. Just something I noticed in passing. Signed-off-by: Rob Clark Acked-by: Danilo Krummrich --- drivers/gpu/drm/drm_gpuvm.c | 6 +++--- include/drm/drm_gpuvm.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/drm_gpuvm.c b/drivers/gpu/drm/drm_gpuvm.c index f9eb56f24bef..0ca717130541 100644 --- a/drivers/gpu/drm/drm_gpuvm.c +++ b/drivers/gpu/drm/drm_gpuvm.c @@ -2299,13 +2299,13 @@ __drm_gpuvm_sm_unmap(struct drm_gpuvm *gpuvm, } /** - * drm_gpuvm_sm_map() - creates the &drm_gpuva_op split/merge steps + * drm_gpuvm_sm_map() - calls the &drm_gpuva_op split/merge steps * @gpuvm: the &drm_gpuvm representing the GPU VA space + * @priv: pointer to a driver private data structure * @req_addr: the start address of the new mapping * @req_range: the range of the new mapping * @req_obj: the &drm_gem_object to map * @req_offset: the offset within the &drm_gem_object - * @priv: pointer to a driver private data structure * * This function iterates the given range of the GPU VA space. It utilizes the * &drm_gpuvm_ops to call back into the driver providing the split and merge @@ -2349,7 +2349,7 @@ drm_gpuvm_sm_map(struct drm_gpuvm *gpuvm, void *priv, EXPORT_SYMBOL_GPL(drm_gpuvm_sm_map); /** - * drm_gpuvm_sm_unmap() - creates the &drm_gpuva_ops to split on unmap + * drm_gpuvm_sm_unmap() - calls the &drm_gpuva_ops to split on unmap * @gpuvm: the &drm_gpuvm representing the GPU VA space * @priv: pointer to a driver private data structure * @req_addr: the start address of the range to unmap diff --git a/include/drm/drm_gpuvm.h b/include/drm/drm_gpuvm.h index 2a9629377633..0ef837a331d6 100644 --- a/include/drm/drm_gpuvm.h +++ b/include/drm/drm_gpuvm.h @@ -1205,11 +1205,11 @@ struct drm_gpuvm_ops { }; int drm_gpuvm_sm_map(struct drm_gpuvm *gpuvm, void *priv, - u64 addr, u64 range, - struct drm_gem_object *obj, u64 offset); + u64 req_addr, u64 req_range, + struct drm_gem_object *req_obj, u64 req_offset); int drm_gpuvm_sm_unmap(struct drm_gpuvm *gpuvm, void *priv, - u64 addr, u64 range); + u64 req_addr, u64 req_range); void drm_gpuva_map(struct drm_gpuvm *gpuvm, struct drm_gpuva *va, From patchwork Fri Jun 13 23:57:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 896981 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB86328F534 for ; Fri, 13 Jun 2025 23:57:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749859036; cv=none; b=bAH3XTGfkXzPDd+YCGKwJeIgmNjk1kGCZWWTlA2ogqYHdUfOKIu3sZ5favfVNeoRdy5K+2zZD6OVaQWK17GFTbX3Cb6KHds90ZHYn2mn8/rPDGQMsQ7bRKvBPaQqmDvGDQu1Y8AlYVBUS0C0nlvurPZriqZl7OIk/UIlsiS3eLU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749859036; c=relaxed/simple; bh=fZld0obXT1+aG8FOaQwUccJe8Q+YKfPzBOMa+OFU0Vo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iC5qfzcCt354VwkhEU/e1EM8N72yrFHcMwO6+o9MCCmajxyM6P81lU75pqG00J0yQEA2ED2EI4Q9xx2YcEEyCNQrFqH+Ec/+S6OdSOUemXC8gmqxkpa2LoU1spcs3sxI8AEuXUTBa35qwYVlwNS9qeWUjANfB7TxcgxGaAYV7Ow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Fo+7wYcc; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="Fo+7wYcc" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55DNaTBR031829 for ; Fri, 13 Jun 2025 23:57:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=yLq0/X+CD6R T9BCguCxV4sLsi3w1/mhgkTuVhmBkydE=; b=Fo+7wYccuOU6D4fAhl/PvOjGLIP dxpZ8MzY6HuCkuWEoRFn3mDyXtTNJO2gRDA7NknZSidV8idS/A3pDu51LpzcezWe cpvjM7BBflAReKPPZdbY8PS4psN5wD0YLFjFDNUBGqaTLwtpXL5BXKa00cFP1u5p ExFK1iox+1etOzdWynPZyCsOLQFFufxR91lJkmwI23sep+tfdokNVnw0U/E3c/xb /RUxiqte4RXIE3X9QljI5YzK123NvZ4oqZtBfqZ60u0jTXjSnhWC7p4TxctHgcxK r55a5AMp5TFxK9Tg1Ba/AZ9qvZ2ZpYzdOUOAqYeYRPCMZbQfeS7KrXaWFIg== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 474dn6mqdy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 13 Jun 2025 23:57:13 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b115fb801bcso2694493a12.3 for ; Fri, 13 Jun 2025 16:57:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749859033; x=1750463833; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yLq0/X+CD6RT9BCguCxV4sLsi3w1/mhgkTuVhmBkydE=; b=F2dhACXGYFOioMCaQI1GrFuh9H+Qi0VRMlTvzH9CRi+AVlrVj6tFu93uLWVAsrqz7r fPKS7FH+I7rYvGfsbE0MUr5y/Yy2LEpCT40DkzGPmTva/ePNzKm5aPCfCYT+0AnmJLKj prqgDONlXkfFrtrz23E5zrsqn8/Ry5KpuCnNbiteUY8nkeZYUTkVkfVPGIOmHhqhQQuC ESA5uQ6/y8/CYP0L3cB9GdQXt/ThL1J2CgT56OUK1Cqe8G6c9qLEWytW7MYjWg9wezrZ bKBunryPlyocynKKJ7Zxs6+dJtPfZqe1iC61cv4VCrUeSj+PvqKAYN9udS1Gs4eEkMUy Dr2g== X-Gm-Message-State: AOJu0Yw5XC1fJb6SKkstK8ZgfhTjPxgPCiFRFwJcZMuDBbKk/bqh5Hu5 Xw+MboZOuTbeG8qRIOHGT36W6rPgBmuWGUMTw4/ZUass4APFX7C3xQOiPqdp+TZcO9GQpMJSyRt sPL7Ee7ghap+hCzVpd6M6idbialHgf/KyrGxoUPCyHIjlrX0FfxbAPUFhN6u+Jg4nIn7H X-Gm-Gg: ASbGncuE10VdtL4yiyIHOQe5eaywyO7rJizkevNCdjZ63sW9BUf79RJmRpothXk2niK 6JDymQ5hlPfh9TxhJgn4BKfMXRKRf3BR49BRj+vYtnmM3yg3FILVpWix0kzRaUB0M2QAHONnkJP NodOKu0d4RV2sdZqL/K6Esrul/ctU+cjhgNeBU02fldbXgNfskPa6uZ0gYdRk1RXOi9pHX54hYD 9ktFFm4f1NdAZjP2eSVCkXKZ/CbpUoI8KfhG6SqGIQzvKrlwK5IAiofiKYFVvCgWfQHMo0uMVic Sz1B05/HYy+HuZu6HzVaUNyTTxFAfapZ X-Received: by 2002:a05:6a21:9991:b0:21e:feb5:9cb8 with SMTP id adf61e73a8af0-21fbd5d4c35mr1592005637.38.1749859032707; Fri, 13 Jun 2025 16:57:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGEhTcTitEJ4ZlWzhRai8zzxxCScgdvvoA2BJ4VUJEL84zgtN+jTH9QJ8KF6Xuy0gdvRZyX9g== X-Received: by 2002:a05:6a21:9991:b0:21e:feb5:9cb8 with SMTP id adf61e73a8af0-21fbd5d4c35mr1591977637.38.1749859032214; Fri, 13 Jun 2025 16:57:12 -0700 (PDT) Received: from localhost ([2601:1c0:5000:d5c:5b3e:de60:4fda:e7b1]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b30948eb78asm1767813a12.28.2025.06.13.16.57.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jun 2025 16:57:11 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Danilo Krummrich , Rob Clark , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/2] drm/gpuvm: Add locking helpers Date: Fri, 13 Jun 2025 16:57:03 -0700 Message-ID: <20250613235705.28006-3-robin.clark@oss.qualcomm.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250613235705.28006-1-robin.clark@oss.qualcomm.com> References: <20250613235705.28006-1-robin.clark@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjEzMDE3NSBTYWx0ZWRfX73uDlCMStu3b rSrAzMWUVzWHp6HR4quh86ayhP67oUYc83kLRNVJjJuewnt/QkDhPqwI96W0G/xTMPLi8HEuHKL SBEwTegiCAVuVCmHoTdUvFksAOqLj/mj6wVUS5itTjEzlPUaUOrf5GWlcaaBKq8SM711JdDfHUf QCRtdR0Fl0wNdUBDIzu4TkrEv2ZUKB+3N8lju5OvX7iKwypLz7f/s9qwclEqVYjxS3SZkGPnsZV yhbrQ98Xprzen0+x2NrgJYMtc/Iq10PIXGZECeAGdjo5gjqulFD7RZvolI90teU2hIcF2lR9hBk mf8j16tXApZWq9tXDvHNeFH1/1dx06a810wr9Mb/ix/TvysRNCM5KeN6JO6nog/YVZAEwpcIRTP LKacQCeIgISJfOfe7Bj76K5Lxykh02cjJyf2foee28zGHu+IhGo7gPwro7b4hjw4C5xq1qYw X-Proofpoint-GUID: QzlYUyh26yJmQ4AQkSTzlyhmErQjDYjL X-Authority-Analysis: v=2.4 cv=FaQ3xI+6 c=1 sm=1 tr=0 ts=684cbad9 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=xqWC_Br6kY4A:10 a=6IFa9wvqVegA:10 a=EUspDBNiAAAA:8 a=J2tNMqIfyHcHeXEe9QMA:9 a=bFCP_H2QrGi7Okbo017w:22 X-Proofpoint-ORIG-GUID: QzlYUyh26yJmQ4AQkSTzlyhmErQjDYjL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-13_04,2025-06-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 bulkscore=0 phishscore=0 adultscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 clxscore=1015 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506130175 For UNMAP/REMAP steps we could be needing to lock objects that are not explicitly listed in the VM_BIND ioctl in order to tear-down unmapped VAs. These helpers handle locking/preparing the needed objects. Note that these functions do not strictly require the VM changes to be applied before the next drm_gpuvm_sm_map_lock()/_unmap_lock() call. In the case that VM changes from an earlier drm_gpuvm_sm_map()/_unmap() call result in a differing sequence of steps when the VM changes are actually applied, it will be the same set of GEM objects involved, so the locking is still correct. Signed-off-by: Rob Clark --- drivers/gpu/drm/drm_gpuvm.c | 81 +++++++++++++++++++++++++++++++++++++ include/drm/drm_gpuvm.h | 8 ++++ 2 files changed, 89 insertions(+) diff --git a/drivers/gpu/drm/drm_gpuvm.c b/drivers/gpu/drm/drm_gpuvm.c index 0ca717130541..197066dd390b 100644 --- a/drivers/gpu/drm/drm_gpuvm.c +++ b/drivers/gpu/drm/drm_gpuvm.c @@ -2390,6 +2390,87 @@ drm_gpuvm_sm_unmap(struct drm_gpuvm *gpuvm, void *priv, } EXPORT_SYMBOL_GPL(drm_gpuvm_sm_unmap); +static int +drm_gpuva_sm_step_lock(struct drm_gpuva_op *op, void *priv) +{ + struct drm_exec *exec = priv; + + switch (op->op) { + case DRM_GPUVA_OP_REMAP: + if (op->remap.unmap->va->gem.obj) + return drm_exec_lock_obj(exec, op->remap.unmap->va->gem.obj); + return 0; + case DRM_GPUVA_OP_UNMAP: + if (op->unmap.va->gem.obj) + return drm_exec_lock_obj(exec, op->unmap.va->gem.obj); + return 0; + default: + return 0; + } +} + +static const struct drm_gpuvm_ops lock_ops = { + .sm_step_map = drm_gpuva_sm_step_lock, + .sm_step_remap = drm_gpuva_sm_step_lock, + .sm_step_unmap = drm_gpuva_sm_step_lock, +}; + +/** + * drm_gpuvm_sm_map_lock() - locks the objects touched by a drm_gpuvm_sm_map() + * @gpuvm: the &drm_gpuvm representing the GPU VA space + * @exec: the &drm_exec locking context + * @num_fences: for newly mapped objects, the # of fences to reserve + * @req_addr: the start address of the range to unmap + * @req_range: the range of the mappings to unmap + * @req_obj: the &drm_gem_object to map + * @req_offset: the offset within the &drm_gem_object + * + * This function locks (drm_exec_lock_obj()) objects that will be unmapped/ + * remapped, and locks+prepares (drm_exec_prepare_object()) objects that + * will be newly mapped. + * + * Returns: 0 on success or a negative error code + */ +int +drm_gpuvm_sm_map_lock(struct drm_gpuvm *gpuvm, + struct drm_exec *exec, unsigned int num_fences, + u64 req_addr, u64 req_range, + struct drm_gem_object *req_obj, u64 req_offset) +{ + if (req_obj) { + int ret = drm_exec_prepare_obj(exec, req_obj, num_fences); + if (ret) + return ret; + } + + return __drm_gpuvm_sm_map(gpuvm, &lock_ops, exec, + req_addr, req_range, + req_obj, req_offset); + +} +EXPORT_SYMBOL_GPL(drm_gpuvm_sm_map_lock); + +/** + * drm_gpuvm_sm_unmap_lock() - locks the objects touched by drm_gpuvm_sm_unmap() + * @gpuvm: the &drm_gpuvm representing the GPU VA space + * @exec: the &drm_exec locking context + * @req_addr: the start address of the range to unmap + * @req_range: the range of the mappings to unmap + * + * This function locks (drm_exec_lock_obj()) objects that will be unmapped/ + * remapped by drm_gpuvm_sm_unmap(). + * + * Returns: 0 on success or a negative error code + */ +int +drm_gpuvm_sm_unmap_lock(struct drm_gpuvm *gpuvm, struct drm_exec *exec, + u64 req_addr, u64 req_range) +{ + return __drm_gpuvm_sm_unmap(gpuvm, &lock_ops, exec, + req_addr, req_range); +} +EXPORT_SYMBOL_GPL(drm_gpuvm_sm_unmap_lock); + static struct drm_gpuva_op * gpuva_op_alloc(struct drm_gpuvm *gpuvm) { diff --git a/include/drm/drm_gpuvm.h b/include/drm/drm_gpuvm.h index 0ef837a331d6..a769dccfb3ae 100644 --- a/include/drm/drm_gpuvm.h +++ b/include/drm/drm_gpuvm.h @@ -1211,6 +1211,14 @@ int drm_gpuvm_sm_map(struct drm_gpuvm *gpuvm, void *priv, int drm_gpuvm_sm_unmap(struct drm_gpuvm *gpuvm, void *priv, u64 req_addr, u64 req_range); +int drm_gpuvm_sm_map_lock(struct drm_gpuvm *gpuvm, + struct drm_exec *exec, unsigned int num_fences, + u64 req_addr, u64 req_range, + struct drm_gem_object *obj, u64 offset); + +int drm_gpuvm_sm_unmap_lock(struct drm_gpuvm *gpuvm, struct drm_exec *exec, + u64 req_addr, u64 req_range); + void drm_gpuva_map(struct drm_gpuvm *gpuvm, struct drm_gpuva *va, struct drm_gpuva_op_map *op);