From nobody Wed Nov 27 02:30:43 2024 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 4769A14A614 for ; Mon, 14 Oct 2024 14:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.180.163 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728915777; cv=fail; b=oTeBruAY0pE5eQ/gSM7/9dMLFeu9PgG3fmDMUGZkzDhWFMRwkx+/P1JTZe2OKHpGL3G7NI3V78P8q0w+zJmvXMDhKqBeR6CE/Z+IfI1SrDRiHxahpRDK1aY9ZEdCimDFs0mfevMTS0gAI18yAE4COS7QHcRZXvn/yw8PlScTh4Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728915777; c=relaxed/simple; bh=bKDs89vRDrhqv9UVH3sdT9iFeVq6qgwLBt8GcQY9pgM=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=ZoeHIkeUaEFqy8GedBNhS9Is9bMVwzUsQS5POHJkhPGZncCE0FNqghXFXU16ZXrP0XWTZ9609jPIaVLLht+ByhfTyajGPzCxQ5fj/eNibCMkJUVC2He/JxDpzety7kV8wsLAs4O0Rq3/f/4L4F+QZK00tmjDnpY8RnHd32GCpKg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=M9I48B2w; dkim=pass (1024-bit key) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b=Y7qjiG6W; arc=fail smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="M9I48B2w"; dkim=pass (1024-bit key) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b="Y7qjiG6W" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49E689cD003071; Mon, 14 Oct 2024 15:22:42 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=dk201812; bh=Y1W73LQbn0Pua5uG7QH4AADD2 X8OHkLtOO++ToKXmvo=; b=M9I48B2wqWSkQXyYp4Gw7T83NsuhFw6uKOh4MOehL QM1btgNeRxlEquPnfj9kPwwRDGL6p80g1ga0Wblr8OFbH+/HAHaBM5H3/xpyxQWb 67WDDiVRIRAq70Us4KbsyB64+2r4DGUgClI6Q0LPRDvmFZT+WGsgwpqIOuKSn9RS uviAye95+LWM+RzoIpaZf/HdXYeurdD489RktrT4WuToEYsndO3EBw/63EXrAxcq N+g24kq+yNckxDrIp0fbHJiZnwlHca6w05qzG9WU3ohxAkSPuG0KMBADYmYjHagS pxIEc49fDIY04NeZo+AJVxgvT05tjKuTt2jehNvituwpg== Received: from cwxp265cu009.outbound.protection.outlook.com (mail-ukwestazlp17011027.outbound.protection.outlook.com [40.93.68.27]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 427h6w29dp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Oct 2024 15:22:41 +0100 (BST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SauoFDARB9R8AjAUbkIa6PJYGujdU9K3nU1dJFmDCEXQpHRZhz69cf1xoXPU5DNmEh/qX5RocdlYplrUw9YPwoH1M0xm6vyuzJRSW3Vler4vNaNPE1tbDDm0ySE3kjhtTceyqh1StPAcT4gploKOeOytFfMnEvFirwz4Yr4+gyT8KE/nKQ0euTnvEIJDlC9g2b2n0bASBSU+db7bEkMzF2t4GBfpr5X8aAG53Ldjxj+FYqDz97VGZVzlKQnE9mdvRvY9iBe/16QwoKwlAo3PB4Zk81ZVkgo77OtlzXnroX2nx6d2490EM4ZoDj+Nj41SvuWJylKEhUT6iTpfKgFeAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Y1W73LQbn0Pua5uG7QH4AADD2X8OHkLtOO++ToKXmvo=; b=xTt2jC4D+Gde2UfbdEyXvYtdUvzrH70O8eZciRnjJ+LZ49/ZOBMy98/gAJZIhXzyPJz3ef79C0K8+u/X0Tuankjt96c9saeGRuEFb+nAC5CzDeRjQqtJ3xpUq+WPWKqJc2B4rdWsa95ypE/x3Lo3fUiwEi2pQ6bAy/NE4xnSEQLkeSCESbVGStuCfijWaANDJ7BsDbObkonfnyLkuQeE546KYLk0GKTry+vKwBZgRSzPIIygK9YeSZipQGaD26YRgQadc55jrdK6dS7rX5Phi062tpf7/fwIuf/VcQmrl0wIjpwlrn2D4ifSHZC4n2pU7VzuhXAfM9aKdmYoMIBAqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=imgtec.com; dmarc=pass action=none header.from=imgtec.com; dkim=pass header.d=imgtec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=IMGTecCRM.onmicrosoft.com; s=selector2-IMGTecCRM-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Y1W73LQbn0Pua5uG7QH4AADD2X8OHkLtOO++ToKXmvo=; b=Y7qjiG6Wgj6LVxro2gUV8xKYTJgYaGU9aM6MWR9aAwQbdVTotvV2TlanH+Ov6bLmfHRNi+4BxSjLEeQrONMv5x84Ffzy9CDaXbrDtxUQTCTyJBlRhRp5lwfzyN5b4yEzW66JCMQ654hbWMn+BGR/lRcWM0FChlWbXwmvaOYHAjE= Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:e7::8) by LO0P265MB5894.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:289::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Mon, 14 Oct 2024 14:22:38 +0000 Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15]) by CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15%3]) with mapi id 15.20.8048.020; Mon, 14 Oct 2024 14:22:38 +0000 From: Matt Coster To: "dri-devel@lists.freedesktop.org" CC: Brendan King , Frank Binns , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , "linux-kernel@vger.kernel.org" Subject: [PATCH v2 1/2] drm/imagination: Add a per-file PVR context list Thread-Topic: [PATCH v2 1/2] drm/imagination: Add a per-file PVR context list Thread-Index: AQHbHkSFDE160/GjWkq3Mfb72eyJpg== Date: Mon, 14 Oct 2024 14:22:38 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CWXP265MB3397:EE_|LO0P265MB5894:EE_ x-ms-office365-filtering-correlation-id: 5ba05169-b26b-4c42-f80d-08dcec5ba80b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?OVNrOUx1VUtzdUlhalE0K3oyZXZOU0tLZlk4Kzg0Qi9WT08wQzVsSXFqWGpz?= =?utf-8?B?YXZlS2pBYmNubjhWUExDTkdrZnpCUUpicTcreENHaDlKdEtrWWRKNTRVa2Vi?= =?utf-8?B?c3pIRnM0eUF2MlFXOGVFbGNpaUg4Y0xMazR3QmxTdzVJMkVHOXBpU0p2NW9u?= =?utf-8?B?dUxkTWVMQUxWbXg2UHIreFBMZkYvcW1FWXdmV3pkL2hVNUkzZ2pBVUJzUUhS?= =?utf-8?B?ZTQ1SmM0cVBjYTQrWGgydE9McWYvalc2c2VMSFVxd0luQkFBWENrRW1UUStN?= =?utf-8?B?TjhSZzBxdHg2MVNBTW5rdEZ6UG4zNXdZSG91V0haM01LdmROS0VhMDZGWmFh?= =?utf-8?B?TlMyT244c0s1QkJmM3JGT0pvQ2JhV0s4M09VVWRFZ3p3ZVZJRzM4UUIzSmdU?= =?utf-8?B?UGdPU2tEK2ZKemkxdDNOckZUM3dWSGk1MmYxZTZsazl2OURhYlpsbHpGQmMw?= =?utf-8?B?d205OE0rTnJkOS9SdU9LRENpVWx3cFYwUTY3ckc2L0dvN29qYWtlNGRlREk3?= =?utf-8?B?VHVhZDFBcVVKT0xSTUNRaXdJWk85TlpmcEgweGNyTnA3TEQvM1JFQWZaemtO?= =?utf-8?B?M1RCbWZ0YWd2UWJyaG9FVEhNT0pacG4zS1dWNy9mN2xXLzFWMDUrVGJaemxQ?= =?utf-8?B?RkNJcXVBNksxQnZWRTZQZjBibW9kNVFUUk11N2JCN2J0ZmNjUFJKbU9pQkNW?= =?utf-8?B?MFFRZWwwVXVpNXBUWk40NzVOcDl3SlVjZU9yRXJFQlRlNllRVnJLQVZYNWVH?= =?utf-8?B?amVMNkVkQWNsaUUrbWZyZDJ0QU9ZbURFRDg4dlgrQmVBNERSS2Zxb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hQRU5SUk4raXNFeGgwYzl0?= =?utf-8?B?c290aWwxQlZqVnFGR0Qrc1BLZ29FOUpXbjhmNHNOVjZteWY5QjhBalcreEFy?= =?utf-8?B?ZjRRbWFjV01hRzMwczUzdz09?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(38070700018);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?cXpyK2hVK1lWUHdZVlBDM2xrcitDSXllc3JoWjIvTjc5cXk3YmliQWRlVFBT?= =?utf-8?B?Yy9oSnFValQvYmxITWVaa1pRZlZocGtwS2xYaFpvRTRuNXA0QVpkbjdCV2Fr?= =?utf-8?B?T01PeXBQaGE3VjlHSUVEM2J1dGFIcTlWTkxKY2F3VXd6bkc0MmxML2w1V1gz?= =?utf-8?B?Q0RKL0V4UGorcmNrUEtCaWtGZ3JQQ2NWSkMrZFM2dGdnU3pFd1Nja25RTXJ5?= =?utf-8?B?VTluUkFXVFNFZjN6eTZnZ2d2cmZRS3VEQWQzN2NQYjdwOTlISGVLUDdMaVJX?= =?utf-8?B?M3pndTFUeXdaallaSEtSWDJ2T3JVV3VIS0plOTZMQjUzVzJtSUxGdm81VHBn?= =?utf-8?B?czNsaDd5VHhXa2N5Q1VwWXVEZWZybFV1TlRyaVhGMHhSRklTKzFRaTVuTEs0?= =?utf-8?B?czVWa3cvVG8wcmJjazgwVW9VR21pTjZFZEU1L3YvdS9xTmFySTQybE9Qbjlw?= =?utf-8?B?ZEVJQVhNWTY3djVZY0g2MUp6NXhQYmlzaUtzZnNHWS9hanpWa2RnTDAva200?= =?utf-8?B?bndSd0ZaU0pkZGladTI3MXJyN0JXOENtSEdkQkdxVE1iRkEwdC96Y2U4TkVR?= =?utf-8?B?OEZu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NktjQUxp?= =?utf-8?B?RHp2N0llSGJDT1VXbm04bmJUMWY1dlVkakx6Mkx3NXNPaDZReFBaazVzNDA3?= =?utf-8?B?MHJDcHJJOURaRjhSbHVubFp0aEJVYjBEYVFqSFdQN0loeGVFRTVrQkpUQ0Ju?= =?utf-8?B?MUt3SkwyOU5Jd3IrTjA1VVFDdWwzNmZXM3paWS9MR2NoKzVZL0dRM29KMitm?= =?utf-8?B?TkxMcXlmN3ZnVzhmNE03SkVqcVBYVWtMaUtVYzJCanZkSGNmSEJSQ1VmY3Jm?= =?utf-8?B?b0ViaCtYVnZpYzZ5cmdPRzlaSE9WMFkyaVIzZFBTQ2crb2RVNlhOWEp2K0N6?= =?utf-8?B?aW85cVFYTlpySmNKWSsvSjNGMXVwek1nbjJSczlwS0NIb2NkK2FhZnZDaU1Y?= =?utf-8?B?WFVrRklZR2hvZU5INjRIdzdsYVpMMXR4dTkvc3FlaHBKV1d5MUR2bm1qUUI5?= =?utf-8?B?bkJ5MjNaekNDaStWa25yMmJVelM3NGtkc3BhaWZlMWFIdGthc2NSRTBYVnVI?= =?utf-8?B?Z3lHRWVMTEpxVWFpK0Z4Q2pTdmcweCtib3d5WC9GSDcwL0lta0toOGZJS01v?= =?utf-8?B?TjZGOHhYaExlUitrWEN6amhOdnA4VHR3cHJEelRTamdNTHZkOFMvNGF5T0xz?= =?utf-8?B?SEEwaEI5RHZTS3VhMVkza3pyVEQwOWxlT3UyWEpieUE0K2g2MGZYUEZWMDhS?= =?utf-8?B?UXc9PQ==?= Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------vUxJuVnRFiGBB4ltNmZwLKMK" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: imgtec.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 5ba05169-b26b-4c42-f80d-08dcec5ba80b X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2024 14:22:38.4687 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0d5fd8bb-e8c2-4e0a-8dd5-2c264f7140fe X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: P0uSY9D1bynJ1Y3MF1JhMj+Q+CjNdQXTmrasMZC+0kect1Tckc/IluKUDEZOcWv5DkqRvADEEfy35aF6ebuj+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LO0P265MB5894 X-Authority-Analysis: v=2.4 cv=LbZu6Sfi c=1 sm=1 tr=0 ts=670d2932 cx=c_pps a=OsxvgCVCPgftFDG+4S7SsQ==:117 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=DAUX931o1VcA:10 a=WnR_qW7rlZcA:10 a=NgoYpvdbvlAA:10 a=r_1tXGB3AAAA:8 a=2zjTdtMHGxF8P-iNuwwA:9 a=QEXdDO2ut3YA:10 a=lyOg1_WVnN3a3aLNPZIA:9 a=FfaGCDsud1wA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-ORIG-GUID: 6BKH6nL-rZfBRCRV4uujK9O7Ump1k5dJ X-Proofpoint-GUID: 6BKH6nL-rZfBRCRV4uujK9O7Ump1k5dJ --------------vUxJuVnRFiGBB4ltNmZwLKMK Content-Type: multipart/mixed; boundary="------------o50onOTlKGAl0QaRkrN6eO2i"; protected-headers="v1" From: Matt Coster To: dri-devel@lists.freedesktop.org Cc: Brendan King , Frank Binns , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org Message-ID: Subject: [PATCH v2 1/2] drm/imagination: Add a per-file PVR context list References: In-Reply-To: --------------o50onOTlKGAl0QaRkrN6eO2i Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Brendan King This adds a linked list of VM contexts which is needed for the next patch= to be able to correctly track VM contexts for destruction on file close. It is only safe for VM contexts to be removed from the list and destroyed= when not in interrupt context. Signed-off-by: Brendan King Signed-off-by: Matt Coster --- Changes in v1 -> v2: - Add justification to the commit message so it stands on its own (e.g. during bisect) --- drivers/gpu/drm/imagination/pvr_context.c | 14 ++++++++++++++ drivers/gpu/drm/imagination/pvr_context.h | 3 +++ drivers/gpu/drm/imagination/pvr_device.h | 10 ++++++++++ drivers/gpu/drm/imagination/pvr_drv.c | 3 +++ 4 files changed, 30 insertions(+) diff --git a/drivers/gpu/drm/imagination/pvr_context.c b/drivers/gpu/drm/= imagination/pvr_context.c index eded5e955cc0..255c93582734 100644 --- a/drivers/gpu/drm/imagination/pvr_context.c +++ b/drivers/gpu/drm/imagination/pvr_context.c @@ -17,10 +17,14 @@ =20 #include #include + +#include #include #include +#include #include #include +#include #include #include #include @@ -354,6 +358,10 @@ int pvr_context_create(struct pvr_file *pvr_file, st= ruct drm_pvr_ioctl_create_co return err; } =20 + spin_lock(&pvr_dev->ctx_list_lock); + list_add_tail(&ctx->file_link, &pvr_file->contexts); + spin_unlock(&pvr_dev->ctx_list_lock); + return 0; =20 err_destroy_fw_obj: @@ -380,6 +388,11 @@ pvr_context_release(struct kref *ref_count) container_of(ref_count, struct pvr_context, ref_count); struct pvr_device *pvr_dev =3D ctx->pvr_dev; =20 + WARN_ON(in_interrupt()); + spin_lock(&pvr_dev->ctx_list_lock); + list_del(&ctx->file_link); + spin_unlock(&pvr_dev->ctx_list_lock); + xa_erase(&pvr_dev->ctx_ids, ctx->ctx_id); pvr_context_destroy_queues(ctx); pvr_fw_object_destroy(ctx->fw_obj); @@ -451,6 +464,7 @@ void pvr_destroy_contexts_for_file(struct pvr_file *p= vr_file) void pvr_context_device_init(struct pvr_device *pvr_dev) { xa_init_flags(&pvr_dev->ctx_ids, XA_FLAGS_ALLOC1); + spin_lock_init(&pvr_dev->ctx_list_lock); } =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_context.h b/drivers/gpu/drm/= imagination/pvr_context.h index 0c7b97dfa6ba..a5b0a82a54a1 100644 --- a/drivers/gpu/drm/imagination/pvr_context.h +++ b/drivers/gpu/drm/imagination/pvr_context.h @@ -85,6 +85,9 @@ struct pvr_context { /** @compute: Transfer queue. */ struct pvr_queue *transfer; } queues; + + /** @file_link: pvr_file PVR context list link. */ + struct list_head file_link; }; =20 static __always_inline struct pvr_queue * diff --git a/drivers/gpu/drm/imagination/pvr_device.h b/drivers/gpu/drm/i= magination/pvr_device.h index b574e23d484b..6d0dfacb677b 100644 --- a/drivers/gpu/drm/imagination/pvr_device.h +++ b/drivers/gpu/drm/imagination/pvr_device.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -293,6 +294,12 @@ struct pvr_device { =20 /** @sched_wq: Workqueue for schedulers. */ struct workqueue_struct *sched_wq; + + /** + * @ctx_list_lock: Lock to be held when accessing the context list in + * struct pvr_file. + */ + spinlock_t ctx_list_lock; }; =20 /** @@ -344,6 +351,9 @@ struct pvr_file { * This array is used to allocate handles returned to userspace. */ struct xarray vm_ctx_handles; + + /** @contexts: PVR context list. */ + struct list_head contexts; }; =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_drv.c b/drivers/gpu/drm/imag= ination/pvr_drv.c index 1a0cb7aa9cea..fb17196e05f4 100644 --- a/drivers/gpu/drm/imagination/pvr_drv.c +++ b/drivers/gpu/drm/imagination/pvr_drv.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -1326,6 +1327,8 @@ pvr_drm_driver_open(struct drm_device *drm_dev, str= uct drm_file *file) */ pvr_file->pvr_dev =3D pvr_dev; =20 + INIT_LIST_HEAD(&pvr_file->contexts); + xa_init_flags(&pvr_file->ctx_handles, XA_FLAGS_ALLOC1); xa_init_flags(&pvr_file->free_list_handles, XA_FLAGS_ALLOC1); xa_init_flags(&pvr_file->hwrt_handles, XA_FLAGS_ALLOC1); --=20 2.47.0 --------------o50onOTlKGAl0QaRkrN6eO2i-- --------------vUxJuVnRFiGBB4ltNmZwLKMK Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- wnsEABYIACMWIQS4qDmoJvwmKhjY+nN5vBnz2d5qsAUCZw0pLgUDAAAAAAAKCRB5vBnz2d5qsA3j AQDpHZXgelDi+95aNWJLjHSgoxQjugN9MCMkXukMViBJAgEAo205ysrQY7iPmp39pN6sKwhvKhXW dySf6C5vI9YnQQ4= =o+H3 -----END PGP SIGNATURE----- --------------vUxJuVnRFiGBB4ltNmZwLKMK-- From nobody Wed Nov 27 02:30:43 2024 Received: from mx07-00376f01.pphosted.com (mx07-00376f01.pphosted.com [185.132.180.163]) (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 35B71E571 for ; Mon, 14 Oct 2024 14:23:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=185.132.180.163 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728915832; cv=fail; b=D2BI61h4Uql5dtzi3xWdVgsQ9WPpLYZx5rtZ+Y+E5/ScZaOXPWCl09nHjn+kwZuWrdmdWJKNXhmznNd/hA7wjwQ4THABcjBMSLYFBPigHRKCvN2O96m+Z+HkBN/CRbMGwmwTYHR+uhxLNapJVaucU8wazCu7Px/9DhPugQcofqM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728915832; c=relaxed/simple; bh=eOjOBsCWtQcWi/tStLVPmyp6q+Ak2bZjlptSqXe4RUE=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=FYmXH/tmO6VIB2T/yJ0GnIJ4ZUH24Z5RAkPcoJ+4HLNLRsgBYuGdkWfJzDqsQUyqP7YlRvVSDODJwPqiUtKO/iUm/mB+tgjWy71Je0Vck2J1HdQ6+KYSCmbvVhV+ChkqykkKpbUPlx8FWM1vdNod/xdi93ARa3ggw72RP2NUcBk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com; spf=pass smtp.mailfrom=imgtec.com; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b=vcTT9Jr7; dkim=pass (1024-bit key) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b=P7+GZcEi; arc=fail smtp.client-ip=185.132.180.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=imgtec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=imgtec.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=imgtec.com header.i=@imgtec.com header.b="vcTT9Jr7"; dkim=pass (1024-bit key) header.d=IMGTecCRM.onmicrosoft.com header.i=@IMGTecCRM.onmicrosoft.com header.b="P7+GZcEi" Received: from pps.filterd (m0168889.ppops.net [127.0.0.1]) by mx07-00376f01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49E69VuC004748; Mon, 14 Oct 2024 15:23:38 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imgtec.com; h=cc :content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to; s=dk201812; bh=MlIOk/5orVk5Lct4n3dW0r7QR Sgwf/6/gluRooM1z0c=; b=vcTT9Jr7KU1ooGGe0j5VpDffc7DMyglmXXXnOVJdR N1PbS0iAlwQ81SB56UNkumMBhZK8TbDKHDGTHmSEgxzRq5v20/9uWv3w6WL/QKsg /obf+lBUOjpMTNhRVY1fHCaE97SinqLT3RNM0W0baa1E3ChW6dLChoCDPNEjx1CY JKwtnwT2FKzVl/+bKzljwYySPf0XrWbWKlyioQSspQoTDuOgAFDAYTUDHEGLY037 F4U62xsfdEjY5TNJ0sMf7RoNs6NvQFrT2KdqI6qo2y/L1peKMv7j6NlsIuWmR24D NJN7/4RwV5FT8HrcPhsNsc9b2+ciOxmxnY1gULrdHTDeg== Received: from lo3p265cu004.outbound.protection.outlook.com (mail-uksouthazlp17010002.outbound.protection.outlook.com [40.93.67.2]) by mx07-00376f01.pphosted.com (PPS) with ESMTPS id 427h6w29ej-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Oct 2024 15:23:37 +0100 (BST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xE65ExYTcE+06zozsEJDE89uoc7o7L88ePRQcBexnc6UK94dMUc4tRkkxBgeXyXv06Tvsa1Xl4JdQVv8U8jFiRLGha06RwegMNbyw+HKykvHqSLST6QFzYBZYcPjsXpRODjcketOXIRbuA6aDc9Hnaauazqb9dq8feXdy0WBC4SaqgLeb2yCg74ZGDFpw67YJAn1kAd6R9I2YWXZ9JySVnfKbZtrrpQxlXRvQ+sGQZd9Z3bv1x4AzAan2fD1FhmeFuH7UAQp6WqFkcvrgZWe/LpcZ2p/PgNQgAvt+qegzWD/mVhx8a1tVZ01iIKPuQWGNQTN5P1m5/dzHYxMqgCeQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MlIOk/5orVk5Lct4n3dW0r7QRSgwf/6/gluRooM1z0c=; b=tAze9Kmk0aaVeS5dUSo/VwqoWO2dlvR6+i8iDGu/41ebqv1ykUkN8f1FgbkMR4fuLFTu6/DoYfj8kjRuuZWsGvhVvhCQOx8HFczzI+DuO6dgAp0+EFVTo6PLDIkwR3HhmuWkksJp0gGX921V/hIJDe8VmvMf5rgKqs4D0XduJN7GSIaZzWAMO4TPqs6uap4VSzvd3UzzzA94RNehGR3EuEl8hruT7xNQFJiDCmZoje7sLh6Fu0GUc2OjAxI0X3eRyFnbyhQmj4KJw3/pUTOpptO/IA391QCRDLqHVyQZ+xwMxxvYrgpwe9GMVHSX3kop8QnzUe9EF2eEcTPlCEZ1ZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=imgtec.com; dmarc=pass action=none header.from=imgtec.com; dkim=pass header.d=imgtec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=IMGTecCRM.onmicrosoft.com; s=selector2-IMGTecCRM-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MlIOk/5orVk5Lct4n3dW0r7QRSgwf/6/gluRooM1z0c=; b=P7+GZcEihD1aRrjVihxClHi+Ly5ZV0fbyMniByIDgYoiHyLSeYRgCZx0oOsd/hoVf6Vbf2XEVze8BKygIdopTRG1veuJ7J8HDKH9DmUtfyNq2pxsQ3YrqD6Mfa2KjU6RkIwMUJcVzGHmQZmq9hp+K1LYk3VOOcsyHurZloYitjI= Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:e7::8) by CWLP265MB3569.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:f1::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Mon, 14 Oct 2024 14:23:35 +0000 Received: from CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15]) by CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM ([fe80::8e9d:6b2f:9881:1e15%3]) with mapi id 15.20.8048.020; Mon, 14 Oct 2024 14:23:35 +0000 From: Matt Coster To: "dri-devel@lists.freedesktop.org" CC: Brendan King , Frank Binns , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , "linux-kernel@vger.kernel.org" Subject: [PATCH v2 2/2] drm/imagination: Break an object reference loop Thread-Topic: [PATCH v2 2/2] drm/imagination: Break an object reference loop Thread-Index: AQHbHkSnYxB3i+0dE0uMRxpUhCZA3Q== Date: Mon, 14 Oct 2024 14:23:35 +0000 Message-ID: <48476abf-2def-4d83-87a3-8cbd8eb9db3b@imgtec.com> References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CWXP265MB3397:EE_|CWLP265MB3569:EE_ x-ms-office365-filtering-correlation-id: 4b0648c9-a2d6-40eb-b8a0-08dcec5bc9d1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?B?UTdybWNoOHJnbFVVdndLOTcwWE93d2ZYdUhSQ1FRMHUzWnFEYi9CUXBtWitE?= =?utf-8?B?cDZWRVh5alNhS2tNRFlHNW1yUGI1S3ZkRGdxR0VLaExwalA3R3NaVVBWTW02?= =?utf-8?B?SHZMZ2tTRXIyV3VjTHRIcW5ZR0l6MFQ0QjdyQXB1c3ZZdGV6ZWFZZUlmQktj?= =?utf-8?B?Ym95azkxTVZtS3hTRzFxTm5MOEYrQ2FyQ0tERG9aQ2FnRDhGbEdreUVLUjE3?= =?utf-8?B?c3lNN2R5U2UvZ09RdWlqZnE5Wlc5YVZoUnNPMkJIQXdadXc1dGpRWWUyYitH?= =?utf-8?B?dEFMQ3pMbm1PU2ZUbHRCM0lqZlp0RnF2akhnSUpMc3lFbU8rbnlhbkNRWjZv?= =?utf-8?B?c2NCclNxUHpGbjIrUGlPbDJLd09aSGFzTUtOZW84MFdwQzV3T3BYODBId3J3?= =?utf-8?B?TkoxQlBjVjlKM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= =?utf-8?B?WHBnei9iVXVxT2J3bzRMWkVyRkZnb1VseEJPaHpvMldENWhCeHVuZ1kwMmdG?= =?utf-8?B?REtGSFNQU2l0eE5UU2VxV2I1TkdqdU5EcjZha2ZIWkZqUnRld3hTbjFpbVRW?= =?utf-8?B?dkozK2ovVmVCdTJ6R3hSM1ljR0I4TTBERnZyWkNCb0VvZmtmYzJzbzZFMjky?= =?utf-8?B?MVo0STViTjBiRHlvakYxN3ByT3crUlRVdytid2RldXo2bUczSEhNSzdXTE1M?= =?utf-8?B?SDBIMzJ1MFhOanVtWVVpSVlNbXQ3bkR4TnRmRXEyNEJhTUk1WTFueE51VjJ6?= =?utf-8?B?SEZ3eWM1Y1ljTjJNdVE4bHhWYXR1U0lTeTNIcFN1M1NBcVN2Z1FaNC85Mlk3?= =?utf-8?B?LzVveXJPYkdFeHlFTVFUY0Z6S2ljdlFFUm44QzhCZm1YNXhmajU3TVdsYmhx?= =?utf-8?B?S3pUVW1aQXh2b3dlME5qMURoSk1MVEpGUjFETWN3NDZqL0xXOVlBTVhqaDFH?= =?utf-8?B?UDk5Umx4ZmRLdDdCR3V2QT09?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(38070700018);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?B?SXBTenBwckhCRm1GYmVCeloyZUtTOVpiZmF0S3E5SXVCT0RoRE9FVCszWWwy?= =?utf-8?B?R3BjN1A4Z0lsMFJrZGs5NjdWRm55QXE0UmRiMGo5dE1jb0w0SERGOFQ3a0Zk?= =?utf-8?B?ZFZwMEtpNHJzaWJLUjRPQlA4N1dpcEdNUTNkbUdmVUlRRVBEQVR5WkhsR3c5?= =?utf-8?B?dGZWQ0RGS0VLdjd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Mzl4UXI3V1E5NENSdnN2?= =?utf-8?B?dnFFMmZhbDV5Q3J4QUlIK0xpb2ZmSlh6VVFvWXExNjhFejczYUFaK1JjUmlh?= =?utf-8?B?c29zU04rbDJHVHZWb09IRnkzaWZjcW5DWTdXaXZoMGhoUnBSTHp2VzZuVFc2?= =?utf-8?B?eUFvdHJlNHJCd00yOUp5eXl3TVBzTVhHaExkeHhudU56VnZrVnI1UWdKeHph?= =?utf-8?B?TEE9PQ==?= Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------qwjWoOzjVoowy6crUCxQVaJ1" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: imgtec.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CWXP265MB3397.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 4b0648c9-a2d6-40eb-b8a0-08dcec5bc9d1 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Oct 2024 14:23:35.1633 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 0d5fd8bb-e8c2-4e0a-8dd5-2c264f7140fe X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0f5y3S+/0FEssFdoLnT2NYYgVDW3ClLtrk5pl9KqjcZlLoRgxW+Z/6RFuqbrxxLwGZ065c7BPeoRztxf1zWstg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP265MB3569 X-Authority-Analysis: v=2.4 cv=LbZu6Sfi c=1 sm=1 tr=0 ts=670d296a cx=c_pps a=fMXg3PN8hKgTqCYPrQuxSw==:117 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=xqWC_Br6kY4A:10 a=DAUX931o1VcA:10 a=WnR_qW7rlZcA:10 a=NgoYpvdbvlAA:10 a=r_1tXGB3AAAA:8 a=E0pLgM0HJGh-r-XSUJMA:9 a=QEXdDO2ut3YA:10 a=sEnSv1DDc_9R21KruKkA:9 a=FfaGCDsud1wA:10 a=t8nPyN_e6usw4ciXM-Pk:22 X-Proofpoint-ORIG-GUID: WRWMUomBiqf3y8HQAbVZYpP_TD0pN7Q_ X-Proofpoint-GUID: WRWMUomBiqf3y8HQAbVZYpP_TD0pN7Q_ --------------qwjWoOzjVoowy6crUCxQVaJ1 Content-Type: multipart/mixed; boundary="------------czh38hws900xlKBHLx9U0ESy"; protected-headers="v1" From: Matt Coster To: dri-devel@lists.freedesktop.org Cc: Brendan King , Frank Binns , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org Message-ID: <48476abf-2def-4d83-87a3-8cbd8eb9db3b@imgtec.com> Subject: [PATCH v2 2/2] drm/imagination: Break an object reference loop References: In-Reply-To: --------------czh38hws900xlKBHLx9U0ESy Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable From: Brendan King When remaining resources are being cleaned up on driver close, outstanding VM mappings may result in resources being leaked, due to an object reference loop, as shown below, with each object (or set of objects) referencing the object below it: PVR GEM Object GPU scheduler "finished" fence GPU scheduler =E2=80=9Cscheduled=E2=80=9D fence PVR driver =E2=80=9Cdone=E2=80=9D fence PVR Context PVR VM Context PVR VM Mappings PVR GEM Object The reference that the PVR VM Context has on the VM mappings is a soft one, in the sense that the freeing of outstanding VM mappings is done as part of VM context destruction; no reference counts are involved, as is the case for all the other references in the loop. To break the reference loop during cleanup, free the outstanding VM mappings before destroying the PVR Context associated with the VM context. Signed-off-by: Brendan King Signed-off-by: Matt Coster --- Changes in v1 -> v2: - None --- drivers/gpu/drm/imagination/pvr_context.c | 19 +++++++++++++++++++ drivers/gpu/drm/imagination/pvr_context.h | 18 ++++++++++++++++++ drivers/gpu/drm/imagination/pvr_vm.c | 22 ++++++++++++++++++---- drivers/gpu/drm/imagination/pvr_vm.h | 1 + 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/imagination/pvr_context.c b/drivers/gpu/drm/= imagination/pvr_context.c index 255c93582734..4cb3494c0bb2 100644 --- a/drivers/gpu/drm/imagination/pvr_context.c +++ b/drivers/gpu/drm/imagination/pvr_context.c @@ -450,11 +450,30 @@ pvr_context_destroy(struct pvr_file *pvr_file, u32 = handle) */ void pvr_destroy_contexts_for_file(struct pvr_file *pvr_file) { + struct pvr_device *pvr_dev =3D pvr_file->pvr_dev; struct pvr_context *ctx; unsigned long handle; =20 xa_for_each(&pvr_file->ctx_handles, handle, ctx) pvr_context_destroy(pvr_file, handle); + + spin_lock(&pvr_dev->ctx_list_lock); + ctx =3D list_first_entry(&pvr_file->contexts, struct pvr_context, file_= link); + + while (!list_entry_is_head(ctx, &pvr_file->contexts, file_link)) { + list_del_init(&ctx->file_link); + + if (pvr_context_get_if_referenced(ctx)) { + spin_unlock(&pvr_dev->ctx_list_lock); + + pvr_vm_unmap_all(ctx->vm_ctx); + + pvr_context_put(ctx); + spin_lock(&pvr_dev->ctx_list_lock); + } + ctx =3D list_first_entry(&pvr_file->contexts, struct pvr_context, file= _link); + } + spin_unlock(&pvr_dev->ctx_list_lock); } =20 /** diff --git a/drivers/gpu/drm/imagination/pvr_context.h b/drivers/gpu/drm/= imagination/pvr_context.h index a5b0a82a54a1..07afa179cdf4 100644 --- a/drivers/gpu/drm/imagination/pvr_context.h +++ b/drivers/gpu/drm/imagination/pvr_context.h @@ -126,6 +126,24 @@ pvr_context_get(struct pvr_context *ctx) return ctx; } =20 +/** + * pvr_context_get_if_referenced() - Take an additional reference on a s= till + * referenced context. + * @ctx: Context pointer. + * + * Call pvr_context_put() to release. + * + * Returns: + * * True on success, or + * * false if no context pointer passed, or the context wasn't still + * * referenced. + */ +static __always_inline bool +pvr_context_get_if_referenced(struct pvr_context *ctx) +{ + return ctx !=3D NULL && kref_get_unless_zero(&ctx->ref_count) !=3D 0; +} + /** * pvr_context_lookup() - Lookup context pointer from handle and file. * @pvr_file: Pointer to pvr_file structure. diff --git a/drivers/gpu/drm/imagination/pvr_vm.c b/drivers/gpu/drm/imagi= nation/pvr_vm.c index 97c0f772ed65..7bd6ba4c6e8a 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.c +++ b/drivers/gpu/drm/imagination/pvr_vm.c @@ -14,6 +14,7 @@ #include #include =20 +#include #include #include #include @@ -597,12 +598,26 @@ pvr_vm_create_context(struct pvr_device *pvr_dev, b= ool is_userspace_context) } =20 /** - * pvr_vm_context_release() - Teardown a VM context. - * @ref_count: Pointer to reference counter of the VM context. + * pvr_vm_unmap_all() - Unmap all mappings associated with a VM context.= + * @vm_ctx: Target VM context. * * This function ensures that no mappings are left dangling by unmapping= them * all in order of ascending device-virtual address. */ +void +pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx) +{ + WARN_ON(pvr_vm_unmap(vm_ctx, vm_ctx->gpuvm_mgr.mm_start, + vm_ctx->gpuvm_mgr.mm_range)); +} + +/** + * pvr_vm_context_release() - Teardown a VM context. + * @ref_count: Pointer to reference counter of the VM context. + * + * This function also ensures that no mappings are left dangling by call= ing + * pvr_vm_unmap_all. + */ static void pvr_vm_context_release(struct kref *ref_count) { @@ -612,8 +627,7 @@ pvr_vm_context_release(struct kref *ref_count) if (vm_ctx->fw_mem_ctx_obj) pvr_fw_object_destroy(vm_ctx->fw_mem_ctx_obj); =20 - WARN_ON(pvr_vm_unmap(vm_ctx, vm_ctx->gpuvm_mgr.mm_start, - vm_ctx->gpuvm_mgr.mm_range)); + pvr_vm_unmap_all(vm_ctx); =20 pvr_mmu_context_destroy(vm_ctx->mmu_ctx); drm_gem_private_object_fini(&vm_ctx->dummy_gem); diff --git a/drivers/gpu/drm/imagination/pvr_vm.h b/drivers/gpu/drm/imagi= nation/pvr_vm.h index f2a6463f2b05..79406243617c 100644 --- a/drivers/gpu/drm/imagination/pvr_vm.h +++ b/drivers/gpu/drm/imagination/pvr_vm.h @@ -39,6 +39,7 @@ int pvr_vm_map(struct pvr_vm_context *vm_ctx, struct pvr_gem_object *pvr_obj, u64 pvr_obj_offset, u64 device_addr, u64 size); int pvr_vm_unmap(struct pvr_vm_context *vm_ctx, u64 device_addr, u64 siz= e); +void pvr_vm_unmap_all(struct pvr_vm_context *vm_ctx); =20 dma_addr_t pvr_vm_get_page_table_root_addr(struct pvr_vm_context *vm_ctx= ); struct dma_resv *pvr_vm_get_dma_resv(struct pvr_vm_context *vm_ctx); --=20 2.47.0 --------------czh38hws900xlKBHLx9U0ESy-- --------------qwjWoOzjVoowy6crUCxQVaJ1 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature.asc" -----BEGIN PGP SIGNATURE----- wnsEABYIACMWIQS4qDmoJvwmKhjY+nN5vBnz2d5qsAUCZw0pZgUDAAAAAAAKCRB5vBnz2d5qsBVY AQCX4MCRm1DhkcSZXlm8cA8Z79i+VF4RJ2tFWf3sU8sBGgD6A+JxFpH/2pyBJaMwbcKX/5SQ6HKa 7rGqLyHoxppggwE= =i8Pd -----END PGP SIGNATURE----- --------------qwjWoOzjVoowy6crUCxQVaJ1--