From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.52.21 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796200796; b=pL/YXNBsZ5ZzkhSphJui+NZdskQJuzllhI1eBNb6dT9/c/VrFYy8QQmJZiaz55zRqkvr joAlGZPF8zRcXgqXkE0XfA5Hq9eXUKvf4i8S4lm4ER63tRL+FiQgaMwfOYQzCdKKXSYUZ Sq3z9TLYZ7soVab1a+gWhcak+8UcEBLzA/ncaoQMkaSKSz/P2I/CFQH4eKq/cjcelDyEd ep/tB5LBLjTyhfGY/egwRyZbcXmHcyn3O//YiD+Xe9fYGzcCWL1q0EdnWMphiLGf6aA87 Phkh5x4yNREw2POwnLDXv/UYQB81hxbp1H6zv6m7n/XO9kZy4lBmYC1twFU5PDKQg7w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796200796; h=DMARC-Filter:DKIM-Signature:Received:Received: X-MS-Exchange-Authentication-Results:Received-SPF:Received:Received: Received:From:To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:Content-Type: X-Originating-IP:X-ClientProxiedBy:X-EOPAttributedMessage: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-Id: X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=6D2uMR06RctgdIwgkSVLB1k6u2EH5YafgGdvAlu+YvA=; b=I8fTFBcWjcXM3tN2O3r6kJh4zk7PWPpopNU6sARfvC0o6HoOYqTJr3Jc70S3ccJ2ra1C e9qMiM59X8rFh2CH48dXYBCKo9nSvHdw3BYZn0eB2JC2J4k87I1azTRYf7XnYVxp6t7YO srjPkimnKqlV/vESnebcUwfw1FbXlnBRDfIeCbmcO6vJ3xgtnMXRbIcswbEm0rPJLxA+r EETFhhb03W/bJr2Z3/0sM536yUjnRdUofPuEj0sRXEpkXdNaOnpSkOX5VSzWHuwCNdyYz Ll66hsoZux86QrEg725LGI0sRvbs5Wv2ikBpLJfjtctSKGsMdf0heyP08VIX8PRuqvA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=rbRAI1dt; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.52.21 Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazon11011021.outbound.protection.outlook.com [52.101.52.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C848606A322; Wed, 2 Dec 2026 08:39:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6C848606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=rbRAI1dt ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Kexjoxw7lS+bbNBjvPozfOMRt0vn0waWuPqkMJYTSjqq8A/bvrksNs+BCTowTFDd2Rp0fYk7uhsfo9aIJQzItu0zVTsCYvlpw0vuAxM/99rU5eBchRsZaG3KOJA1v9Xk+znrLjnMA4zzLpqp9E4//Iyr1TEFgbzYRUp3wNWDHNREV9CGNHese8f/t84M/S7sFhFX9T/YueXWjBdwA9EW2MZL9Wp7seYcLSDuzQt/QNEEjCm3DV6o9zCPZlLQmg/w5WulroSoQ/v4nBzwBZz4MVq9ReMzHNB0SnIdI6cN6IkPB1MZyOiZvAz8I9LcWSYSlCNL9BMn9KPXomwuhf7iEQ== 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=6D2uMR06RctgdIwgkSVLB1k6u2EH5YafgGdvAlu+YvA=; b=CgMJwF6Uv17+j5ib5FBgLy194zt1Yhbq7ssXLgFr13fFgvwONer8sHCAE9PWohGN7XFqERLoU7EoVYVT8ptK9kFyhwpclhJY+M8kK8AJDPCeE7m2YA2VB+hiIKbWkuh3STHxKbmVptLiECp+V0GJzMZTPAwG89wBNZzLAO6R+a4cGiNrYhOcXMVhUQS2/kHazRzg0+GufZG9Xy167WGYhh3jgFS0XEXrhXIAedixFnnHMtECSCQJBkGxWV1Cu+ZtFOeI0m9MDkh6vZAVbvWn2HUKGcP4/C/Po6YMH0zC3MGTObOjJK58AEw1LjQY+V3r4YjOyxTueFHsRE/aSLyoyQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6D2uMR06RctgdIwgkSVLB1k6u2EH5YafgGdvAlu+YvA=; b=rbRAI1dtwezbeAPEI6DB2K2pL6sq0BApbmcc+zNBtB0O449iLT6+NCUvE8c9K4kFniwTjVvQ0fUdNPXlrlcxffPh9U0qnhQcKY3odb5x8TT/UuMoRb2il33Y+QrQy65vYoKqI9LABxzR7naHTkgk25x/vwGW4W33qO+4YeBOEoKMzGMJ5PFP6ucXhDbbCXfvq6c9VhIktqqdt+wlbToPGO3xtzn0eMCnTBS/bn+ww80CmkWe/losGK9djGB28FGbej3YDN+aTcnPytXqHZxX0TFX3B3eGMPQ8gbyNuHT0QccXB+pJkmBn8jcOrBuIh6h5esltok2rx8PqP0k1WH9HA== Received: from BN1PR13CA0012.namprd13.prod.outlook.com (2603:10b6:408:e2::17) by CY3PR12MB9630.namprd12.prod.outlook.com (2603:10b6:930:101::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.7; Wed, 2 Dec 2026 08:39:49 +0000 Received: from LV8PEPF0000005E.namprd02.prod.outlook.com (2603:10b6:408:e2:cafe::5f) by BN1PR13CA0012.outlook.office365.com (2603:10b6:408:e2::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Wed, 2 Dec 2026 08:39:49 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by LV8PEPF0000005E.mail.protection.outlook.com (10.167.245.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Wed, 2 Dec 2026 08:39:49 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 00:39:31 -0800 Received: from kalok-SPC741D16QM3.nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 00:39:17 -0800 From: Alok Kumar To: , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 31/34] gpu: nova-core: vgpu: add CeUtils commands Date: Wed, 2 Dec 2026 13:58:55 +0530 Message-ID: <122edb7e4f630d04d0fa5444d0bbef6dae30d16d.1796191008.git.alkumar@nvidia.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV8PEPF0000005E:EE_|CY3PR12MB9630:EE_ X-MS-Office365-Filtering-Correlation-Id: e82aa8af-5b04-47f8-de6d-08df504fd39f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|23010399003|1800799024|36860700016|7416014|376014|6133799003|18002099003|22082099003|3023799007|261022105027099003|56012099006|261028144727099003|11063799006|260925021911599003|260925021311599003|260925022911599003|261026121527099003|261022075727099003|261026140227099003|261021121427099003|261009223027099003|261102123227099003|261021123027099003|10067099003; X-Microsoft-Antispam-Message-Info: qCH+9MZFifbrrmQTSuvsTw9WFvce4lPJ7S7/oZ5ISwhFBr/J9kARNp2Wx9Wr1w2yW11mW47ak5gWgevkIkaRUVlaz9GjgqsE8C00yNBg/hGeMctax3Tqv2+CIob2xjvm3/k4EIhj/1pnwYImKGWP10VyQEmjX1uatAlAMTa1KK3rnO4/KSOkCw1W89hw+u1n1lCS9APifM1rellacG4xt2mbFYch/ZSsjsDM95IqLzOmj7mNOJWu0Wxsyr6tMruQTR10JKul8Bo9gv/PjY9MO1sb9X+axNSL4RGwQN0arkPkuDUuT75LVJY2zS3lOcZ6bOnxfJTB3VlA8gIJaGZGyEfSMOr1cCjzBHcDRo3+05zgzKCcvMKK1Q3VTqb/5EC/1LuS7reAPdgL4nKvyj6farpW0OTZaS4JgdVGqS8DER//7Iisj0Tmk98dlRy6tus+j9zn8kU+M5sB2D+E3keTXT2EB0JuBGzF1igWSU3pJ0dGBfWHe4NIHulAzpgIJJrGc/9nUjTudp2n/rSYiAgcW6MTd0rzE6PHXbJQMaeht7VGXLfkhvZrPGuYv5CEwnFCRO+EdzI32L/C+IsTDTP+eFQRO+FktwiSkKWZVHj+RHIP1RMxkB4YwEtsLDw3FpAb8wM8aOdexPTe13z1EI1ew2WrxtxhmTZsudsF+zuMcYOovgtRVETAEfWEZW43lC8iYKuzFJBbrNj/C3fU9JOmWg== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(23010399003)(1800799024)(36860700016)(7416014)(376014)(6133799003)(18002099003)(22082099003)(3023799007)(261022105027099003)(56012099006)(261028144727099003)(11063799006)(260925021911599003)(260925021311599003)(260925022911599003)(261026121527099003)(261022075727099003)(261026140227099003)(261021121427099003)(261009223027099003)(261102123227099003)(261021123027099003)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iqmaSv2OWWviBKtNOUJKrg1qGbaL0cA8bLMJ62G8BDUVE2GlSGPYm39IU7vfUHfs1WerWtjOFvjJp5e2rFQQFpyqU/AI0eBLpWEu7GEQ3xtkrLI6N0qz2cqDoyZ/SKyTYH8JJ45vdfXn0As/Q+M2siSAljTaJwS3nZtW0rpwVhMEgTPETf+/35FUwzcA5qrY+2FCm7AVwLReeqcwmybTmN/40kjOrwVJGZC87aicb+3TFm4UKhGiI842MVSCKA+R0/wM7asTwAnQWfY7oMJcfjKXuu+udkaSvVUIIp5+j/7r5z42S0AHzo/u/2hlKMFfFIYXZp3o1suxbLbghJbWxARdHUHzhG73iG40BSmNGGYS2lhBJjisrZgsv9r7Zkm1ugFigKA9fNcYUGw2h3hr17Z7/fNJ7gDNm00OmZKQOY15WJkN9dyTSm6RlTo49QBs X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 08:39:49.1625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e82aa8af-5b04-47f8-de6d-08df504fd39f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: LV8PEPF0000005E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY3PR12MB9630 From: Zhi Wang Add Cmdq operations to allocate and free a CeUtils channel and submit guest VRAM scrub requests. Decode the allocation and scrub replies, and validate the returned semaphore address and aperture. Distinguish an explicit allocation rejection from failures that may leave firmware owning the channel, so callers can decide whether to retain its host resources. Signed-off-by: Zhi Wang Co-developed-by: Alexandre Courbot Signed-off-by: Alexandre Courbot Signed-off-by: Alok Kumar --- drivers/gpu/nova-core/vgpu/commands.rs | 153 ++++++++++++++++++ drivers/gpu/nova-core/vgpu/fw.rs | 2 + drivers/gpu/nova-core/vgpu/fw/commands.rs | 48 +++++- .../gpu/nova-core/vgpu/fw/r000_00/bindings.rs | 1 + 4 files changed, 202 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nova-core/vgpu/commands.rs b/drivers/gpu/nova-core/vgpu/commands.rs index 0456a928cf41..de700ff923f8 100644 --- a/drivers/gpu/nova-core/vgpu/commands.rs +++ b/drivers/gpu/nova-core/vgpu/commands.rs @@ -10,6 +10,7 @@ use kernel::{ device, + num::casts::usize_as_u64, prelude::*, time::Delta, transmute::AsBytes, // @@ -36,16 +37,22 @@ GmcCommandId, GSP_PAGE_SIZE, // }, + mm::PAGE_SIZE, sbuffer::SBufferIter, vgpu::{ fw::{ commands::{ encode_plugin_set_bme, + AllocCeutilsRequest, + AllocCeutilsResponse, AssignedVfVgpuType, + ScrubGuestFbRequest, + ScrubGuestFbResponse, VgpuProperties, VgpuPropertiesSchema, // }, RpcMessage, + NV_ADDR_FBMEM, // }, gsp_plugin_rpc::PluginRpc, instance::Gfid, @@ -255,3 +262,149 @@ pub(super) fn set_plugin_bme( let bme = encode_plugin_set_bme(enable)?; rpc.rpc_call_nvkv(dev, RpcMessage::UpdateBmeState, &bme) } + +impl CommandToGsp for AllocCeutilsRequest { + const COMMAND: GmcCommandId = GmcCommandId::VgpuMgrAllocGspCeutils; + type Command = Self; + type Reply = AllocCeutilsResponse; + const MAX_REPLY_SIZE: u32 = cv!(size_of::()); + type InitError = Infallible; + + fn init(&self) -> impl Init { + *self + } +} + +impl MessageFromGsp for AllocCeutilsResponse { + type InitError = Error; + + fn read(payload: &mut MessagePayload<'_>) -> Result { + payload.read() + } +} + +/// The `VGPU_MGR_FREE_GSP_CEUTILS` command. +struct FreeCeutils(Gfid); + +impl CommandToGsp for FreeCeutils { + const COMMAND: GmcCommandId = GmcCommandId::VgpuMgrFreeGspCeutils; + type Command = u32; + type Reply = (); + const MAX_REPLY_SIZE: u32 = 0; + type InitError = Infallible; + + fn init(&self) -> impl Init { + u32::from(self.0.get()).to_le() + } +} + +impl CommandToGsp for ScrubGuestFbRequest { + const COMMAND: GmcCommandId = GmcCommandId::VgpuMgrScrubGuestFb; + type Command = Self; + type Reply = ScrubGuestFbResponse; + const MAX_REPLY_SIZE: u32 = cv!(size_of::()); + type InitError = Infallible; + + fn init(&self) -> impl Init { + *self + } +} + +impl MessageFromGsp for ScrubGuestFbResponse { + type InitError = Error; + + fn read(payload: &mut MessagePayload<'_>) -> Result { + payload.read() + } +} + +/// Whether a failed allocation may still have transferred CHID ownership to firmware. +#[expect(dead_code)] +pub(super) enum CeUtilsAllocError { + /// A matching firmware response explicitly rejected the allocation. + NotOwned(Error), + /// The request may have completed despite a transport or response-validation error. + MayOwn(Error), +} + +/// Allocate a CeUtils channel and validate its semaphore description. +#[expect(dead_code)] +pub(super) fn alloc_ceutils( + dev: &device::Device, + cmdq: &Cmdq<'_>, + gfid: Gfid, + chid: u32, +) -> core::result::Result { + let request = AllocCeutilsRequest { + gfid: u32::from(gfid.get()).to_le(), + fixed_chid: chid.to_le(), + force_ceid: u32::MAX.to_le(), + swizz_id: 0, + }; + + dev_dbg!(dev, "alloc CeUtils: gfid={} chid={}\n", gfid.get(), chid,); + + let response = cmdq + .send_gmc_command(request, |_| Ok(())) + .map_err(CeUtilsAllocError::MayOwn)? + .map_err(|_| CeUtilsAllocError::NotOwned(EIO))?; + + let semaphore_address = u64::from_le(response.semaphore_address); + let semaphore_aperture = u32::from_le(response.semaphore_aperture); + let page_size = usize_as_u64(PAGE_SIZE); + + if semaphore_address == 0 + || !semaphore_address.is_multiple_of(page_size) + || semaphore_aperture != NV_ADDR_FBMEM + { + return Err(CeUtilsAllocError::MayOwn(EINVAL)); + } + + dev_dbg!( + dev, + "alloc CeUtils: gfid={} semaphore={:#x}\n", + gfid.get(), + semaphore_address, + ); + Ok(semaphore_address) +} + +/// Release a CeUtils allocation, including one whose allocation reply was lost. +#[expect(dead_code)] +pub(super) fn free_ceutils(dev: &device::Device, cmdq: &Cmdq<'_>, gfid: Gfid) -> Result { + dev_dbg!(dev, "free CeUtils: gfid={}\n", gfid.get()); + + cmdq.send_gmc_command(FreeCeutils(gfid), |_| Ok(()))? + .map_err(|_| EIO) +} + +/// Submit an asynchronous guest FB scrub and return its work identifier. +#[expect(dead_code)] +pub(super) fn submit_ceutils_scrub( + dev: &device::Device, + cmdq: &Cmdq<'_>, + gfid: Gfid, + fb_offset: u64, + fb_size: u64, +) -> Result { + let request = ScrubGuestFbRequest { + gfid: u32::from(gfid.get()).to_le(), + reserved: 0, + fb_offset: fb_offset.to_le(), + fb_size: fb_size.to_le(), + }; + + dev_dbg!( + dev, + "submit scrub: gfid={} offset={:#x} size={:#x}\n", + gfid.get(), + fb_offset, + fb_size, + ); + + let response = cmdq + .send_gmc_command(request, |_| Ok(()))? + .map_err(|_| EIO)?; + + u32::try_from(u64::from_le(response.work_id)).map_err(|_| EOVERFLOW) +} diff --git a/drivers/gpu/nova-core/vgpu/fw.rs b/drivers/gpu/nova-core/vgpu/fw.rs index 76bd2b7e4e52..02f51bb8cf7f 100644 --- a/drivers/gpu/nova-core/vgpu/fw.rs +++ b/drivers/gpu/nova-core/vgpu/fw.rs @@ -31,6 +31,8 @@ VGPU_CPU_GSP_VGPU_TASK_LOG_BUFF_REGION_SIZE, // }; +pub(super) use bindings::NV_ADDR_FBMEM; + /// State observed in the response buffer for an expected RPC sequence. pub(super) enum RpcResponse { Pending { diff --git a/drivers/gpu/nova-core/vgpu/fw/commands.rs b/drivers/gpu/nova-core/vgpu/fw/commands.rs index 7d67a1172d3d..9164e28123f6 100644 --- a/drivers/gpu/nova-core/vgpu/fw/commands.rs +++ b/drivers/gpu/nova-core/vgpu/fw/commands.rs @@ -20,10 +20,10 @@ Array, Encodable, Encoder, - Index, // + Index, Key, KeyId, - Required, + Required, // }, mm::vram::VramRegion, vgpu::Dbdf, // @@ -330,6 +330,50 @@ pub(crate) fn encode_plugin_config_params( Ok(encoder.finish()) } +#[repr(C)] +#[derive(Clone, Copy)] +pub(crate) struct AllocCeutilsRequest { + pub(crate) gfid: u32, + pub(crate) fixed_chid: u32, + pub(crate) force_ceid: u32, + pub(crate) swizz_id: u32, +} + +// SAFETY: All fields are integers, and the struct has no padding. +unsafe impl kernel::transmute::AsBytes for AllocCeutilsRequest {} + +// SAFETY: All fields are integers, for which all bit patterns are valid. +unsafe impl kernel::transmute::FromBytes for AllocCeutilsRequest {} + +#[repr(C)] +#[derive(FromBytes, IntoBytes)] +pub(crate) struct AllocCeutilsResponse { + pub(crate) semaphore_address: u64, + pub(crate) semaphore_aperture: u32, + _reserved: u32, +} + +#[repr(C)] +#[derive(Clone, Copy)] +pub(crate) struct ScrubGuestFbRequest { + pub(crate) gfid: u32, + pub(crate) reserved: u32, + pub(crate) fb_offset: u64, + pub(crate) fb_size: u64, +} + +// SAFETY: All fields are integers, and the struct has no padding. +unsafe impl kernel::transmute::AsBytes for ScrubGuestFbRequest {} + +// SAFETY: All fields are integers, for which all bit patterns are valid. +unsafe impl kernel::transmute::FromBytes for ScrubGuestFbRequest {} + +#[repr(C)] +#[derive(FromBytes, IntoBytes)] +pub(crate) struct ScrubGuestFbResponse { + pub(crate) work_id: u64, +} + nvkv_encode! { struct PluginSetBmeRequest { bme_enable: Key, diff --git a/drivers/gpu/nova-core/vgpu/fw/r000_00/bindings.rs b/drivers/gpu/nova-core/vgpu/fw/r000_00/bindings.rs index 85f965335b64..e46f7339544a 100644 --- a/drivers/gpu/nova-core/vgpu/fw/r000_00/bindings.rs +++ b/drivers/gpu/nova-core/vgpu/fw/r000_00/bindings.rs @@ -8,6 +8,7 @@ pub type u16_ = __u16; pub type u32_ = __u32; pub type u64_ = __u64; +pub const NV_ADDR_FBMEM: u32 = 2; pub const GSP_PLUGIN_BOOTLOADED: u32 = 1315261039; pub const VGPU_CPU_GSP_CTRL_BUFF_VERSION: u32 = 2; pub const VGPU_CPU_GSP_CTRL_BUFF_REGION_SIZE: u32 = 4096;