From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932635AbdGTC5N (ORCPT ); Wed, 19 Jul 2017 22:57:13 -0400 Received: from szxga03-in.huawei.com ([45.249.212.189]:9387 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751464AbdGTC5M (ORCPT ); Wed, 19 Jul 2017 22:57:12 -0400 Subject: Re: [PATCH 4/4] iommu/iova: Make dma_32bit_pfn implicit To: kbuild test robot , Robin Murphy References: <201707192352.79mkRePJ%fengguang.wu@intel.com> CC: , , , , , , , , , , , Thierry Reding , "Jonathan Hunter" , David Airlie , Sudeep Dutt , Ashutosh Dixit From: "Leizhen (ThunderTown)" Message-ID: <59701BAC.7060800@huawei.com> Date: Thu, 20 Jul 2017 10:55:40 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <201707192352.79mkRePJ%fengguang.wu@intel.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020202.59701BBE.004E,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 8b03428a23fad708c9b321c8c9c6a46c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/7/19 23:07, kbuild test robot wrote: > Hi Zhen, > > [auto build test WARNING on iommu/next] > [also build test WARNING on v4.13-rc1] > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > url: https://github.com/0day-ci/linux/commits/Robin-Murphy/Optimise-64-bit-IOVA-allocations/20170719-060847 > base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next > config: arm-multi_v7_defconfig (attached as .config) > compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705 > reproduce: > wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > make.cross ARCH=arm > > All warnings (new ones prefixed by >>): > > drivers/iommu/iova.c: In function 'init_iova_domain': >>> drivers/iommu/iova.c:53:41: warning: large integer implicitly truncated to unsigned type [-Woverflow] > iovad->dma_32bit_pfn = iova_pfn(iovad, 1ULL << 32); OK, I see. I think the problem is that "1ULL << 32" exceed the scope of 32bits general register. We should replace "1ULL << 32" with DMA_BIT_MASK(32), the latter will minus one to keep it can be safely stored in the general register. iovad->dma_32bit_pfn = iova_pfn(iovad, DMA_BIT_MASK(32)) + 1; > ^~~~ > > vim +53 drivers/iommu/iova.c > > 35 > 36 void > 37 init_iova_domain(struct iova_domain *iovad, unsigned long granule, > 38 unsigned long start_pfn) > 39 { > 40 /* > 41 * IOVA granularity will normally be equal to the smallest > 42 * supported IOMMU page size; both *must* be capable of > 43 * representing individual CPU pages exactly. > 44 */ > 45 BUG_ON((granule > PAGE_SIZE) || !is_power_of_2(granule)); > 46 > 47 spin_lock_init(&iovad->iova_rbtree_lock); > 48 iovad->rbroot = RB_ROOT; > 49 iovad->cached_node = NULL; > 50 iovad->cached32_node = NULL; > 51 iovad->granule = granule; > 52 iovad->start_pfn = start_pfn; > > 53 iovad->dma_32bit_pfn = iova_pfn(iovad, 1ULL << 32); > 54 init_iova_rcaches(iovad); > 55 } > 56 EXPORT_SYMBOL_GPL(init_iova_domain); > 57 > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation > -- Thanks! BestRegards