get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2225519/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2225519,
    "url": "http://patchwork.ozlabs.org/api/patches/2225519/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260421-nova-unload-v2-4-2fe54963af8b@nvidia.com/",
    "project": {
        "id": 28,
        "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api",
        "name": "Linux PCI development",
        "link_name": "linux-pci",
        "list_id": "linux-pci.vger.kernel.org",
        "list_email": "linux-pci@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20260421-nova-unload-v2-4-2fe54963af8b@nvidia.com>",
    "list_archive_url": null,
    "date": "2026-04-21T06:16:14",
    "name": "[v2,4/5] gpu: nova-core: send UNLOADING_GUEST_DRIVER GSP command upon unloading",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "a2416dffe94f009a726a5ab20339953c80450478",
    "submitter": {
        "id": 13521,
        "url": "http://patchwork.ozlabs.org/api/people/13521/?format=api",
        "name": "Alexandre Courbot",
        "email": "acourbot@nvidia.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260421-nova-unload-v2-4-2fe54963af8b@nvidia.com/mbox/",
    "series": [
        {
            "id": 500739,
            "url": "http://patchwork.ozlabs.org/api/series/500739/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=500739",
            "date": "2026-04-21T06:16:10",
            "name": "gpu: nova-core: run unload sequence upon unbinding",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/500739/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2225519/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2225519/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "\n <linux-pci+bounces-52815-incoming=patchwork.ozlabs.org@vger.kernel.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "linux-pci@vger.kernel.org"
        ],
        "Delivered-To": "patchwork-incoming@legolas.ozlabs.org",
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256\n header.s=selector2 header.b=rk9w7e2Z;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-52815-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)",
            "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com\n header.b=\"rk9w7e2Z\"",
            "smtp.subspace.kernel.org;\n arc=fail smtp.client-ip=40.107.209.24",
            "smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=nvidia.com",
            "smtp.subspace.kernel.org;\n spf=fail smtp.mailfrom=nvidia.com",
            "dkim=none (message not signed)\n header.d=none;dmarc=none action=none header.from=nvidia.com;"
        ],
        "Received": [
            "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0C1x1MfDz1yGt\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 16:22:13 +1000 (AEST)",
            "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id BA5F83034657\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 06:16:42 +0000 (UTC)",
            "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 3EEF8223336;\n\tTue, 21 Apr 2026 06:16:42 +0000 (UTC)",
            "from PH8PR06CU001.outbound.protection.outlook.com\n (mail-westus3azon11012024.outbound.protection.outlook.com [40.107.209.24])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id A3D2535E947;\n\tTue, 21 Apr 2026 06:16:40 +0000 (UTC)",
            "from CH2PR12MB3990.namprd12.prod.outlook.com (2603:10b6:610:28::18)\n by CYYPR12MB8749.namprd12.prod.outlook.com (2603:10b6:930:c6::12) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.15; Tue, 21 Apr\n 2026 06:16:33 +0000",
            "from CH2PR12MB3990.namprd12.prod.outlook.com\n ([fe80::7de1:4fe5:8ead:5989]) by CH2PR12MB3990.namprd12.prod.outlook.com\n ([fe80::7de1:4fe5:8ead:5989%4]) with mapi id 15.20.9846.016; Tue, 21 Apr 2026\n 06:16:33 +0000"
        ],
        "ARC-Seal": [
            "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776752202; cv=fail;\n b=cBKyKvR6dBVsw9qFAjwhzeZxNFOJzRdGrxHGI+2JDihiuNclbKkjswgvecuIbK1D/GpgH1f3eMO6/1ikg9Exo/t1HbQ+ZEOacL3wWl6lbKdw+vostPY7vmXdQK18jE64PaUoowvAbYw4nUupRjHbAwzaPe2dFilxGQgJ8Ltydxo=",
            "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=cinGcQKyO5g47N6lFamyjYG6yBuqq34Oz1a2VYovpYZjNLMigDhDo1VEJjhNvE+Ut7XtHTni/SIgcOqDuLI9WqTUSb5IKrJtiMhabubmGmPqjr6Fgy+rNd/72OOZl/Q/j5LN/1W16tnjM/MsH2vlWGkerBLw6vyRd3oyVAM55p+9MgUjFFJ9rBrraR8MMFVbxMWlhYgdP4aPnXyw42cJwQGIUKW6J4an9MgMYkmRCKFyv7TIUXKfV4LaRKU3H2fk+BBuLH656gXWj8lLNwtCa2nNayrc4ha9dv7G5jZxkRYmpGzluuuq1YwggkicPLCJ3OyuIKrxnYMC4792pxj82w=="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776752202; c=relaxed/simple;\n\tbh=cXPuak9HUliia3E5O2qG/XBdHMZ9+OnK7bGTReyJr6Y=;\n\th=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To:\n\t To:Cc:MIME-Version;\n b=HA/o/fKekd1nl9dDickhALfOo1/sxApoILhph5xKy9usFUdAXO4GG/Dz4C3Gzj47m9uSGDEuT7l/aysPt0Wa6ng2oGHiFa398eNdfuBd4s6RUiKgXItH6Fp4g8I7BnI+U+yd1AZoErrNRcN1W3/PmA9xIXkFA7vLuxwX7UeEusc=",
            "i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n 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;\n bh=LS/9e/tDax4bkVeHVJ5hd/JEceKzidDFI9TcIg/dzD8=;\n b=FxUz642A9/8L5MQQBtQfO902EQo06PwTkTkPfhtMEo+Dz4xYOV1ucqLrb8ykUk1YmNVxgK8SDsDf6fXy5TOaMEymcsqzu0iHbpZP3vEjrsCEwGrO5c4U5nFWTj5bw54fuNym2CBURSEy4EEAZ3OMRdhCSk3pC2uEjJLdLkjzKj6WzyrR78H7LErycs5/S1LirD8P2i4PUB0Obem4rjLNQ800F9FDEHV6EKno5f43XgsJpCcgoFiGgYFhNPkFZHik24t4htpG/Ze1Ml8kgxRKyHBEGcpfRFCcpNyln+RNYidB11rJauiOSghrMUq424m74UKA6HFd6uMSKmPWy2OJBg=="
        ],
        "ARC-Authentication-Results": [
            "i=2; smtp.subspace.kernel.org;\n dmarc=pass (p=reject dis=none) header.from=nvidia.com;\n spf=fail smtp.mailfrom=nvidia.com;\n dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com\n header.b=rk9w7e2Z; arc=fail smtp.client-ip=40.107.209.24",
            "i=1; mx.microsoft.com 1; spf=pass\n smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com;\n dkim=pass header.d=nvidia.com; arc=none"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=LS/9e/tDax4bkVeHVJ5hd/JEceKzidDFI9TcIg/dzD8=;\n b=rk9w7e2ZhA1d8jyWzebDICJ/6qKg5o48Cdwfi2R2DW6ILHzfuWhKTYR/U0B0L/hVxwtfSakWXE8yD2BYHJojFhjIpH5lxUcpCZp/ARANw5ZJH13NWLVGQ049F+tgZTtYWnWYuupvEpiF1vc002sMKrMDtuLa1p4FqpJAdSZ3CQUHGlGiVTRz61HTX3lJmV58TPLmHBZSpFaxeQKR8ntNIUt3zgNBLTIYoCOMo/m6OBy1LmBz3WF+1+YquBjT7iIHhMxefKAbTeLVEOPTQ4Jie/AEB+qE2l1COXFIg13WDvGhXI+Wr7CiDCvROLdlddkXu80RMb70+Q4tmN/j2QxcIg==",
        "From": "Alexandre Courbot <acourbot@nvidia.com>",
        "Date": "Tue, 21 Apr 2026 15:16:14 +0900",
        "Subject": "[PATCH v2 4/5] gpu: nova-core: send UNLOADING_GUEST_DRIVER GSP\n command upon unloading",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260421-nova-unload-v2-4-2fe54963af8b@nvidia.com>",
        "References": "<20260421-nova-unload-v2-0-2fe54963af8b@nvidia.com>",
        "In-Reply-To": "<20260421-nova-unload-v2-0-2fe54963af8b@nvidia.com>",
        "To": "Danilo Krummrich <dakr@kernel.org>, Alice Ryhl <aliceryhl@google.com>,\n  David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,\n  Bjorn Helgaas <bhelgaas@google.com>,\n =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= <kwilczynski@kernel.org>,\n  Miguel Ojeda <ojeda@kernel.org>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj?=\n\t=?utf-8?q?=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>,\n  Benno Lossin <lossin@kernel.org>, Andreas Hindborg <a.hindborg@kernel.org>,\n  Trevor Gross <tmgross@umich.edu>, Boqun Feng <boqun@kernel.org>",
        "Cc": "John Hubbard <jhubbard@nvidia.com>,\n Alistair Popple <apopple@nvidia.com>,\n Joel Fernandes <joelagnelf@nvidia.com>, Timur Tabi <ttabi@nvidia.com>,\n Eliot Courtney <ecourtney@nvidia.com>, nouveau@lists.freedesktop.org,\n dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,\n linux-pci@vger.kernel.org, rust-for-linux@vger.kernel.org,\n Alexandre Courbot <acourbot@nvidia.com>",
        "X-Mailer": "b4 0.15.2",
        "X-ClientProxiedBy": "OS7PR01CA0192.jpnprd01.prod.outlook.com\n (2603:1096:604:250::7) To CH2PR12MB3990.namprd12.prod.outlook.com\n (2603:10b6:610:28::18)",
        "Precedence": "bulk",
        "X-Mailing-List": "linux-pci@vger.kernel.org",
        "List-Id": "<linux-pci.vger.kernel.org>",
        "List-Subscribe": "<mailto:linux-pci+subscribe@vger.kernel.org>",
        "List-Unsubscribe": "<mailto:linux-pci+unsubscribe@vger.kernel.org>",
        "MIME-Version": "1.0",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-TrafficTypeDiagnostic": "CH2PR12MB3990:EE_|CYYPR12MB8749:EE_",
        "X-MS-Office365-Filtering-Correlation-Id": "b889574c-7a91-4cc1-8b09-08de9f6d88c5",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-MS-Exchange-AntiSpam-Relay": "0",
        "X-Microsoft-Antispam": "\n\tBCL:0;ARA:13230040|376014|7416014|1800799024|10070799003|366016|921020|56012099003|18002099003|22082099003;",
        "X-Microsoft-Antispam-Message-Info": "\n\tW3sep71e/OtTKs17dWRAPOurvg0VwynG/M1Z2UbuDuhx3rb8YnF2jJuFWk9ZxFgr+PJUC+UBoyNoregbWr9A1Ygk5maz1IVALsJbc0GyK+TZKQ6D73v3q1w82slBGUVyxCaRcKwQyrOv6mJ8XV51x4w7TQvxsU4IhmVpi+rrfgZ6lfK7N2t/uXdFUE1k1wjQMb1pRBJ13S59p+EqdrHZsnryUAhSBOcKEkAE43UfvPPLKEWTE+umFXTaJSoD1hbGvtH2YQ/JQUfPzHal9AdgZB1WPHPiwiPSPGRL+CPDMqWCX8bL4ydrQB9mAA6Bv85jrIXt/oIQ5MUPp6h7kB5yqA/JFDdMCDcEtbUQwcs9hLxJFxQ/4x8VXNSU75t3DfYzYs3qI/xkKowcLaUcyB3dV0DHabVI58hvjsHi6jXeUTZ49bdyB7Nr8GgLz3p9+2vq9UsJZ8aAZcqt/5jByWUcHXfOVvH2jdVPtMiARtQnmV2eQpzS+kcnTWQwmhK6D7ELe4vkpIC3xeSPdkD9ue/Dr+LMF0Zdxu7QLynZvU9yJTV1hfjBPkjIF/q1bWEO7JjTM6xPX9VHqMJh3RZchQkXWOW6e9TE0VghvcyTPa7Rtk1Culom367vlLiJQr6lUQUL/8duoWGvaiFdj5yD8X/XVGjolc7+B3jjoeUFMZhYmQpLgKDpeaD8l4HA1sYNqnhWqdwGMczErH+fdab/bExNQAPVPMtIcnh0vYmEkOivRvw/QqHaktjiZIP7QbZYbKNzKakDifQ0qxNvO3GNca/wnw==",
        "X-Forefront-Antispam-Report": "\n\tCIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH2PR12MB3990.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(10070799003)(366016)(921020)(56012099003)(18002099003)(22082099003);DIR:OUT;SFP:1101;",
        "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "2",
        "X-MS-Exchange-AntiSpam-MessageData-0": "=?utf-8?q?iYqb4JAPnBVrw3+Iw6BpwGhOIPEJ?=\n\t=?utf-8?q?Qs7U2OvLH3MXKOgTT2sWpZzXWCnGSpSuNrJDVocrd/2JPLw/wY8ptPx2gd/doAtiV?=\n\t=?utf-8?q?A4U/l6bjIVabROrUV3mu6+MbgPqFLbmOTYWh2HesQPW/ZGBbi4sjP/BbfD8l/cTyB?=\n\t=?utf-8?q?u7zU3Nc+J2fLHVBIi/Oe1kKEiTHAI9u+a0dVYgBhGNRpb2jk/M89A24QGK+UnvuXB?=\n\t=?utf-8?q?4VTnQrn7Wrhh8pCINnpq5OmvKR6h8TXCi1t0jKGvG/cHSbHWaNbrpFUCArCxwEVw+?=\n\t=?utf-8?q?tsaK86P29xtR9lXWxh6FeEJiVMP/uFwStlOo0rVm/gB5nNoLrM8NAF+6zMvMFNnv0?=\n\t=?utf-8?q?/++wHPIdCIiDVgaLgjeL/b5IxXrk9Op4lRCsH6YrtUbkgUHh8Z2Ypf2gURAjkglxH?=\n\t=?utf-8?q?eEhWJ+pEPCMKVbvvflrVRZM4aIcIDWlS1FLw8MBHwIjqgyu40IdFGgIYmj4g4lWRA?=\n\t=?utf-8?q?oFLUytgFJNMUp8phAp2WCyifAUPj76Cb6lJ5Kls2hnRKkwLylk/QCsfLiF2rRrQiB?=\n\t=?utf-8?q?zVX4oqNDWOzp4/ZwaNSc1bcCyzmpIIvtdFAnkwEyvdT1oEe4C2ffla01RjlSLrurc?=\n\t=?utf-8?q?RBWbJeUJNlZ/9RHPFkVRH3dhwxeb2NmU7QkkPhZ9YoJw+XFqBfpYYMfIUlwY6Dv3G?=\n\t=?utf-8?q?m+kP4Ac7pzPjeYa8yhLdfgsTXL/r5orVBfWtyWz7iUeuZjvH6cS71qu3oUmhYnpiK?=\n\t=?utf-8?q?Frf4rcU7gZqBfpgHHtYkUfkW+WSH8njr1i4EFy+jpmoILAvvoOLCVEeYBJbq07NG2?=\n\t=?utf-8?q?+ka3/cmKwRnC+2BNkfl6CIpsAmidQ5eamn1I2H6g50t05ORnxom7xCaQXMyvd7jQ+?=\n\t=?utf-8?q?VCFnCjGwBYklF5RBPjL70cNTWHVmMTEyta4/V3HNnwTMHbDfASPMQ8D2yNNjn44Kv?=\n\t=?utf-8?q?JGutNzmOY07ma+wwotS4trSNYOvl5ZLYQdd2u5LIbD6344jfdQm9xo34fMfCiM9tn?=\n\t=?utf-8?q?sqZg2hbA3rC/vsKWpvT5pFp6PVlD8vm9r6k6kjHJtsEEZq5F7eOwqwOO/NTLXepmE?=\n\t=?utf-8?q?peCgssILkOxgjQWsI4XcOw6lpv70JzfsKOW2HNLWFk9CXU94dzQKeIK3k6oiODL4L?=\n\t=?utf-8?q?xnORcFArdo+utFqm+NuX3TUy6Wyy6UKvpbGK92zpRXHRIRIhWpHWQpFn2D+MZ9iDI?=\n\t=?utf-8?q?pYKUBMACtoBrD8wMiBFQM6G7JGheCk2/1bkdLDGEaJxvrkZliKtNVJI0fN6/8DTag?=\n\t=?utf-8?q?LG17oFnwtvjyFXQuxrQ7jk+r3DSht2xNCQ3h/eM9ILa5hTwNJMfEjvjcxSVakveSK?=\n\t=?utf-8?q?mTdlevsiDH0vph+4cqqJZ/Td7OipJTLrVmzEnrm63IcCZvJWFEG/F7Hr7O+0KbWOC?=\n\t=?utf-8?q?Tc8Ra9VYpx3qys//ysPV7iuKFNmzO1UVJRAFHlDwBb4Amg7FKPsPHpxpYaFmPXpL9?=\n\t=?utf-8?q?/LyQwONKYfO7KWMiLH6l4g/3shQk1Lh3M6VushZoxLl/Knpm1ltNDTFZCcVFmdpEs?=\n\t=?utf-8?q?00zAgCKtZVCK2+jnsKjhMs5WQ00r0VOZDIXG5gSTNUUIzUjSlb6t+5MepWwGTTRoh?=\n\t=?utf-8?q?pgDZKT5+qvzHDWRFZlF3GIo88CnJKNzDCTSpjAMsYSBIEIcD3jGbdzh9tB8ztXSjO?=\n\t=?utf-8?q?NI3soL6DbGgOOPXTnFwyT3ltjBd26ZFjH6qL5zwz/uM9aujOT/pL2TaSZkDQZ4NYE?=\n\t=?utf-8?q?kd655YAcuJHm9VuQLsMaKzWySWPkZGMrum2b4UJ8v9YuWrub7eUshYUt34dxGyiJ1?=\n\t=?utf-8?q?rzGqneaheSKGK09y7?=",
        "X-MS-Exchange-AntiSpam-MessageData-1": "Yhinwq2ojiuQMw==",
        "X-OriginatorOrg": "Nvidia.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n b889574c-7a91-4cc1-8b09-08de9f6d88c5",
        "X-MS-Exchange-CrossTenant-AuthSource": "CH2PR12MB3990.namprd12.prod.outlook.com",
        "X-MS-Exchange-CrossTenant-AuthAs": "Internal",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "21 Apr 2026 06:16:33.0755\n (UTC)",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted",
        "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a",
        "X-MS-Exchange-CrossTenant-MailboxType": "HOSTED",
        "X-MS-Exchange-CrossTenant-UserPrincipalName": "\n pfKxM5APqr6w0mjIMcq4L5cJaU6xOjs+7noOYuUbj7GsHNili1jtkU+U7X/QnG2po/ovgufzxEYmwLOj/avPhg==",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "CYYPR12MB8749"
    },
    "content": "Currently, the GSP is left running after the driver is unbound. This is\nnot great for several reasons, notably that it can still access shared\nmemory areas that the kernel will now reclaim (especially problematic on\nsetups without an IOMMU).\n\nFix this by sending the `UNLOADING_GUEST_DRIVER` GSP command when\nunbinding. This stops the GSP and lets us proceed with the rest of the\nunbind sequence in the next patch.\n\nSigned-off-by: Alexandre Courbot <acourbot@nvidia.com>\n---\n drivers/gpu/nova-core/gpu.rs                      |  5 +++\n drivers/gpu/nova-core/gsp/boot.rs                 | 40 +++++++++++++++++++++++\n drivers/gpu/nova-core/gsp/commands.rs             | 36 ++++++++++++++++++++\n drivers/gpu/nova-core/gsp/fw.rs                   |  4 +++\n drivers/gpu/nova-core/gsp/fw/commands.rs          | 23 +++++++++++++\n drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs |  8 +++++\n 6 files changed, 116 insertions(+)",
    "diff": "diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs\nindex 1701c2600538..8f2ae9e8a519 100644\n--- a/drivers/gpu/nova-core/gpu.rs\n+++ b/drivers/gpu/nova-core/gpu.rs\n@@ -277,12 +277,17 @@ pub(crate) fn new<'a>(\n \n     /// Called when the corresponding [`Device`](device::Device) is unbound.\n     ///\n+    /// Prepares the GPU for unbinding by shutting down the GSP and unregistering the sysmem flush\n+    /// memory page.\n+    ///\n     /// Note: This method must only be called from `Driver::unbind`.\n     pub(crate) fn unbind(&self, dev: &device::Device<device::Core>) {\n         let Ok(bar) = kernel::warn_on_err!(self.bar.access(dev)) else {\n             return;\n         };\n \n+        let _ = kernel::warn_on_err!(self.gsp.unload(dev, bar, &self.gsp_falcon));\n+\n         self.sysmem_flush.unregister(bar);\n     }\n }\ndiff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs\nindex 18f356c9178e..3f4e99b2497b 100644\n--- a/drivers/gpu/nova-core/gsp/boot.rs\n+++ b/drivers/gpu/nova-core/gsp/boot.rs\n@@ -33,6 +33,7 @@\n     },\n     gpu::Chipset,\n     gsp::{\n+        cmdq::Cmdq,\n         commands,\n         sequencer::{\n             GspSequencer,\n@@ -237,4 +238,43 @@ pub(crate) fn boot(\n \n         Ok(())\n     }\n+\n+    /// Shut down the GSP and wait until it is offline.\n+    fn shutdown_gsp(\n+        cmdq: &Cmdq,\n+        bar: &Bar0,\n+        gsp_falcon: &Falcon<Gsp>,\n+        suspend: bool,\n+    ) -> Result<()> {\n+        // Send command to shutdown GSP and wait for response.\n+        cmdq.send_command(bar, commands::UnloadingGuestDriver::new(suspend))?;\n+\n+        // Wait until GSP signals it is suspended.\n+        const LIBOS_INTERRUPT_PROCESSOR_SUSPENDED: u32 = 0x8000_0000;\n+        read_poll_timeout(\n+            || Ok(gsp_falcon.read_mailbox0(bar)),\n+            |&mb0| mb0 == LIBOS_INTERRUPT_PROCESSOR_SUSPENDED,\n+            Delta::from_millis(10),\n+            Delta::from_secs(5),\n+        )\n+        .map(|_| ())\n+    }\n+\n+    /// Attempts to unload the GSP firmware.\n+    ///\n+    /// This stops all activity on the GSP.\n+    pub(crate) fn unload(\n+        &self,\n+        dev: &device::Device<device::Bound>,\n+        bar: &Bar0,\n+        gsp_falcon: &Falcon<Gsp>,\n+    ) -> Result {\n+        // Shut down the GSP.\n+\n+        Self::shutdown_gsp(&self.cmdq, bar, gsp_falcon, false)\n+            .inspect_err(|e| dev_err!(dev, \"unload guest driver failed: {:?}\", e))?;\n+        dev_dbg!(dev, \"GSP shut down\\n\");\n+\n+        Ok(())\n+    }\n }\ndiff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs\nindex c80df421702c..fb94460c451e 100644\n--- a/drivers/gpu/nova-core/gsp/commands.rs\n+++ b/drivers/gpu/nova-core/gsp/commands.rs\n@@ -237,3 +237,39 @@ pub(crate) fn gpu_name(&self) -> core::result::Result<&str, GpuNameError> {\n pub(crate) fn get_gsp_info(cmdq: &Cmdq, bar: &Bar0) -> Result<GetGspStaticInfoReply> {\n     cmdq.send_command(bar, GetGspStaticInfo)\n }\n+\n+pub(crate) struct UnloadingGuestDriver {\n+    suspend: bool,\n+}\n+\n+impl UnloadingGuestDriver {\n+    pub(crate) fn new(suspend: bool) -> Self {\n+        Self { suspend }\n+    }\n+}\n+\n+impl CommandToGsp for UnloadingGuestDriver {\n+    const FUNCTION: MsgFunction = MsgFunction::UnloadingGuestDriver;\n+    type Command = fw::commands::UnloadingGuestDriver;\n+    type Reply = UnloadingGuestDriverReply;\n+    type InitError = Infallible;\n+\n+    fn init(&self) -> impl Init<Self::Command, Self::InitError> {\n+        fw::commands::UnloadingGuestDriver::new(self.suspend)\n+    }\n+}\n+\n+pub(crate) struct UnloadingGuestDriverReply;\n+\n+impl MessageFromGsp for UnloadingGuestDriverReply {\n+    const FUNCTION: MsgFunction = MsgFunction::UnloadingGuestDriver;\n+    type InitError = Infallible;\n+    type Message = ();\n+\n+    fn read(\n+        _msg: &Self::Message,\n+        _sbuffer: &mut SBufferIter<array::IntoIter<&[u8], 2>>,\n+    ) -> Result<Self, Self::InitError> {\n+        Ok(UnloadingGuestDriverReply)\n+    }\n+}\ndiff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs\nindex 0c8a74f0e8ac..59b4c4883185 100644\n--- a/drivers/gpu/nova-core/gsp/fw.rs\n+++ b/drivers/gpu/nova-core/gsp/fw.rs\n@@ -278,6 +278,7 @@ pub(crate) enum MsgFunction {\n     Nop = bindings::NV_VGPU_MSG_FUNCTION_NOP,\n     SetGuestSystemInfo = bindings::NV_VGPU_MSG_FUNCTION_SET_GUEST_SYSTEM_INFO,\n     SetRegistry = bindings::NV_VGPU_MSG_FUNCTION_SET_REGISTRY,\n+    UnloadingGuestDriver = bindings::NV_VGPU_MSG_FUNCTION_UNLOADING_GUEST_DRIVER,\n \n     // Event codes\n     GspInitDone = bindings::NV_VGPU_MSG_EVENT_GSP_INIT_DONE,\n@@ -322,6 +323,9 @@ fn try_from(value: u32) -> Result<MsgFunction> {\n                 Ok(MsgFunction::SetGuestSystemInfo)\n             }\n             bindings::NV_VGPU_MSG_FUNCTION_SET_REGISTRY => Ok(MsgFunction::SetRegistry),\n+            bindings::NV_VGPU_MSG_FUNCTION_UNLOADING_GUEST_DRIVER => {\n+                Ok(MsgFunction::UnloadingGuestDriver)\n+            }\n \n             // Event codes\n             bindings::NV_VGPU_MSG_EVENT_GSP_INIT_DONE => Ok(MsgFunction::GspInitDone),\ndiff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs\nindex db46276430be..71c8690c9322 100644\n--- a/drivers/gpu/nova-core/gsp/fw/commands.rs\n+++ b/drivers/gpu/nova-core/gsp/fw/commands.rs\n@@ -129,3 +129,26 @@ unsafe impl AsBytes for GspStaticConfigInfo {}\n // SAFETY: This struct only contains integer types for which all bit patterns\n // are valid.\n unsafe impl FromBytes for GspStaticConfigInfo {}\n+\n+/// Payload of the `UnloadingGuestDriver` command and message.\n+#[repr(transparent)]\n+#[derive(Clone, Copy, Debug, Zeroable)]\n+pub(crate) struct UnloadingGuestDriver(bindings::rpc_unloading_guest_driver_v1F_07);\n+\n+impl UnloadingGuestDriver {\n+    pub(crate) fn new(suspend: bool) -> Self {\n+        Self(bindings::rpc_unloading_guest_driver_v1F_07 {\n+            bInPMTransition: u8::from(suspend),\n+            bGc6Entering: 0,\n+            newLevel: if suspend { 3 } else { 0 },\n+            ..Zeroable::zeroed()\n+        })\n+    }\n+}\n+\n+// SAFETY: Padding is explicit and will not contain uninitialized data.\n+unsafe impl AsBytes for UnloadingGuestDriver {}\n+\n+// SAFETY: This struct only contains integer types for which all bit patterns\n+// are valid.\n+unsafe impl FromBytes for UnloadingGuestDriver {}\ndiff --git a/drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs b/drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs\nindex 334e8be5fde8..5d8e4c0ad904 100644\n--- a/drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs\n+++ b/drivers/gpu/nova-core/gsp/fw/r570_144/bindings.rs\n@@ -880,6 +880,14 @@ fn default() -> Self {\n     }\n }\n #[repr(C)]\n+#[derive(Debug, Default, Copy, Clone, MaybeZeroable)]\n+pub struct rpc_unloading_guest_driver_v1F_07 {\n+    pub bInPMTransition: u8_,\n+    pub bGc6Entering: u8_,\n+    pub __bindgen_padding_0: [u8; 2usize],\n+    pub newLevel: u32_,\n+}\n+#[repr(C)]\n #[derive(Debug, Default, MaybeZeroable)]\n pub struct rpc_run_cpu_sequencer_v17_00 {\n     pub bufferSizeDWord: u32_,\n",
    "prefixes": [
        "v2",
        "4/5"
    ]
}