* [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion
@ 2025-09-26 13:05 Danilo Krummrich
2025-09-26 13:05 ` [PATCH 2/2] gpu: nova-core: gsp: do not unwrap() SGEntry Danilo Krummrich
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Danilo Krummrich @ 2025-09-26 13:05 UTC (permalink / raw)
To: acourbot, ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh, lossin,
a.hindborg, aliceryhl, tmgross
Cc: nouveau, dri-devel, rust-for-linux, Danilo Krummrich
Meanwhile nova-core depends on CONFIG_64BIT and a raw DmaAddress is
always a u64, hence remove the now actually useless conversion.
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
drivers/gpu/nova-core/firmware/gsp.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs
index 9b70095434c6..ca785860e1c8 100644
--- a/drivers/gpu/nova-core/firmware/gsp.rs
+++ b/drivers/gpu/nova-core/firmware/gsp.rs
@@ -202,8 +202,7 @@ pub(crate) fn new<'a, 'b>(
let mut level0_data = kvec![0u8; GSP_PAGE_SIZE]?;
// Fill level 1 page entry.
- #[allow(clippy::useless_conversion)]
- let level1_entry = u64::from(level1.iter().next().unwrap().dma_address());
+ let level1_entry = level1.iter().next().unwrap().dma_address();
let dst = &mut level0_data[..size_of_val(&level1_entry)];
dst.copy_from_slice(&level1_entry.to_le_bytes());
base-commit: 299eb32863e584cfff7c6b667c3e92ae7d4d2bf9
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] gpu: nova-core: gsp: do not unwrap() SGEntry
2025-09-26 13:05 [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion Danilo Krummrich
@ 2025-09-26 13:05 ` Danilo Krummrich
2025-09-27 0:32 ` John Hubbard
2025-09-27 0:30 ` [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion John Hubbard
2025-09-29 4:18 ` Alexandre Courbot
2 siblings, 1 reply; 6+ messages in thread
From: Danilo Krummrich @ 2025-09-26 13:05 UTC (permalink / raw)
To: acourbot, ojeda, alex.gaynor, boqun.feng, gary, bjorn3_gh, lossin,
a.hindborg, aliceryhl, tmgross
Cc: nouveau, dri-devel, rust-for-linux, Danilo Krummrich
Don't use unwrap() to extract an Option<SGEntry>, instead handle the
error condition gracefully.
Fixes: a841614e607c ("gpu: nova-core: firmware: process and prepare the GSP firmware")
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
---
drivers/gpu/nova-core/firmware/gsp.rs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs
index ca785860e1c8..6b0761460a57 100644
--- a/drivers/gpu/nova-core/firmware/gsp.rs
+++ b/drivers/gpu/nova-core/firmware/gsp.rs
@@ -202,9 +202,10 @@ pub(crate) fn new<'a, 'b>(
let mut level0_data = kvec![0u8; GSP_PAGE_SIZE]?;
// Fill level 1 page entry.
- let level1_entry = level1.iter().next().unwrap().dma_address();
- let dst = &mut level0_data[..size_of_val(&level1_entry)];
- dst.copy_from_slice(&level1_entry.to_le_bytes());
+ let level1_entry = level1.iter().next().ok_or(EINVAL)?;
+ let level1_entry_addr = level1_entry.dma_address();
+ let dst = &mut level0_data[..size_of_val(&level1_entry_addr)];
+ dst.copy_from_slice(&level1_entry_addr.to_le_bytes());
// Turn the level0 page table into a [`DmaObject`].
DmaObject::from_data(dev, &level0_data)?
--
2.51.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion
2025-09-26 13:05 [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion Danilo Krummrich
2025-09-26 13:05 ` [PATCH 2/2] gpu: nova-core: gsp: do not unwrap() SGEntry Danilo Krummrich
@ 2025-09-27 0:30 ` John Hubbard
2025-09-29 4:18 ` Alexandre Courbot
2 siblings, 0 replies; 6+ messages in thread
From: John Hubbard @ 2025-09-27 0:30 UTC (permalink / raw)
To: Danilo Krummrich, acourbot, ojeda, alex.gaynor, boqun.feng, gary,
bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross
Cc: nouveau, dri-devel, rust-for-linux
On 9/26/25 6:05 AM, Danilo Krummrich wrote:
> Meanwhile nova-core depends on CONFIG_64BIT and a raw DmaAddress is
> always a u64, hence remove the now actually useless conversion.
>
Because I'm already here and have at least mild OCD, I'll suggest
saying it like this:
"Because nova-core depends on CONFIG_64BIT and a raw DmaAddress is
always a u64, we can remove the now actually useless conversion."
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
> drivers/gpu/nova-core/firmware/gsp.rs | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Either way, it's clearly correct, so:
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
thanks,
John Hubbard
>
> diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs
> index 9b70095434c6..ca785860e1c8 100644
> --- a/drivers/gpu/nova-core/firmware/gsp.rs
> +++ b/drivers/gpu/nova-core/firmware/gsp.rs
> @@ -202,8 +202,7 @@ pub(crate) fn new<'a, 'b>(
> let mut level0_data = kvec![0u8; GSP_PAGE_SIZE]?;
>
> // Fill level 1 page entry.
> - #[allow(clippy::useless_conversion)]
> - let level1_entry = u64::from(level1.iter().next().unwrap().dma_address());
> + let level1_entry = level1.iter().next().unwrap().dma_address();
> let dst = &mut level0_data[..size_of_val(&level1_entry)];
> dst.copy_from_slice(&level1_entry.to_le_bytes());
>
>
> base-commit: 299eb32863e584cfff7c6b667c3e92ae7d4d2bf9
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] gpu: nova-core: gsp: do not unwrap() SGEntry
2025-09-26 13:05 ` [PATCH 2/2] gpu: nova-core: gsp: do not unwrap() SGEntry Danilo Krummrich
@ 2025-09-27 0:32 ` John Hubbard
0 siblings, 0 replies; 6+ messages in thread
From: John Hubbard @ 2025-09-27 0:32 UTC (permalink / raw)
To: Danilo Krummrich, acourbot, ojeda, alex.gaynor, boqun.feng, gary,
bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross
Cc: nouveau, dri-devel, rust-for-linux
On 9/26/25 6:05 AM, Danilo Krummrich wrote:
> Don't use unwrap() to extract an Option<SGEntry>, instead handle the
> error condition gracefully.
>
> Fixes: a841614e607c ("gpu: nova-core: firmware: process and prepare the GSP firmware")
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
> ---
> drivers/gpu/nova-core/firmware/gsp.rs | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
Looks good!
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
thanks,
John Hubbard
> diff --git a/drivers/gpu/nova-core/firmware/gsp.rs b/drivers/gpu/nova-core/firmware/gsp.rs
> index ca785860e1c8..6b0761460a57 100644
> --- a/drivers/gpu/nova-core/firmware/gsp.rs
> +++ b/drivers/gpu/nova-core/firmware/gsp.rs
> @@ -202,9 +202,10 @@ pub(crate) fn new<'a, 'b>(
> let mut level0_data = kvec![0u8; GSP_PAGE_SIZE]?;
>
> // Fill level 1 page entry.
> - let level1_entry = level1.iter().next().unwrap().dma_address();
> - let dst = &mut level0_data[..size_of_val(&level1_entry)];
> - dst.copy_from_slice(&level1_entry.to_le_bytes());
> + let level1_entry = level1.iter().next().ok_or(EINVAL)?;
> + let level1_entry_addr = level1_entry.dma_address();
> + let dst = &mut level0_data[..size_of_val(&level1_entry_addr)];
> + dst.copy_from_slice(&level1_entry_addr.to_le_bytes());
>
> // Turn the level0 page table into a [`DmaObject`].
> DmaObject::from_data(dev, &level0_data)?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion
2025-09-26 13:05 [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion Danilo Krummrich
2025-09-26 13:05 ` [PATCH 2/2] gpu: nova-core: gsp: do not unwrap() SGEntry Danilo Krummrich
2025-09-27 0:30 ` [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion John Hubbard
@ 2025-09-29 4:18 ` Alexandre Courbot
2025-10-15 23:20 ` Alexandre Courbot
2 siblings, 1 reply; 6+ messages in thread
From: Alexandre Courbot @ 2025-09-29 4:18 UTC (permalink / raw)
To: Danilo Krummrich, acourbot, ojeda, alex.gaynor, boqun.feng, gary,
bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross
Cc: nouveau, dri-devel, rust-for-linux
On Fri Sep 26, 2025 at 10:05 PM JST, Danilo Krummrich wrote:
> Meanwhile nova-core depends on CONFIG_64BIT and a raw DmaAddress is
> always a u64, hence remove the now actually useless conversion.
>
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Thanks - staging both for being applied to drm-rust-next after -rc1 is
released.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion
2025-09-29 4:18 ` Alexandre Courbot
@ 2025-10-15 23:20 ` Alexandre Courbot
0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Courbot @ 2025-10-15 23:20 UTC (permalink / raw)
To: Alexandre Courbot, Danilo Krummrich, ojeda, alex.gaynor,
boqun.feng, gary, bjorn3_gh, lossin, a.hindborg, aliceryhl,
tmgross
Cc: nouveau, dri-devel, rust-for-linux
On Mon Sep 29, 2025 at 1:18 PM JST, Alexandre Courbot wrote:
> On Fri Sep 26, 2025 at 10:05 PM JST, Danilo Krummrich wrote:
>> Meanwhile nova-core depends on CONFIG_64BIT and a raw DmaAddress is
>> always a u64, hence remove the now actually useless conversion.
>>
>> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
>
> Thanks - staging both for being applied to drm-rust-next after -rc1 is
> released.
Both patches pushed to drm-rust-next, thank you!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-10-15 23:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26 13:05 [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion Danilo Krummrich
2025-09-26 13:05 ` [PATCH 2/2] gpu: nova-core: gsp: do not unwrap() SGEntry Danilo Krummrich
2025-09-27 0:32 ` John Hubbard
2025-09-27 0:30 ` [PATCH 1/2] gpu: nova-core: gsp: remove useless conversion John Hubbard
2025-09-29 4:18 ` Alexandre Courbot
2025-10-15 23:20 ` Alexandre Courbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).