All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oded Gabbay <ogabbay@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: kernel test robot <lkp@intel.com>
Subject: [PATCH] habanalabs/gaudi2: use DIV_ROUND_UP_SECTOR_T instead of roundup
Date: Tue,  5 Jul 2022 10:53:34 +0300	[thread overview]
Message-ID: <20220705075334.2624692-1-ogabbay@kernel.org> (raw)

roundup will create an error in 32-bit architectures as we use
64-bit variables.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
---
 drivers/misc/habanalabs/gaudi2/gaudi2.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/habanalabs/gaudi2/gaudi2.c b/drivers/misc/habanalabs/gaudi2/gaudi2.c
index 919e5028f341..29d2d4c3db1f 100644
--- a/drivers/misc/habanalabs/gaudi2/gaudi2.c
+++ b/drivers/misc/habanalabs/gaudi2/gaudi2.c
@@ -1796,10 +1796,10 @@ static int gaudi2_set_dram_properties(struct hl_device *hdev)
 	prop->hints_dram_reserved_va_range.start_addr = RESERVED_VA_RANGE_FOR_ARC_ON_HBM_START;
 	prop->hints_dram_reserved_va_range.end_addr = RESERVED_VA_RANGE_FOR_ARC_ON_HBM_END;
 
-	/* since DRAM page size differs from dmmu page size we need to allocate
+	/* since DRAM page size differs from DMMU page size we need to allocate
 	 * DRAM memory in units of dram_page size and mapping this memory in
 	 * units of DMMU page size. we overcome this size mismatch using a
-	 * scarmbling routine which takes a DRAM page and converts it to a DMMU
+	 * scrambling routine which takes a DRAM page and converts it to a DMMU
 	 * page.
 	 * We therefore:
 	 * 1. partition the virtual address space to DRAM-page (whole) pages.
@@ -1814,7 +1814,7 @@ static int gaudi2_set_dram_properties(struct hl_device *hdev)
 	 *    the DRAM address MSBs (63:48) are not part of the roundup calculation
 	 */
 	prop->dmmu.start_addr = prop->dram_base_address +
-			roundup(prop->dram_size, prop->dram_page_size);
+			DIV_ROUND_UP_SECTOR_T(prop->dram_size, prop->dram_page_size);
 
 	prop->dmmu.end_addr = prop->dmmu.start_addr + prop->dram_page_size *
 			div_u64((VA_HBM_SPACE_END - prop->dmmu.start_addr), prop->dmmu.page_size);
@@ -2404,7 +2404,7 @@ static int gaudi2_cpucp_info_get(struct hl_device *hdev)
 		/* we can have wither 5 or 6 HBMs. other values are invalid */
 
 		if ((dram_size != ((GAUDI2_HBM_NUM - 1) * SZ_16G)) &&
-					(dram_size != (GAUDI2_HBM_NUM  * SZ_16G))) {
+					(dram_size != (GAUDI2_HBM_NUM * SZ_16G))) {
 			dev_err(hdev->dev,
 				"F/W reported invalid DRAM size %llu. Trying to use default size %llu\n",
 				dram_size, prop->dram_size);
-- 
2.25.1


                 reply	other threads:[~2022-07-05  7:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220705075334.2624692-1-ogabbay@kernel.org \
    --to=ogabbay@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.