Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp333362pxj; Thu, 10 Jun 2021 01:43:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwig9lH2Rp9pHvysRJ0dWQpsuqdyMkIju9xJaJTDK3HJFT/Fbgz9c+zXM0e3Wsc16714Cnw X-Received: by 2002:a17:906:b34e:: with SMTP id cd14mr3475219ejb.69.1623314602122; Thu, 10 Jun 2021 01:43:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623314602; cv=none; d=google.com; s=arc-20160816; b=grh9HKT75LJgPEoN60TCJYl3iFMhE2ReZ5ocitootvUs9vRSELKjuIdlW2vwViArCJ bt16KvmdVP9+hrQbtg646QX+ruzeeBWJgySL6gXT2F6XwFM5yhhF1fNXnQEg04PkfMv6 Ki2HbH7Rsf4M+ZzJtR0OiPqiw0ejnVg7yIKQVqmhmuIO8qbrde8l51L4vseduUk9QyDi noENu4hLNjlEm3BRN6n7huBhogZKAv6O3yNA+XpCgGDLiELsQUYPHn4Zh2Nyf4+ETwF9 GQoPY4PsknX+XvDhtlo5OZTfwILYaWSSrpCthtaLW00VnDuHCGx5QjK4EgU/L0tBL5pO 8EVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=kg1i0J3tPPCLuz5nErJ53xzB7H19YMyZ8zz4WOLWPnU=; b=iJ8Vay7oda5eCNtXqT2IcfZk2PJ8hUrgQ6SbR67kauzkwijyTfWmK4uozQt7vr187O Zr8PTEb8kyrUexCy3p7n1AoBqcSJc5cMpAkrdqi9gJf2p31PVQ4iFy285GI9rcvLf9aF ZtApKl+MhHI9Z8c1WHfO6+lVhzDQ7GLuOYsINVGPjqaNhgqz716tKn3TDZsO0+G87G// xbrU87dofoU+L9bP8ZELn/Pxt3oTGHZpugn/9FDnfZrI2AHf74uU6LPsj53R0invmWHD nnUascOwCdzCzntcIcTa1v2lojTaW/Pi615agXx7YrWfD9YcluHhlBnzvgWaKp5LNci1 MWJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v23si1726065edw.122.2021.06.10.01.42.58; Thu, 10 Jun 2021 01:43:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229823AbhFJInD (ORCPT + 99 others); Thu, 10 Jun 2021 04:43:03 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:3826 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229895AbhFJInC (ORCPT ); Thu, 10 Jun 2021 04:43:02 -0400 Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4G0y4C24mtzWtkL; Thu, 10 Jun 2021 16:36:11 +0800 (CST) Received: from [10.67.110.136] (10.67.110.136) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Thu, 10 Jun 2021 16:41:04 +0800 Subject: Re: [PATCH -next] drm/amdgpu: Use DIV_ROUND_UP_ULL instead of DIV_ROUND_UP To: =?UTF-8?Q?Christian_K=c3=b6nig?= , , , , , , , , , , , CC: , , References: <20210610082005.86876-1-heying24@huawei.com> <5ffe00de-a7b6-3ac4-f61a-5f28b653e7b1@amd.com> From: He Ying Message-ID: Date: Thu, 10 Jun 2021 16:41:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <5ffe00de-a7b6-3ac4-f61a-5f28b653e7b1@amd.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.110.136] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, 在 2021/6/10 16:20, Christian König 写道: > > > Am 10.06.21 um 10:20 schrieb He Ying: >> When compiling the kernel for MIPS with CONFIG_DRM_AMDGPU = y, errors >> are >> encountered as follows: >> >> drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.o: In function >> `amdgpu_vram_mgr_new': >> amdgpu_vram_mgr.c:(.text+0x740): undefined reference to `__udivdi3' >> >> Making a 64 bit division by a/b (a is uint64_t) is not supported by >> default >> in linux kernel space. Instead, using do_div is OK for this >> situation. For >> this problem, using DIV_ROUND_UP_ULL instead of DIV_ROUND_UP is better. > > Already fixed by this patch in drm-next: > > commit 691cf8cd7a531dbfcc29d09a23c509a86fd9b24f > Author: Dave Airlie > Date:   Thu Jun 10 12:59:00 2021 +1000 > >     drm/amdgpu: use correct rounding macro for 64-bit > >     This fixes 32-bit arm build due to lack of 64-bit divides. OK. Sigh. Before sending my patch, I searched patches in https://lore.kernel.org/lkml/ but I didn't find this patch. How can I find whether my patch is duplicated before sending it? Any suggestions? Thanks. > > Regards, > Christian. > >> >> Fixes: 6a7f76e70fac ("drm/amdgpu: add VRAM manager v2") >> Reported-by: Hulk Robot >> Signed-off-by: He Ying >> --- >>   drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c >> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c >> index 9a6df02477ce..436ec246a7da 100644 >> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c >> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c >> @@ -407,7 +407,7 @@ static int amdgpu_vram_mgr_new(struct >> ttm_resource_manager *man, >>   #endif >>           pages_per_node = max_t(uint32_t, pages_per_node, >>                          tbo->page_alignment); >> -        num_nodes = DIV_ROUND_UP(PFN_UP(mem_bytes), pages_per_node); >> +        num_nodes = DIV_ROUND_UP_ULL(PFN_UP(mem_bytes), >> pages_per_node); >>       } >>         node = kvmalloc(struct_size(node, mm_nodes, num_nodes), > > .