From patchwork Tue Oct 16 18:12:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirti Wankhede X-Patchwork-Id: 984957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nvidia.com header.i=@nvidia.com header.b="ON5Vf8gj"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42ZNwd3hBgz9s8T for ; Wed, 17 Oct 2018 05:23:29 +1100 (AEDT) Received: from localhost ([::1]:59576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCU07-0001Rh-10 for incoming@patchwork.ozlabs.org; Tue, 16 Oct 2018 14:23:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCTwU-0006oP-Dc for qemu-devel@nongnu.org; Tue, 16 Oct 2018 14:19:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCTwT-0003vf-8x for qemu-devel@nongnu.org; Tue, 16 Oct 2018 14:19:42 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:4197) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gCTwP-0003ff-NW for qemu-devel@nongnu.org; Tue, 16 Oct 2018 14:19:38 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 16 Oct 2018 11:14:15 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 16 Oct 2018 11:14:18 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 16 Oct 2018 11:14:18 -0700 Received: from HQMAIL106.nvidia.com (172.18.146.12) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 16 Oct 2018 18:14:18 +0000 Received: from kwankhede-dev.nvidia.com (172.20.13.39) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Tue, 16 Oct 2018 18:14:16 +0000 From: Kirti Wankhede To: , Date: Tue, 16 Oct 2018 23:42:34 +0530 Message-ID: <1539713558-2453-1-git-send-email-kwankhede@nvidia.com> X-Mailer: git-send-email 2.7.0 X-NVConfidentiality: public MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1539713656; bh=2lHtuY0Qm3r/jBow0rRkWxjPRRhuZvfYsMfRKSDXGhw=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=ON5Vf8gjuNJWFV1f+z/Fig7DFy1bYNx4XNZwSOaGSlM6sHW9iLrtTk+PCLqJNDkLp 9fTGrwwkOdAsSAptn8nBbrmzavDcDpPiqU9IbfQ2vjdOD7IKxGVg+UhD2wYkSV2gV5 Ycc00ZAcslyfS1s3B2tLvo7TUdkM5fSflBavLxx/GechGYVYqqC1dhTXsAI/hL0L3+ ZiKcNj608u2bR6KaR5ZlsuN1Of6MsYAwLfC+Xd+wAlAYnbAwFWVGxJJ2LmoEyC6oSl AlJTJVdW+Lwpe/yQBWW68w8RVdSxpiFTkAe5UQyY1qrogbX8lMyJS5r5Fhu5W7Wjnd SLu9lz+4Fm6IQ== X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 216.228.121.64 Subject: [Qemu-devel] [RFC PATCH v1 0/4] Add migration support for VFIO device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kirti Wankhede , qemu-devel@nongnu.org, kvm@vger.kernel.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Add migration support for VFIO device This Patch set include patches as below: - Define KABI for VFIO device for migration support. - Generic migration functionality for VFIO device. * This patch set adds functionality only for PCI devices, but can be extended to other VFIO devices. * Added all the basic functions required for pre-copy, stop-and-copy and resume phases of migration. * Added state change notifier and from that notifier function, VFIO device's state changed is conveyed to VFIO vendor driver. * During save setup phase and resume/load setup phase, migration region is queried from vendor driver and is mmaped by QEMU. This region is used to read/write data from and to vendor driver. * .save_live_pending, .save_live_iterate and .is_active_iterate are implemented to use QEMU's functionality of iteration during pre-copy phase. * In .save_live_complete_precopy, that is in stop-and-copy phase, iteration to read data from vendor driver is implemented till pending bytes returned by vendor driver are not zero. * .save_cleanup and .load_cleanup are implemented to unmap migration region that was setup duing setup phase. * Added function to get dirty pages bitmap from vendor driver. - Add vfio_listerner_log_sync to mark dirty pages. - Make VFIO PCI device migration capable. Thanks, Kirti Kirti Wankhede (4): VFIO KABI for migration interface Add migration functions for VFIO devices Add vfio_listerner_log_sync to mark dirty pages Make vfio-pci device migration capable. hw/vfio/Makefile.objs | 2 +- hw/vfio/common.c | 32 ++ hw/vfio/migration.c | 716 ++++++++++++++++++++++++++++++++++++++++++ hw/vfio/pci.c | 13 +- include/hw/vfio/vfio-common.h | 23 ++ linux-headers/linux/vfio.h | 91 ++++++ 6 files changed, 869 insertions(+), 8 deletions(-) create mode 100644 hw/vfio/migration.c