mirror of https://github.com/torvalds/linux.git
gpu: nova-core: implement Display for Spec
Implement Display for Spec. This simplifies the dev_info!() code for
printing banners such as:
NVIDIA (Chipset: GA104, Architecture: Ampere, Revision: a.1)
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Timur Tabi <ttabi@nvidia.com>
Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Message-ID: <20251114024109.465136-2-jhubbard@nvidia.com>
This commit is contained in:
parent
5949d419c1
commit
38b7cc448a
|
|
@ -180,6 +180,18 @@ fn new(bar: &Bar0) -> Result<Spec> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Spec {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(
|
||||||
|
f,
|
||||||
|
"Chipset: {}, Architecture: {:?}, Revision: {}",
|
||||||
|
self.chipset,
|
||||||
|
self.chipset.arch(),
|
||||||
|
self.revision
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Structure holding the resources required to operate the GPU.
|
/// Structure holding the resources required to operate the GPU.
|
||||||
#[pin_data]
|
#[pin_data]
|
||||||
pub(crate) struct Gpu {
|
pub(crate) struct Gpu {
|
||||||
|
|
@ -206,13 +218,7 @@ pub(crate) fn new<'a>(
|
||||||
) -> impl PinInit<Self, Error> + 'a {
|
) -> impl PinInit<Self, Error> + 'a {
|
||||||
try_pin_init!(Self {
|
try_pin_init!(Self {
|
||||||
spec: Spec::new(bar).inspect(|spec| {
|
spec: Spec::new(bar).inspect(|spec| {
|
||||||
dev_info!(
|
dev_info!(pdev.as_ref(),"NVIDIA ({})\n", spec);
|
||||||
pdev.as_ref(),
|
|
||||||
"NVIDIA (Chipset: {}, Architecture: {:?}, Revision: {})\n",
|
|
||||||
spec.chipset,
|
|
||||||
spec.chipset.arch(),
|
|
||||||
spec.revision
|
|
||||||
);
|
|
||||||
})?,
|
})?,
|
||||||
|
|
||||||
// We must wait for GFW_BOOT completion before doing any significant setup on the GPU.
|
// We must wait for GFW_BOOT completion before doing any significant setup on the GPU.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue