Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp34951895rwd; Sun, 9 Jul 2023 23:54:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlEja82ndVxz7AtxkPAaunHkbPkANHu65zSOrju5Cfjf2oTX4GYDst3RsNbInHlLETNA45o/ X-Received: by 2002:a17:906:10a:b0:974:6de:8a5e with SMTP id 10-20020a170906010a00b0097406de8a5emr13655697eje.40.1688972086123; Sun, 09 Jul 2023 23:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688972086; cv=none; d=google.com; s=arc-20160816; b=dv91dVtZO9BM+9ItwZY5LKRdhBwxXMssYSeGlrj5IilEQBQpJaT5aLpl11Q4imQA3M GBiAMs1gmsN4K27A2l2Dl/STaI8ZmPQJSyCMaqQe6cclaRsmoqyCpFzcyDtdYj4ve29B 1x5NWLCIwIVcLnx2Ilu/a2Nt+tDXg/URwbDydNwjuVbhgwKDhfMTS3xpTIjcrLWggzgN E2+WptCM7iBHc0T/5wLYOgE8Etz+NZl16oTV8NZycwDEJKup8eaymXsOrTuBO0YkXVFB 3tYaihQrfh/6veMQVPnmhtlLgevZfYfZR2OTg3A9STbIrvokQD4asEoO0dvL7qFM512a fm7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PqU18RCvG9gZGLXwts6aQQVQ+56QhVBkxpH4cTIUoU4=; fh=52wouRw8e+/WsmHgLCtlGKsLnw+rTEBD/doraa8ADL4=; b=TeefxH7X5VXesSfL6w0d2CiKJZPDMDmBnQMQAoeaA5KmrQZl8haCheaXrKxnSBLY1u lzA1uHyW/wLi/fLm5rx2Hdesz4LdJ0yvdSonfyOVA+vRZmRMPCqy8YzfT+G2gftl6r3x SoZxp5mJiXZeWrCluvOmTXBF/edZiY9WVugf2YnXH4aF3F+V6ZVi8lP+LyeF5iY3w2Q/ 1P8C0GSvHE4d4mY9zTmjz5IiWzB/hG7nRJcqgJYSlSC7xPzRdhvjFw9yiGVAxor1y4+4 R4mkFVMe2x4Uv34vet9yIHdJBBLcx825i+pN/ag26EZUDvieGjfxy/IMthCfIy8EiMiP vQJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LgA0kahp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v6-20020a1709064e8600b009929280d0d7si5355667eju.432.2023.07.09.23.54.22; Sun, 09 Jul 2023 23:54:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LgA0kahp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbjGJGiG (ORCPT + 99 others); Mon, 10 Jul 2023 02:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbjGJGh7 (ORCPT ); Mon, 10 Jul 2023 02:37:59 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4360CE73; Sun, 9 Jul 2023 23:37:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688971054; x=1720507054; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Fq8L0jRrWp8MFI20LM4QP+Y9mNsBbARTx9OQBMf9Qb4=; b=LgA0kahpXY/rxme/iJDop5Rzl/fbp5WINHIvW5jJtHcGFBZNl6CdMaag wY/ENoea5ZfAbQc4+4LwizXTzidOTzBbefL7OyYF//BEml+deITt/saEh TmDmhJmOSsuA8aODG68LzI+sbcLgZNHLpQPxrqheVpdXuiUprgmCOjm53 oIae6I4aTj2Lf0RuKUXTVX5zq9vTsYaU3WY4pTufiM2vSz4FJsy1bKnJz tis3GWDbpl8gsZUyKEUVlrfoI3lg/XCUeNlfKD4quRy926WV7f5Kll/Cc BqdzqMb20G6++fLmTAvA1IpcIpsCL6Nhe0tjZPot872H5xtuQeVMoZHo+ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10766"; a="430340497" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="430340497" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2023 23:37:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10766"; a="894675457" X-IronPort-AV: E=Sophos;i="6.01,194,1684825200"; d="scan'208";a="894675457" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by orsmga005.jf.intel.com with ESMTP; 09 Jul 2023 23:37:16 -0700 Date: Mon, 10 Jul 2023 14:35:49 +0800 From: Xu Yilun To: Peter Colberg Cc: hao.wu@intel.com, gregkh@linuxfoundation.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, aaron.j.grier@intel.com, tianfei.zhang@intel.com, russell.h.weight@intel.com, matthew.gerlach@linux.intel.com, marpagan@redhat.com, lgoncalv@redhat.com, Andy Shevchenko Subject: Re: [PATCH v3] fpga: dfl: afu: use PFN_DOWN() helper macro Message-ID: References: <20230629002255.25262-1-peter.colberg@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230629002255.25262-1-peter.colberg@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-06-28 at 20:22:55 -0400, Peter Colberg wrote: > Replace right shifts by PAGE_SHIFT with PFN_DOWN() helper macro to convert > from physical addresses to page frame numbers. > > These changes are cosmetic only; no functional changes. > > Suggested-by: Andy Shevchenko > Signed-off-by: Peter Colberg > Reviewed-by: Andy Shevchenko > --- > v3: > - Revert afu_mmap(), which calculates file offsets, not physical pages > v2: > - Comment in commit message that changes are cosmetic only > --- > drivers/fpga/dfl-afu-dma-region.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma-region.c > index 02b60fde0430..e8d54cfbb301 100644 > --- a/drivers/fpga/dfl-afu-dma-region.c > +++ b/drivers/fpga/dfl-afu-dma-region.c > @@ -10,6 +10,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -34,7 +35,7 @@ void afu_dma_region_init(struct dfl_feature_platform_data *pdata) > static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata, > struct dfl_afu_dma_region *region) > { > - int npages = region->length >> PAGE_SHIFT; > + int npages = PFN_DOWN(region->length); > struct device *dev = &pdata->dev->dev; > int ret, pinned; > > @@ -82,7 +83,7 @@ static int afu_dma_pin_pages(struct dfl_feature_platform_data *pdata, > static void afu_dma_unpin_pages(struct dfl_feature_platform_data *pdata, > struct dfl_afu_dma_region *region) > { > - long npages = region->length >> PAGE_SHIFT; > + long npages = PFN_DOWN(region->length); > struct device *dev = &pdata->dev->dev; > > unpin_user_pages(region->pages, npages); > @@ -101,7 +102,7 @@ static void afu_dma_unpin_pages(struct dfl_feature_platform_data *pdata, > */ > static bool afu_dma_check_continuous_pages(struct dfl_afu_dma_region *region) > { > - int npages = region->length >> PAGE_SHIFT; > + int npages = PFN_DOWN(region->length); > int i; > > for (i = 0; i < npages - 1; i++) @@ -837,7 +838,7 @@ static int afu_mmap(struct file *filp, struct vm_area_struct *vma) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); return remap_pfn_range(vma, vma->vm_start, - (region.phys + (offset - region.offset)) >> PAGE_SHIFT, + PFN_DOWN(region.phys + (offset - region.offset)), size, vma->vm_page_prot); Why is this change also dropped? Maybe use PHYS_PFN() instead? Thanks, Yilun > -- > 2.28.0 >