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: 10644045 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C1D3109C for ; Tue, 16 Oct 2018 18:14:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F2B6F2A587 for ; Tue, 16 Oct 2018 18:14:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E69852A5F1; Tue, 16 Oct 2018 18:14:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D2CC2A587 for ; Tue, 16 Oct 2018 18:14:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727416AbeJQCF6 (ORCPT ); Tue, 16 Oct 2018 22:05:58 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:3976 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727395AbeJQCF6 (ORCPT ); Tue, 16 Oct 2018 22:05:58 -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: , CC: , , Kirti Wankhede Subject: [RFC PATCH v1 0/4] Add migration support for VFIO device 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=1539713655; bh=2lHtuY0Qm3r/jBow0rRkWxjPRRhuZvfYsMfRKSDXGhw=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=KMgBfqi+OJwJibA0IyNzXQhS1Pt81hBPNKtg41Je08cbyW6tPR3Tu2U+QizuNZvan WzGqZB80JKjL/uyUeNqGB6j5Vp96O9CBOEWDuV8T0JFL74qb2dyeD5mF+6jaYLjOva juQXfRQLIS44GzqSR9kNioCMQV+cdtuiWlMfC7gTnG/0QiFaVZu55p94k7thslDrcq k/i+nLnD/xV7LW1Mp2lA3TnNWt/y12c6AhMsS4LiuOSC0BbD3G1FzIvdYPoyeAS4pI rXv+n4qT5myN1iVgzeLu1G2g1rY627lXgPC0tCAYn2V0S4FiscJz7Sp2K2qlf6UIwb KRIL+VswFg1gA== Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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