Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4589379pxu; Wed, 9 Dec 2020 23:45:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0br3SkVqK6kyklMnmOTevWed4jcUtsMfUojO+2VrrU0xSHS9XV94Le3thMG6McIuLR2Y3 X-Received: by 2002:a05:6402:1c8a:: with SMTP id cy10mr5541381edb.151.1607586330701; Wed, 09 Dec 2020 23:45:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607586330; cv=none; d=google.com; s=arc-20160816; b=Rmco2sGsaoGY68RzdGDv5dWuKHZCavQHDP5mT7nUtQVa6h4YJ9GepTIkmfnGScoC+q Kif9ENuIPUTuba7l1WePeltiI5eYqZZeCUW1B+xM9L5lh8grOzU58Ertke8SpMO4cbAG JifgRAeHK7lQf5WKTzKXsZqTFcscmFC8XeWTM1XOIkT7Hcue3udipYaSxA2PJBWtV669 muIR0u8vwhAGpOUukm05S4z9ieKTQNCk/Z+RMHrUu0Yoa2LE+SecuEliL7VGimK1UPzV 51uLy91l2YIs3kbq+eeB4pHzyHvHax/Za3FjuDBQyCFA5b5Wj5TZF6hsxhfEdIeVbBzL Zvzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=hKKiA5OGJPYjLSGz6mOf25TM/QFg/Aq16cn5i3RVrnI=; b=mdmQaL23YTgZALVhnGp2JX+JYKmiL9s7AuEBsbRAvFxA6i8z2xtjuEijQGgwiIXvKu ymPHlWZ1w/xZApWv7LZlAKjYpOTXqG5RLdcQpztbawPdx2pYD0wUutWU1O/7fXuyFr2q zJRQnfXg3OCbj3UZ/2mbYt2/FdGcR0gwN2R2E/8KbZHJceCbQD3VDxBNSBV8E2hjxmGE GAQ7kz/jTzm9uYdMG57OdJ+MKLIB44I4rpX5ZGsr2oB5yA6GyGgB9KcgMzpshwiU2l0L N26lLXUFG+zeiAQupL8kbQH2VGw2/9kiiX5lNiLBkq/730Stx+9yIeSEo8FXP3/bXJkr jEDA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb36si255281ejc.696.2020.12.09.23.45.08; Wed, 09 Dec 2020 23:45:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387442AbgLJHgw (ORCPT + 99 others); Thu, 10 Dec 2020 02:36:52 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9147 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733168AbgLJHg3 (ORCPT ); Thu, 10 Dec 2020 02:36:29 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cs5Km4WnFz15b9R; Thu, 10 Dec 2020 15:35:08 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.187.37) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Thu, 10 Dec 2020 15:35:31 +0800 From: Keqian Zhu To: , , , , , Alex Williamson , Cornelia Huck , Marc Zyngier , Will Deacon , Robin Murphy CC: Joerg Roedel , Catalin Marinas , James Morse , Suzuki K Poulose , Sean Christopherson , Julien Thierry , Mark Brown , "Thomas Gleixner" , Andrew Morton , Alexios Zavras , , , Keqian Zhu Subject: [PATCH 7/7] vfio: iommu_type1: Drop parameter "pgsize" of update_user_bitmap Date: Thu, 10 Dec 2020 15:34:25 +0800 Message-ID: <20201210073425.25960-8-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20201210073425.25960-1-zhukeqian1@huawei.com> References: <20201210073425.25960-1-zhukeqian1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.187.37] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We always use the smallest supported page size of vfio_iommu as pgsize. Drop parameter "pgsize" of update_user_bitmap. Signed-off-by: Keqian Zhu --- drivers/vfio/vfio_iommu_type1.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 2d7a5cd9b916..edb0a6468e8d 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -989,10 +989,9 @@ static void vfio_update_pgsize_bitmap(struct vfio_iommu *iommu) } static int update_user_bitmap(u64 __user *bitmap, struct vfio_iommu *iommu, - struct vfio_dma *dma, dma_addr_t base_iova, - size_t pgsize) + struct vfio_dma *dma, dma_addr_t base_iova) { - unsigned long pgshift = __ffs(pgsize); + unsigned long pgshift = __ffs(iommu->pgsize_bitmap); unsigned long nbits = dma->size >> pgshift; unsigned long bit_offset = (dma->iova - base_iova) >> pgshift; unsigned long copy_offset = bit_offset / BITS_PER_LONG; @@ -1057,7 +1056,7 @@ static int vfio_iova_dirty_bitmap(u64 __user *bitmap, struct vfio_iommu *iommu, if (dma->iova > iova + size - 1) break; - ret = update_user_bitmap(bitmap, iommu, dma, iova, pgsize); + ret = update_user_bitmap(bitmap, iommu, dma, iova); if (ret) return ret; @@ -1203,7 +1202,7 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu, if (unmap->flags & VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP) { ret = update_user_bitmap(bitmap->data, iommu, dma, - unmap->iova, pgsize); + unmap->iova); if (ret) break; } -- 2.23.0