From: Zhi Wang The host must negotiate the RPC protocol with the booted GSP plugin before sending instance configuration. After observing the plugin's ready marker, initialize the shared RPC buffers and submit the existing typed version-negotiation request through the instance's PluginRpc channel. 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 | 20 ++++++++++++++++---- drivers/gpu/nova-core/vgpu/fw/commands.rs | 1 - drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs | 2 -- drivers/gpu/nova-core/vgpu/instance.rs | 3 +++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/nova-core/vgpu/commands.rs b/drivers/gpu/nova-core/vgpu/commands.rs index d0fd7ab2593b..c1783ace8b3f 100644 --- a/drivers/gpu/nova-core/vgpu/commands.rs +++ b/drivers/gpu/nova-core/vgpu/commands.rs @@ -38,11 +38,15 @@ }, sbuffer::SBufferIter, vgpu::{ - fw::commands::{ - AssignedVfVgpuType, - VgpuProperties, - VgpuPropertiesSchema, // + fw::{ + commands::{ + AssignedVfVgpuType, + VgpuProperties, + VgpuPropertiesSchema, // + }, + RpcMessage, }, + gsp_plugin_rpc::PluginRpc, instance::Gfid, Dbdf, }, @@ -223,3 +227,11 @@ pub(super) fn send_cleanup(dev: &device::Device, cmdq: &Cmdq<'_>, gfid: Gfid) -> dev_dbg!(dev, "cleanup: gfid={} done\n", gfid.get()); Ok(()) } + +/// Negotiate the host protocol with a bootloaded GSP plugin. +pub(super) fn negotiate_plugin_version( + dev: &device::Device, + rpc: &mut PluginRpc<'_, '_>, +) -> Result { + rpc.rpc_call(dev, RpcMessage::VersionNegotiation, &[]) +} diff --git a/drivers/gpu/nova-core/vgpu/fw/commands.rs b/drivers/gpu/nova-core/vgpu/fw/commands.rs index a8f6f0316d25..168a2447b67c 100644 --- a/drivers/gpu/nova-core/vgpu/fw/commands.rs +++ b/drivers/gpu/nova-core/vgpu/fw/commands.rs @@ -31,7 +31,6 @@ use super::bindings; /// Message types supported by the nova-core plugin RPC channel. -#[expect(dead_code)] #[derive(Clone, Copy)] #[repr(u32)] pub(crate) enum RpcMessage { diff --git a/drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs b/drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs index d96f6072a941..c68681d8d08b 100644 --- a/drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs +++ b/drivers/gpu/nova-core/vgpu/gsp_plugin_rpc.rs @@ -65,7 +65,6 @@ pub(super) fn comm(&self) -> &CommBufferRegion<'map, 'gpu> { } /// Initialize the control and response buffers for the first RPC. - #[expect(dead_code)] pub(super) fn init_rpc(&mut self) -> Result { self.comm.initialize()?; self.message_sequence = 0; @@ -82,7 +81,6 @@ fn next_sequence(&self) -> u32 { } /// Write one RPC message, ring the VF doorbell, and wait for its response. - #[expect(dead_code)] pub(super) fn rpc_call( &mut self, dev: &device::Device, diff --git a/drivers/gpu/nova-core/vgpu/instance.rs b/drivers/gpu/nova-core/vgpu/instance.rs index 94735df79e1a..2c8542a45643 100644 --- a/drivers/gpu/nova-core/vgpu/instance.rs +++ b/drivers/gpu/nova-core/vgpu/instance.rs @@ -31,6 +31,7 @@ use super::{ commands::{ + negotiate_plugin_version, send_bootload, send_cleanup, send_shutdown, // @@ -161,6 +162,8 @@ impl<'gpu> VgpuInstance<'gpu> { fn activate(&mut self, vgpu: &VgpuManagerInner<'gpu>) -> Result { let dev = vgpu.dev; self.bootload(dev, vgpu.cmdq, &vgpu.fifo_engine_list)?; + self.plugin_rpc.init_rpc()?; + negotiate_plugin_version(dev, &mut self.plugin_rpc)?; Ok(()) } -- 2.53.0