Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3065888ybb; Sun, 12 Apr 2020 23:07:25 -0700 (PDT) X-Google-Smtp-Source: APiQypJ6BhqcnMZlyWO3t75RiHfIuXot5FxbmoLBDJLkMWy9H1EgHu5jda1ITWuSXvdDzswb7cEo X-Received: by 2002:aed:3f30:: with SMTP id p45mr1751405qtf.49.1586758045629; Sun, 12 Apr 2020 23:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586758045; cv=none; d=google.com; s=arc-20160816; b=SVu56eIq27t1Hy1BapuTLhwXqTmgyd5gqXBeyQ2sFZ8UQztr/FPU3GxwgSUVk8Mi82 hhtt+4EeuGvLkkeRa7k2W2d1aX+mGxHcM89yFqp1PICAkOGQDxdm+YGYWEi9Z3H8E9H0 6EN6U/chPJf0zbf/ueOQgHtjZdFgvnwG3dLOtV2R9O08KBsXGQDBgcoQ89xGXC5HJU9C ZeGdl+0uqAbmNBMQkKQoFky/KnIP3+uj+iOdDQGe7xkWsi7TpdfBSYdQLseLzvrkCSP5 8ODKrnOYIKlmJAtrgMGgGfy/vxgt6ack2eKnOH3Jng0CRJCeIV63mcx+/TzebBCCIffT j26g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr:ironport-sdr; bh=O09Mi7k452H+Zz0ps96ezZpOJJygXS95gG8gaexcgPU=; b=UlDfsLTgSrTpIh3ZvpiFKDWMXXuwUxsqDuWT8KoPoH24rGfz4abiJA3qWl1Hbup9Ub FOj95Uc64XaZle4USlG2H+FB5HdDLNsQcAhIE9BCPdteatL3xaJ2rjv7JJ5k9bPl8MTN mhOk+BgB1OiruEtpy3oCrk7Q3Ghswp39eTsr2y8iFxItJd+8u86WUkZyb/5DRUwd+2wG erM6V6wEyqsiWqCgOZMp8VVLI4u14O3f+W4B5rqATznumtMpwanVkXmUkJJXK9/w8i4n TE6NxmY10O749mg0s27+tjR4QUJPvNeu6S9fpybJvW0CoWdwwdeTB17mel3VbCsrsPCV k1Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org ([209.132.180.67]) by mx.google.com with ESMTP id q15si5703752qtf.321.2020.04.12.23.07.11; Sun, 12 Apr 2020 23:07:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.132.180.67 is neither permitted nor denied by best guess record for domain of linux-kernel-owner@vger.kernel.org) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbgDMGCB (ORCPT + 99 others); Mon, 13 Apr 2020 02:02:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:46164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726967AbgDMGCA (ORCPT ); Mon, 13 Apr 2020 02:02:00 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34661C0A3BE0; Sun, 12 Apr 2020 23:02:00 -0700 (PDT) IronPort-SDR: J+h/MBje8AxqNUX6hmRuU4GVAaqWr2uoKhQKt/uhcPmiklveoPpVrJyaVGOpVr+nKwH9OXIx2f HYUziwvH9OIQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Apr 2020 23:01:59 -0700 IronPort-SDR: O5wdGuyQlc7bo5KmVytTBytv4gIaY33RmF0q8WDMiPNVI4GCYyrC5X6Yd4Ae+HQAXSFb7BKflg 896Qwv3gpldQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,377,1580803200"; d="scan'208";a="453054045" Received: from joy-optiplex-7040.sh.intel.com ([10.239.13.16]) by fmsmga005.fm.intel.com with ESMTP; 12 Apr 2020 23:01:52 -0700 From: Yan Zhao To: intel-gvt-dev@lists.freedesktop.org Cc: libvir-list@redhat.com, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, 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, xin.zeng@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, 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, berrange@redhat.com, dinechin@redhat.com, corbet@lwn.net, Yan Zhao Subject: [PATCH v5 0/4] introduction of migration_version attribute for VFIO live migration Date: Mon, 13 Apr 2020 01:52:01 -0400 Message-Id: <20200413055201.27053-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset introduces a migration_version attribute under sysfs of VFIO Mediated devices. This migration_version attribute is used to check migration compatibility between two mdev devices. Currently, it has two locations: (1) under mdev_type node, which can be used even before device creation, but only for mdev devices of the same mdev type. (2) under mdev device node, which can only be used after the mdev devices are created, but the src and target mdev devices are not necessarily be of the same mdev type (The second location is newly added in v5, in order to keep consistent with the migration_version node for migratable pass-though devices) Patch 1 defines migration_version attribute for the first location in Documentation/vfio-mediated-device.txt Patch 2 uses GVT as an example for patch 1 to show how to expose migration_version attribute and check migration compatibility in vendor driver. Patch 3 defines migration_version attribute for the second location in Documentation/vfio-mediated-device.txt Patch 4 uses GVT as an example for patch 3 to show how to expose migration_version attribute and check migration compatibility in vendor driver. (The previous "Reviewed-by" and "Acked-by" for patch 1 and patch 2 are kept in v5, as there are only small changes to commit messages of the two patches.) v5: added patch 2 and 4 for mdev device part of migration_version attribute. v4: 1. fixed indentation/spell errors, reworded several error messages 2. added a missing memory free for error handling in patch 2 v3: 1. renamed version to migration_version 2. let errno to be freely defined by vendor driver 3. let checking mdev_type be prerequisite of migration compatibility check 4. reworded most part of patch 1 5. print detailed error log in patch 2 and generate migration_version string at init time v2: 1. renamed patched 1 2. made definition of device version string completely private to vendor driver 3. reverted changes to sample mdev drivers 4. described intent and usage of version attribute more clearly. Yan Zhao (4): vfio/mdev: add migration_version attribute for mdev (under mdev_type node) drm/i915/gvt: export migration_version to mdev sysfs (under mdev_type node) vfio/mdev: add migration_version attribute for mdev (under mdev device node) drm/i915/gvt: export migration_version to mdev sysfs (under mdev device node) .../driver-api/vfio-mediated-device.rst | 183 ++++++++++++++++++ drivers/gpu/drm/i915/gvt/Makefile | 2 +- drivers/gpu/drm/i915/gvt/gvt.c | 39 ++++ drivers/gpu/drm/i915/gvt/gvt.h | 7 + drivers/gpu/drm/i915/gvt/kvmgt.c | 55 ++++++ drivers/gpu/drm/i915/gvt/migration_version.c | 170 ++++++++++++++++ drivers/gpu/drm/i915/gvt/vgpu.c | 13 +- 7 files changed, 466 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/i915/gvt/migration_version.c -- 2.17.1