[PATCH v2 6/7] gpu: nova-core: set RMSetSriovMode when vGPU is enabled
Zhi Wang <[email protected]>
| Newsgroups | dev.linux.lists.nova-gpu,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
The registry object "RMSetSriovMode" is required to be set when vGPU is enabled. Set "RMSetSriovMode" to 1 when nova-core is loading the GSP firmware and initializing the GSP registry objects, if vGPU is enabled. Signed-off-by: Zhi Wang <[email protected]> --- drivers/gpu/nova-core/gsp/boot.rs | 2 +- drivers/gpu/nova-core/gsp/commands.rs | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nova-core/gsp/boot.rs b/drivers/gpu/nova-core/gsp/boot.rs index 55ea8e38aa79..c607081e8242 100644 --- a/drivers/gpu/nova-core/gsp/boot.rs +++ b/drivers/gpu/nova-core/gsp/boot.rs @@ -94,7 +94,7 @@ pub(crate) fn boot( self.cmdq .send_command_no_wait(bar, commands::SetSystemInfo::new(pdev, chipset))?; self.cmdq - .send_command_no_wait(bar, commands::SetRegistry::new()?)?; + .send_command_no_wait(bar, commands::SetRegistry::new(ctx.vgpu)?)?; hal.post_boot(&self, &mut ctx, &gsp_fw)?; diff --git a/drivers/gpu/nova-core/gsp/commands.rs b/drivers/gpu/nova-core/gsp/commands.rs index 3dccb012a37e..bf2b569f5578 100644 --- a/drivers/gpu/nova-core/gsp/commands.rs +++ b/drivers/gpu/nova-core/gsp/commands.rs @@ -33,6 +33,7 @@ }, }, sbuffer::SBufferIter, + vgpu::VgpuManager, }; /// The `GspSetSystemInfo` command. @@ -70,8 +71,8 @@ pub(crate) struct SetRegistry { } impl SetRegistry { - /// Creates a new `SetRegistry` command, using a set of hardcoded entries. - pub(crate) fn new() -> Result<Self> { + /// Creates a new `SetRegistry` command. + pub(crate) fn new(vgpu: &VgpuManager) -> Result<Self> { let mut entries = KVec::new(); // RMSecBusResetEnable - enables PCI secondary bus reset. @@ -103,6 +104,17 @@ pub(crate) fn new() -> Result<Self> { GFP_KERNEL, )?; + if vgpu.enabled() { + // RMSetSriovMode - required when vGPU is enabled. + entries.push( + RegistryEntry { + key: "RMSetSriovMode", + value: 1, + }, + GFP_KERNEL, + )?; + } + Ok(Self { entries }) } } -- 2.51.0