public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Gary Guo" <gary@garyguo.net>
Cc: "Timur Tabi" <ttabi@nvidia.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"John Hubbard" <jhubbard@nvidia.com>,
	"Joel Fernandes" <joelagnelf@nvidia.com>,
	<rust-for-linux@vger.kernel.org>, <nouveau@lists.freedesktop.org>
Subject: Re: [PATCH v8 11/13] gpu: nova-core: align LibosMemoryRegionInitArgument size to page size
Date: Sat, 24 Jan 2026 07:54:29 +0900	[thread overview]
Message-ID: <DFWC7A81FRFW.3347HWNH0CE6L@nvidia.com> (raw)
In-Reply-To: <DFW69A2VGB81.1YJ26924JUFII@garyguo.net>

On Sat Jan 24, 2026 at 3:14 AM JST, Gary Guo wrote:
> On Thu Jan 22, 2026 at 10:28 PM GMT, Timur Tabi wrote:
>> From: Alexandre Courbot <acourbot@nvidia.com>
>>
>> On Turing and GA100 (i.e. the versions that use Libos v2), GSP-RM insists
>> that the 'size' parameter of the LibosMemoryRegionInitArgument struct be
>> aligned to 4KB.  The logging buffers are already aligned to that size, so
>> only the GSP_ARGUMENTS_CACHED struct needs to be adjusted.  Make that
>> adjustment by adding padding to the end of the struct.
>>
>> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
>> Signed-off-by: Timur Tabi <ttabi@nvidia.com>
>> ---
>>  drivers/gpu/nova-core/gsp.rs    |  8 ++++----
>>  drivers/gpu/nova-core/gsp/fw.rs | 14 +++++++++++++-
>>  2 files changed, 17 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/gpu/nova-core/gsp.rs b/drivers/gpu/nova-core/gsp.rs
>> index 766fd9905358..bcf6ce18a4a1 100644
>> --- a/drivers/gpu/nova-core/gsp.rs
>> +++ b/drivers/gpu/nova-core/gsp.rs
>> @@ -27,7 +27,7 @@
>>  use crate::{
>>      gsp::cmdq::Cmdq,
>>      gsp::fw::{
>> -        GspArgumentsCached,
>> +        GspArgumentsAligned,
>>          LibosMemoryRegionInitArgument, //
>>      },
>>      num,
>> @@ -114,7 +114,7 @@ pub(crate) struct Gsp {
>>      /// Command queue.
>>      pub(crate) cmdq: Cmdq,
>>      /// RM arguments.
>> -    rmargs: CoherentAllocation<GspArgumentsCached>,
>> +    rmargs: CoherentAllocation<GspArgumentsAligned>,
>>  }
>>  
>>  impl Gsp {
>> @@ -133,7 +133,7 @@ pub(crate) fn new(pdev: &pci::Device<device::Bound>) -> impl PinInit<Self, Error
>>                  logintr: LogBuffer::new(dev)?,
>>                  logrm: LogBuffer::new(dev)?,
>>                  cmdq: Cmdq::new(dev)?,
>> -                rmargs: CoherentAllocation::<GspArgumentsCached>::alloc_coherent(
>> +                rmargs: CoherentAllocation::<GspArgumentsAligned>::alloc_coherent(
>>                      dev,
>>                      1,
>>                      GFP_KERNEL | __GFP_ZERO,
>> @@ -149,7 +149,7 @@ pub(crate) fn new(pdev: &pci::Device<device::Bound>) -> impl PinInit<Self, Error
>>                          libos[1] = LibosMemoryRegionInitArgument::new("LOGINTR", &logintr.0)
>>                      )?;
>>                      dma_write!(libos[2] = LibosMemoryRegionInitArgument::new("LOGRM", &logrm.0))?;
>> -                    dma_write!(rmargs[0] = fw::GspArgumentsCached::new(cmdq))?;
>> +                    dma_write!(rmargs[0].inner = fw::GspArgumentsCached::new(cmdq))?;
>>                      dma_write!(libos[3] = LibosMemoryRegionInitArgument::new("RMARGS", rmargs))?;
>>                  },
>>              }))
>> diff --git a/drivers/gpu/nova-core/gsp/fw.rs b/drivers/gpu/nova-core/gsp/fw.rs
>> index caeb0d251fe5..89be26b597d1 100644
>> --- a/drivers/gpu/nova-core/gsp/fw.rs
>> +++ b/drivers/gpu/nova-core/gsp/fw.rs
>> @@ -904,9 +904,21 @@ pub(crate) fn new(cmdq: &Cmdq) -> Self {
>>  // SAFETY: Padding is explicit and will not contain uninitialized data.
>>  unsafe impl AsBytes for GspArgumentsCached {}
>>  
>> +/// On Turing and GA100, the entries in the `LibosMemoryRegionInitArgument`
>> +/// must all be a multiple of GSP_PAGE_SIZE in size, so add padding to force it
>> +/// to that size.
>> +#[repr(C)]
>> +pub(crate) struct GspArgumentsAligned {
>
> Hi Timir,
>
> This is not "aligned" to GSP_PAGE_SIZE, but rather just "padded" to
> GSP_PAGE_SIZE, so calling it `GspArgumentsAligned` would be a misnomer.
>
> `GspArgumentsPadded`, perhaps?

Sounds good, let me convert when applying.

  parent reply	other threads:[~2026-01-23 22:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22 22:28 [PATCH v8 00/13] gpu: nova-core: add Turing support Timur Tabi
2026-01-22 22:28 ` [PATCH v8 01/13] gpu: nova-core: rename Imem to ImemSecure Timur Tabi
2026-01-22 22:28 ` [PATCH v8 02/13] gpu: nova-core: add ImemNonSecure section infrastructure Timur Tabi
2026-01-23 18:07   ` Gary Guo
2026-01-23 23:02     ` Alexandre Courbot
2026-01-22 22:28 ` [PATCH v8 03/13] gpu: nova-core: support header parsing on Turing/GA100 Timur Tabi
2026-01-22 22:28 ` [PATCH v8 04/13] gpu: nova-core: add support for Turing/GA100 fwsignature Timur Tabi
2026-01-22 22:28 ` [PATCH v8 05/13] gpu: nova-core: add NV_PFALCON_FALCON_DMATRFCMD::with_falcon_mem() Timur Tabi
2026-01-22 22:28 ` [PATCH v8 06/13] gpu: nova-core: move some functions into the HAL Timur Tabi
2026-01-22 22:28 ` [PATCH v8 07/13] gpu: nova-core: Add basic Turing HAL Timur Tabi
2026-01-22 22:28 ` [PATCH v8 08/13] gpu: nova-core: add NV_PFALCON_FALCON_ENGINE::reset_engine() Timur Tabi
2026-01-22 22:28 ` [PATCH v8 09/13] gpu: nova-core: add Falcon HAL method load_method() Timur Tabi
2026-01-24  2:26   ` Alexandre Courbot
2026-01-24  4:56     ` Timur Tabi
2026-01-24 11:56       ` Miguel Ojeda
2026-01-24 12:04         ` Danilo Krummrich
2026-01-24 12:40       ` Alexandre Courbot
2026-01-22 22:28 ` [PATCH v8 10/13] gpu: nova-core: add FalconUCodeDescV2 support Timur Tabi
2026-01-22 22:28 ` [PATCH v8 11/13] gpu: nova-core: align LibosMemoryRegionInitArgument size to page size Timur Tabi
2026-01-23 18:14   ` Gary Guo
2026-01-23 18:41     ` Timur Tabi
2026-01-23 20:15       ` John Hubbard
2026-01-23 22:54     ` Alexandre Courbot [this message]
2026-01-22 22:28 ` [PATCH v8 12/13] gpu: nova-core: add PIO support for loading firmware images Timur Tabi
2026-01-22 22:28 ` [PATCH v8 13/13] gpu: nova-core: use the Generic Bootloader to boot FWSEC Timur Tabi
2026-01-23 12:20 ` [PATCH v8 00/13] gpu: nova-core: add Turing support Danilo Krummrich
2026-01-24  2:27   ` Alexandre Courbot
2026-01-23 18:36 ` Gary Guo
2026-01-23 23:01   ` Alexandre Courbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DFWC7A81FRFW.3347HWNH0CE6L@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=jhubbard@nvidia.com \
    --cc=joelagnelf@nvidia.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=ttabi@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox