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.43.69 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796200772; b=J716YGAgNt9TCsFI0kBNmaSxmahRti6qrAzoAVHFpDM7Y9ppBrBj+pZtz/A3wKCIMAT9 QEo4bQDVwTN+u74zHpgEdLTdUtEGxGAsstTF/YmNdJCsE3B08K8d1Tu5zozqYkpnQe/Gl 7FzsEKZJHJslFT/kr7LORxtsdrC2gWGpvBy7uC9YfBsyXGvvCQdZf5sqxB/YB+Qr12+16 t7STBmV4o+BcgnIFL+L4VXuyYphZf9qiLxyleySSpBYUIEene1sgeortrY0cG1gx+jZM/ 7XySF5wSbx1kRZFtLFQ9jlJflzo2s1otySU1N0sIHysWnyFzaqL3SNuGnvY/bTEGpoA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796200772; 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=Z9ELBmgGj52ioT0IuRR23hcA4ijlrkoLS99d+KSMI+M=; b=sZkXBDjWkP+bPNulTZo2R91w3khA9ZLuX25moqsgzxoDNjThhxu+ozdtLPm/ilevKQsO 3A9RzlqpXfHj49ZXebenEuNLJZNsdMTMuqrFTTtAav7pKYtqvYeaiJk1KNJQL8Bb0VVLC 9Pj7mZhlHea8lw06eUWk0ufUuXG3OEaRRpo8x8oYYjOVnCnM/M4O7c0t01aq3M3XuJ0FG baR8Z0rU0KLz+iCRB4uLmKyTsfLa0AUpqnRiSCapfgy50Ir5lcyHzbu1C4vdBByFh3dyL rxqhTNWLKa6wOYr8JZtj7I5m9MpXNZjw+cAY7YkDKGODZNngCK3LyzlqGKRGuPFAOEg== 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=YT8z0gtX; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.43.69 Received: from SJ2PR03CU001.outbound.protection.outlook.com (mail-westusazon11012069.outbound.protection.outlook.com [52.101.43.69]) (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 9BA07606A31A; Wed, 2 Dec 2026 08:39:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9BA07606A31A 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=YT8z0gtX ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GaERepPm/CGdwB2i3w1CpDCsmijGeHPz7/Y5C/WlI+RMcAb97snwuL/rO+z193VuclIvnJY/zxvOOsjStqPVKfpPSpvMO0E/IQHNC6vb+3E8rDxxl3ZvSkSHglYh43fdUDMY4MQHIc1kpecAM+zj6dgVbUdZ09gwubmYN+pyLZDVTG0vNq3xt7lZNp/WjqWKDzxySE7gwQrHKMdov/Bc6w57AXZVMIOt+qJ7XKvcmbL1OUiiqq9bF3ZWcTYhNmBVJyHbDrF+Mxp6SqslBXCRzj20vUF8+nbCd1IozjkETu6B1zjKO6MBrZJzqO31RWpy7xYAfy2dMOxGjSDep6Ge8w== 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=Z9ELBmgGj52ioT0IuRR23hcA4ijlrkoLS99d+KSMI+M=; b=XI1tQaPpcechZiVRIZToEDWx9GpT5tf97qG8PPYbWyqP2eST72ZG85SyfWia7LFL2tq+nJ6Tez58tbChRx9LO3wuogJuhHMzSb/nIi6J6owUrnsmGJuSflaWYY6Jptf/uMLqHx0KOJY8GoBmXA9MrIAmFckGK0/8B00RbM/tfxlLT6QXFKfksNLU4KN703DXWSpGzQNjFz2H/vJK4ExgEgk3t+3H3RaSE1cV8mRWQnZMoPd8mhSMnvo4RTGptRm4iOFTI+2QdTiWP59xwy3C1gMpzhgWUY93Kv1zkPmA2oyv2yB5tOORU85QxfDUbYtWSQPIn83lff5BwdaBIWiFuQ== 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=Z9ELBmgGj52ioT0IuRR23hcA4ijlrkoLS99d+KSMI+M=; b=YT8z0gtXeaJnG+sRflCWxwo/AOaB4PvuL/fQ68hbUb5UuEXcj9ibjqSQgs8watik3a9znoGrOUtKmOOwkK+0udPOPFI2eFj5P7ENB2Fd7bd1SS2ONhkVEhcKN0pWCT1+8Vz5SxB35YQLIwX47yACfRu4A7pWLCJ2UQDTuTrWcJAdYn5xLZjEQOEN5xllGOhFQ3Xtn5D5CwfRQ+P7ugj1DaKFQLK/3HhQ1H/YAgMBC2uV3//GAsQcu/dMblZIDM9y8b8SSF7DaTS+Mndd26aGMH2No0iRB2FlJKGgxhgGrqGCe2ttWoCNRQc7Gyls8Ra5sSMIOanlL+EitwILmzaS3w== Received: from BN9PR03CA0866.namprd03.prod.outlook.com (2603:10b6:408:13d::31) by PH7PR12MB6905.namprd12.prod.outlook.com (2603:10b6:510:1b7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Wed, 2 Dec 2026 08:39:20 +0000 Received: from LV8PEPF0000005C.namprd02.prod.outlook.com (2603:10b6:408:13d:cafe::5b) by BN9PR03CA0866.outlook.office365.com (2603:10b6:408:13d::31) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.662.13 via Frontend Transport; Wed, 2 Dec 2026 08:39:20 +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 LV8PEPF0000005C.mail.protection.outlook.com (10.167.245.132) 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:20 +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:02 -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:38:48 -0800 From: Alok Kumar To: , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v6 29/34] gpu: nova-core: vgpu: send GSP plugin configuration parameters Date: Wed, 2 Dec 2026 13:58:53 +0530 Message-ID: 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: LV8PEPF0000005C:EE_|PH7PR12MB6905:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bd58fcb-3625-46c6-8650-08df504fc246 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|23010399003|1800799024|82310400026|7416014|376014|22082099003|18002099003|10067099003|56012099006|261028144727099003|261022105027099003|261021121427099003|261021123027099003|261102123227099003|261021135927099003|261022075727099003|261026121527099003|261026140227099003|261009223027099003|11063799006|6133799003|3023799007; X-Microsoft-Antispam-Message-Info: d5DohgaqLz0RTrhO+/vYRDVExXnsGN369jz4z5lSrgrISQuVdCwKhhTdKHbIzCqGF69QiXXsJ6UGXMogLAgrb5jmv2xcjxztXvniZKW2jzSAuhA1iTF5Bic2afAGsixyeB/eaHo1cFVla65V3kvAImrp93fY7r3fgjdpR8JDFQJ/b25KBuJDN0xLaaswTsLvvCE6luaXiwTs9Lc3AQsFlzR+/3nnUpR/iAvkQ0H2K0JcanGvXpr/P0aAygnGJZ5bL6AV2+pnvq8vhvW/2t/45+A1LToVTEmf++MYM+apKRK6LJyodrooDutHH49wOPjLLSQoNrNMWuHxJt0XXP0f5Jy0u8+gTjwbR87xxUUP2x9M5jz3O0Yi1tqIVypgakOOcVAAgkfBc5uYvkcNlJ4eHZThbCQ+vHHwCxrpwjZGpCt1HFvRAN1uEaz5hZTBw2Jqu2quZzJwXPv4NLNWZRVXdRJTciW1+Vq7hljYBkTJUupztBYFwfNlhrZDB57rKSHo2A1BOF/UBVy6uxdlKV1yVyHnSZbJt4GwUo/2MNk6gbD1SHIO9WMCgMY9VgkR3PIRfMnvv1I1ggmTHv5aIaaDjhjJTFurPJ3wRCyXIXxE9PIi2IOD5dM/kXeLSZPOV/O6nHn5zIKGiuoI3EQChlsqupOthnOFdpVmj58cXOM6Q8pZ2RiLcdFEaiKEZJYLmD1jbXMz2SKoiAVPL0JtsWIh5Q== 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)(36860700016)(23010399003)(1800799024)(82310400026)(7416014)(376014)(22082099003)(18002099003)(10067099003)(56012099006)(261028144727099003)(261022105027099003)(261021121427099003)(261021123027099003)(261102123227099003)(261021135927099003)(261022075727099003)(261026121527099003)(261026140227099003)(261009223027099003)(11063799006)(6133799003)(3023799007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hrKCpQzqezwV4D6LuyJmA2XyYPAlA7aqVEmhWNNn4ZSDQHjUSYUV+HuxVjRqa8pkYuzvhB1yuIpY96i8fNpkuGptm76TW0CI4vqheJpYspP/UjocHg7gns/xtbFEbg8SKk55E7TJ506wRYlw2g4aPHnb4SDjWdiVhVYDVn90qLKlnc1ixxg4hDv8s3uRQcc4s1xdzmwoB4i0Mti+4Gyrc90OUJ5x7nAp7b3rv04z73I1CGVCrLgipZsr02Q0LLgN2LQsSkM93iyxZxAgFCzsq56AYg18emR1Ulo1Lasv5kwFTxIs7qM2b47ZdUJxiuHsy5YV3EuPwRLvyYx5jp0pp4KvtewT9sZjbTyVsdaq/D34mcOyBDuXwe9v6Meqv40rustwuKXPc4gGfhpEzCZpL9N7AWqvzo1ne3dGM3DdcspJewouO1s0TbuBotAKBLsW X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Dec 2026 08:39:20.0499 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bd58fcb-3625-46c6-8650-08df504fc246 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: LV8PEPF0000005C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6905 From: Zhi Wang The GSP plugin needs instance identity, channel allocation and host parameters before it can serve guest requests. Encode the configuration as an NVKV stream, prefix it with its word count and send SETUP_CONFIG_PARAMS_AND_INIT after protocol negotiation through the instance's PluginRpc channel. Derive the host's opaque device identity from the VF DBDF within the supported 16-bit PCI segment namespace. This identifies the local device without imposing a migration-persistent identity. Describe the supported whole-GPU configuration and distinguish the optional VMM capability bitmap from the separately reported migration features. Encode the host page size with the kernel's infallible conversion. Co-developed-by: Eliot Courtney Signed-off-by: Eliot Courtney Signed-off-by: Zhi Wang Signed-off-by: Alok Kumar --- drivers/gpu/nova-core/vgpu/commands.rs | 9 ++ drivers/gpu/nova-core/vgpu/fw/commands.rs | 118 +++++++++++++++++++ drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs | 17 +++ drivers/gpu/nova-core/vgpu/instance.rs | 16 +++ 4 files changed, 160 insertions(+) diff --git a/drivers/gpu/nova-core/vgpu/commands.rs b/drivers/gpu/nova-core/vgpu/commands.rs index 660df399330e..3517f29e5715 100644 --- a/drivers/gpu/nova-core/vgpu/commands.rs +++ b/drivers/gpu/nova-core/vgpu/commands.rs @@ -235,3 +235,12 @@ pub(super) fn negotiate_plugin_version( ) -> Result { rpc.rpc_call(dev, RpcMessage::VersionNegotiation, &[]) } + +/// Send an instance's encoded configuration to the GSP plugin. +pub(super) fn send_plugin_config( + dev: &device::Device, + rpc: &mut PluginRpc<'_, '_, '_>, + config: &[u64], +) -> Result { + rpc.rpc_call_nvkv(dev, RpcMessage::SetupConfigParamsAndInit, config) +} diff --git a/drivers/gpu/nova-core/vgpu/fw/commands.rs b/drivers/gpu/nova-core/vgpu/fw/commands.rs index e912c8255702..2e70cf8b25b6 100644 --- a/drivers/gpu/nova-core/vgpu/fw/commands.rs +++ b/drivers/gpu/nova-core/vgpu/fw/commands.rs @@ -9,6 +9,7 @@ use kernel::{ alloc::ArrayVec, bitfield, + num::casts::usize_as_u64, prelude::*, // }; @@ -35,6 +36,7 @@ #[repr(u32)] pub(crate) enum RpcMessage { VersionNegotiation = bindings::MESSAGE_NV_VGPU_CPU_RPC_MSG_VERSION_NEGOTIATION, + SetupConfigParamsAndInit = bindings::MESSAGE_NV_VGPU_CPU_RPC_MSG_SETUP_CONFIG_PARAMS_AND_INIT, } #[derive(Clone, Copy)] @@ -211,6 +213,122 @@ impl VgpuProperties { const STRING_LEN: usize = 64; } +#[derive(Clone, Copy)] +#[repr(u32)] +enum HypervisorType { + Unknown = 4, +} + +impl From for u32 { + fn from(value: HypervisorType) -> Self { + // CAST: `HypervisorType` uses the wire field's `u32` representation. + value as u32 + } +} + +#[derive(Clone, Copy)] +#[repr(u32)] +enum CpuArch { + Aarch64 = 1, + X86_64 = 2, +} + +impl CpuArch { + fn host() -> Result { + if cfg!(target_arch = "x86_64") { + Ok(Self::X86_64) + } else if cfg!(target_arch = "aarch64") { + Ok(Self::Aarch64) + } else { + Err(EOPNOTSUPP) + } + } +} + +impl From for u32 { + fn from(value: CpuArch) -> Self { + // CAST: `CpuArch` uses the wire field's `u32` representation. + value as u32 + } +} + +#[derive(Clone, Copy)] +struct MigrationFeature(u32); + +impl MigrationFeature { + const PRESERVE_CTX_BUF: Self = Self(0x4000); +} + +impl From for u32 { + fn from(value: MigrationFeature) -> Self { + value.0 + } +} + +bitfield! { + struct FeatureFlags(u64) { + 3:3 enable_uvm => bool; + 5:5 vmm_migration => bool; + } +} + +nvkv_encode! { + struct PluginConfigParamsRequest { + uuid: Key<[u8; 16], 0x0001>, + dbdf: Key, + device_instance_id: Key, + vgpu_type: Key, + vm_pid: Key, + swizz_id: Key, + num_channels: Key, + num_plugin_channels: Key, + vmm_cap: Key, + migration_feature: Key, + hypervisor_type: Key, + cpu_arch: Key, + page_size: Key, + feature_flags: Key, + } +} + +/// Encodes plugin configuration parameters using the typed NVKV schema. +pub(crate) fn encode_plugin_config_params( + uuid: [u8; 16], + dbdf: Dbdf, + vgpu_type: u32, + vm_pid: u32, + num_channels: u32, + num_plugin_channels: u32, +) -> Result> { + let request = PluginConfigParamsRequest { + uuid: uuid.into(), + dbdf: dbdf.into(), + // The full host PCI address distinguishes VFs within a VM, including VFs + // from different PFs. This opaque identity lasts for the host device lifetime. + device_instance_id: dbdf.into_raw().into(), + vgpu_type: vgpu_type.into(), + vm_pid: vm_pid.into(), + swizz_id: SwizzId::WHOLE_GPU.into(), + num_channels: num_channels.into(), + num_plugin_channels: num_plugin_channels.into(), + // Advertise no optional VMM capabilities (vmioplugin.h VMM_CAP_*), + // independently of the plugin feature_flags and migration_feature below. + vmm_cap: 0.into(), + migration_feature: MigrationFeature::PRESERVE_CTX_BUF.into(), + hypervisor_type: HypervisorType::Unknown.into(), + cpu_arch: CpuArch::host()?.into(), + page_size: usize_as_u64(kernel::page::PAGE_SIZE).into(), + feature_flags: FeatureFlags::zeroed() + .with_enable_uvm(false) + .with_vmm_migration(true) + .into(), + }; + + let mut encoder = Encoder::new(); + request.encode(&mut encoder)?; + Ok(encoder.finish()) +} + // TODO: extract from bindings #[repr(C)] #[derive(FromBytes, IntoBytes)] diff --git a/drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs b/drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs index c22f35b43f0c..cd4aeffe3032 100644 --- a/drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs +++ b/drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs @@ -19,6 +19,7 @@ use kernel::{ device, + num::casts::usize_as_u64, prelude::*, time::{ delay::fsleep, @@ -26,6 +27,7 @@ Instant, Monotonic, // }, + transmute::AsBytes, // }; use crate::{ @@ -109,6 +111,21 @@ pub(super) fn rpc_call( self.wait_response(dev, sequence) } + /// Send an NVKV stream prefixed by its word count. + pub(super) fn rpc_call_nvkv( + &mut self, + dev: &device::Device, + message_type: RpcMessage, + encoded: &[u64], + ) -> Result { + let word_count = usize_as_u64(encoded.len()); + let mut payload = KVec::new(); + payload.extend_from_slice(&word_count.to_le_bytes(), GFP_KERNEL)?; + payload.extend_from_slice(AsBytes::as_bytes(encoded), GFP_KERNEL)?; + + self.rpc_call(dev, message_type, &payload) + } + fn wait_response(&self, dev: &device::Device, expected_sequence: u32) -> Result { let start = Instant::::now(); let timeout = Delta::from_secs(120); diff --git a/drivers/gpu/nova-core/vgpu/instance.rs b/drivers/gpu/nova-core/vgpu/instance.rs index 18aa4d4c7e90..d31f840997a7 100644 --- a/drivers/gpu/nova-core/vgpu/instance.rs +++ b/drivers/gpu/nova-core/vgpu/instance.rs @@ -34,9 +34,11 @@ negotiate_plugin_version, send_bootload, send_cleanup, + send_plugin_config, send_shutdown, // }, fw::commands::{ + encode_plugin_config_params, encode_vgpu_bootload, BootloadInfo, ChannelMapEntry, @@ -164,6 +166,7 @@ fn activate(&mut self, vgpu: &VgpuManagerInner<'gpu>) -> Result { self.bootload(dev, vgpu.cmdq, &vgpu.fifo_engine_list)?; self.plugin_rpc.init_rpc()?; negotiate_plugin_version(dev, &mut self.plugin_rpc)?; + self.configure_plugin(dev)?; Ok(()) } @@ -235,6 +238,19 @@ fn bootload( Ok(()) } + fn configure_plugin(&mut self, dev: &device::Device) -> Result { + let config = encode_plugin_config_params( + [0; 16], + self.dbdf, + self.vgpu_type.vgpu_type_id, + self.vm_pid, + u32::try_from(self.chids.len()).map_err(|_| EOVERFLOW)?, + self.num_plugin_channels, + )?; + + send_plugin_config(dev, &mut self.plugin_rpc, &config) + } + /// Stop the plugin when firmware may own instance resources. fn shutdown(&mut self, dev: &device::Device, cmdq: &Cmdq<'_>) -> Result { if self.needs_teardown {