[PATCH v2 29/32] gpu: nova-core: vgpu: update the GSP plugin BME state
From: Zhi Wang
Date: Mon Sep 14 2026 - 04:08:42 EST
The vGPU manager reports the enabled bus-mastering state to the GSP plugin
after its initial configuration. The guest can then use the vGPU from now
on.
Add the BME state request and NVKV encoder, and send the enabled state
after configuration succeeds.
Co-developed-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
Signed-off-by: Eliot Courtney <ecourtney@xxxxxxxxxx>
Signed-off-by: Zhi Wang <zhiw@xxxxxxxxxx>
---
drivers/gpu/nova-core/vgpu/commands.rs | 14 ++++++++++++++
drivers/gpu/nova-core/vgpu/fw/commands.rs | 22 ++++++++++++++++++++++
drivers/gpu/nova-core/vgpu/instance.rs | 4 +++-
3 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/nova-core/vgpu/commands.rs b/drivers/gpu/nova-core/vgpu/commands.rs
index 2089c91b648e..7bfde85ad35a 100644
--- a/drivers/gpu/nova-core/vgpu/commands.rs
+++ b/drivers/gpu/nova-core/vgpu/commands.rs
@@ -37,6 +37,8 @@
VgpuProperties, //
};
+use super::fw::commands::encode_plugin_set_bme;
+
use super::fw::{
GMCAPI_CMD_BOOTLOAD_GSP_VGPU_PLUGIN_TASK,
GMCAPI_CMD_CLEANUP_GSP_VGPU_PLUGIN_RESOURCES,
@@ -177,3 +179,15 @@ pub(super) fn send_plugin_config(
config,
)
}
+
+/// Update the bus-mastering state reported to the GSP plugin.
+pub(super) fn set_plugin_bme(
+ dev: &device::Device<device::Bound>,
+ bar0: Bar0<'_>,
+ gfid: Gfid,
+ rpc: &mut PluginRpc<'_, '_>,
+ enable: bool,
+) -> Result {
+ let bme = encode_plugin_set_bme(enable)?;
+ rpc.rpc_call_nvkv(dev, bar0, gfid, RpcMessage::UpdateBmeState, &bme)
+}
diff --git a/drivers/gpu/nova-core/vgpu/fw/commands.rs b/drivers/gpu/nova-core/vgpu/fw/commands.rs
index 0386c8178962..7030479441e8 100644
--- a/drivers/gpu/nova-core/vgpu/fw/commands.rs
+++ b/drivers/gpu/nova-core/vgpu/fw/commands.rs
@@ -33,6 +33,7 @@
pub(in crate::vgpu) 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,
+ UpdateBmeState = bindings::MESSAGE_NV_VGPU_CPU_RPC_MSG_UPDATE_BME_STATE,
}
bitfield! {
@@ -385,3 +386,24 @@ pub(in crate::vgpu) fn encode_plugin_config_params(
request.encode(&mut encoder)?;
Ok(encoder.finish())
}
+
+nvkv_encode! {
+ struct PluginSetBmeRequest {
+ bme_enable: Key<bool, { Self::BME_ENABLE_KEY }, u32>,
+ }
+}
+
+impl PluginSetBmeRequest {
+ const BME_ENABLE_KEY: KeyId = 0x0100;
+}
+
+/// Encodes a plugin BME state update using the typed NVKV schema.
+pub(in crate::vgpu) fn encode_plugin_set_bme(enable: bool) -> Result<EncodedStream> {
+ let request = PluginSetBmeRequest {
+ bme_enable: enable.into(),
+ };
+
+ let mut encoder = Encoder::new();
+ request.encode(&mut encoder)?;
+ Ok(encoder.finish())
+}
diff --git a/drivers/gpu/nova-core/vgpu/instance.rs b/drivers/gpu/nova-core/vgpu/instance.rs
index c3ec24f48682..5d71de0ad108 100644
--- a/drivers/gpu/nova-core/vgpu/instance.rs
+++ b/drivers/gpu/nova-core/vgpu/instance.rs
@@ -48,6 +48,7 @@
send_cleanup,
send_plugin_config,
send_shutdown,
+ set_plugin_bme,
Dbdf,
VgpuProperties, //
};
@@ -390,7 +391,8 @@ pub(super) fn activate_instance(
instance.plugin_rpc.init_rpc()?;
negotiate_plugin_version(dev, bar0, gfid, &mut instance.plugin_rpc)?;
- instance.configure_plugin(dev, bar0)
+ instance.configure_plugin(dev, bar0)?;
+ set_plugin_bme(dev, bar0, gfid, &mut instance.plugin_rpc, true)
}
/// Stop the plugin and release the instance's firmware and host resources.