From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: "Lucas De Marchi" <lucas.demarchi@intel.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Oak Zeng" <oak.zeng@intel.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Matthew Auld" <matthew.auld@intel.com>,
"Nirmoy Das" <nirmoy.das@intel.com>,
"Akshata Jahagirdar" <akshata.jahagirdar@intel.com>,
"José Roberto de Souza" <jose.souza@intel.com>,
intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/xe: avoid plain 64-bit division
Date: Fri, 28 Mar 2025 14:27:45 -0400 [thread overview]
Message-ID: <Z-bqIaInowqtHeVc@intel.com> (raw)
In-Reply-To: <20250324210612.2927194-1-arnd@kernel.org>
On Mon, Mar 24, 2025 at 10:06:02PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Building the xe driver for i386 results in a link time warning:
>
> x86_64-linux-ld: drivers/gpu/drm/xe/xe_migrate.o: in function `xe_migrate_vram':
> xe_migrate.c:(.text+0x1e15): undefined reference to `__udivdi3'
>
> Avoid this by using DIV_U64_ROUND_UP() instead of DIV_ROUND_UP(). The driver
> is unlikely to be used on 32=bit hardware, so the extra cost here is not
> too important.
>
> Fixes: 9c44fd5f6e8a ("drm/xe: Add migrate layer functions for SVM support")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
and pushing it right now, thanks for the patch
> ---
> drivers/gpu/drm/xe/xe_migrate.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
> index df4282c71bf0..aafb6209f2d0 100644
> --- a/drivers/gpu/drm/xe/xe_migrate.c
> +++ b/drivers/gpu/drm/xe/xe_migrate.c
> @@ -1547,7 +1547,7 @@ void xe_migrate_wait(struct xe_migrate *m)
> static u32 pte_update_cmd_size(u64 size)
> {
> u32 num_dword;
> - u64 entries = DIV_ROUND_UP(size, XE_PAGE_SIZE);
> + u64 entries = DIV_U64_ROUND_UP(size, XE_PAGE_SIZE);
>
> XE_WARN_ON(size > MAX_PREEMPTDISABLE_TRANSFER);
> /*
> @@ -1558,7 +1558,7 @@ static u32 pte_update_cmd_size(u64 size)
> * 2 dword for the page table's physical location
> * 2*n dword for value of pte to fill (each pte entry is 2 dwords)
> */
> - num_dword = (1 + 2) * DIV_ROUND_UP(entries, 0x1ff);
> + num_dword = (1 + 2) * DIV_U64_ROUND_UP(entries, 0x1ff);
> num_dword += entries * 2;
>
> return num_dword;
> --
> 2.39.5
>
prev parent reply other threads:[~2025-03-28 18:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-24 21:06 [PATCH] drm/xe: avoid plain 64-bit division Arnd Bergmann
2025-03-28 18:27 ` Rodrigo Vivi [this message]
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=Z-bqIaInowqtHeVc@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=airlied@gmail.com \
--cc=akshata.jahagirdar@intel.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jose.souza@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=nirmoy.das@intel.com \
--cc=oak.zeng@intel.com \
--cc=simona@ffwll.ch \
--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