Re: [PATCH 3/3] gpu: nova-core: gsp: send the PCI domain, bus and device to GSP-RM
From: Gary Guo
Date: Mon Nov 30 2026 - 08:12:18 EST
On Fri Nov 27, 2026 at 11:46 AM GMT, Alexandre Courbot wrote:
> From: John Hubbard <jhubbard@xxxxxxxxxx>
>
> Open RM sends the PCI location of the GPU to GSP-RM as one word, which
> gpuEncodeDomainBusDevice() builds: the domain in bits 63:32, the bus
> number in bits 15:8 and the device number in bits 7:0.
>
> Nova-core's system-info command sends the PCI device ID in that word
> instead: the bus number, the device number and the function number, with
> no domain. The two words are equal only for a GPU at device 0, function
> 0 of domain 0, so GSP-RM receives a wrong location for a GPU anywhere
> else.
>
> Send the domain, the bus number and the device number instead, in the
> layout that Open RM uses.
>
> Fixes: edcb134264f7 ("gpu: nova-core: gsp: Add SetSystemInfo command")
> Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
> Co-developed-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> Signed-off-by: Alexandre Courbot <acourbot@xxxxxxxxxx>
> ---
> drivers/gpu/nova-core/gsp/fw/commands.rs | 30 +++++++++++++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/nova-core/gsp/fw/commands.rs b/drivers/gpu/nova-core/gsp/fw/commands.rs
> index 37b89e62387f..a1a5e0d5569e 100644
> --- a/drivers/gpu/nova-core/gsp/fw/commands.rs
> +++ b/drivers/gpu/nova-core/gsp/fw/commands.rs
> @@ -88,7 +88,7 @@ pub(crate) fn init<'a>(
> gpuPhysAddr: dev.resource_start(0)?,
> gpuPhysFbAddr: dev.resource_start(1)?,
> gpuPhysInstAddr: dev.resource_start(3)?,
> - nvDomainBusDeviceFunc: u64::from(dev.dev_id().into_raw()),
> + nvDomainBusDeviceFunc: u64::from(DomainBusDevice::new(dev)),
>
> // Using TASK_SIZE in r535_gsp_rpc_set_system_info() seems wrong because
> // TASK_SIZE is per-task. That's probably a design issue in GSP-RM though.
> @@ -377,6 +377,34 @@ struct GspInitRequest {
> }
> }
>
> +bitfield! {
> + /// A GPU's PCI location as GSP-RM reads it: the domain, the bus number and the device number.
nit: the latter part of this line can probably be moved down to be in the same
paragraph of "function".
Or it can be omitted completely, given this info is already available in the
name and also the bitfeidl definition.
Best,
Gary
> + ///
> + /// The function is omitted on purpose.
> + struct DomainBusDevice(u64) {
> + /// PCI domain number.
> + 63:32 domain;
> + /// PCI bus number.
> + 15:8 bus;
> + /// PCI device number.
> + ///
> + /// Note: this field is larger than the equivalent one in [`pci::Bdf`]. This follows OpenRM.
> + 7:0 device;
> + }
> +}
> +
> +impl DomainBusDevice {
> + /// Returns the PCI location of `dev`.
> + fn new(dev: &pci::Device<device::Bound>) -> Self {
> + let dev_id = dev.dev_id();
> +
> + Self::zeroed()
> + .with_domain(dev.domain_nr())
> + .with_bus(u8::from(dev_id.bus()))
> + .with_device(u8::from(dev_id.device()))
> + }
> +}
> +
> // Decode:
>
> // Should decode with UnknownKeyPolicy::Ignore.