From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: "Lin, Shuicheng" <shuicheng.lin@intel.com>
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"De Marchi, Lucas" <lucas.demarchi@intel.com>,
"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/3] drm/xe: Change return type of detect_bar2_dgfx() from s64 to u64
Date: Thu, 9 Oct 2025 15:51:24 -0400 [thread overview]
Message-ID: <aOgSPCmwMEFuRajH@intel.com> (raw)
In-Reply-To: <DM4PR11MB5456181EDCAFA6F6A2732B6FEAEEA@DM4PR11MB5456.namprd11.prod.outlook.com>
On Thu, Oct 09, 2025 at 02:06:40PM -0400, Lin, Shuicheng wrote:
> On Thu, Oct 9, 2025 7:53 AM Rodrigo Vivi wrote:
> > On Mon, Oct 06, 2025 at 08:13:27PM +0000, Shuicheng Lin wrote:
> > > The function never returns a negative value, and the return value is
> > > assigned to a u64 variable. Use u64 for better type correctness and
> > > clarity.
> > >
> > > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > > Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
> > > ---
> > > drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
> > > b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
> > > index 9b00bdc8ef1a..d8ded2400706 100644
> > > --- a/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
> > > +++ b/drivers/gpu/drm/xe/xe_ttm_stolen_mgr.c
> > > @@ -81,7 +81,7 @@ static u32 get_wopcm_size(struct xe_device *xe)
> > > return wopcm_size;
> > > }
> > >
> > > -static s64 detect_bar2_dgfx(struct xe_device *xe, struct
> > > xe_ttm_stolen_mgr *mgr)
> > > +static u64 detect_bar2_dgfx(struct xe_device *xe, struct
> > > +xe_ttm_stolen_mgr *mgr)
> >
> > hmmm.... because stolen size is u64, this is right.
> >
> > But looking to this function below, I'm wondering...
> >
> > Although theoritical case, perhaps we should convert stolen_size to s64 and
> > then fail if stolen_size -= wopcm_size took it to the negative side?
> >
> > Lucas, Thomas, thoughts?
>
> How about add an assertion like below?
> + xe_assert(xe, stolen_size > wopcm_size);
I like this assert
> stolen_size -= wopcm_size;
>
> Or add drm_WARN_ON that already used in this function.
> + if (drm_WARN_ON(&xe->drm, stolen_size < stolen_size))
> + return 0;
>
> xe_assert() is controlled by CONFIG_DRM_XE_DEBUG.
>
> Shuicheng
>
> >
> > > {
> > > struct xe_vram_region *tile_vram = xe_device_get_root_tile(xe)-
> > >mem.vram;
> > > resource_size_t tile_io_start = xe_vram_region_io_start(tile_vram);
> > > --
> > > 2.49.0
> > >
next prev parent reply other threads:[~2025-10-09 19:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-06 20:13 [PATCH 0/3] Fix copyright Shuicheng Lin
2025-10-06 20:13 ` [PATCH 1/3] drm/xe: Fix copyright and function naming in xe_ttm_sys_mgr Shuicheng Lin
2025-10-09 14:55 ` Rodrigo Vivi
2025-10-09 17:53 ` Lin, Shuicheng
2025-10-09 18:08 ` Rodrigo Vivi
2025-10-06 20:13 ` [PATCH 2/3] drm/xe: Fix copyright in xe_ttm_stolen_mgr Shuicheng Lin
2025-10-07 9:12 ` Upadhyay, Tejas
2025-10-06 20:13 ` [PATCH 3/3] drm/xe: Change return type of detect_bar2_dgfx() from s64 to u64 Shuicheng Lin
2025-10-09 14:53 ` Rodrigo Vivi
2025-10-09 18:06 ` Lin, Shuicheng
2025-10-09 19:51 ` Rodrigo Vivi [this message]
2025-10-06 20:23 ` ✓ CI.KUnit: success for Fix copyright Patchwork
2025-10-06 21:06 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-07 0:33 ` ✗ Xe.CI.Full: failure " Patchwork
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=aOgSPCmwMEFuRajH@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=shuicheng.lin@intel.com \
--cc=thomas.hellstrom@linux.intel.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