Message ID | 20240224121528.1972719-3-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-79635-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1116187dyb; Sat, 24 Feb 2024 04:16:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVoIVc7r5Jicj26nR3XgMpSxySfGOtdQDr3sUkE5Fj34IFphE0zjm/X1rz3Hkh2lQQq+Rw98TtYjVJfR1i+aC54dfzoFQ== X-Google-Smtp-Source: AGHT+IH8NUNcyIMfvih3uNFLVmUHU1b/YRFaztezz7TFvoEdxfeAMoO5FKV1qGpfxJy9gd7np2cu X-Received: by 2002:a17:902:c946:b0:1dc:4bc2:4923 with SMTP id i6-20020a170902c94600b001dc4bc24923mr2475317pla.65.1708776987099; Sat, 24 Feb 2024 04:16:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708776987; cv=pass; d=google.com; s=arc-20160816; b=nLdr/tY+RKmcDR3QVL2e+63+cr4Odu7w+oTtP+bTsYv9K1G9OYj+ctnOEUvxZl2UKG 7NGgjrZeTtHUhZtF6W/OJ9roQ5XA3A1sNhIvJ9wB5pdjfDPkiPnNLy4HlyVy3cBHFGa2 D0l35AXqSLmCPPad3p/WMjnmKrR1g3M1YfLTeUkrCrHxWUr2AH+v1bjmf2mqOwdgEm8Q aLMzKVmIyz65wIcxV6v63N7Jx8HiyYumxb5BR8zcoW15G3vDlMbyeDNxJNGzL2mxnCxw Mt4B/0prMImfOdQjnD1s6rCI/cdukK4HzYy/bHvQxfQ4vuE2rnvQUehuOXCroltWGxRu WVKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Itlrazf/c3eDXMQ18Z9x2AwWU204yDUiHazByrlMLM0=; fh=UXQ+5Z3bRGipZXH+yEkWg+oQV4fU2ImlzuMaPyrXSOQ=; b=pr9gLSWzciET/1w8k+HqYUG9PssJU386CCY4Ff35ALmf7vWG8EZSo5Mit4wW9Wlr3H ftiP4O86eAkGiZxQ5cM/SlahEtK8xNORI0KI//AowHSt+IpNmMXEQufCquprxTPTJzmN NxCp628XqLADMWYJv9efdc97kiKHWAJnfHzcNK/WBn0Ri7XBE900+3C1lHKTXJ/7Bw72 /enYYw2b4RNccBfgzKkz2Df8wZ2L7h4PvTuG/9V8O6lG2hQvezxcxXmAdHs34RqQs6TG GvxAESRZSFMN7Rbzw0C8NiwZWCrYVpKV/j5JQnqTeOzfxazbU9kUvNt+VBH2IWFgBajL oB/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="XjL/ME58"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79635-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79635-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id im9-20020a170902bb0900b001db9170927bsi749091plb.296.2024.02.24.04.16.26 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Feb 2024 04:16:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-79635-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="XjL/ME58"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-79635-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-79635-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E3283282EA1 for <ouuuleilei@gmail.com>; Sat, 24 Feb 2024 12:16:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90A833F9C6; Sat, 24 Feb 2024 12:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XjL/ME58" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE0B73D988 for <linux-kernel@vger.kernel.org>; Sat, 24 Feb 2024 12:16:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708776972; cv=none; b=u053Gdx03//Pn+CAwXaD/8As7D5f8RbJhi9V6uZWDxMdF/llzqTgPeQaEk8b1VhF84nwvGk5XbM2OEsntGuZCONqfc1x+v274HW6V49X2/4sKY+8dimIM+zf2ORlLZnc8z3mMw0DTxaC4vOOjFmIyA/O2rxE+TN+VS12AmSJDMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708776972; c=relaxed/simple; bh=FVqwkjBGiGZ+FrnuOmvhnP6hzKLmcnGCY/w4xZTohpY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sPS4YZx5U3/C4eZezkzkXOzPNXZZxGuYqulaUwEbB//1N8OdY088lDtCqqGKKt0MvE3qYjv4bsmK+QeTCyQDrSeAhdyURXEM5KevY4rCIc1ioW5HJqfetPuV0Mqz1AOeHQQGg4iBuCXEj5Wkf/Lekegz2RxpP0TWnfqNwS9aI1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XjL/ME58; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6462C433F1; Sat, 24 Feb 2024 12:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708776971; bh=FVqwkjBGiGZ+FrnuOmvhnP6hzKLmcnGCY/w4xZTohpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XjL/ME582gBj+PnpaYTcAJdRjWCltO0ujLpFGlmYasM9RQuSkdzve0IpVw+2qvHrb 4oqTU1S+Iep91HOzIAgIb+hHbKAhsa9/b3uTFbcowMuARdI3FpC4SAwzG/DR+zo3CV aPrwkUhUDsQrdBsTyE5lAkwd3Rp5jpwNDIcIfx1X7WaWscenCVj97SVKk16zJe3L5U KF8z9/nNbY+1dQFiuJEnfp/+cJnxufDun68bUW1FNO2I8JVGO3cbkJ12p3x1s3Az1S IjrNd3LUfFkHv4PjvnnH+cDfNE5fHimeCIxJu5w8by24eFIaNEYMXmosPgkoyqsmSS MrYuj+UrUAwKQ== From: Arnd Bergmann <arnd@kernel.org> To: Lucas De Marchi <lucas.demarchi@intel.com>, Oded Gabbay <ogabbay@kernel.org>, =?utf-8?q?Thomas_Hellstr=C3=B6m?= <thomas.hellstrom@linux.intel.com> Cc: 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: [PATCH 3/3] drm/xe/xe2: fix 64-bit division in pte_update_size Date: Sat, 24 Feb 2024 13:15:01 +0100 Message-Id: <20240224121528.1972719-3-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240224121528.1972719-1-arnd@kernel.org> References: <20240224121528.1972719-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791782537909580164 X-GMAIL-MSGID: 1791782537909580164 |
Series |
[1/3] drm/xe/kunit: fix link failure with built-in xe
|
|
Commit Message
Arnd Bergmann
Feb. 24, 2024, 12:15 p.m. UTC
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") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/gpu/drm/xe/xe_migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
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 >
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);