Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4590366pxu; Wed, 9 Dec 2020 23:47:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxhJeI2/avhPezd6hMeiTJSX0alDSCzwXMV9ifzhbFaGF9dsWJj8pRdrxPpJ/iZEQkqGvk7 X-Received: by 2002:aa7:cac2:: with SMTP id l2mr5492600edt.141.1607586465586; Wed, 09 Dec 2020 23:47:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607586465; cv=none; d=google.com; s=arc-20160816; b=Teqy4r5F7fuRiYo3mNYMcUYQSDwj3pQDOHtkCM/kTQpaI4HTx01zdEncg5JeBCpJom ckA5ES8F4Mt3vi6eILqcPnbVxAq8EnCWL1XQGMch13ZbdkZE9HdWLEr8aAIIq61xVwNK qnw1T3Ca+A0Y6aVoODj4pMumXylF5ghdebO4cnRrfKR+JDrRBHWK0iCxHMangYhr5C5E TDRVm8ifQ2+xkK3kYL+w60CqeybyhfYR8ptNizLHNvOUZUNbC3z88sWs6ohcOuU4yBC7 b8xJh7OBg78r14wY4QlnjodqQHZ8Djj4ATDU4kiov6Pr+p5xDaSsgBlIlH36hRdoYWwr OcWA== 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=PvF3hiSnDLXXHl5gOxWAqwtb6Y21JdwjDjC4NzJAkIs=; b=MeaFKMS45tAx5g2xn5KH72Hnw8CrEMwTUjkx+W3kNn5zUMVxaubl8elZ/ZmebPMYEp iNIq60deovjJkp92n0g+Oge32DctHrdz50ugMlPmMrVLDpGSw4NkuBPUAujblVvq2JXv zSdjDmzTObrhJopCljUh6sXDxUGvXrVqU3lx50WMth5RT74aw9ckFf0PF8+6b93o15Bn 1hDRSrWKhutVe5+bh137O2lqS1pBb5Mss4huCVUD9mi1ppRku4VeHn9HKhoWS6LH+za6 xk1/akMXrhigEscLJ3zhV9Iy1sA+ZIs1CaLMj5hdPMUpFWVa8yT2RfKyKXTdPD3AJLG1 RYTw== 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 c20si2238834edw.222.2020.12.09.23.47.23; Wed, 09 Dec 2020 23:47:45 -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 S1733214AbgLJHgv (ORCPT + 99 others); Thu, 10 Dec 2020 02:36:51 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:9863 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732601AbgLJHgU (ORCPT ); Thu, 10 Dec 2020 02:36:20 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Cs5Kg5xvQz7C9b; Thu, 10 Dec 2020 15:35:03 +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:29 +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 5/7] vfio: iommu_type1: Drop parameter "pgsize" of vfio_dma_bitmap_alloc_all Date: Thu, 10 Dec 2020 15:34:23 +0800 Message-ID: <20201210073425.25960-6-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. Remove parameter "pgsize" of vfio_dma_bitmap_alloc_all. Signed-off-by: Keqian Zhu --- drivers/vfio/vfio_iommu_type1.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index 00684597b098..32ab889c8193 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -236,9 +236,10 @@ static void vfio_dma_populate_bitmap(struct vfio_dma *dma, size_t pgsize) } } -static int vfio_dma_bitmap_alloc_all(struct vfio_iommu *iommu, size_t pgsize) +static int vfio_dma_bitmap_alloc_all(struct vfio_iommu *iommu) { struct rb_node *n; + size_t pgsize = (size_t)1 << __ffs(iommu->pgsize_bitmap); for (n = rb_first(&iommu->dma_list); n; n = rb_next(n)) { struct vfio_dma *dma = rb_entry(n, struct vfio_dma, node); @@ -2798,12 +2799,9 @@ static int vfio_iommu_type1_dirty_pages(struct vfio_iommu *iommu, return -EINVAL; if (dirty.flags & VFIO_IOMMU_DIRTY_PAGES_FLAG_START) { - size_t pgsize; - mutex_lock(&iommu->lock); - pgsize = 1 << __ffs(iommu->pgsize_bitmap); if (!iommu->dirty_page_tracking) { - ret = vfio_dma_bitmap_alloc_all(iommu, pgsize); + ret = vfio_dma_bitmap_alloc_all(iommu); if (!ret) iommu->dirty_page_tracking = true; } -- 2.23.0