Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2404578pxb; Tue, 13 Apr 2021 00:40:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzto7NZcqoErzBPsreWk2YbhzwXWSGQ9GpclA+8hRLdUVDE3UJQ6daieZQwo7Hi1lZSdi+4 X-Received: by 2002:aa7:c455:: with SMTP id n21mr29055316edr.48.1618299634376; Tue, 13 Apr 2021 00:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618299634; cv=none; d=google.com; s=arc-20160816; b=EDi6/6EOrPEyGosThgdfexstr4CiZCDnEg95+cYEFihwolfx+hVdzbtserQjs3rCN+ sPGl5yXiuGh71XOv9hoVSeOcDtlMxoCQHWvgCl4XtB4Cjax0hkIsJqpIVc0CyLlXeT+1 0TmEzqc0jvmT+umdSzztDcz1/tXKymmzudMEpYAk9q56GOLzDDBaQMmXJqgafOZItDu/ qBamAOV/ZzZQaswaHlVz4DZyQh+IaZ5ZrCcwBQdQGqr+SgseJ8LqdbE/eKtIlTOXG2G3 lCO1aJ29FBdL8X2E+dWECDP8pHYGzlt+PDGJ8PE0mDs0uxsJeoZql6+VCLpBGzO3wgpS rEGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=hsk903qvbuHpPewyI9zxA+1HNyZb8sX4J4HT84JgxNY=; b=m93pxp7znqSjOZHpEyb0mRBvjcVQyAiYsjkkUQM4TRzNI0rf/VxC83ulQKo+ubjyBv xwK6kbplCvU4bXM40H5DcSmcfPdRFEl8k1or3ax3j/fw1ww/pMfrk6uqA/9qY8+qq+Oo CceKHx8+4SovyYDQ2jgDapfTfxJzfZswqvoIH/PvXCQCiPASDXIc672ugZ6I6+EGmLG4 P8Vv3Ndts7TpJ+l3/mI+4xyDjvMS5jFpRNUvmml8hcXkwYvvgDOpyGNtL4x5D6P8XNys IAGjJQIwV4b1kKZJqt78sHVsaG/9GihTWheWKFeMTF4nIX54xW5lxIN5/z0gKGzFCFup kXMg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si9515448ejb.97.2021.04.13.00.40.10; Tue, 13 Apr 2021 00:40:34 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243555AbhDMBX3 (ORCPT + 99 others); Mon, 12 Apr 2021 21:23:29 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:17315 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237829AbhDMBX2 (ORCPT ); Mon, 12 Apr 2021 21:23:28 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4FK78h0jHwz9yyL; Tue, 13 Apr 2021 09:20:52 +0800 (CST) Received: from huawei.com (10.67.165.24) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.498.0; Tue, 13 Apr 2021 09:22:57 +0800 From: Longfang Liu To: CC: , , , Subject: [RFC PATCH v3 0/3] vfio/hisilicon: add acc live migration driver Date: Tue, 13 Apr 2021 09:20:18 +0800 Message-ID: <1618276821-8320-1-git-send-email-liulongfang@huawei.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.165.24] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The live migration solution relies on the vfio_device_migration_info protocol. The structure vfio_device_migration_info is placed at the 0th offset of the VFIO_REGION_SUBTYPE_MIGRATION region to get and set VFIO device related migration information. Field accesses from this structure are only supported at their native width and alignment. Otherwise, the result is undefined and vendor drivers should return an error. (1).The driver framework is based on vfio_pci_register_dev_region() of vfio-pci, and then a new live migration region is added, and the live migration is realized through the ops of this region. (2).In order to ensure the compatibility of the devices before and after the migration, the device compatibility information check will be performed in the Pre-copy stage. If the check fails, an error will be returned and the source VM will exit the migration function. (3).After the compatibility check is passed, it will enter the Stop-and-copy stage. At this time, all the live migration data will be copied, and then saved to the VF device of the destination, and then the VF device of the destination will be started and the VM of the source will be exited. Longfang Liu (3): vfio/hisilicon: add acc live migration driver vfio/hisilicon: register the driver to vfio vfio/hisilicom: add debugfs for driver drivers/vfio/pci/Kconfig | 9 + drivers/vfio/pci/Makefile | 3 +- drivers/vfio/pci/hisilicon/acc_vf_migration.c | 1357 +++++++++++++++++++++++++ drivers/vfio/pci/hisilicon/acc_vf_migration.h | 172 ++++ drivers/vfio/pci/vfio_pci.c | 11 + drivers/vfio/pci/vfio_pci_private.h | 10 + 6 files changed, 1561 insertions(+), 1 deletion(-) create mode 100644 drivers/vfio/pci/hisilicon/acc_vf_migration.c create mode 100644 drivers/vfio/pci/hisilicon/acc_vf_migration.h -- 2.8.1