Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp45123pxu; Wed, 6 Jan 2021 20:46:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzT1efaDYB/2LP+56s8uBqTbNriRtk1y2Xi6XuynCEEkDZjH6QZ9WrHMojIMTDsU9Dgfi+0 X-Received: by 2002:a50:8741:: with SMTP id 1mr276960edv.349.1609994784725; Wed, 06 Jan 2021 20:46:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609994784; cv=none; d=google.com; s=arc-20160816; b=NjSzB9p2+tZgr9U0lkQwd57YnfNz+WQ0KpHzSHF7zqsCuxuyqbGMOvSilRpqcQU+hM EEZ2vFn47CtMqs9wFVtzc2He2sIfOzqFQLhCFPOu5iqXwwQ3n9JeQnZ45QT8Wh0e9qSK WEW4k0qioqBJ/OXryeZ6zYaLWfEB+EKFz4V815V5/kgYNRfFu83b/If5MipyaFHPg5kx 3GkmaPtSFrbo3uiOEZa5Sc5AQrDnQltJI9/YZbJ4VdC2NJAFBE9vNKUBfXoBXA2Z+zjg 7B2QklOCzFtg54/01rzWrLVyNMLkGXWoUXE/qmVp6OlXa+x3aS6HObXlmytz0GJffz3l aiXw== 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=zD3KK+kC9eQg9SOR6RniKazK8eYL6OqyQ0psCbqxR98=; b=yHdnLNf/G81bfM3Ipt0JaKR/xlH/2GMtAkApGSUX9mwrZ8SXivO1IADCyivS/XZGwf QBZvzklJAYp3c82zK/WMouk4Vr3u1dbxbcSCKg/ZUndqiT35e12o+J4eD6F6PJdv8BCT 3Tdv3OnmMWTEjZ4EJ/SA1jTzm5mbl1OlX9ChqFgm5ESEztb/cybircAvy2pJyH1zf2s7 Y6Cheuua0C71/6OUuoD9tuJH1B7ADkjlZ9JNfAtmz+gU5YowV06Gg8u/HU+vUGeGya4a vaRKz4EgnzmICRH2bs4m/JwtXittdVOWMILzjgi6CygxpAHaiVMeYDUGRXj0mMoaT9TU hacQ== 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 d5si1694098ejk.389.2021.01.06.20.46.01; Wed, 06 Jan 2021 20:46:24 -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 S1727290AbhAGEpZ (ORCPT + 99 others); Wed, 6 Jan 2021 23:45:25 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:9968 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbhAGEpY (ORCPT ); Wed, 6 Jan 2021 23:45:24 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DBDCF5z03zj2mh; Thu, 7 Jan 2021 12:43:53 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.184.42) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.498.0; Thu, 7 Jan 2021 12:44:31 +0800 From: Keqian Zhu To: , , , , , Alex Williamson , Cornelia Huck , Will Deacon , "Marc Zyngier" , Catalin Marinas CC: Mark Rutland , James Morse , Robin Murphy , Joerg Roedel , "Daniel Lezcano" , Thomas Gleixner , Suzuki K Poulose , Julien Thierry , Andrew Morton , Alexios Zavras , , Subject: [PATCH 6/6] vfio/iommu_type1: Drop parameter "pgsize" of update_user_bitmap Date: Thu, 7 Jan 2021 12:44:01 +0800 Message-ID: <20210107044401.19828-7-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20210107044401.19828-1-zhukeqian1@huawei.com> References: <20210107044401.19828-1-zhukeqian1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.174.184.42] 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 82649a040148..bceda5e8baaa 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -978,10 +978,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; @@ -1046,7 +1045,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; @@ -1192,7 +1191,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.19.1