Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp370293pxb; Fri, 15 Jan 2021 15:44:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzy5G7a7ogKdkevYk86vR+7A1jUPXDnL0F/kbMcUXIxYo9nhocrz1Ht49cK0X4nzJm9Yhxb X-Received: by 2002:a17:906:c2ca:: with SMTP id ch10mr10275944ejb.157.1610754267631; Fri, 15 Jan 2021 15:44:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610754267; cv=none; d=google.com; s=arc-20160816; b=D8mRhzFwaetr1tM799ioCqohR1aCMBQXUq3d5fdd7wGzyjGO7qmSDHxqgE0V+h5TmM iamWSxOhnW4i89KwfE/uuuSWX380Uy5V0zyoBNPWHfMroYm5UlTNEP09N1NRaEUoWIrd NpL/0AMwCpjQUWHviT1gb9FlZ7vNh9BOqcBWFA0mqhqRXXqn3YU0lfdPx3fI6tC43Kpm +oGNQBVdhFRQKIwOOA3NJRvSw6ms9vKEb57/eqX+9fNhusY04ZifB3U2ApS6sug/uHA3 mIYPCzpvyTzHlrUu4LsRSeAJevMW7lgFtrmnq0OxkSHIKE++Kmu9cT3NV2cd/V0FZ4Pl 8UAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=vlht7br4mqv7F1sN7U7/EAPyte/4NdiUCZ7SCmktRbE=; b=Fz/Y6Y2DbG+qCw4oUSqk3vcN5ZQz1nkWb2v9ZMo2bRmLelLrTuB+Mf2Ycf9TXiArDz DuGA9LaEfaEDVVLU1xPXYTrGhBwmXqI2+oYmGN6FzhzrHvyCPdeJZbtyKdQipn2RKw8P bHndSX0qY6/MLHktZvTzBzs2Br2+BUGEtorK1P09xJKH6f8up0HTADirjVCsSIsOlNBW VN6RWY1YOs7d+JOl2cYYlSEThEVgp5BUqTJHQYC+1g7WA1Z0+XzoyqXdUPHUOd55CYCG rcjbeDQYwrlJIwJiwf5ikjkASeLweUf5L/F+T5VO0o8j+aUS8++OFXL5Sj3dsHBzBP/M lsaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=A56Fs0zF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id re20si479295ejb.277.2021.01.15.15.44.04; Fri, 15 Jan 2021 15:44:27 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=A56Fs0zF; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728224AbhAOXnb (ORCPT + 99 others); Fri, 15 Jan 2021 18:43:31 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40166 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbhAOXna (ORCPT ); Fri, 15 Jan 2021 18:43:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1610754124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vlht7br4mqv7F1sN7U7/EAPyte/4NdiUCZ7SCmktRbE=; b=A56Fs0zFttYr5AAs38Ymm4uvUiM9glXYApmb40q46hJf7jLn1ELFOrWfURcihKZ3CA4Blw a5D830kQlvMEB3qaNkXGnDHht16MEETNdFqZ5YH78zcc24jwS3wQfFUOuZOmFck7xwCaIt 32oXvKBNXEefkQJVZzcatYeynGVDhNI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-18-hgMpZCqAORS7qjHkQ2sM7A-1; Fri, 15 Jan 2021 18:39:30 -0500 X-MC-Unique: hgMpZCqAORS7qjHkQ2sM7A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 17826806660; Fri, 15 Jan 2021 23:39:28 +0000 (UTC) Received: from omen.home.shazbot.org (ovpn-112-255.phx2.redhat.com [10.3.112.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFF7A6F818; Fri, 15 Jan 2021 23:39:26 +0000 (UTC) Date: Fri, 15 Jan 2021 16:39:26 -0700 From: Alex Williamson To: Keqian Zhu Cc: , , , , , Cornelia Huck , Will Deacon , "Marc Zyngier" , Catalin Marinas , Mark Rutland , James Morse , Robin Murphy , Joerg Roedel , "Daniel Lezcano" , Thomas Gleixner , Suzuki K Poulose , Julien Thierry , Andrew Morton , Alexios Zavras , , Subject: Re: [PATCH 5/6] vfio/iommu_type1: Drop parameter "pgsize" of vfio_iova_dirty_bitmap Message-ID: <20210115163926.3d107090@omen.home.shazbot.org> In-Reply-To: <20210107044401.19828-6-zhukeqian1@huawei.com> References: <20210107044401.19828-1-zhukeqian1@huawei.com> <20210107044401.19828-6-zhukeqian1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 Jan 2021 12:44:00 +0800 Keqian Zhu wrote: > We always use the smallest supported page size of vfio_iommu as > pgsize. Remove parameter "pgsize" of vfio_iova_dirty_bitmap. > > Signed-off-by: Keqian Zhu > --- > drivers/vfio/vfio_iommu_type1.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c > index 080c05b129ee..82649a040148 100644 > --- a/drivers/vfio/vfio_iommu_type1.c > +++ b/drivers/vfio/vfio_iommu_type1.c > @@ -1015,11 +1015,12 @@ static int update_user_bitmap(u64 __user *bitmap, struct vfio_iommu *iommu, > } > > static int vfio_iova_dirty_bitmap(u64 __user *bitmap, struct vfio_iommu *iommu, > - dma_addr_t iova, size_t size, size_t pgsize) > + dma_addr_t iova, size_t size) > { > struct vfio_dma *dma; > struct rb_node *n; > - unsigned long pgshift = __ffs(pgsize); > + unsigned long pgshift = __ffs(iommu->pgsize_bitmap); > + size_t pgsize = (size_t)1 << pgshift; > int ret; > > /* > @@ -2824,8 +2825,7 @@ static int vfio_iommu_type1_dirty_pages(struct vfio_iommu *iommu, > if (iommu->dirty_page_tracking) > ret = vfio_iova_dirty_bitmap(range.bitmap.data, > iommu, range.iova, > - range.size, > - range.bitmap.pgsize); > + range.size); > else > ret = -EINVAL; > out_unlock: In this case the caller has actually already calculated both pgsize and pgshift, the better optimization would be to pass both rather than recalculate. Thanks, Alex