From: Lucas De Marchi <lucas.demarchi@intel.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: "Oded Gabbay" <ogabbay@kernel.org>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Matt Roper" <matthew.d.roper@intel.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Himal Prasad Ghimiray" <himal.prasad.ghimiray@intel.com>,
"Francois Dugast" <francois.dugast@intel.com>,
"Dave Airlie" <airlied@redhat.com>,
intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] drm/xe/xe2: fix 64-bit division in pte_update_size
Date: Sun, 25 Feb 2024 21:47:41 -0600 [thread overview]
Message-ID: <nuwtejmu4nvxxvkobawafbmogpx6qjk3dnbnj7kobfb7gvpyw7@pxg3bv42qkop> (raw)
In-Reply-To: <20240224121528.1972719-3-arnd@kernel.org>
On Sat, Feb 24, 2024 at 01:15:01PM +0100, Arnd Bergmann wrote:
>From: Arnd Bergmann <arnd@arndb.de>
>
>This function does not build on 32-bit targets when the compiler
>fails to reduce DIV_ROUND_UP() into a shift:
>
>ld.lld: error: undefined symbol: __aeabi_uldivmod
>>>> referenced by xe_migrate.c
>>>> drivers/gpu/drm/xe/xe_migrate.o:(pte_update_size) in archive vmlinux.a
>
>There are two instances in this function. Change the first to
>use an open-coded shift with the same behavior, and the second
>one to a 32-bit calculation, which is sufficient here as the size
>is never more than 2^32 pages (16TB).
>
>Fixes: ea97a66a2218 ("drm/xe: Disable 32bits build")
same comment as in patch 2... should rather be the commit *enabling* 32b
builds?
Should this be something to be dealt with at the DIV_ROUND_UP() layer?
Why did the compiler fail to reduce it here but didn't in the other
11 uses in the xe driver?
thanks
Lucas De Marchi
>Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>---
> drivers/gpu/drm/xe/xe_migrate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
>index a66fdf2d2991..ee1bb938c493 100644
>--- a/drivers/gpu/drm/xe/xe_migrate.c
>+++ b/drivers/gpu/drm/xe/xe_migrate.c
>@@ -462,7 +462,7 @@ static u32 pte_update_size(struct xe_migrate *m,
> } else {
> /* Clip L0 to available size */
> u64 size = min(*L0, (u64)avail_pts * SZ_2M);
>- u64 num_4k_pages = DIV_ROUND_UP(size, XE_PAGE_SIZE);
>+ u32 num_4k_pages = (size + XE_PAGE_SIZE - 1) >> XE_PTE_SHIFT;
>
> *L0 = size;
> *L0_ofs = xe_migrate_vm_addr(pt_ofs, 0);
>--
>2.39.2
>
next prev parent reply other threads:[~2024-02-26 3:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-24 12:14 [PATCH 1/3] drm/xe/kunit: fix link failure with built-in xe Arnd Bergmann
2024-02-24 12:15 ` [PATCH 2/3] drm/xe/mmio: fix build warning for BAR resize on 32-bit Arnd Bergmann
2024-02-26 3:44 ` Lucas De Marchi
2024-02-24 12:15 ` [PATCH 3/3] drm/xe/xe2: fix 64-bit division in pte_update_size Arnd Bergmann
2024-02-26 3:47 ` Lucas De Marchi [this message]
2024-02-26 3:42 ` [PATCH 1/3] drm/xe/kunit: fix link failure with built-in xe Lucas De Marchi
2024-02-26 9:04 ` Maxime Ripard
2024-02-26 12:46 ` Arnd Bergmann
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=nuwtejmu4nvxxvkobawafbmogpx6qjk3dnbnj7kobfb7gvpyw7@pxg3bv42qkop \
--to=lucas.demarchi@intel.com \
--cc=airlied@gmail.com \
--cc=airlied@redhat.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=francois.dugast@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=mripard@kernel.org \
--cc=ogabbay@kernel.org \
--cc=rodrigo.vivi@intel.com \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tzimmermann@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).