Message ID | 20210107092901.19712-3-zhukeqian1@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=86FG=GK=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8555C433E0 for <linux-arm-kernel@archiver.kernel.org>; Thu, 7 Jan 2021 09:32:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9D6432333C for <linux-arm-kernel@archiver.kernel.org>; Thu, 7 Jan 2021 09:32:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D6432333C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ZQuxvyts8DhdMEmudtJ8jn7E1adzX6Ve70UdwIGtniw=; b=DIbHUkbLuAVrnQk7f9jDh29xc dt0lBPz1BKR3Ksg02/27QsAaF/i8lp/VwsScmqk8pLqnT1J5z6KojH2JUnKRhmRmz1NTrsPwcop4q 1fjB7go3MSIogTv1NJ5pA+JULZX2R+I2OJUo3MBlY9hYSBctkJH4c8VuETGRVqf5qtOT+0s2E/k89 ZSVavilbaxUh3xcv1FTIgeVInZRK+K0EJsPtHD2QAAFcKsBnynBg7unvPGdB+W5HOWZe9QepUXisz rjlD11ub4u0wwTkn3916K89yDo0Nq/I2PRC9HR9lu9GfPRLIlvFE+El/djOXZ85PvHZsTPAiEiail vAv15K8RA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxRc9-0001cz-4f; Thu, 07 Jan 2021 09:29:53 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kxRc4-0001Yy-Fu for linux-arm-kernel@lists.infradead.org; Thu, 07 Jan 2021 09:29:49 +0000 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4DBLWb6N3FzMGSP; Thu, 7 Jan 2021 17:28:27 +0800 (CST) Received: from DESKTOP-5IS4806.china.huawei.com (10.174.184.42) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Thu, 7 Jan 2021 17:29:30 +0800 From: Keqian Zhu <zhukeqian1@huawei.com> To: <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <iommu@lists.linux-foundation.org>, <kvm@vger.kernel.org>, <kvmarm@lists.cs.columbia.edu>, Alex Williamson <alex.williamson@redhat.com>, Kirti Wankhede <kwankhede@nvidia.com>, Cornelia Huck <cohuck@redhat.com>, Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>, Catalin Marinas <catalin.marinas@arm.com> Subject: [PATCH 2/5] vfio/iommu_type1: Populate dirty bitmap for new vfio_dma Date: Thu, 7 Jan 2021 17:28:58 +0800 Message-ID: <20210107092901.19712-3-zhukeqian1@huawei.com> X-Mailer: git-send-email 2.8.4.windows.1 In-Reply-To: <20210107092901.19712-1-zhukeqian1@huawei.com> References: <20210107092901.19712-1-zhukeqian1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.184.42] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210107_042948_898231_0D53D127 X-CRM114-Status: GOOD ( 11.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Mark Rutland <mark.rutland@arm.com>, jiangkunkun@huawei.com, Suzuki K Poulose <suzuki.poulose@arm.com>, Joerg Roedel <joro@8bytes.org>, Daniel Lezcano <daniel.lezcano@linaro.org>, Alexios Zavras <alexios.zavras@intel.com>, James Morse <james.morse@arm.com>, wanghaibin.wang@huawei.com, Thomas Gleixner <tglx@linutronix.de>, Robin Murphy <robin.murphy@arm.com>, Andrew Morton <akpm@linux-foundation.org>, Julien Thierry <julien.thierry.kdev@gmail.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
vfio/iommu_type1: Some fixes about dirty tracking
|
expand
|
diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c index b0a26e8e0adf..29c8702c3b6e 100644 --- a/drivers/vfio/vfio_iommu_type1.c +++ b/drivers/vfio/vfio_iommu_type1.c @@ -1413,7 +1413,9 @@ static int vfio_dma_do_map(struct vfio_iommu *iommu, if (!ret && iommu->dirty_page_tracking) { ret = vfio_dma_bitmap_alloc(dma, pgsize); - if (ret) + if (!ret) + vfio_dma_populate_bitmap(iommu, dma); + else vfio_remove_dma(iommu, dma); }
We should populate dirty bitmap for newly added vfio_dma as it can be accessed arbitrarily if vfio_iommu is not promoted to pinned_scope. vfio_dma_populate_bitmap can handle this properly. Fixes: d6a4c185660c ("vfio iommu: Implementation of ioctl for dirty pages tracking") Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com> --- drivers/vfio/vfio_iommu_type1.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)