Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2223697/?format=api
{ "id": 2223697, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2223697/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260416014504.63067-1-ankita@nvidia.com/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.1/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 }, "msgid": "<20260416014504.63067-1-ankita@nvidia.com>", "date": "2026-04-16T01:45:04", "name": "[v3,1/1] vfio/nvgrace-gpu: Add Blackwell-Next GPU readiness check via CXL DVSEC", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "65d6d18b1888c1e1ff90eaa0c3ea63afb0ba5914", "submitter": { "id": 86155, "url": "http://patchwork.ozlabs.org/api/1.1/people/86155/?format=api", "name": "Ankit Agrawal", "email": "ankita@nvidia.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20260416014504.63067-1-ankita@nvidia.com/mbox/", "series": [ { "id": 500064, "url": "http://patchwork.ozlabs.org/api/1.1/series/500064/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=500064", "date": "2026-04-16T01:45:04", "name": "[v3,1/1] vfio/nvgrace-gpu: Add Blackwell-Next GPU readiness check via CXL DVSEC", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/500064/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2223697/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2223697/checks/", "tags": {}, "headers": { "Return-Path": "\n <linux-pci+bounces-52569-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=Nk6Zb2+d;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.232.135.74; helo=sto.lore.kernel.org;\n envelope-from=linux-pci+bounces-52569-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=\"Nk6Zb2+d\"", "smtp.subspace.kernel.org;\n arc=fail smtp.client-ip=40.93.196.56", "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" ], "Received": [ "from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])\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 4fx1762JpPz1yHV\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 11:45:38 +1000 (AEST)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id 00858302FC3E\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 01:45:35 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 5FA1B4A0C;\n\tThu, 16 Apr 2026 01:45:32 +0000 (UTC)", "from SA9PR02CU001.outbound.protection.outlook.com\n (mail-southcentralusazon11013056.outbound.protection.outlook.com\n [40.93.196.56])\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 CB58F1643B;\n\tThu, 16 Apr 2026 01:45:30 +0000 (UTC)", "from BN9P220CA0022.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::27)\n by IA0PR12MB7697.namprd12.prod.outlook.com (2603:10b6:208:433::19) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9818.20; Thu, 16 Apr\n 2026 01:45:22 +0000", "from BN1PEPF00004683.namprd03.prod.outlook.com\n (2603:10b6:408:13e:cafe::db) by BN9P220CA0022.outlook.office365.com\n (2603:10b6:408:13e::27) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.51 via Frontend Transport; Thu,\n 16 Apr 2026 01:45:22 +0000", "from mail.nvidia.com (216.228.117.160) by\n BN1PEPF00004683.mail.protection.outlook.com (10.167.243.89) with Microsoft\n SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.9769.17 via Frontend Transport; Thu, 16 Apr 2026 01:45:21 +0000", "from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com\n (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Wed, 15 Apr\n 2026 18:45:06 -0700", "from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com\n (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Wed, 15 Apr\n 2026 18:45:05 -0700", "from localhost.nvidia.com (10.127.8.12) by mail.nvidia.com\n (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend\n Transport; Wed, 15 Apr 2026 18:45:04 -0700" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776303932; cv=fail;\n b=sExZ2wq3Ch8xrSKaukQPrVZL4/qBR1c+0WfbpQeCDgpuhZjKE7AkGadtbp+O+WI/R1ko8zhRPB8k+0goHVwL17b+pkNiiHJk+gpCOftF+dfvpp4r8nibIAEqQL7VUSwA7mAbJZ/9YVj1tIaWdCyL7yCArHO29rw9JpK8CSPv9Rs=", "i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=pqVJduAPZDRIyP2ZlalvVwajtfgAuwOx+yAgLDNiiksKLoYXotSUqRtqeJt0ynsTTn+IbzBPijRolxjQuHC3HIAY0SWRPeMM/6kBO4OZDySFEI6FMiU1R9tInnRcYWsCZFPGVXt33Gebwxms//2VnohFHtI3EbuW4Zwx2smLo9GliuRWRI9mf9kHNBTnaRp6IWyitQFNPLJZauEMw7RL5koWLhwhF7akbkhsxAP+GIGN5U4EUINs9BXf7shhnLMGJJtqQwkHO1BHu2Ln0vP+Ggw8pc+WFRI7izAKs9xZvokEajuwe4a509mt4kB/Zbs8Y6iW3wlSbMZnBL3gjBWQXA==" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776303932; c=relaxed/simple;\n\tbh=zyy46RCeSc6gcpsPMeHG3R7Qnm5WRGOy2WdJakTxPpw=;\n\th=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type;\n b=pzf1FScU/tlU+oRcIVtfKQytYgdZZFE+bKVQaLUh6P762Se8na0EVaI83FNokIrF9CYbpxM8anxo41JG/uERAL+Z4z9xNGhgFBcBncPgkkZt2SYC2OBeU4+dazeLDrOZQDLY5Kw/XgVDuKQy5TH9sBlcYpm3oweaZ2XzkcHVrM8=", "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=xVrF2afIAO04+rkv1v9aSPXIFRC8O7Y53EIltUpShl4=;\n b=FwxyP+DeHZtZCJ64KW51mOxC5Jp5FojKwpJfNqL8CLZyVz1onXn2h7mRIPaOeH0FdmCkvIu4XZvRV+AQ/FW9Yb8IElG27ybY5Ug/Z0Cs8OfKCE+0p4FQkUuw6KNKip0Ucrr+Xtfcj2qE1U+Jcq9Q3kHA2dxcWmWcEPBiUhyIKx537RMjzh49mg3Jjr4OD3WUkQ+Hjs4y9y7AiZMknvwCMmQEkADJGBwtR8sCGJCmGz8OXSP0PbwsKm9NXYJ6JFZNeUE7jD3IkuggPepMHz+mxItT6jVtw8sidDve/IHQCneuIhnaxJTwpZ7jOtJX+DoizqB+O+viV9HcGbNCioYCkg==" ], "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=Nk6Zb2+d; arc=fail smtp.client-ip=40.93.196.56", "i=1; mx.microsoft.com 1; spf=pass (sender ip is\n 216.228.117.160) smtp.rcpttodomain=shazbot.org smtp.mailfrom=nvidia.com;\n dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com;\n dkim=none (message not signed); arc=none (0)" ], "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=xVrF2afIAO04+rkv1v9aSPXIFRC8O7Y53EIltUpShl4=;\n b=Nk6Zb2+dhGinMhNXQ/cevS2VFLao2d9X7plUMmCHuQycgqfKq/wYxJ6vjXrWrkHhwEM4jLDiGH6VzSA0v7/yTwt3es2e7dSIPoxSeUqdFs1bnQ3A6jFxQAFgrG3HgSFX8Q78YZ+ITmLT4D/A58f4phv6bpHH+1LPSxGQu3jF4Wh7vSyT+9jPMGzuA5QZeMD77Ni06hc4b7INYTrvSgUCF65OzDw7hF4qPFX0yf57hFw+h4VHL2vQ1JIn2VlNOvgWxgsazoeydjbvlFAVKA+rbu+U4eT/E1jT9HAMrWjr7I6q/tcQLii5ZOr1Z1gQNYWk0Q422RgmdsZNwOKlsNDtIA==", "X-MS-Exchange-Authentication-Results": "spf=pass (sender IP is 216.228.117.160)\n smtp.mailfrom=nvidia.com; dkim=none (message not signed)\n header.d=none;dmarc=pass action=none header.from=nvidia.com;", "Received-SPF": "Pass (protection.outlook.com: domain of nvidia.com designates\n 216.228.117.160 as permitted sender) receiver=protection.outlook.com;\n client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C", "From": "Ankit Agrawal <ankita@nvidia.com>", "To": "<alex@shazbot.org>, <kvm@vger.kernel.org>", "CC": "<jgg@ziepe.ca>, <yishaih@nvidia.com>, <skolothumtho@nvidia.com>,\n\t<kevin.tian@intel.com>, <ankita@nvidia.com>, <bhelgaas@google.com>,\n\t<linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>", "Subject": "[PATCH v3 1/1] vfio/nvgrace-gpu: Add Blackwell-Next GPU readiness\n check via CXL DVSEC", "Date": "Thu, 16 Apr 2026 01:45:04 +0000", "Message-ID": "<20260416014504.63067-1-ankita@nvidia.com>", "X-Mailer": "git-send-email 2.34.1", "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", "Content-Transfer-Encoding": "8bit", "Content-Type": "text/plain", "X-NV-OnPremToCloud": "ExternallySecured", "X-EOPAttributedMessage": "0", "X-MS-PublicTrafficType": "Email", "X-MS-TrafficTypeDiagnostic": "BN1PEPF00004683:EE_|IA0PR12MB7697:EE_", "X-MS-Office365-Filtering-Correlation-Id": "f086d314-f634-4995-c188-08de9b59d26f", "X-MS-Exchange-SenderADCheck": "1", "X-MS-Exchange-AntiSpam-Relay": "0", "X-Microsoft-Antispam": "\n\tBCL:0;ARA:13230040|1800799024|36860700016|376014|82310400026|18002099003|56012099003;", "X-Microsoft-Antispam-Message-Info": "\n\tXQL9iueo8QI6007w7jqNKFw6rNwRRYurtInnezQobIW5n+CmBauQsOo26EufpLD/IvHkq/7ie/akjIO8lpRzVabzJVBkVL3Bo1Vgmi08xRuhrwabVDhcm6gNEnzjSaWkRAF0DFfOQbZ7Z3osYZvrJPJBiv74hgZxjyWjEvCRzcs4oxyjcfFkIQI+Hcf5dIHXgNka9oq/oKGHMR1jYeoAPMc1n7Be+12GNCiCTolw+0OWF+PZua4I/gTV5fRzBfUljfLqzGVOPua7JR3B32+Ywe35arP3N5sw70vvfsLX9dLQaZ7Gr1Dm8cmXQnjHWj2NEiU1ijO9ekkHKtOO5fvt5EHZKwcj9ZVmS68A2TrCLxUS812EpoxTbtF1p5eyJUWx0q1Fu2vf9POZfwAlJZCeQPrYlZKUfSWFKdXDtAorJWYGecKoCel7RzeNhb8Nn4TkygeBN86Ih/BpUREVSHTpzfLxPn7P0zjdO7vpTzSNWXngf3wskdZvPiYpgjVvGFfslPrKKm2Of8BzXiU5kXTRF86541e2VrrXsTv9tbtvMnZVCGD/xSzGYzoeiaiGa2h1bRJIY5yragbsCRY+vdoJh9ioh44NTVhcaX1fG6lhFcpSp4gwCEl+O5jX+nr5MN2ihXtPc3Ddt5RtFCJWP9s0pcQEowyx0edJYKkPZ/Z/O/8d2qGoV2By+ACiQQASdkSIsMsu96mTvLuTJuljpTyHO8bKCZFuOF7kQFpMQJdWtsONH5nMhFQ5+QqsKCvR+8ANadTm4A0KKkrQUY9VMhwyTQ==", "X-Forefront-Antispam-Report": "\n\tCIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(1800799024)(36860700016)(376014)(82310400026)(18002099003)(56012099003);DIR:OUT;SFP:1101;", "X-MS-Exchange-AntiSpam-MessageData-ChunkCount": "1", "X-MS-Exchange-AntiSpam-MessageData-0": "\n\tcYS39FNVHGu5UEYJ8PLfcZiwjFefzjeJ8yKYytY6MErN8nFLCKSjTGxuOy3OAKEWul9pe5792R2r+luTCFufeM2u/EZM3fspdQToDBIzoE5T+gFdOfGaImJLgYgmdNNB+MV5BOSJwZT83Y/YQGETzmgOpVkwZMLp0M9ooeh9+V12B4Bdv1oBZbi6/pBfrmS14oTMkvZ2D7L4rNA+p2/kL7IDufCySdv/7n8D75/gkDAHqbRS2hUP31KpfKQtg3OqWlwF0mliFMzr54+1EI1Yiqy0hc4EPsnqokSxWpTAXBfaVr3dU9B25U5smcNBIGLOUgh/znApybChSnrtReFhhDTGh8DZk9xnqVFbVo/Z2caEP6HKwxwu5gB0wSXdoaGkmBkMXsmhdfknQF9MKVNZUlu9NgVoxPplmZnH5E28nr1mfY6kgTlj+NDG6UIxVgyT", "X-OriginatorOrg": "Nvidia.com", "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "16 Apr 2026 01:45:21.6311\n (UTC)", "X-MS-Exchange-CrossTenant-Network-Message-Id": "\n f086d314-f634-4995-c188-08de9b59d26f", "X-MS-Exchange-CrossTenant-Id": "43083d15-7273-40c1-b7db-39efd9ccc17a", "X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp": "\n TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com]", "X-MS-Exchange-CrossTenant-AuthSource": "\n\tBN1PEPF00004683.namprd03.prod.outlook.com", "X-MS-Exchange-CrossTenant-AuthAs": "Anonymous", "X-MS-Exchange-CrossTenant-FromEntityHeader": "HybridOnPrem", "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "IA0PR12MB7697" }, "content": "Add a CXL DVSEC-based readiness check for Blackwell-Next GPUs alongside\nthe existing legacy BAR0 polling path. On probe and after reset, the\ndriver reads the CXL Device DVSEC capability to determine whether the\nGPU memory is valid. This is checked by polling on the Memory_Active bit\nbased on the Memory_Active_Timeout. Also check if MEM_INFO_VALID is set\nwithin 1 second per CXL spec 4.0 Tables 8-13. If not, return error.\n\nA static inline wrapper dispatches to the appropriate readiness check\nbased on whether the CXL DVSEC capability is present.\n\nAdd PCI_DVSEC_CXL_MEM_ACTIVE_TIMEOUT to pci_regs.h for the timeout\nfield encoding.\n\ncc: Kevin Tian <kevin.tian@intel.com>\nSuggested-by: Alex Williamson <alex@shazbot.org>\nSigned-off-by: Ankit Agrawal <ankita@nvidia.com>\n---\n drivers/vfio/pci/nvgrace-gpu/main.c | 96 ++++++++++++++++++++++++++---\n include/uapi/linux/pci_regs.h | 1 +\n 2 files changed, 89 insertions(+), 8 deletions(-)", "diff": "diff --git a/drivers/vfio/pci/nvgrace-gpu/main.c b/drivers/vfio/pci/nvgrace-gpu/main.c\nindex fa056b69f899..70020af85901 100644\n--- a/drivers/vfio/pci/nvgrace-gpu/main.c\n+++ b/drivers/vfio/pci/nvgrace-gpu/main.c\n@@ -64,6 +64,8 @@ struct nvgrace_gpu_pci_core_device {\n \tbool has_mig_hw_bug;\n \t/* GPU has just been reset */\n \tbool reset_done;\n+\t/* CXL Device DVSEC offset; 0 if not present (legacy GB path) */\n+\tint cxl_dvsec;\n };\n \n static void nvgrace_gpu_init_fake_bar_emu_regs(struct vfio_device *core_vdev)\n@@ -242,7 +244,7 @@ static void nvgrace_gpu_close_device(struct vfio_device *core_vdev)\n \tvfio_pci_core_close_device(core_vdev);\n }\n \n-static int nvgrace_gpu_wait_device_ready(void __iomem *io)\n+static int nvgrace_gpu_wait_device_ready_legacy(void __iomem *io)\n {\n \tunsigned long timeout = jiffies + msecs_to_jiffies(POLL_TIMEOUT_MS);\n \n@@ -256,6 +258,76 @@ static int nvgrace_gpu_wait_device_ready(void __iomem *io)\n \treturn -ETIME;\n }\n \n+/*\n+ * Decode the 3-bit Memory_Active_Timeout field from CXL DVSEC Range 1 Low\n+ * (bits 15:13) into milliseconds. Encoding per CXL spec r4.0 sec 8.1.3.8.2:\n+ * 000b = 1s, 001b = 4s, 010b = 16s, 011b = 64s, 100b = 256s,\n+ * 101b-111b = reserved (clamped to 256s).\n+ */\n+static inline unsigned long cxl_mem_active_timeout_ms(u8 timeout)\n+{\n+\treturn 1000UL << (2 * min_t(u8, timeout, 4));\n+}\n+\n+/*\n+ * Check if CXL DVSEC reports memory as valid and active.\n+ */\n+static inline bool cxl_dvsec_mem_is_active(u32 status)\n+{\n+\treturn (status & PCI_DVSEC_CXL_MEM_INFO_VALID) &&\n+\t (status & PCI_DVSEC_CXL_MEM_ACTIVE);\n+}\n+\n+static int nvgrace_gpu_wait_device_ready_cxl(struct nvgrace_gpu_pci_core_device *nvdev)\n+{\n+\tstruct pci_dev *pdev = nvdev->core_device.pdev;\n+\tint cxl_dvsec = nvdev->cxl_dvsec;\n+\tunsigned long mem_info_valid_deadline;\n+\tunsigned long timeout;\n+\tu32 dvsec_memory_status;\n+\tu8 mem_active_timeout;\n+\n+\tpci_read_config_dword(pdev, cxl_dvsec + PCI_DVSEC_CXL_RANGE_SIZE_LOW(0),\n+\t\t\t &dvsec_memory_status);\n+\n+\tif (cxl_dvsec_mem_is_active(dvsec_memory_status))\n+\t\treturn 0;\n+\n+\tmem_active_timeout = FIELD_GET(PCI_DVSEC_CXL_MEM_ACTIVE_TIMEOUT,\n+\t\t\t\t dvsec_memory_status);\n+\n+\ttimeout = jiffies +\n+\t\t msecs_to_jiffies(cxl_mem_active_timeout_ms(mem_active_timeout));\n+\n+\tmem_info_valid_deadline = jiffies + msecs_to_jiffies(POLL_QUANTUM_MS);\n+\n+\tdo {\n+\t\tpci_read_config_dword(pdev,\n+\t\t\t\t cxl_dvsec + PCI_DVSEC_CXL_RANGE_SIZE_LOW(0),\n+\t\t\t\t &dvsec_memory_status);\n+\n+\t\tif (cxl_dvsec_mem_is_active(dvsec_memory_status))\n+\t\t\treturn 0;\n+\n+\t\t/* Bail early if MEM_INFO_VALID is not set within 1 second */\n+\t\tif (!(dvsec_memory_status & PCI_DVSEC_CXL_MEM_INFO_VALID) &&\n+\t\t time_after(jiffies, mem_info_valid_deadline))\n+\t\t\treturn -ETIME;\n+\n+\t\tmsleep(POLL_QUANTUM_MS);\n+\t} while (!time_after(jiffies, timeout));\n+\n+\treturn -ETIME;\n+}\n+\n+static inline int nvgrace_gpu_wait_device_ready(struct nvgrace_gpu_pci_core_device *nvdev,\n+\t\t\t\t\t\tvoid __iomem *io)\n+{\n+\treturn nvdev->cxl_dvsec ?\n+\t\tnvgrace_gpu_wait_device_ready_cxl(nvdev) :\n+\t\tnvgrace_gpu_wait_device_ready_legacy(io);\n+}\n+\n /*\n * If the GPU memory is accessed by the CPU while the GPU is not ready\n * after reset, it can cause harmless corrected RAS events to be logged.\n@@ -275,7 +347,7 @@ nvgrace_gpu_check_device_ready(struct nvgrace_gpu_pci_core_device *nvdev)\n \tif (!__vfio_pci_memory_enabled(vdev))\n \t\treturn -EIO;\n \n-\tret = nvgrace_gpu_wait_device_ready(vdev->barmap[0]);\n+\tret = nvgrace_gpu_wait_device_ready(nvdev, vdev->barmap[0]);\n \tif (ret)\n \t\treturn ret;\n \n@@ -1146,11 +1218,16 @@ static bool nvgrace_gpu_has_mig_hw_bug(struct pci_dev *pdev)\n * Ensure that the BAR0 region is enabled before accessing the\n * registers.\n */\n-static int nvgrace_gpu_probe_check_device_ready(struct pci_dev *pdev)\n+static int nvgrace_gpu_probe_check_device_ready(struct nvgrace_gpu_pci_core_device *nvdev)\n {\n+\tstruct pci_dev *pdev = nvdev->core_device.pdev;\n \tvoid __iomem *io;\n \tint ret;\n \n+\t/* CXL path only reads PCI config space; no need to map BAR0. */\n+\tif (nvdev->cxl_dvsec)\n+\t\treturn nvgrace_gpu_wait_device_ready_cxl(nvdev);\n+\n \tret = pci_enable_device(pdev);\n \tif (ret)\n \t\treturn ret;\n@@ -1165,7 +1242,7 @@ static int nvgrace_gpu_probe_check_device_ready(struct pci_dev *pdev)\n \t\tgoto iomap_exit;\n \t}\n \n-\tret = nvgrace_gpu_wait_device_ready(io);\n+\tret = nvgrace_gpu_wait_device_ready_legacy(io);\n \n \tpci_iounmap(pdev, io);\n iomap_exit:\n@@ -1183,10 +1260,6 @@ static int nvgrace_gpu_probe(struct pci_dev *pdev,\n \tu64 memphys, memlength;\n \tint ret;\n \n-\tret = nvgrace_gpu_probe_check_device_ready(pdev);\n-\tif (ret)\n-\t\treturn ret;\n-\n \tret = nvgrace_gpu_fetch_memory_property(pdev, &memphys, &memlength);\n \tif (!ret)\n \t\tops = &nvgrace_gpu_pci_ops;\n@@ -1198,6 +1271,13 @@ static int nvgrace_gpu_probe(struct pci_dev *pdev,\n \n \tdev_set_drvdata(&pdev->dev, &nvdev->core_device);\n \n+\tnvdev->cxl_dvsec = pci_find_dvsec_capability(pdev, PCI_VENDOR_ID_CXL,\n+\t\t\t\t\t\t PCI_DVSEC_CXL_DEVICE);\n+\n+\tret = nvgrace_gpu_probe_check_device_ready(nvdev);\n+\tif (ret)\n+\t\tgoto out_put_vdev;\n+\n \tif (ops == &nvgrace_gpu_pci_ops) {\n \t\tnvdev->has_mig_hw_bug = nvgrace_gpu_has_mig_hw_bug(pdev);\n \ndiff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h\nindex 14f634ab9350..718fb630f5bb 100644\n--- a/include/uapi/linux/pci_regs.h\n+++ b/include/uapi/linux/pci_regs.h\n@@ -1357,6 +1357,7 @@\n #define PCI_DVSEC_CXL_RANGE_SIZE_LOW(i)\t\t(0x1C + (i * 0x10))\n #define PCI_DVSEC_CXL_MEM_INFO_VALID\t\t\t_BITUL(0)\n #define PCI_DVSEC_CXL_MEM_ACTIVE\t\t\t_BITUL(1)\n+#define PCI_DVSEC_CXL_MEM_ACTIVE_TIMEOUT\t\t__GENMASK(15, 13)\n #define PCI_DVSEC_CXL_MEM_SIZE_LOW\t\t\t__GENMASK(31, 28)\n #define PCI_DVSEC_CXL_RANGE_BASE_HIGH(i)\t\t(0x20 + (i * 0x10))\n #define PCI_DVSEC_CXL_RANGE_BASE_LOW(i)\t\t(0x24 + (i * 0x10))\n", "prefixes": [ "v3", "1/1" ] }