From patchwork Fri Apr 19 08:32:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhao X-Patchwork-Id: 10909619 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 D0D211515 for ; Fri, 19 Apr 2019 19:12:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C3A0D28DFD for ; Fri, 19 Apr 2019 19:12:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B629E28E02; Fri, 19 Apr 2019 19:12:50 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable 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 6D0E228DFD for ; Fri, 19 Apr 2019 19:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728901AbfDSTMZ (ORCPT ); Fri, 19 Apr 2019 15:12:25 -0400 Received: from mga12.intel.com ([192.55.52.136]:62826 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfDSTMY (ORCPT ); Fri, 19 Apr 2019 15:12:24 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2019 01:39:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,368,1549958400"; d="scan'208";a="141935693" Received: from joy-optiplex-7040.sh.intel.com ([10.239.13.9]) by fmsmga008.fm.intel.com with ESMTP; 19 Apr 2019 01:39:19 -0700 From: Yan Zhao To: intel-gvt-dev@lists.freedesktop.org Cc: arei.gonglei@huawei.com, aik@ozlabs.ru, Zhengxiao.zx@alibaba-inc.com, shuangtai.tst@alibaba-inc.com, qemu-devel@nongnu.org, eauger@redhat.com, yi.l.liu@intel.com, ziye.yang@intel.com, mlevitsk@redhat.com, pasic@linux.ibm.com, felipe@nutanix.com, changpeng.liu@intel.com, Ken.Xue@amd.com, jonathan.davies@nutanix.com, shaopeng.he@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, libvir-list@redhat.com, alex.williamson@redhat.com, eskultet@redhat.com, dgilbert@redhat.com, cohuck@redhat.com, kevin.tian@intel.com, zhenyuw@linux.intel.com, zhi.a.wang@intel.com, cjia@nvidia.com, kwankhede@nvidia.com, Yan Zhao Subject: [PATCH 0/2] introduction of version attribute for VFIO live migration Date: Fri, 19 Apr 2019 04:32:58 -0400 Message-Id: <20190419083258.19580-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patchset introduces a version attribute under sysfs of VFIO Mediated devices. This version attribute is used by user space software like libvirt to determine whether two mdev devices are compatible for live migration before starting live migration. Patch 1 defines version attribute as mandatory for VFIO live migration. It means if version attribute is missing or it returns errno, the corresponding mdev device is regarded as not supporting live migration. samples for vfio-mdev are modified to demonstrate it. Patch 2 uses GVT as an example to show how to expose version attribute and check device compatibility in vendor driver. Yan Zhao (2): vfio/mdev: add version field as mandatory attribute for mdev device drm/i915/gvt: export mdev device version to sysfs for Intel vGPU Documentation/vfio-mediated-device.txt | 36 +++++++++ drivers/gpu/drm/i915/gvt/Makefile | 2 +- drivers/gpu/drm/i915/gvt/device_version.c | 94 +++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/gvt.c | 55 +++++++++++++ drivers/gpu/drm/i915/gvt/gvt.h | 6 ++ samples/vfio-mdev/mbochs.c | 17 ++++ samples/vfio-mdev/mdpy.c | 16 ++++ samples/vfio-mdev/mtty.c | 16 ++++ 8 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/gvt/device_version.c