Skip to contentSkip to conversation

refactor the i915 GVT support

PATCH In review Christoph Hellwig 10 participants 68 messages Jul 21, 2021 – Oct 5, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

the GVT code in the i915 is a bit of a mess right now due to strange abstractions and lots of indirect calls. This series refactors various bits to clean that up. The main user visible change is that almost all of the GVT code moves out of the main i915 driver and into the kvmgt module.

Tested on my Thinkpad with a Kaby Lake CPU and integrated graphics.

Git tree:

    git://git.infradead.org/users/hch/misc.git i915-gvt

Gitweb:

http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/i915-gvt

Diffstat:

 b/drivers/gpu/drm/i915/Kconfig                         |   31 
 b/drivers/gpu/drm/i915/Makefile                        |   30 
 b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c |    4 
 b/drivers/gpu/drm/i915/gvt/cfg_space.c                 |   89 --
 b/drivers/gpu/drm/i915/gvt/cmd_parser.c                |    4 
 b/drivers/gpu/drm/i915/gvt/dmabuf.c                    |   36 
 b/drivers/gpu/drm/i915/gvt/execlist.c                  |   12 
 b/drivers/gpu/drm/i915/gvt/gtt.c                       |   55 -
 b/drivers/gpu/drm/i915/gvt/gvt.c                       |  100 --
 b/drivers/gpu/drm/i915/gvt/gvt.h                       |  132 ++-
 b/drivers/gpu/drm/i915/gvt/interrupt.c                 |   38 -
 b/drivers/gpu/drm/i915/gvt/kvmgt.c                     |  634 ++++-------------
 b/drivers/gpu/drm/i915/gvt/mmio.c                      |    4 
 b/drivers/gpu/drm/i915/gvt/opregion.c                  |  148 ---
 b/drivers/gpu/drm/i915/gvt/page_track.c                |    8 
 b/drivers/gpu/drm/i915/gvt/scheduler.c                 |   37 
 b/drivers/gpu/drm/i915/gvt/trace.h                     |    2 
 b/drivers/gpu/drm/i915/gvt/vgpu.c                      |   22 
 b/drivers/gpu/drm/i915/i915_drv.h                      |    7 
 b/drivers/gpu/drm/i915/i915_params.c                   |    2 
 b/drivers/gpu/drm/i915/intel_gvt.c                     |   64 +
 b/drivers/gpu/drm/i915/intel_gvt.h                     |    4 
 drivers/gpu/drm/i915/gvt/Makefile                      |    9 
 drivers/gpu/drm/i915/gvt/hypercall.h                   |   82 --
 drivers/gpu/drm/i915/gvt/mpt.h                         |  400 ----------
 25 files changed, 541 insertions(+), 1413 deletions(-)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#1 lore raw

PATCH 1/21 drm/i915/gvt: integrate into the main Makefile

Remove the separately included Makefile and just use the relative reference from the main i915 Makefile as for source files in other subdirectories.

---
 drivers/gpu/drm/i915/Makefile     | 29 ++++++++++++++++++++++++-----
 drivers/gpu/drm/i915/gvt/Makefile |  9 ---------
 drivers/gpu/drm/i915/gvt/trace.h  |  2 +-
 3 files changed, 25 insertions(+), 15 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/gvt/Makefile
drivers/gpu/drm/i915/Makefile +24 -5
index 4f22cac1c49b..2153f67705b8 100644
@@ -289,11 +289,30 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
 
 # virtual gpu code
 i915-y += i915_vgpu.o
-
-ifeq ($(CONFIG_DRM_I915_GVT),y)
-i915-y += intel_gvt.o
-include $(src)/gvt/Makefile
-endif
+i915-$(CONFIG_DRM_I915_GVT) += \
+	intel_gvt.o \
+	gvt/gvt.o \
+	gvt/aperture_gm.o \
+	gvt/handlers.o \
+	gvt/vgpu.o \
+	gvt/trace_points.o \
+	gvt/firmware.o \
+	gvt/interrupt.o \
+	gvt/gtt.o \
+	gvt/cfg_space.o \
+	gvt/opregion.o \
+	gvt/mmio.o \
+	gvt/display.o \
+	gvt/edid.o \
+	gvt/execlist.o \
+	gvt/scheduler.o \
+	gvt/sched_policy.o \
+	gvt/mmio_context.o \
+	gvt/cmd_parser.o \
+	gvt/debugfs.o \
+	gvt/fb_decoder.o \
+	gvt/dmabuf.o \
+	gvt/page_track.o
 
 obj-$(CONFIG_DRM_I915) += i915.o
 obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o
drivers/gpu/drm/i915/gvt/Makefile deleted +0 -9
deleted file mode 100644
index ea8324abc784..000000000000
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-GVT_DIR := gvt
-GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
-	interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \
-	execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o debugfs.o \
-	fb_decoder.o dmabuf.o page_track.o
-
-ccflags-y				+= -I $(srctree)/$(src) -I $(srctree)/$(src)/$(GVT_DIR)/
-i915-y					+= $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
drivers/gpu/drm/i915/gvt/trace.h +1 -1
index 6d787750d279..348f57f8301d 100644
@@ -379,5 +379,5 @@ TRACE_EVENT(render_mmio,
 #undef TRACE_INCLUDE_PATH
 #define TRACE_INCLUDE_PATH .
 #undef TRACE_INCLUDE_FILE
-#define TRACE_INCLUDE_FILE trace
+#define TRACE_INCLUDE_FILE gvt/trace
 #include <trace/define_trace.h>
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

Re: [PATCH 01/21] drm/i915/gvt: integrate into the main Makefile

Quoted 4 lines · Christoph Hellwig

Remove the separately included Makefile and just use the relative reference from the main i915 Makefile as for source files in other subdirectories.

We agreed to make gvt mostly self-contained in its own directory before. Although I don't think we would change files much later, but still need to get ack from i915 maintainers.

Thanks

Quoted 81 lines
---
 drivers/gpu/drm/i915/Makefile     | 29 ++++++++++++++++++++++++-----
 drivers/gpu/drm/i915/gvt/Makefile |  9 ---------
 drivers/gpu/drm/i915/gvt/trace.h  |  2 +-
 3 files changed, 25 insertions(+), 15 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/gvt/Makefile
drivers/gpu/drm/i915/Makefile +24 -5
index 4f22cac1c49b..2153f67705b8 100644
@@ -289,11 +289,30 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
 
 # virtual gpu code
 i915-y += i915_vgpu.o
-
-ifeq ($(CONFIG_DRM_I915_GVT),y)
-i915-y += intel_gvt.o
-include $(src)/gvt/Makefile
-endif
+i915-$(CONFIG_DRM_I915_GVT) += \
+	intel_gvt.o \
+	gvt/gvt.o \
+	gvt/aperture_gm.o \
+	gvt/handlers.o \
+	gvt/vgpu.o \
+	gvt/trace_points.o \
+	gvt/firmware.o \
+	gvt/interrupt.o \
+	gvt/gtt.o \
+	gvt/cfg_space.o \
+	gvt/opregion.o \
+	gvt/mmio.o \
+	gvt/display.o \
+	gvt/edid.o \
+	gvt/execlist.o \
+	gvt/scheduler.o \
+	gvt/sched_policy.o \
+	gvt/mmio_context.o \
+	gvt/cmd_parser.o \
+	gvt/debugfs.o \
+	gvt/fb_decoder.o \
+	gvt/dmabuf.o \
+	gvt/page_track.o
 
 obj-$(CONFIG_DRM_I915) += i915.o
 obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o
drivers/gpu/drm/i915/gvt/Makefile deleted +0 -9
deleted file mode 100644
index ea8324abc784..000000000000
@@ -1,9 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-GVT_DIR := gvt
-GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
-	interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \
-	execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o debugfs.o \
-	fb_decoder.o dmabuf.o page_track.o
-
-ccflags-y				+= -I $(srctree)/$(src) -I $(srctree)/$(src)/$(GVT_DIR)/
-i915-y					+= $(addprefix $(GVT_DIR)/, $(GVT_SOURCE))
drivers/gpu/drm/i915/gvt/trace.h +1 -1
index 6d787750d279..348f57f8301d 100644
@@ -379,5 +379,5 @@ TRACE_EVENT(render_mmio,
 #undef TRACE_INCLUDE_PATH
 #define TRACE_INCLUDE_PATH .
 #undef TRACE_INCLUDE_FILE
-#define TRACE_INCLUDE_FILE trace
+#define TRACE_INCLUDE_FILE gvt/trace
 #include <trace/define_trace.h>
Signature · 6 lines
2.30.2

_______________________________________________
intel-gvt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev
#3 lore raw

PATCH 2/21 drm/i915/gvt: remove module refcounting in intel_gvt_{,un}register_hypervisor

In reply to Christoph Hellwig

THIS_MODULE always is reference when a symbol called by it is used, so don't bother with the additional reference.

---
 drivers/gpu/drm/i915/gvt/gvt.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.c +0 -6
index cbac409f6c8a..6d7938aacca4 100644
@@ -308,10 +308,6 @@ intel_gvt_register_hypervisor(const struct intel_gvt_mpt *m)
 	    m->type != INTEL_GVT_HYPERVISOR_XEN)
 		return -EINVAL;
 
-	/* Get a reference for device model module */
-	if (!try_module_get(THIS_MODULE))
-		return -ENODEV;
-
 	intel_gvt_host.mpt = m;
 	intel_gvt_host.hypervisor_type = m->type;
 	gvt = (void *)kdev_to_i915(intel_gvt_host.dev)->gvt;
@@ -321,7 +317,6 @@ intel_gvt_register_hypervisor(const struct intel_gvt_mpt *m)
 	if (ret < 0) {
 		gvt_err("Failed to init %s hypervisor module\n",
 			supported_hypervisors[intel_gvt_host.hypervisor_type]);
-		module_put(THIS_MODULE);
 		return -ENODEV;
 	}
 	gvt_dbg_core("Running with hypervisor %s in host mode\n",
@@ -335,6 +330,5 @@ intel_gvt_unregister_hypervisor(void)
 {
 	void *gvt = (void *)kdev_to_i915(intel_gvt_host.dev)->gvt;
 	intel_gvt_hypervisor_host_exit(intel_gvt_host.dev, gvt);
-	module_put(THIS_MODULE);
 }
 EXPORT_SYMBOL_GPL(intel_gvt_unregister_hypervisor);
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw

PATCH 3/21 drm/i915/gvt: remove enum hypervisor_type

In reply to Christoph Hellwig

The only supported hypervisor is KVM, so don't bother with dead code enumerating hypervisors.

---
 drivers/gpu/drm/i915/gvt/gvt.c       |  17 +--
 drivers/gpu/drm/i915/gvt/gvt.h       |   1 -
 drivers/gpu/drm/i915/gvt/hypercall.h |   6 --
 drivers/gpu/drm/i915/gvt/kvmgt.c     |   1 -
 drivers/gpu/drm/i915/gvt/opregion.c  | 150 ++++++---------------------
 5 files changed, 34 insertions(+), 141 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.c +1 -16
index 6d7938aacca4..ee09bba970af 100644
@@ -41,11 +41,6 @@
 
 struct intel_gvt_host intel_gvt_host;
 
-static const char * const supported_hypervisors[] = {
-	[INTEL_GVT_HYPERVISOR_XEN] = "XEN",
-	[INTEL_GVT_HYPERVISOR_KVM] = "KVM",
-};
-
 static const struct intel_gvt_ops intel_gvt_ops = {
 	.emulate_cfg_read = intel_vgpu_emulate_cfg_read,
 	.emulate_cfg_write = intel_vgpu_emulate_cfg_write,
@@ -304,23 +299,13 @@ intel_gvt_register_hypervisor(const struct intel_gvt_mpt *m)
 	if (!intel_gvt_host.initialized)
 		return -ENODEV;
 
-	if (m->type != INTEL_GVT_HYPERVISOR_KVM &&
-	    m->type != INTEL_GVT_HYPERVISOR_XEN)
-		return -EINVAL;
-
 	intel_gvt_host.mpt = m;
-	intel_gvt_host.hypervisor_type = m->type;
 	gvt = (void *)kdev_to_i915(intel_gvt_host.dev)->gvt;
 
 	ret = intel_gvt_hypervisor_host_init(intel_gvt_host.dev, gvt,
 					     &intel_gvt_ops);
-	if (ret < 0) {
-		gvt_err("Failed to init %s hypervisor module\n",
-			supported_hypervisors[intel_gvt_host.hypervisor_type]);
+	if (ret < 0)
 		return -ENODEV;
-	}
-	gvt_dbg_core("Running with hypervisor %s in host mode\n",
-		     supported_hypervisors[intel_gvt_host.hypervisor_type]);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(intel_gvt_register_hypervisor);
drivers/gpu/drm/i915/gvt/gvt.h +0 -1
index 0c0615602343..9b9fdbf9df10 100644
@@ -59,7 +59,6 @@
 struct intel_gvt_host {
 	struct device *dev;
 	bool initialized;
-	int hypervisor_type;
 	const struct intel_gvt_mpt *mpt;
 };
 
drivers/gpu/drm/i915/gvt/hypercall.h +0 -6
index f33e3cbd0439..317983153645 100644
@@ -37,17 +37,11 @@
 
 struct device;
 
-enum hypervisor_type {
-	INTEL_GVT_HYPERVISOR_XEN = 0,
-	INTEL_GVT_HYPERVISOR_KVM,
-};
-
 /*
  * Specific GVT-g MPT modules function collections. Currently GVT-g supports
  * both Xen and KVM by providing dedicated hypervisor-related MPT modules.
  */
 struct intel_gvt_mpt {
-	enum hypervisor_type type;
 	int (*host_init)(struct device *dev, void *gvt, const void *ops);
 	void (*host_exit)(struct device *dev, void *gvt);
 	int (*attach_vgpu)(void *vgpu, unsigned long *handle);
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -1
index 1ac98f8aba31..0d0902d7405d 100644
@@ -2204,7 +2204,6 @@ static bool kvmgt_is_valid_gfn(unsigned long handle, unsigned long gfn)
 }
 
 static const struct intel_gvt_mpt kvmgt_mpt = {
-	.type = INTEL_GVT_HYPERVISOR_KVM,
 	.host_init = kvmgt_host_init,
 	.host_exit = kvmgt_host_exit,
 	.attach_vgpu = kvmgt_attach_vgpu,
drivers/gpu/drm/i915/gvt/opregion.c +33 -117

185 lines not on this page · raw message

Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

PATCH 4/21 drm/i915/gvt: move the gvt code into kvmgt.ko

In reply to Christoph Hellwig

Instead of having an option to build the gvt code into the main i915 module, just move it into the kvmgt.ko module. This only requires a new struct with three entries that the main i915 module needs to request before enabling VGPU passthrough operations.

This also conveniently streamlines the GVT initialization and avoids the need for the global device pointer.

---
 drivers/gpu/drm/i915/Kconfig                  | 31 +++------
 drivers/gpu/drm/i915/Makefile                 |  7 +-
 .../drm/i915/gt/intel_execlists_submission.c  |  4 +-
 drivers/gpu/drm/i915/gvt/gvt.c                | 56 ++++++----------
 drivers/gpu/drm/i915/gvt/gvt.h                |  6 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c              | 19 ++----
 drivers/gpu/drm/i915/gvt/mpt.h                |  3 -
 drivers/gpu/drm/i915/i915_drv.h               |  7 ++
 drivers/gpu/drm/i915/i915_params.c            |  2 +-
 drivers/gpu/drm/i915/intel_gvt.c              | 64 +++++++++++++++++--
 drivers/gpu/drm/i915/intel_gvt.h              |  4 +-
 11 files changed, 107 insertions(+), 96 deletions(-)
drivers/gpu/drm/i915/Kconfig +8 -23
index f960f5d7664e..46e37238b2e4 100644
@@ -98,39 +98,24 @@ config DRM_I915_USERPTR
 
 	  If in doubt, say "Y".
 
-config DRM_I915_GVT
-	bool "Enable Intel GVT-g graphics virtualization host support"
+config DRM_I915_GVT_KVMGT
+	tristate "Enable KVM host support Intel GVT-g graphics virtualization"
 	depends on DRM_I915
 	depends on 64BIT
-	default n
+	depends on KVM
+	depends on VFIO_MDEV
 	help
 	  Choose this option if you want to enable Intel GVT-g graphics
 	  virtualization technology host support with integrated graphics.
 	  With GVT-g, it's possible to have one integrated graphics
-	  device shared by multiple VMs under different hypervisors.
+	  device shared by multiple VMs under KVM.
 
-	  Note that at least one hypervisor like Xen or KVM is required for
-	  this driver to work, and it only supports newer device from
-	  Broadwell+. For further information and setup guide, you can
-	  visit: http://01.org/igvt-g.
-
-	  Now it's just a stub to support the modifications of i915 for
-	  GVT device model. It requires at least one MPT modules for Xen/KVM
-	  and other components of GVT device model to work. Use it under
-	  you own risk.
+	  Note that this driver only supports newer device from Broadwell on.
+	  For further information and setup guide, you can visit:
+	  http://01.org/igvt-g.
 
 	  If in doubt, say "N".
 
-config DRM_I915_GVT_KVMGT
-	tristate "Enable KVM/VFIO support for Intel GVT-g"
-	depends on DRM_I915_GVT
-	depends on KVM
-	depends on VFIO_MDEV
-	default n
-	help
-	  Choose this option if you want to enable KVMGT support for
-	  Intel GVT-g.
-
 menu "drm/i915 Debugging"
 depends on DRM_I915
 depends on EXPERT
drivers/gpu/drm/i915/Makefile +4 -3
index 2153f67705b8..45cdb94363c7 100644
@@ -289,8 +289,9 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
 
 # virtual gpu code
 i915-y += i915_vgpu.o
-i915-$(CONFIG_DRM_I915_GVT) += \
-	intel_gvt.o \
+i915-$(CONFIG_DRM_I915_GVT_KVMGT) += intel_gvt.o
+
+kvmgt-y += gvt/kvmgt.o \
 	gvt/gvt.o \
 	gvt/aperture_gm.o \
 	gvt/handlers.o \
@@ -315,7 +316,7 @@ i915-$(CONFIG_DRM_I915_GVT) += \
 	gvt/page_track.o
 
 obj-$(CONFIG_DRM_I915) += i915.o
-obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o
+obj-$(CONFIG_DRM_I915_GVT_KVMGT) += kvmgt.o
 
 # header test
 
drivers/gpu/drm/i915/gt/intel_execlists_submission.c +2 -2
index fc77592d88a9..8b23c63db7ba 100644
@@ -417,7 +417,7 @@ execlists_context_status_change(struct i915_request *rq, unsigned long status)
 	 * Only used when GVT-g is enabled now. When GVT-g is disabled,
 	 * The compiler should eliminate this function as dead-code.
 	 */
-	if (!IS_ENABLED(CONFIG_DRM_I915_GVT))
+	if (!IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT))
 		return;
 
 	atomic_notifier_call_chain(&rq->engine->context_status_notifier,
@@ -911,7 +911,7 @@ static void execlists_submit_ports(struct intel_engine_cs *engine)
 
 static bool ctx_single_port_submission(const struct intel_context *ce)
 {
-	return (IS_ENABLED(CONFIG_DRM_I915_GVT) &&
+	return (IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT) &&
 		intel_context_force_single_submission(ce));
 }
 
drivers/gpu/drm/i915/gvt/gvt.c +20 -36

98 lines not on this page · raw message

drivers/gpu/drm/i915/gvt/gvt.h +2 -4
index 9b9fdbf9df10..c346111f0300 100644
@@ -57,8 +57,6 @@
 #define GVT_MAX_VGPU 8
 
 struct intel_gvt_host {
-	struct device *dev;
-	bool initialized;
 	const struct intel_gvt_mpt *mpt;
 };
 
@@ -727,9 +725,9 @@ void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu);
 void intel_gvt_debugfs_init(struct intel_gvt *gvt);
 void intel_gvt_debugfs_clean(struct intel_gvt *gvt);
 
-int intel_gvt_pm_resume(struct intel_gvt *gvt);
-
 #include "trace.h"
 #include "mpt.h"
 
+extern const struct i915_virtual_gpu_ops intel_gvt_vgpu_ops;
+
 #endif
drivers/gpu/drm/i915/gvt/kvmgt.c +5 -14
index 0d0902d7405d..65659094eee6 100644
@@ -49,6 +49,8 @@
 #include "i915_drv.h"
 #include "gvt.h"
 
+MODULE_IMPORT_NS(I915_GVT);
+
 static const struct intel_gvt_ops *intel_gvt_ops;
 
 /* helper macros copied from vfio-pci */
@@ -2225,20 +2227,9 @@ static const struct intel_gvt_mpt kvmgt_mpt = {
 	.is_valid_gfn = kvmgt_is_valid_gfn,
 };
 
-static int __init kvmgt_init(void)
-{
-	if (intel_gvt_register_hypervisor(&kvmgt_mpt) < 0)
-		return -ENODEV;
-	return 0;
-}
-
-static void __exit kvmgt_exit(void)
-{
-	intel_gvt_unregister_hypervisor();
-}
-
-module_init(kvmgt_init);
-module_exit(kvmgt_exit);
+struct intel_gvt_host intel_gvt_host = {
+	.mpt		= &kvmgt_mpt,
+};
 
 MODULE_LICENSE("GPL and additional rights");
 MODULE_AUTHOR("Intel Corporation");
drivers/gpu/drm/i915/gvt/mpt.h +0 -3
index e6c5a792a49a..1b5617bb2745 100644
@@ -394,7 +394,4 @@ static inline bool intel_gvt_hypervisor_is_valid_gfn(
 	return intel_gvt_host.mpt->is_valid_gfn(vgpu->handle, gfn);
 }
 
-int intel_gvt_register_hypervisor(const struct intel_gvt_mpt *);
-void intel_gvt_unregister_hypervisor(void);
-
 #endif /* _GVT_MPT_H_ */
drivers/gpu/drm/i915/i915_drv.h +7 -0
index 38ff2fb89744..37afbe2d9563 100644
@@ -750,10 +750,17 @@ struct i915_frontbuffer_tracking {
 	unsigned flip_bits;
 };
 
+struct i915_virtual_gpu_ops {
+	int (*init_device)(struct drm_i915_private *dev_priv);
+	void (*clean_device)(struct drm_i915_private *dev_priv);
+	void (*pm_resume)(struct drm_i915_private *i915);
+};
+
 struct i915_virtual_gpu {
 	struct mutex lock; /* serialises sending of g2v_notify command pkts */
 	bool active;
 	u32 caps;
+	const struct i915_virtual_gpu_ops *ops;
 };
 
 struct intel_cdclk_config {
drivers/gpu/drm/i915/i915_params.c +1 -1
index e07f4cfea63a..a7394294c010 100644
@@ -187,7 +187,7 @@ i915_param_named(enable_dpcd_backlight, int, 0400,
 	"Enable support for DPCD backlight control"
 	"(-1=use per-VBT LFP backlight type setting [default], 0=disabled, 1=enable, 2=force VESA interface, 3=force Intel interface)");
 
-#if IS_ENABLED(CONFIG_DRM_I915_GVT)
+#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
 i915_param_named(enable_gvt, bool, 0400,
 	"Enable support for Intel GVT-g graphics virtualization host support(default:false)");
 #endif
drivers/gpu/drm/i915/intel_gvt.c +57 -7

92 lines not on this page · raw message

drivers/gpu/drm/i915/intel_gvt.h +1 -3
index d7d3fb6186fd..389589f006ad 100644
@@ -26,11 +26,9 @@
 
 struct drm_i915_private;
 
-#ifdef CONFIG_DRM_I915_GVT
+#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
 int intel_gvt_init(struct drm_i915_private *dev_priv);
 void intel_gvt_driver_remove(struct drm_i915_private *dev_priv);
-int intel_gvt_init_device(struct drm_i915_private *dev_priv);
-void intel_gvt_clean_device(struct drm_i915_private *dev_priv);
 int intel_gvt_init_host(void);
 void intel_gvt_sanitize_options(struct drm_i915_private *dev_priv);
 void intel_gvt_resume(struct drm_i915_private *dev_priv);
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer
#6 lore raw

Re: [PATCH 04/21] drm/i915/gvt: move the gvt code into kvmgt.ko

Quoting Christoph Hellwig (2021-07-21 18:53:38)

Quoted 9 lines

Instead of having an option to build the gvt code into the main i915 module, just move it into the kvmgt.ko module. This only requires a new struct with three entries that the main i915 module needs to request before enabling VGPU passthrough operations.

This also conveniently streamlines the GVT initialization and avoids the need for the global device pointer.

Hi,

Thanks for putting the work into this. This conversion has been requested for a long time. For clarity, should we call the module i915_kvmgt?

How far would we be from dynamically modprobing/rmmoding the kvmgt module in order to eliminate the enable_gvt parameter?

<SNIP>

Quoted 28 lines
drivers/gpu/drm/i915/intel_gvt.c +28 -0
+
+/*
+ * Exported here so that the exports only get created when GVT support is
+ * actually enabled.
+ */
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_alloc, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_create_shmem, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_init, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_ggtt_pin_ww, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_pin_map, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_set_to_cpu_domain, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(__i915_gem_object_flush_map, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(__i915_gem_object_set_pages, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_gtt_insert, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_prime_export, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_init, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_backoff, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_fini, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_ppgtt_create, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_request_add, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_request_create, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_request_wait, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_reserve_fence, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_unreserve_fence, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_vm_release, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(i915_vma_move_to_active, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(intel_context_create, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(intel_context_unpin, I915_GVT);

drivers/gpu/drm/i915/intel_gvt.c void intel_gvt_driver_remove(struct drm_i915_private *dev_priv) · line 214

Quoted 10 lines
drivers/gpu/drm/i915/intel_gvt.c +10 -0
+EXPORT_SYMBOL_NS_GPL(__intel_context_do_pin, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(intel_ring_begin, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_get, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_put_unchecked, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_for_reg, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_get, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_put, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(shmem_pin_map, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(shmem_unpin_map, I915_GVT);
+EXPORT_SYMBOL_NS_GPL(__px_dma, I915_GVT);

This list is also a concern. At the least the double underscore functions should be eliminated from being exported.

Zhi and Zhenyu, can we have some further patches to clean that up?

Regards, Joonas

#7 lore raw

Re: [PATCH 04/21] drm/i915/gvt: move the gvt code into kvmgt.ko

Quoted 3 lines · Joonas Lahtinen

Thanks for putting the work into this. This conversion has been requested for a long time. For clarity, should we call the module i915_kvmgt?

If this was a new module that would be my preferance. But the kvmgt module already exists, so I thought it might be a good idea to keep the name.

Quoted 2 lines

How far would we be from dynamically modprobing/rmmoding the kvmgt module in order to eliminate the enable_gvt parameter?

Hmm. I suspect it could be done fairly easily, but from what I see it would still require to disable GUC at i915 module load time.

If you want I could look into that for an incremental patch, but to unblock the vfio/mdev work I'd like to do that in a separate stage.

#8 lore raw

PATCH 5/21 drm/i915/gvt: remove intel_gvt_ops

In reply to Christoph Hellwig

Remove these pointless indirect alls by just calling the only instance of each method directly.

---
 drivers/gpu/drm/i915/gvt/gvt.c       | 20 +--------------
 drivers/gpu/drm/i915/gvt/gvt.h       | 24 ------------------
 drivers/gpu/drm/i915/gvt/hypercall.h |  2 +-
 drivers/gpu/drm/i915/gvt/kvmgt.c     | 37 +++++++++++-----------------
 drivers/gpu/drm/i915/gvt/mpt.h       |  5 ++--
 5 files changed, 19 insertions(+), 69 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.c +1 -19
index 3671a076bd7a..2b59e79f5e3b 100644
@@ -39,23 +39,6 @@
 #include <linux/vfio.h>
 #include <linux/mdev.h>
 
-static const struct intel_gvt_ops intel_gvt_ops = {
-	.emulate_cfg_read = intel_vgpu_emulate_cfg_read,
-	.emulate_cfg_write = intel_vgpu_emulate_cfg_write,
-	.emulate_mmio_read = intel_vgpu_emulate_mmio_read,
-	.emulate_mmio_write = intel_vgpu_emulate_mmio_write,
-	.vgpu_create = intel_gvt_create_vgpu,
-	.vgpu_destroy = intel_gvt_destroy_vgpu,
-	.vgpu_release = intel_gvt_release_vgpu,
-	.vgpu_reset = intel_gvt_reset_vgpu,
-	.vgpu_activate = intel_gvt_activate_vgpu,
-	.vgpu_deactivate = intel_gvt_deactivate_vgpu,
-	.vgpu_query_plane = intel_vgpu_query_plane,
-	.vgpu_get_dmabuf = intel_vgpu_get_dmabuf,
-	.write_protect_handler = intel_vgpu_page_track_handler,
-	.emulate_hotplug = intel_vgpu_emulate_hotplug,
-};
-
 static void init_device_info(struct intel_gvt *gvt)
 {
 	struct intel_gvt_device_info *info = &gvt->device_info;
@@ -252,8 +235,7 @@ static int intel_gvt_init_device(struct drm_i915_private *i915)
 
 	intel_gvt_debugfs_init(gvt);
 
-	ret = intel_gvt_hypervisor_host_init(i915->drm.dev, gvt,
-					     &intel_gvt_ops);
+	ret = intel_gvt_hypervisor_host_init(i915->drm.dev, gvt);
 	if (ret)
 		goto out_destroy_idle_vgpu;
 
drivers/gpu/drm/i915/gvt/gvt.h +0 -24
index c346111f0300..40643fe14383 100644
@@ -555,30 +555,6 @@ void populate_pvinfo_page(struct intel_vgpu *vgpu);
 int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload);
 void enter_failsafe_mode(struct intel_vgpu *vgpu, int reason);
 
-struct intel_gvt_ops {
-	int (*emulate_cfg_read)(struct intel_vgpu *, unsigned int, void *,
-				unsigned int);
-	int (*emulate_cfg_write)(struct intel_vgpu *, unsigned int, void *,
-				unsigned int);
-	int (*emulate_mmio_read)(struct intel_vgpu *, u64, void *,
-				unsigned int);
-	int (*emulate_mmio_write)(struct intel_vgpu *, u64, void *,
-				unsigned int);
-	struct intel_vgpu *(*vgpu_create)(struct intel_gvt *,
-				struct intel_vgpu_type *);
-	void (*vgpu_destroy)(struct intel_vgpu *vgpu);
-	void (*vgpu_release)(struct intel_vgpu *vgpu);
-	void (*vgpu_reset)(struct intel_vgpu *);
-	void (*vgpu_activate)(struct intel_vgpu *);
-	void (*vgpu_deactivate)(struct intel_vgpu *);
-	int (*vgpu_query_plane)(struct intel_vgpu *vgpu, void *);
-	int (*vgpu_get_dmabuf)(struct intel_vgpu *vgpu, unsigned int);
-	int (*write_protect_handler)(struct intel_vgpu *, u64, void *,
-				     unsigned int);
-	void (*emulate_hotplug)(struct intel_vgpu *vgpu, bool connected);
-};
-
-
 enum {
 	GVT_FAILSAFE_UNSUPPORTED_GUEST,
 	GVT_FAILSAFE_INSUFFICIENT_RESOURCE,
drivers/gpu/drm/i915/gvt/hypercall.h +1 -1
index 317983153645..395bce9633fa 100644
@@ -42,7 +42,7 @@ struct device;
  * both Xen and KVM by providing dedicated hypervisor-related MPT modules.
  */
 struct intel_gvt_mpt {
-	int (*host_init)(struct device *dev, void *gvt, const void *ops);
+	int (*host_init)(struct device *dev, void *gvt);
 	void (*host_exit)(struct device *dev, void *gvt);
 	int (*attach_vgpu)(void *vgpu, unsigned long *handle);
 	void (*detach_vgpu)(void *vgpu);
drivers/gpu/drm/i915/gvt/kvmgt.c +15 -22
index 65659094eee6..935d1c8287a4 100644
@@ -51,8 +51,6 @@
 
 MODULE_IMPORT_NS(I915_GVT);
 
-static const struct intel_gvt_ops *intel_gvt_ops;
-
 /* helper macros copied from vfio-pci */
 #define VFIO_PCI_OFFSET_SHIFT   40
 #define VFIO_PCI_OFFSET_TO_INDEX(off)   (off >> VFIO_PCI_OFFSET_SHIFT)
@@ -602,9 +600,9 @@ static int handle_edid_regs(struct intel_vgpu *vgpu,
 					gvt_vgpu_err("invalid EDID blob\n");
 					return -EINVAL;
 				}
-				intel_gvt_ops->emulate_hotplug(vgpu, true);
+				intel_vgpu_emulate_hotplug(vgpu, true);
 			} else if (data == VFIO_DEVICE_GFX_LINK_STATE_DOWN)
-				intel_gvt_ops->emulate_hotplug(vgpu, false);
+				intel_vgpu_emulate_hotplug(vgpu, false);
 			else {
 				gvt_vgpu_err("invalid EDID link state %d\n",
 					regs->link_state);
@@ -806,7 +804,7 @@ static int intel_vgpu_create(struct mdev_device *mdev)
 		goto out;
 	}
 
-	vgpu = intel_gvt_ops->vgpu_create(gvt, type);
+	vgpu = intel_gvt_create_vgpu(gvt, type);
 	if (IS_ERR_OR_NULL(vgpu)) {
 		ret = vgpu == NULL ? -EFAULT : PTR_ERR(vgpu);
 		gvt_err("failed to create intel vgpu: %d\n", ret);
@@ -833,7 +831,7 @@ static int intel_vgpu_remove(struct mdev_device *mdev)
 	if (handle_valid(vgpu->handle))
 		return -EBUSY;
 
-	intel_gvt_ops->vgpu_destroy(vgpu);
+	intel_gvt_destroy_vgpu(vgpu);
 	return 0;
 }
 
@@ -936,7 +934,7 @@ static int intel_vgpu_open(struct mdev_device *mdev)
 	if (ret)
 		goto undo_group;
 
-	intel_gvt_ops->vgpu_activate(vgpu);
+	intel_gvt_activate_vgpu(vgpu);
 
 	atomic_set(&vdev->released, 0);
 	return ret;
@@ -981,7 +979,7 @@ static void __intel_vgpu_release(struct intel_vgpu *vgpu)
 	if (atomic_cmpxchg(&vdev->released, 0, 1))
 		return;
 
-	intel_gvt_ops->vgpu_release(vgpu);
+	intel_gvt_release_vgpu(vgpu);
 
 	ret = vfio_unregister_notifier(mdev_dev(vdev->mdev), VFIO_IOMMU_NOTIFY,
 					&vdev->iommu_notifier);
@@ -1055,10 +1053,10 @@ static int intel_vgpu_bar_rw(struct intel_vgpu *vgpu, int bar, u64 off,
 	int ret;
 
 	if (is_write)
-		ret = intel_gvt_ops->emulate_mmio_write(vgpu,
+		ret = intel_vgpu_emulate_mmio_write(vgpu,
 					bar_start + off, buf, count);
 	else
-		ret = intel_gvt_ops->emulate_mmio_read(vgpu,
+		ret = intel_vgpu_emulate_mmio_read(vgpu,
 					bar_start + off, buf, count);
 	return ret;
 }
@@ -1114,10 +1112,10 @@ static ssize_t intel_vgpu_rw(struct mdev_device *mdev, char *buf,
 	switch (index) {
 	case VFIO_PCI_CONFIG_REGION_INDEX:
 		if (is_write)
-			ret = intel_gvt_ops->emulate_cfg_write(vgpu, pos,
+			ret = intel_vgpu_emulate_cfg_write(vgpu, pos,
 						buf, count);
 		else
-			ret = intel_gvt_ops->emulate_cfg_read(vgpu, pos,
+			ret = intel_vgpu_emulate_cfg_read(vgpu, pos,
 						buf, count);
 		break;
 	case VFIO_PCI_BAR0_REGION_INDEX:
@@ -1685,7 +1683,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
 
 		return ret;
 	} else if (cmd == VFIO_DEVICE_RESET) {
-		intel_gvt_ops->vgpu_reset(vgpu);
+		intel_gvt_reset_vgpu(vgpu);
 		return 0;
 	} else if (cmd == VFIO_DEVICE_QUERY_GFX_PLANE) {
 		struct vfio_device_gfx_plane_info dmabuf;
@@ -1698,7 +1696,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
 		if (dmabuf.argsz < minsz)
 			return -EINVAL;
 
-		ret = intel_gvt_ops->vgpu_query_plane(vgpu, &dmabuf);
+		ret = intel_vgpu_query_plane(vgpu, &dmabuf);
 		if (ret != 0)
 			return ret;
 
@@ -1706,14 +1704,10 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
 								-EFAULT : 0;
 	} else if (cmd == VFIO_DEVICE_GET_GFX_DMABUF) {
 		__u32 dmabuf_id;
-		__s32 dmabuf_fd;
 
 		if (get_user(dmabuf_id, (__u32 __user *)arg))
 			return -EFAULT;
-
-		dmabuf_fd = intel_gvt_ops->vgpu_get_dmabuf(vgpu, dmabuf_id);
-		return dmabuf_fd;
-
+		return intel_vgpu_get_dmabuf(vgpu, dmabuf_id);
 	}
 
 	return -ENOTTY;
@@ -1764,7 +1758,7 @@ static struct mdev_parent_ops intel_vgpu_ops = {
 	.ioctl			= intel_vgpu_ioctl,
 };
 
-static int kvmgt_host_init(struct device *dev, void *gvt, const void *ops)
+static int kvmgt_host_init(struct device *dev, void *gvt)
 {
 	int ret;
 
@@ -1772,7 +1766,6 @@ static int kvmgt_host_init(struct device *dev, void *gvt, const void *ops)
 	if (ret)
 		return ret;
 
-	intel_gvt_ops = ops;
 	intel_vgpu_ops.supported_type_groups = gvt_vgpu_type_groups;
 
 	ret = mdev_register_device(dev, &intel_vgpu_ops);
@@ -1864,7 +1857,7 @@ static void kvmgt_page_track_write(struct kvm_vcpu *vcpu, gpa_t gpa,
 					struct kvmgt_guest_info, track_node);
 
 	if (kvmgt_gfn_is_write_protected(info, gpa_to_gfn(gpa)))
-		intel_gvt_ops->write_protect_handler(info->vgpu, gpa,
+		intel_vgpu_page_track_handler(info->vgpu, gpa,
 						     (void *)val, len);
 }
 
drivers/gpu/drm/i915/gvt/mpt.h +2 -3
index 1b5617bb2745..0e3966e1fec8 100644
@@ -51,13 +51,12 @@
  * Returns:
  * Zero on success, negative error code if failed
  */
-static inline int intel_gvt_hypervisor_host_init(struct device *dev,
-						 void *gvt, const void *ops)
+static inline int intel_gvt_hypervisor_host_init(struct device *dev, void *gvt)
 {
 	if (!intel_gvt_host.mpt->host_init)
 		return -ENODEV;
 
-	return intel_gvt_host.mpt->host_init(dev, gvt, ops);
+	return intel_gvt_host.mpt->host_init(dev, gvt);
 }
 
 /**
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

PATCH 6/21 drm/i915/gvt: remove the map_gfn_to_mfn and set_trap_area ops

In reply to Christoph Hellwig

The map_gfn_to_mfn and set_trap_area ops are never defined, so remove them and clean up code that depends on them in the callers.

---
 drivers/gpu/drm/i915/gvt/cfg_space.c | 89 ++++++----------------------
 drivers/gpu/drm/i915/gvt/hypercall.h |  4 --
 drivers/gpu/drm/i915/gvt/mpt.h       | 44 --------------
 3 files changed, 17 insertions(+), 120 deletions(-)
drivers/gpu/drm/i915/gvt/cfg_space.c +17 -72
index b490e3db2e38..dad3a6054335 100644
@@ -129,60 +129,16 @@ int intel_vgpu_emulate_cfg_read(struct intel_vgpu *vgpu, unsigned int offset,
 	return 0;
 }
 
-static int map_aperture(struct intel_vgpu *vgpu, bool map)
+static void map_aperture(struct intel_vgpu *vgpu, bool map)
 {
-	phys_addr_t aperture_pa = vgpu_aperture_pa_base(vgpu);
-	unsigned long aperture_sz = vgpu_aperture_sz(vgpu);
-	u64 first_gfn;
-	u64 val;
-	int ret;
-
-	if (map == vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_APERTURE].tracked)
-		return 0;
-
-	val = vgpu_cfg_space(vgpu)[PCI_BASE_ADDRESS_2];
-	if (val & PCI_BASE_ADDRESS_MEM_TYPE_64)
-		val = *(u64 *)(vgpu_cfg_space(vgpu) + PCI_BASE_ADDRESS_2);
-	else
-		val = *(u32 *)(vgpu_cfg_space(vgpu) + PCI_BASE_ADDRESS_2);
-
-	first_gfn = (val + vgpu_aperture_offset(vgpu)) >> PAGE_SHIFT;
-
-	ret = intel_gvt_hypervisor_map_gfn_to_mfn(vgpu, first_gfn,
-						  aperture_pa >> PAGE_SHIFT,
-						  aperture_sz >> PAGE_SHIFT,
-						  map);
-	if (ret)
-		return ret;
-
-	vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_APERTURE].tracked = map;
-	return 0;
+	if (map != vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_APERTURE].tracked)
+		vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_APERTURE].tracked = map;
 }
 
-static int trap_gttmmio(struct intel_vgpu *vgpu, bool trap)
+static void trap_gttmmio(struct intel_vgpu *vgpu, bool trap)
 {
-	u64 start, end;
-	u64 val;
-	int ret;
-
-	if (trap == vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_GTTMMIO].tracked)
-		return 0;
-
-	val = vgpu_cfg_space(vgpu)[PCI_BASE_ADDRESS_0];
-	if (val & PCI_BASE_ADDRESS_MEM_TYPE_64)
-		start = *(u64 *)(vgpu_cfg_space(vgpu) + PCI_BASE_ADDRESS_0);
-	else
-		start = *(u32 *)(vgpu_cfg_space(vgpu) + PCI_BASE_ADDRESS_0);
-
-	start &= ~GENMASK(3, 0);
-	end = start + vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_GTTMMIO].size - 1;
-
-	ret = intel_gvt_hypervisor_set_trap_area(vgpu, start, end, trap);
-	if (ret)
-		return ret;
-
-	vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_GTTMMIO].tracked = trap;
-	return 0;
+	if (trap != vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_GTTMMIO].tracked)
+		vgpu->cfg_space.bar[INTEL_GVT_PCI_BAR_GTTMMIO].tracked = trap;
 }
 
 static int emulate_pci_command_write(struct intel_vgpu *vgpu,
@@ -191,26 +147,17 @@ static int emulate_pci_command_write(struct intel_vgpu *vgpu,
 	u8 old = vgpu_cfg_space(vgpu)[offset];
 	u8 new = *(u8 *)p_data;
 	u8 changed = old ^ new;
-	int ret;
 
 	vgpu_pci_cfg_mem_write(vgpu, offset, p_data, bytes);
 	if (!(changed & PCI_COMMAND_MEMORY))
 		return 0;
 
 	if (old & PCI_COMMAND_MEMORY) {
-		ret = trap_gttmmio(vgpu, false);
-		if (ret)
-			return ret;
-		ret = map_aperture(vgpu, false);
-		if (ret)
-			return ret;
+		trap_gttmmio(vgpu, false);
+		map_aperture(vgpu, false);
 	} else {
-		ret = trap_gttmmio(vgpu, true);
-		if (ret)
-			return ret;
-		ret = map_aperture(vgpu, true);
-		if (ret)
-			return ret;
+		trap_gttmmio(vgpu, true);
+		map_aperture(vgpu, true);
 	}
 
 	return 0;
@@ -230,13 +177,12 @@ static int emulate_pci_rom_bar_write(struct intel_vgpu *vgpu,
 	return 0;
 }
 
-static int emulate_pci_bar_write(struct intel_vgpu *vgpu, unsigned int offset,
+static void emulate_pci_bar_write(struct intel_vgpu *vgpu, unsigned int offset,
 	void *p_data, unsigned int bytes)
 {
 	u32 new = *(u32 *)(p_data);
 	bool lo = IS_ALIGNED(offset, 8);
 	u64 size;
-	int ret = 0;
 	bool mmio_enabled =
 		vgpu_cfg_space(vgpu)[PCI_COMMAND] & PCI_COMMAND_MEMORY;
 	struct intel_vgpu_pci_bar *bars = vgpu->cfg_space.bar;
@@ -259,14 +205,14 @@ static int emulate_pci_bar_write(struct intel_vgpu *vgpu, unsigned int offset,
 			 * Untrap the BAR, since guest hasn't configured a
 			 * valid GPA
 			 */
-			ret = trap_gttmmio(vgpu, false);
+			trap_gttmmio(vgpu, false);
 			break;
 		case PCI_BASE_ADDRESS_2:
 		case PCI_BASE_ADDRESS_3:
 			size = ~(bars[INTEL_GVT_PCI_BAR_APERTURE].size -1);
 			intel_vgpu_write_pci_bar(vgpu, offset,
 						size >> (lo ? 0 : 32), lo);
-			ret = map_aperture(vgpu, false);
+			map_aperture(vgpu, false);
 			break;
 		default:
 			/* Unimplemented BARs */
@@ -282,19 +228,18 @@ static int emulate_pci_bar_write(struct intel_vgpu *vgpu, unsigned int offset,
 			 */
 			trap_gttmmio(vgpu, false);
 			intel_vgpu_write_pci_bar(vgpu, offset, new, lo);
-			ret = trap_gttmmio(vgpu, mmio_enabled);
+			trap_gttmmio(vgpu, mmio_enabled);
 			break;
 		case PCI_BASE_ADDRESS_2:
 		case PCI_BASE_ADDRESS_3:
 			map_aperture(vgpu, false);
 			intel_vgpu_write_pci_bar(vgpu, offset, new, lo);
-			ret = map_aperture(vgpu, mmio_enabled);
+			map_aperture(vgpu, mmio_enabled);
 			break;
 		default:
 			intel_vgpu_write_pci_bar(vgpu, offset, new, lo);
 		}
 	}
-	return ret;
 }
 
 /**
@@ -336,8 +281,8 @@ int intel_vgpu_emulate_cfg_write(struct intel_vgpu *vgpu, unsigned int offset,
 	case PCI_BASE_ADDRESS_0 ... PCI_BASE_ADDRESS_5:
 		if (drm_WARN_ON(&i915->drm, !IS_ALIGNED(offset, 4)))
 			return -EINVAL;
-		return emulate_pci_bar_write(vgpu, offset, p_data, bytes);
-
+		emulate_pci_bar_write(vgpu, offset, p_data, bytes);
+		break;
 	case INTEL_GVT_PCI_SWSCI:
 		if (drm_WARN_ON(&i915->drm, !IS_ALIGNED(offset, 4)))
 			return -EINVAL;
drivers/gpu/drm/i915/gvt/hypercall.h +0 -4
index 395bce9633fa..f1a4926f6f1b 100644
@@ -62,10 +62,6 @@ struct intel_gvt_mpt {
 
 	int (*dma_pin_guest_page)(unsigned long handle, dma_addr_t dma_addr);
 
-	int (*map_gfn_to_mfn)(unsigned long handle, unsigned long gfn,
-			      unsigned long mfn, unsigned int nr, bool map);
-	int (*set_trap_area)(unsigned long handle, u64 start, u64 end,
-			     bool map);
 	int (*set_opregion)(void *vgpu);
 	int (*set_edid)(void *vgpu, int port_num);
 	int (*get_vfio_device)(void *vgpu);
drivers/gpu/drm/i915/gvt/mpt.h +0 -44

50 lines not on this page · raw message

Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#10 lore raw

PATCH 7/21 drm/i915/gvt: remove the unused from_virt_to_mfn op

In reply to Christoph Hellwig
---
 drivers/gpu/drm/i915/gvt/hypercall.h |  1 -
 drivers/gpu/drm/i915/gvt/kvmgt.c     |  6 ------
 drivers/gpu/drm/i915/gvt/mpt.h       | 12 ------------
 3 files changed, 19 deletions(-)
drivers/gpu/drm/i915/gvt/hypercall.h +0 -1
index f1a4926f6f1b..27890a5e2d82 100644
@@ -47,7 +47,6 @@ struct intel_gvt_mpt {
 	int (*attach_vgpu)(void *vgpu, unsigned long *handle);
 	void (*detach_vgpu)(void *vgpu);
 	int (*inject_msi)(unsigned long handle, u32 addr, u16 data);
-	unsigned long (*from_virt_to_mfn)(void *p);
 	int (*enable_page_track)(unsigned long handle, u64 gfn);
 	int (*disable_page_track)(unsigned long handle, u64 gfn);
 	int (*read_gpa)(unsigned long handle, unsigned long gpa, void *buf,
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -6
index 935d1c8287a4..d1f3f1253306 100644
@@ -2173,11 +2173,6 @@ static int kvmgt_write_gpa(unsigned long handle, unsigned long gpa,
 	return kvmgt_rw_gpa(handle, gpa, buf, len, true);
 }
 
-static unsigned long kvmgt_virt_to_pfn(void *addr)
-{
-	return PFN_DOWN(__pa(addr));
-}
-
 static bool kvmgt_is_valid_gfn(unsigned long handle, unsigned long gfn)
 {
 	struct kvmgt_guest_info *info;
@@ -2204,7 +2199,6 @@ static const struct intel_gvt_mpt kvmgt_mpt = {
 	.attach_vgpu = kvmgt_attach_vgpu,
 	.detach_vgpu = kvmgt_detach_vgpu,
 	.inject_msi = kvmgt_inject_msi,
-	.from_virt_to_mfn = kvmgt_virt_to_pfn,
 	.enable_page_track = kvmgt_page_track_add,
 	.disable_page_track = kvmgt_page_track_remove,
 	.read_gpa = kvmgt_read_gpa,
drivers/gpu/drm/i915/gvt/mpt.h +0 -12
index bb0e9e71d13e..6d062cf71de9 100644
@@ -140,18 +140,6 @@ static inline int intel_gvt_hypervisor_inject_msi(struct intel_vgpu *vgpu)
 	return 0;
 }
 
-/**
- * intel_gvt_hypervisor_set_wp_page - translate a host VA into MFN
- * @p: host kernel virtual address
- *
- * Returns:
- * MFN on success, INTEL_GVT_INVALID_ADDR if failed.
- */
-static inline unsigned long intel_gvt_hypervisor_virt_to_mfn(void *p)
-{
-	return intel_gvt_host.mpt->from_virt_to_mfn(p);
-}
-
 /**
  * intel_gvt_hypervisor_enable_page_track - track a guest page
  * @vgpu: a vGPU
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 8/21 drm/i915/gvt: merge struct kvmgt_vdev into struct intel_vgpu

In reply to Christoph Hellwig

Move towards having only a single structure for the per-VGPU state.

---
 drivers/gpu/drm/i915/gvt/gvt.h       |  31 ++-
 drivers/gpu/drm/i915/gvt/hypercall.h |   1 -
 drivers/gpu/drm/i915/gvt/kvmgt.c     | 288 ++++++++++-----------------
 drivers/gpu/drm/i915/gvt/mpt.h       |  16 --
 drivers/gpu/drm/i915/gvt/vgpu.c      |   8 +-
 5 files changed, 128 insertions(+), 216 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.h +23 -8
index 40643fe14383..9f419e7f7a1b 100644
@@ -206,21 +206,36 @@ struct intel_vgpu {
 
 	struct dentry *debugfs;
 
-	/* Hypervisor-specific device state. */
-	void *vdev;
-
 	struct list_head dmabuf_obj_list_head;
 	struct mutex dmabuf_lock;
 	struct idr object_idr;
 	struct intel_vgpu_vblank_timer vblank_timer;
 
 	u32 scan_nonprivbb;
-};
 
-static inline void *intel_vgpu_vdev(struct intel_vgpu *vgpu)
-{
-	return vgpu->vdev;
-}
+	struct mdev_device *mdev;
+	struct vfio_region *region;
+	int num_regions;
+	struct eventfd_ctx *intx_trigger;
+	struct eventfd_ctx *msi_trigger;
+
+	/*
+	 * Two caches are used to avoid mapping duplicated pages (eg.
+	 * scratch pages). This help to reduce dma setup overhead.
+	 */
+	struct rb_root gfn_cache;
+	struct rb_root dma_addr_cache;
+	unsigned long nr_cache_entries;
+	struct mutex cache_lock;
+
+	struct notifier_block iommu_notifier;
+	struct notifier_block group_notifier;
+	struct kvm *kvm;
+	struct work_struct release_work;
+	atomic_t released;
+	struct vfio_device *vfio_device;
+	struct vfio_group *vfio_group;
+};
 
 /* validating GM healthy status*/
 #define vgpu_is_vm_unhealthy(ret_val) \
drivers/gpu/drm/i915/gvt/hypercall.h +0 -1
index 27890a5e2d82..eacee6f41f9c 100644
@@ -44,7 +44,6 @@ struct device;
 struct intel_gvt_mpt {
 	int (*host_init)(struct device *dev, void *gvt);
 	void (*host_exit)(struct device *dev, void *gvt);
-	int (*attach_vgpu)(void *vgpu, unsigned long *handle);
 	void (*detach_vgpu)(void *vgpu);
 	int (*inject_msi)(unsigned long handle, u32 addr, u16 data);
 	int (*enable_page_track)(unsigned long handle, u64 gfn);
drivers/gpu/drm/i915/gvt/kvmgt.c +104 -184

726 lines not on this page · raw message

drivers/gpu/drm/i915/gvt/mpt.h +0 -16
index 6d062cf71de9..8a659301d78b 100644
@@ -71,22 +71,6 @@ static inline void intel_gvt_hypervisor_host_exit(struct device *dev, void *gvt)
 	intel_gvt_host.mpt->host_exit(dev, gvt);
 }
 
-/**
- * intel_gvt_hypervisor_attach_vgpu - call hypervisor to initialize vGPU
- * related stuffs inside hypervisor.
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_attach_vgpu(struct intel_vgpu *vgpu)
-{
-	/* optional to provide */
-	if (!intel_gvt_host.mpt->attach_vgpu)
-		return 0;
-
-	return intel_gvt_host.mpt->attach_vgpu(vgpu, &vgpu->handle);
-}
-
 /**
  * intel_gvt_hypervisor_detach_vgpu - call hypervisor to release vGPU
  * related stuffs inside hypervisor.
drivers/gpu/drm/i915/gvt/vgpu.c +1 -7
index fa6b92615799..7b9a571c0dc9 100644
@@ -405,13 +405,9 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
 
 	populate_pvinfo_page(vgpu);
 
-	ret = intel_gvt_hypervisor_attach_vgpu(vgpu);
-	if (ret)
-		goto out_clean_vgpu_resource;
-
 	ret = intel_vgpu_init_gtt(vgpu);
 	if (ret)
-		goto out_detach_hypervisor_vgpu;
+		goto out_clean_vgpu_resource;
 
 	ret = intel_vgpu_init_opregion(vgpu);
 	if (ret)
@@ -454,8 +450,6 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
 	intel_vgpu_clean_opregion(vgpu);
 out_clean_gtt:
 	intel_vgpu_clean_gtt(vgpu);
-out_detach_hypervisor_vgpu:
-	intel_gvt_hypervisor_detach_vgpu(vgpu);
 out_clean_vgpu_resource:
 	intel_vgpu_free_resource(vgpu);
 out_clean_vgpu_mmio:
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#12 lore raw

PATCH 9/21 drm/i915/gvt: merge struct kvmgt_guest_info into strut intel_vgpu

In reply to Christoph Hellwig

Consolidate the per-VGPU structures into a single one.

---
 drivers/gpu/drm/i915/gvt/gvt.h   |   8 +++
 drivers/gpu/drm/i915/gvt/kvmgt.c | 117 ++++++++++++-------------------
 2 files changed, 52 insertions(+), 73 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.h +8 -0
index 9f419e7f7a1b..a4691f0607e6 100644
@@ -34,6 +34,7 @@
 #define _GVT_H_
 
 #include <uapi/linux/pci_regs.h>
+#include <linux/kvm_host.h>
 
 #include "i915_drv.h"
 
@@ -173,6 +174,8 @@ struct intel_vgpu_submission {
 	} last_ctx[I915_NUM_ENGINES];
 };
 
+#define KVMGT_DEBUGFS_FILENAME		"kvmgt_nr_cache_entries"
+
 struct intel_vgpu {
 	struct intel_gvt *gvt;
 	struct mutex vgpu_lock;
@@ -235,6 +238,11 @@ struct intel_vgpu {
 	atomic_t released;
 	struct vfio_device *vfio_device;
 	struct vfio_group *vfio_group;
+
+	struct kvm_page_track_notifier_node track_node;
+#define NR_BKT (1 << 18)
+	struct hlist_head ptable[NR_BKT];
+#undef NR_BKT
 };
 
 /* validating GM healthy status*/
drivers/gpu/drm/i915/gvt/kvmgt.c +44 -73

332 lines not on this page · raw message

Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#13 lore raw

PATCH 10/21 drm/i915/gvt: remove vgpu->handle

In reply to Christoph Hellwig

Always pass the actual vgpu structure instead of encoding it as a "handle" and add a bool flag to denote if a VGPU is attached.

---
 drivers/gpu/drm/i915/gvt/gvt.h       |   3 +-
 drivers/gpu/drm/i915/gvt/hypercall.h |  32 +++----
 drivers/gpu/drm/i915/gvt/kvmgt.c     | 126 +++++++++------------------
 drivers/gpu/drm/i915/gvt/mpt.h       |  20 ++---
 drivers/gpu/drm/i915/gvt/vgpu.c      |   6 +-
 5 files changed, 71 insertions(+), 116 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.h +1 -2
index a4691f0607e6..ad10ef2377e7 100644
@@ -180,8 +180,8 @@ struct intel_vgpu {
 	struct intel_gvt *gvt;
 	struct mutex vgpu_lock;
 	int id;
-	unsigned long handle; /* vGPU handle used by hypervisor MPT modules */
 	bool active;
+	bool attached;
 	bool pv_notified;
 	bool failsafe;
 	unsigned int resetting_eng;
@@ -448,7 +448,6 @@ int intel_gvt_load_firmware(struct intel_gvt *gvt);
 #define RING_CTX_SIZE 320
 
 struct intel_vgpu_creation_params {
-	__u64 handle;
 	__u64 low_gm_sz;  /* in MB */
 	__u64 high_gm_sz; /* in MB */
 	__u64 fence_sz;
drivers/gpu/drm/i915/gvt/hypercall.h +17 -15
index eacee6f41f9c..9f0475759825 100644
@@ -36,6 +36,7 @@
 #include <linux/types.h>
 
 struct device;
+struct intel_vgpu;
 
 /*
  * Specific GVT-g MPT modules function collections. Currently GVT-g supports
@@ -44,27 +45,28 @@ struct device;
 struct intel_gvt_mpt {
 	int (*host_init)(struct device *dev, void *gvt);
 	void (*host_exit)(struct device *dev, void *gvt);
-	void (*detach_vgpu)(void *vgpu);
-	int (*inject_msi)(unsigned long handle, u32 addr, u16 data);
-	int (*enable_page_track)(unsigned long handle, u64 gfn);
-	int (*disable_page_track)(unsigned long handle, u64 gfn);
-	int (*read_gpa)(unsigned long handle, unsigned long gpa, void *buf,
+	void (*detach_vgpu)(struct intel_vgpu *vgpu);
+	int (*inject_msi)(struct intel_vgpu *vgpu, u32 addr, u16 data);
+	int (*enable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
+	int (*disable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
+	int (*read_gpa)(struct intel_vgpu *vgpu, unsigned long gpa, void *buf,
 			unsigned long len);
-	int (*write_gpa)(unsigned long handle, unsigned long gpa, void *buf,
+	int (*write_gpa)(struct intel_vgpu *vgpu, unsigned long gpa, void *buf,
 			 unsigned long len);
-	unsigned long (*gfn_to_mfn)(unsigned long handle, unsigned long gfn);
+	unsigned long (*gfn_to_mfn)(struct intel_vgpu *vgpu, unsigned long gfn);
 
-	int (*dma_map_guest_page)(unsigned long handle, unsigned long gfn,
+	int (*dma_map_guest_page)(struct intel_vgpu *vgpu, unsigned long gfn,
 				  unsigned long size, dma_addr_t *dma_addr);
-	void (*dma_unmap_guest_page)(unsigned long handle, dma_addr_t dma_addr);
+	void (*dma_unmap_guest_page)(struct intel_vgpu *vgpu,
+				dma_addr_t dma_addr);
 
-	int (*dma_pin_guest_page)(unsigned long handle, dma_addr_t dma_addr);
+	int (*dma_pin_guest_page)(struct intel_vgpu *vgpu, dma_addr_t dma_addr);
 
-	int (*set_opregion)(void *vgpu);
-	int (*set_edid)(void *vgpu, int port_num);
-	int (*get_vfio_device)(void *vgpu);
-	void (*put_vfio_device)(void *vgpu);
-	bool (*is_valid_gfn)(unsigned long handle, unsigned long gfn);
+	int (*set_opregion)(struct intel_vgpu *vgpu);
+	int (*set_edid)(struct intel_vgpu *vgpu, int port_num);
+	int (*get_vfio_device)(struct intel_vgpu *vgpu);
+	void (*put_vfio_device)(struct intel_vgpu *vgpu);
+	bool (*is_valid_gfn)(struct intel_vgpu *vgpu, unsigned long gfn);
 };
 
 #endif /* _GVT_HYPERCALL_H_ */
drivers/gpu/drm/i915/gvt/kvmgt.c +41 -85

313 lines not on this page · raw message

drivers/gpu/drm/i915/gvt/mpt.h +10 -10
index 8a659301d78b..ba0c31c4a705 100644
@@ -118,7 +118,7 @@ static inline int intel_gvt_hypervisor_inject_msi(struct intel_vgpu *vgpu)
 
 	trace_inject_msi(vgpu->id, addr, data);
 
-	ret = intel_gvt_host.mpt->inject_msi(vgpu->handle, addr, data);
+	ret = intel_gvt_host.mpt->inject_msi(vgpu, addr, data);
 	if (ret)
 		return ret;
 	return 0;
@@ -135,7 +135,7 @@ static inline int intel_gvt_hypervisor_inject_msi(struct intel_vgpu *vgpu)
 static inline int intel_gvt_hypervisor_enable_page_track(
 		struct intel_vgpu *vgpu, unsigned long gfn)
 {
-	return intel_gvt_host.mpt->enable_page_track(vgpu->handle, gfn);
+	return intel_gvt_host.mpt->enable_page_track(vgpu, gfn);
 }
 
 /**
@@ -149,7 +149,7 @@ static inline int intel_gvt_hypervisor_enable_page_track(
 static inline int intel_gvt_hypervisor_disable_page_track(
 		struct intel_vgpu *vgpu, unsigned long gfn)
 {
-	return intel_gvt_host.mpt->disable_page_track(vgpu->handle, gfn);
+	return intel_gvt_host.mpt->disable_page_track(vgpu, gfn);
 }
 
 /**
@@ -165,7 +165,7 @@ static inline int intel_gvt_hypervisor_disable_page_track(
 static inline int intel_gvt_hypervisor_read_gpa(struct intel_vgpu *vgpu,
 		unsigned long gpa, void *buf, unsigned long len)
 {
-	return intel_gvt_host.mpt->read_gpa(vgpu->handle, gpa, buf, len);
+	return intel_gvt_host.mpt->read_gpa(vgpu, gpa, buf, len);
 }
 
 /**
@@ -181,7 +181,7 @@ static inline int intel_gvt_hypervisor_read_gpa(struct intel_vgpu *vgpu,
 static inline int intel_gvt_hypervisor_write_gpa(struct intel_vgpu *vgpu,
 		unsigned long gpa, void *buf, unsigned long len)
 {
-	return intel_gvt_host.mpt->write_gpa(vgpu->handle, gpa, buf, len);
+	return intel_gvt_host.mpt->write_gpa(vgpu, gpa, buf, len);
 }
 
 /**
@@ -195,7 +195,7 @@ static inline int intel_gvt_hypervisor_write_gpa(struct intel_vgpu *vgpu,
 static inline unsigned long intel_gvt_hypervisor_gfn_to_mfn(
 		struct intel_vgpu *vgpu, unsigned long gfn)
 {
-	return intel_gvt_host.mpt->gfn_to_mfn(vgpu->handle, gfn);
+	return intel_gvt_host.mpt->gfn_to_mfn(vgpu, gfn);
 }
 
 /**
@@ -212,7 +212,7 @@ static inline int intel_gvt_hypervisor_dma_map_guest_page(
 		struct intel_vgpu *vgpu, unsigned long gfn, unsigned long size,
 		dma_addr_t *dma_addr)
 {
-	return intel_gvt_host.mpt->dma_map_guest_page(vgpu->handle, gfn, size,
+	return intel_gvt_host.mpt->dma_map_guest_page(vgpu, gfn, size,
 						      dma_addr);
 }
 
@@ -224,7 +224,7 @@ static inline int intel_gvt_hypervisor_dma_map_guest_page(
 static inline void intel_gvt_hypervisor_dma_unmap_guest_page(
 		struct intel_vgpu *vgpu, dma_addr_t dma_addr)
 {
-	intel_gvt_host.mpt->dma_unmap_guest_page(vgpu->handle, dma_addr);
+	intel_gvt_host.mpt->dma_unmap_guest_page(vgpu, dma_addr);
 }
 
 /**
@@ -239,7 +239,7 @@ static inline int
 intel_gvt_hypervisor_dma_pin_guest_page(struct intel_vgpu *vgpu,
 					dma_addr_t dma_addr)
 {
-	return intel_gvt_host.mpt->dma_pin_guest_page(vgpu->handle, dma_addr);
+	return intel_gvt_host.mpt->dma_pin_guest_page(vgpu, dma_addr);
 }
 
 /**
@@ -318,7 +318,7 @@ static inline bool intel_gvt_hypervisor_is_valid_gfn(
 	if (!intel_gvt_host.mpt->is_valid_gfn)
 		return true;
 
-	return intel_gvt_host.mpt->is_valid_gfn(vgpu->handle, gfn);
+	return intel_gvt_host.mpt->is_valid_gfn(vgpu, gfn);
 }
 
 #endif /* _GVT_MPT_H_ */
drivers/gpu/drm/i915/gvt/vgpu.c +2 -4
index 7b9a571c0dc9..9e8fa9f388eb 100644
@@ -370,8 +370,8 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
 	struct intel_vgpu *vgpu;
 	int ret;
 
-	gvt_dbg_core("handle %llu low %llu MB high %llu MB fence %llu\n",
-			param->handle, param->low_gm_sz, param->high_gm_sz,
+	gvt_dbg_core("low %llu MB high %llu MB fence %llu\n",
+			param->low_gm_sz, param->high_gm_sz,
 			param->fence_sz);
 
 	vgpu = vzalloc(sizeof(*vgpu));
@@ -384,7 +384,6 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
 		goto out_free_vgpu;
 
 	vgpu->id = ret;
-	vgpu->handle = param->handle;
 	vgpu->gvt = gvt;
 	vgpu->sched_ctl.weight = param->weight;
 	mutex_init(&vgpu->vgpu_lock);
@@ -477,7 +476,6 @@ struct intel_vgpu *intel_gvt_create_vgpu(struct intel_gvt *gvt,
 	struct intel_vgpu_creation_params param;
 	struct intel_vgpu *vgpu;
 
-	param.handle = 0;
 	param.primary = 1;
 	param.low_gm_sz = type->low_gm_size;
 	param.high_gm_sz = type->high_gm_size;
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH 11/21 drm/i915/gvt: devirtualize ->{read,write}_gpa

In reply to Christoph Hellwig

Just call the VFIO functions directly instead of through the method table.

---
 drivers/gpu/drm/i915/gvt/cmd_parser.c |  4 +--
 drivers/gpu/drm/i915/gvt/execlist.c   | 12 ++++-----
 drivers/gpu/drm/i915/gvt/gtt.c        |  6 ++---
 drivers/gpu/drm/i915/gvt/gvt.h        | 37 +++++++++++++++++++++++++++
 drivers/gpu/drm/i915/gvt/hypercall.h  |  4 ---
 drivers/gpu/drm/i915/gvt/kvmgt.c      | 23 -----------------
 drivers/gpu/drm/i915/gvt/mmio.c       |  4 +--
 drivers/gpu/drm/i915/gvt/mpt.h        | 32 -----------------------
 drivers/gpu/drm/i915/gvt/opregion.c   | 10 +++-----
 drivers/gpu/drm/i915/gvt/scheduler.c  | 37 +++++++++++++--------------
 10 files changed, 72 insertions(+), 97 deletions(-)
drivers/gpu/drm/i915/gvt/cmd_parser.c +2 -2
index c4118b808268..c694d2c5efdd 100644
@@ -1009,7 +1009,7 @@ static int cmd_reg_handler(struct parser_exec_state *s,
 	if (GRAPHICS_VER(s->engine->i915) == 9 &&
 	    intel_gvt_mmio_is_sr_in_ctx(gvt, offset) &&
 	    !strncmp(cmd, "lri", 3)) {
-		intel_gvt_hypervisor_read_gpa(s->vgpu,
+		intel_gvt_read_gpa(s->vgpu,
 			s->workload->ring_context_gpa + 12, &ctx_sr_ctl, 4);
 		/* check inhibit context */
 		if (ctx_sr_ctl & 1) {
@@ -1773,7 +1773,7 @@ static int copy_gma_to_hva(struct intel_vgpu *vgpu, struct intel_vgpu_mm *mm,
 		copy_len = (end_gma - gma) >= (I915_GTT_PAGE_SIZE - offset) ?
 			I915_GTT_PAGE_SIZE - offset : end_gma - gma;
 
-		intel_gvt_hypervisor_read_gpa(vgpu, gpa, va + len, copy_len);
+		intel_gvt_read_gpa(vgpu, gpa, va + len, copy_len);
 
 		len += copy_len;
 		gma += copy_len;
drivers/gpu/drm/i915/gvt/execlist.c +6 -6
index c8dcda6d4f0d..a3e15e7a8375 100644
@@ -159,12 +159,12 @@ static void emulate_csb_update(struct intel_vgpu_execlist *execlist,
 	hwsp_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm,
 					 vgpu->hws_pga[execlist->engine->id]);
 	if (hwsp_gpa != INTEL_GVT_INVALID_ADDR) {
-		intel_gvt_hypervisor_write_gpa(vgpu,
-					       hwsp_gpa + I915_HWS_CSB_BUF0_INDEX * 4 + write_pointer * 8,
-					       status, 8);
-		intel_gvt_hypervisor_write_gpa(vgpu,
-					       hwsp_gpa + intel_hws_csb_write_index(execlist->engine->i915) * 4,
-					       &write_pointer, 4);
+		intel_gvt_write_gpa(vgpu,
+			hwsp_gpa + I915_HWS_CSB_BUF0_INDEX * 4 + write_pointer * 8,
+			status, 8);
+		intel_gvt_write_gpa(vgpu,
+			hwsp_gpa + intel_hws_csb_write_index(execlist->engine->i915) * 4,
+			&write_pointer, 4);
 	}
 
 	gvt_dbg_el("vgpu%d: w pointer %u reg %x csb l %x csb h %x\n",
drivers/gpu/drm/i915/gvt/gtt.c +3 -3
index cc2c05e18206..0a953ab7a38b 100644
@@ -312,7 +312,7 @@ static inline int gtt_get_entry64(void *pt,
 		return -EINVAL;
 
 	if (hypervisor_access) {
-		ret = intel_gvt_hypervisor_read_gpa(vgpu, gpa +
+		ret = intel_gvt_read_gpa(vgpu, gpa +
 				(index << info->gtt_entry_size_shift),
 				&e->val64, 8);
 		if (WARN_ON(ret))
@@ -337,7 +337,7 @@ static inline int gtt_set_entry64(void *pt,
 		return -EINVAL;
 
 	if (hypervisor_access) {
-		ret = intel_gvt_hypervisor_write_gpa(vgpu, gpa +
+		ret = intel_gvt_write_gpa(vgpu, gpa +
 				(index << info->gtt_entry_size_shift),
 				&e->val64, 8);
 		if (WARN_ON(ret))
@@ -1495,7 +1495,7 @@ static int attach_oos_page(struct intel_vgpu_oos_page *oos_page,
 	struct intel_gvt *gvt = spt->vgpu->gvt;
 	int ret;
 
-	ret = intel_gvt_hypervisor_read_gpa(spt->vgpu,
+	ret = intel_gvt_read_gpa(spt->vgpu,
 			spt->guest_page.gfn << I915_GTT_PAGE_SHIFT,
 			oos_page->mem, I915_GTT_PAGE_SIZE);
 	if (ret)
drivers/gpu/drm/i915/gvt/gvt.h +37 -0
index ad10ef2377e7..e604d6f6d06a 100644
@@ -35,6 +35,7 @@
 
 #include <uapi/linux/pci_regs.h>
 #include <linux/kvm_host.h>
+#include <linux/vfio.h>
 
 #include "i915_drv.h"
 
@@ -719,6 +720,42 @@ static inline bool intel_gvt_mmio_is_cmd_write_patch(
 	return gvt->mmio.mmio_attribute[offset >> 2] & F_CMD_WRITE_PATCH;
 }
 
+/**
+ * intel_gvt_read_gpa - copy data from GPA to host data buffer
+ * @vgpu: a vGPU
+ * @gpa: guest physical address
+ * @buf: host data buffer
+ * @len: data length
+ *
+ * Returns:
+ * Zero on success, negative error code if failed.
+ */
+static inline int intel_gvt_read_gpa(struct intel_vgpu *vgpu, unsigned long gpa,
+		void *buf, unsigned long len)
+{
+	if (!vgpu->attached)
+		return -ESRCH;
+	return vfio_dma_rw(vgpu->vfio_group, gpa, buf, len, false);
+}
+
+/**
+ * intel_gvt_write_gpa - copy data from host data buffer to GPA
+ * @vgpu: a vGPU
+ * @gpa: guest physical address
+ * @buf: host data buffer
+ * @len: data length
+ *
+ * Returns:
+ * Zero on success, negative error code if failed.
+ */
+static inline int intel_gvt_write_gpa(struct intel_vgpu *vgpu,
+		unsigned long gpa, void *buf, unsigned long len)
+{
+	if (!vgpu->attached)
+		return -ESRCH;
+	return vfio_dma_rw(vgpu->vfio_group, gpa, buf, len, true);
+}
+
 void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu);
 void intel_gvt_debugfs_init(struct intel_gvt *gvt);
 void intel_gvt_debugfs_clean(struct intel_gvt *gvt);
drivers/gpu/drm/i915/gvt/hypercall.h +0 -4
index 9f0475759825..61e493e2de85 100644
@@ -49,10 +49,6 @@ struct intel_gvt_mpt {
 	int (*inject_msi)(struct intel_vgpu *vgpu, u32 addr, u16 data);
 	int (*enable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
 	int (*disable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
-	int (*read_gpa)(struct intel_vgpu *vgpu, unsigned long gpa, void *buf,
-			unsigned long len);
-	int (*write_gpa)(struct intel_vgpu *vgpu, unsigned long gpa, void *buf,
-			 unsigned long len);
 	unsigned long (*gfn_to_mfn)(struct intel_vgpu *vgpu, unsigned long gfn);
 
 	int (*dma_map_guest_page)(struct intel_vgpu *vgpu, unsigned long gfn,
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -23
index bd08c2927c75..7b588a371adb 100644
@@ -39,7 +39,6 @@
 #include <linux/spinlock.h>
 #include <linux/eventfd.h>
 #include <linux/uuid.h>
-#include <linux/vfio.h>
 #include <linux/mdev.h>
 #include <linux/debugfs.h>
 
@@ -2005,26 +2004,6 @@ static void kvmgt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
 	mutex_unlock(&vgpu->cache_lock);
 }
 
-static int kvmgt_rw_gpa(struct intel_vgpu *vgpu, unsigned long gpa,
-			void *buf, unsigned long len, bool write)
-{
-	if (!vgpu->attached)
-		return -ESRCH;
-	return vfio_dma_rw(vgpu->vfio_group, gpa, buf, len, write);
-}
-
-static int kvmgt_read_gpa(struct intel_vgpu *vgpu, unsigned long gpa,
-			void *buf, unsigned long len)
-{
-	return kvmgt_rw_gpa(vgpu, gpa, buf, len, false);
-}
-
-static int kvmgt_write_gpa(struct intel_vgpu *vgpu, unsigned long gpa,
-			void *buf, unsigned long len)
-{
-	return kvmgt_rw_gpa(vgpu, gpa, buf, len, true);
-}
-
 static bool kvmgt_is_valid_gfn(struct intel_vgpu *vgpu, unsigned long gfn)
 {
 	struct kvm *kvm = vgpu->kvm;
@@ -2048,8 +2027,6 @@ static const struct intel_gvt_mpt kvmgt_mpt = {
 	.inject_msi = kvmgt_inject_msi,
 	.enable_page_track = kvmgt_page_track_add,
 	.disable_page_track = kvmgt_page_track_remove,
-	.read_gpa = kvmgt_read_gpa,
-	.write_gpa = kvmgt_write_gpa,
 	.gfn_to_mfn = kvmgt_gfn_to_pfn,
 	.dma_map_guest_page = kvmgt_dma_map_guest_page,
 	.dma_unmap_guest_page = kvmgt_dma_unmap_guest_page,
drivers/gpu/drm/i915/gvt/mmio.c +2 -2
index 24210b1eaec5..464a2ae1a83c 100644
@@ -136,7 +136,7 @@ int intel_vgpu_emulate_mmio_read(struct intel_vgpu *vgpu, u64 pa,
 	}
 
 	if (drm_WARN_ON_ONCE(&i915->drm, !reg_is_mmio(gvt, offset))) {
-		ret = intel_gvt_hypervisor_read_gpa(vgpu, pa, p_data, bytes);
+		ret = intel_gvt_read_gpa(vgpu, pa, p_data, bytes);
 		goto out;
 	}
 
@@ -212,7 +212,7 @@ int intel_vgpu_emulate_mmio_write(struct intel_vgpu *vgpu, u64 pa,
 	}
 
 	if (drm_WARN_ON_ONCE(&i915->drm, !reg_is_mmio(gvt, offset))) {
-		ret = intel_gvt_hypervisor_write_gpa(vgpu, pa, p_data, bytes);
+		ret = intel_gvt_write_gpa(vgpu, pa, p_data, bytes);
 		goto out;
 	}
 
drivers/gpu/drm/i915/gvt/mpt.h +0 -32
index ba0c31c4a705..72388ceec596 100644
@@ -152,38 +152,6 @@ static inline int intel_gvt_hypervisor_disable_page_track(
 	return intel_gvt_host.mpt->disable_page_track(vgpu, gfn);
 }
 
-/**
- * intel_gvt_hypervisor_read_gpa - copy data from GPA to host data buffer
- * @vgpu: a vGPU
- * @gpa: guest physical address
- * @buf: host data buffer
- * @len: data length
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_read_gpa(struct intel_vgpu *vgpu,
-		unsigned long gpa, void *buf, unsigned long len)
-{
-	return intel_gvt_host.mpt->read_gpa(vgpu, gpa, buf, len);
-}
-
-/**
- * intel_gvt_hypervisor_write_gpa - copy data from host data buffer to GPA
- * @vgpu: a vGPU
- * @gpa: guest physical address
- * @buf: host data buffer
- * @len: data length
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_write_gpa(struct intel_vgpu *vgpu,
-		unsigned long gpa, void *buf, unsigned long len)
-{
-	return intel_gvt_host.mpt->write_gpa(vgpu, gpa, buf, len);
-}
-
 /**
  * intel_gvt_hypervisor_gfn_to_mfn - translate a GFN to MFN
  * @vgpu: a vGPU
drivers/gpu/drm/i915/gvt/opregion.c +4 -6
index 286ac6d7c6ce..d2bed466540a 100644
@@ -421,14 +421,14 @@ int intel_vgpu_emulate_opregion_request(struct intel_vgpu *vgpu, u32 swsci)
 				INTEL_GVT_OPREGION_SCIC;
 	parm_pa = (vgpu_opregion(vgpu)->gfn[0] << PAGE_SHIFT) +
 				INTEL_GVT_OPREGION_PARM;
-	ret = intel_gvt_hypervisor_read_gpa(vgpu, scic_pa, &scic, sizeof(scic));
+	ret = intel_gvt_read_gpa(vgpu, scic_pa, &scic, sizeof(scic));
 	if (ret) {
 		gvt_vgpu_err("guest opregion read error %d, gpa 0x%llx, len %lu\n",
 			ret, scic_pa, sizeof(scic));
 		return ret;
 	}
 
-	ret = intel_gvt_hypervisor_read_gpa(vgpu, parm_pa, &parm, sizeof(parm));
+	ret = intel_gvt_read_gpa(vgpu, parm_pa, &parm, sizeof(parm));
 	if (ret) {
 		gvt_vgpu_err("guest opregion read error %d, gpa 0x%llx, len %lu\n",
 			ret, scic_pa, sizeof(scic));
@@ -465,16 +465,14 @@ int intel_vgpu_emulate_opregion_request(struct intel_vgpu *vgpu, u32 swsci)
 	parm = 0;
 
 out:
-	ret = intel_gvt_hypervisor_write_gpa(vgpu, scic_pa, &scic,
-					     sizeof(scic));
+	ret = intel_gvt_write_gpa(vgpu, scic_pa, &scic, sizeof(scic));
 	if (ret) {
 		gvt_vgpu_err("guest opregion write error %d, gpa 0x%llx, len %lu\n",
 			ret, scic_pa, sizeof(scic));
 		return ret;
 	}
 
-	ret = intel_gvt_hypervisor_write_gpa(vgpu, parm_pa, &parm,
-					     sizeof(parm));
+	ret = intel_gvt_write_gpa(vgpu, parm_pa, &parm, sizeof(parm));
 	if (ret) {
 		gvt_vgpu_err("guest opregion write error %d, gpa 0x%llx, len %lu\n",
 			ret, scic_pa, sizeof(scic));
drivers/gpu/drm/i915/gvt/scheduler.c +18 -19
index 734c37c5e347..801b9168feb5 100644
@@ -148,10 +148,10 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload)
 
 	sr_oa_regs(workload, (u32 *)shadow_ring_context, true);
 #define COPY_REG(name) \
-	intel_gvt_hypervisor_read_gpa(vgpu, workload->ring_context_gpa \
+	intel_gvt_read_gpa(vgpu, workload->ring_context_gpa \
 		+ RING_CTX_OFF(name.val), &shadow_ring_context->name.val, 4)
 #define COPY_REG_MASKED(name) {\
-		intel_gvt_hypervisor_read_gpa(vgpu, workload->ring_context_gpa \
+		intel_gvt_read_gpa(vgpu, workload->ring_context_gpa \
 					      + RING_CTX_OFF(name.val),\
 					      &shadow_ring_context->name.val, 4);\
 		shadow_ring_context->name.val |= 0xffff << 16;\
@@ -165,7 +165,7 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload)
 		COPY_REG(rcs_indirect_ctx);
 		COPY_REG(rcs_indirect_ctx_offset);
 	} else if (workload->engine->id == BCS0)
-		intel_gvt_hypervisor_read_gpa(vgpu,
+		intel_gvt_read_gpa(vgpu,
 				workload->ring_context_gpa +
 				BCS_TILE_REGISTER_VAL_OFFSET,
 				(void *)shadow_ring_context +
@@ -176,7 +176,7 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload)
 	/* don't copy Ring Context (the first 0x50 dwords),
 	 * only copy the Engine Context part from guest
 	 */
-	intel_gvt_hypervisor_read_gpa(vgpu,
+	intel_gvt_read_gpa(vgpu,
 			workload->ring_context_gpa +
 			RING_CTX_SIZE,
 			(void *)shadow_ring_context +
@@ -243,7 +243,7 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload)
 		continue;
 
 read:
-		intel_gvt_hypervisor_read_gpa(vgpu, gpa_base, dst, gpa_size);
+		intel_gvt_read_gpa(vgpu, gpa_base, dst, gpa_size);
 		gpa_base = context_gpa;
 		gpa_size = I915_GTT_PAGE_SIZE;
 		dst = context_base + (i << I915_GTT_PAGE_SHIFT);
@@ -909,8 +909,7 @@ static void update_guest_pdps(struct intel_vgpu *vgpu,
 	gpa = ring_context_gpa + RING_CTX_OFF(pdps[0].val);
 
 	for (i = 0; i < 8; i++)
-		intel_gvt_hypervisor_write_gpa(vgpu,
-				gpa + i * 8, &pdp[7 - i], 4);
+		intel_gvt_write_gpa(vgpu, gpa + i * 8, &pdp[7 - i], 4);
 }
 
 static __maybe_unused bool
@@ -1005,13 +1004,13 @@ static void update_guest_context(struct intel_vgpu_workload *workload)
 		continue;
 
 write:
-		intel_gvt_hypervisor_write_gpa(vgpu, gpa_base, src, gpa_size);
+		intel_gvt_write_gpa(vgpu, gpa_base, src, gpa_size);
 		gpa_base = context_gpa;
 		gpa_size = I915_GTT_PAGE_SIZE;
 		src = context_base + (i << I915_GTT_PAGE_SHIFT);
 	}
 
-	intel_gvt_hypervisor_write_gpa(vgpu, workload->ring_context_gpa +
+	intel_gvt_write_gpa(vgpu, workload->ring_context_gpa +
 		RING_CTX_OFF(ring_header.val), &workload->rb_tail, 4);
 
 	shadow_ring_context = (void *) ctx->lrc_reg_state;
@@ -1026,7 +1025,7 @@ static void update_guest_context(struct intel_vgpu_workload *workload)
 	}
 
 #define COPY_REG(name) \
-	intel_gvt_hypervisor_write_gpa(vgpu, workload->ring_context_gpa + \
+	intel_gvt_write_gpa(vgpu, workload->ring_context_gpa + \
 		RING_CTX_OFF(name.val), &shadow_ring_context->name.val, 4)
 
 	COPY_REG(ctx_ctrl);
@@ -1034,7 +1033,7 @@ static void update_guest_context(struct intel_vgpu_workload *workload)
 
 #undef COPY_REG
 
-	intel_gvt_hypervisor_write_gpa(vgpu,
+	intel_gvt_write_gpa(vgpu,
 			workload->ring_context_gpa +
 			sizeof(*shadow_ring_context),
 			(void *)shadow_ring_context +
@@ -1574,7 +1573,7 @@ static void read_guest_pdps(struct intel_vgpu *vgpu,
 	gpa = ring_context_gpa + RING_CTX_OFF(pdps[0].val);
 
 	for (i = 0; i < 8; i++)
-		intel_gvt_hypervisor_read_gpa(vgpu,
+		intel_gvt_read_gpa(vgpu,
 				gpa + i * 8, &pdp[7 - i], 4);
 }
 
@@ -1645,10 +1644,10 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu,
 		return ERR_PTR(-EINVAL);
 	}
 
-	intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa +
+	intel_gvt_read_gpa(vgpu, ring_context_gpa +
 			RING_CTX_OFF(ring_header.val), &head, 4);
 
-	intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa +
+	intel_gvt_read_gpa(vgpu, ring_context_gpa +
 			RING_CTX_OFF(ring_tail.val), &tail, 4);
 
 	guest_head = head;
@@ -1675,11 +1674,11 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu,
 	gvt_dbg_el("ring %s begin a new workload\n", engine->name);
 
 	/* record some ring buffer register values for scan and shadow */
-	intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa +
+	intel_gvt_read_gpa(vgpu, ring_context_gpa +
 			RING_CTX_OFF(rb_start.val), &start, 4);
-	intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa +
+	intel_gvt_read_gpa(vgpu, ring_context_gpa +
 			RING_CTX_OFF(rb_ctrl.val), &ctl, 4);
-	intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa +
+	intel_gvt_read_gpa(vgpu, ring_context_gpa +
 			RING_CTX_OFF(ctx_ctrl.val), &ctx_ctl, 4);
 
 	if (!intel_gvt_ggtt_validate_range(vgpu, start,
@@ -1702,9 +1701,9 @@ intel_vgpu_create_workload(struct intel_vgpu *vgpu,
 	workload->rb_ctl = ctl;
 
 	if (engine->id == RCS0) {
-		intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa +
+		intel_gvt_read_gpa(vgpu, ring_context_gpa +
 			RING_CTX_OFF(bb_per_ctx_ptr.val), &per_ctx, 4);
-		intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa +
+		intel_gvt_read_gpa(vgpu, ring_context_gpa +
 			RING_CTX_OFF(rcs_indirect_ctx.val), &indirect_ctx, 4);
 
 		workload->wa_ctx.indirect_ctx.guest_gma =
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

PATCH 12/21 drm/i915/gvt: devirtualize ->{get,put}_vfio_device

In reply to Christoph Hellwig

Just open code the calls to the VFIO APIs.

---
 drivers/gpu/drm/i915/gvt/dmabuf.c    | 12 ++++++-----
 drivers/gpu/drm/i915/gvt/hypercall.h |  2 --
 drivers/gpu/drm/i915/gvt/kvmgt.c     | 22 --------------------
 drivers/gpu/drm/i915/gvt/mpt.h       | 30 ----------------------------
 4 files changed, 7 insertions(+), 59 deletions(-)
drivers/gpu/drm/i915/gvt/dmabuf.c +7 -5
index 8e65cd8258b9..bc53a0c60b44 100644
@@ -29,7 +29,7 @@
  */
 
 #include <linux/dma-buf.h>
-#include <linux/vfio.h>
+#include <linux/mdev.h>
 
 #include "i915_drv.h"
 #include "gvt.h"
@@ -152,7 +152,7 @@ static void dmabuf_gem_object_free(struct kref *kref)
 					struct intel_vgpu_dmabuf_obj, list);
 			if (dmabuf_obj == obj) {
 				list_del(pos);
-				intel_gvt_hypervisor_put_vfio_device(vgpu);
+				vfio_device_put(vgpu->vfio_device);
 				idr_remove(&vgpu->object_idr,
 					   dmabuf_obj->dmabuf_id);
 				kfree(dmabuf_obj->info);
@@ -493,9 +493,11 @@ int intel_vgpu_query_plane(struct intel_vgpu *vgpu, void *args)
 	kref_init(&dmabuf_obj->kref);
 
 	mutex_lock(&vgpu->dmabuf_lock);
-	if (intel_gvt_hypervisor_get_vfio_device(vgpu)) {
-		gvt_vgpu_err("get vfio device failed\n");
+	vgpu->vfio_device = vfio_device_get_from_dev(mdev_dev(vgpu->mdev));
+	if (!vgpu->vfio_device) {
+		gvt_vgpu_err("failed to get vfio device\n");
 		mutex_unlock(&vgpu->dmabuf_lock);
+		ret = -ENODEV;
 		goto out_free_info;
 	}
 	mutex_unlock(&vgpu->dmabuf_lock);
@@ -605,7 +607,7 @@ void intel_vgpu_dmabuf_cleanup(struct intel_vgpu *vgpu)
 		dmabuf_obj->vgpu = NULL;
 
 		idr_remove(&vgpu->object_idr, dmabuf_obj->dmabuf_id);
-		intel_gvt_hypervisor_put_vfio_device(vgpu);
+		vfio_device_put(vgpu->vfio_device);
 		list_del(pos);
 
 		/* dmabuf_obj might be freed in dmabuf_obj_put */
drivers/gpu/drm/i915/gvt/hypercall.h +0 -2
index 61e493e2de85..fd903d52f431 100644
@@ -60,8 +60,6 @@ struct intel_gvt_mpt {
 
 	int (*set_opregion)(struct intel_vgpu *vgpu);
 	int (*set_edid)(struct intel_vgpu *vgpu, int port_num);
-	int (*get_vfio_device)(struct intel_vgpu *vgpu);
-	void (*put_vfio_device)(struct intel_vgpu *vgpu);
 	bool (*is_valid_gfn)(struct intel_vgpu *vgpu, unsigned long gfn);
 };
 
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -22
index 7b588a371adb..a74fd4c78f35 100644
@@ -643,18 +643,6 @@ static int intel_vgpu_register_reg(struct intel_vgpu *vgpu,
 	return 0;
 }
 
-static int kvmgt_get_vfio_device(struct intel_vgpu *vgpu)
-{
-	vgpu->vfio_device = vfio_device_get_from_dev(
-		mdev_dev(vgpu->mdev));
-	if (!vgpu->vfio_device) {
-		gvt_vgpu_err("failed to get vfio device\n");
-		return -ENODEV;
-	}
-	return 0;
-}
-
-
 static int kvmgt_set_opregion(struct intel_vgpu *vgpu)
 {
 	void *base;
@@ -711,14 +699,6 @@ static int kvmgt_set_edid(struct intel_vgpu *vgpu, int port_num)
 	return ret;
 }
 
-static void kvmgt_put_vfio_device(struct intel_vgpu *vgpu)
-{
-	if (WARN_ON(!vgpu->vfio_device))
-		return;
-
-	vfio_device_put(vgpu->vfio_device);
-}
-
 static int intel_vgpu_create(struct mdev_device *mdev)
 {
 	struct intel_vgpu *vgpu = NULL;
@@ -2033,8 +2013,6 @@ static const struct intel_gvt_mpt kvmgt_mpt = {
 	.dma_pin_guest_page = kvmgt_dma_pin_guest_page,
 	.set_opregion = kvmgt_set_opregion,
 	.set_edid = kvmgt_set_edid,
-	.get_vfio_device = kvmgt_get_vfio_device,
-	.put_vfio_device = kvmgt_put_vfio_device,
 	.is_valid_gfn = kvmgt_is_valid_gfn,
 };
 
drivers/gpu/drm/i915/gvt/mpt.h +0 -30
index 72388ceec596..2196187203af 100644
@@ -242,36 +242,6 @@ static inline int intel_gvt_hypervisor_set_edid(struct intel_vgpu *vgpu,
 	return intel_gvt_host.mpt->set_edid(vgpu, port_num);
 }
 
-/**
- * intel_gvt_hypervisor_get_vfio_device - increase vfio device ref count
- * @vgpu: a vGPU
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_get_vfio_device(struct intel_vgpu *vgpu)
-{
-	if (!intel_gvt_host.mpt->get_vfio_device)
-		return 0;
-
-	return intel_gvt_host.mpt->get_vfio_device(vgpu);
-}
-
-/**
- * intel_gvt_hypervisor_put_vfio_device - decrease vfio device ref count
- * @vgpu: a vGPU
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline void intel_gvt_hypervisor_put_vfio_device(struct intel_vgpu *vgpu)
-{
-	if (!intel_gvt_host.mpt->put_vfio_device)
-		return;
-
-	intel_gvt_host.mpt->put_vfio_device(vgpu);
-}
-
 /**
  * intel_gvt_hypervisor_is_valid_gfn - check if a visible gfn
  * @vgpu: a vGPU
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

PATCH 13/21 drm/i915/gvt: devirtualize ->set_edid and ->set_opregion

In reply to Christoph Hellwig

Just call the code to setup the opregions and EDID data directly.

---
 drivers/gpu/drm/i915/gvt/gvt.h       |  3 +++
 drivers/gpu/drm/i915/gvt/hypercall.h |  3 ---
 drivers/gpu/drm/i915/gvt/kvmgt.c     |  6 ++----
 drivers/gpu/drm/i915/gvt/mpt.h       | 32 ----------------------------
 drivers/gpu/drm/i915/gvt/vgpu.c      |  6 +++---
 5 files changed, 8 insertions(+), 42 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.h +3 -0
index e604d6f6d06a..1cb4b48d9a25 100644
@@ -516,6 +516,9 @@ void intel_gvt_reset_vgpu(struct intel_vgpu *vgpu);
 void intel_gvt_activate_vgpu(struct intel_vgpu *vgpu);
 void intel_gvt_deactivate_vgpu(struct intel_vgpu *vgpu);
 
+int intel_gvt_set_opregion(struct intel_vgpu *vgpu);
+int intel_gvt_set_edid(struct intel_vgpu *vgpu, int port_num);
+
 /* validating GM functions */
 #define vgpu_gmadr_is_aperture(vgpu, gmadr) \
 	((gmadr >= vgpu_aperture_gmadr_base(vgpu)) && \
drivers/gpu/drm/i915/gvt/hypercall.h +0 -3
index fd903d52f431..091249a924a8 100644
@@ -57,9 +57,6 @@ struct intel_gvt_mpt {
 				dma_addr_t dma_addr);
 
 	int (*dma_pin_guest_page)(struct intel_vgpu *vgpu, dma_addr_t dma_addr);
-
-	int (*set_opregion)(struct intel_vgpu *vgpu);
-	int (*set_edid)(struct intel_vgpu *vgpu, int port_num);
 	bool (*is_valid_gfn)(struct intel_vgpu *vgpu, unsigned long gfn);
 };
 
drivers/gpu/drm/i915/gvt/kvmgt.c +2 -4
index a74fd4c78f35..572d51950abb 100644
@@ -643,7 +643,7 @@ static int intel_vgpu_register_reg(struct intel_vgpu *vgpu,
 	return 0;
 }
 
-static int kvmgt_set_opregion(struct intel_vgpu *vgpu)
+int intel_gvt_set_opregion(struct intel_vgpu *vgpu)
 {
 	void *base;
 	int ret;
@@ -670,7 +670,7 @@ static int kvmgt_set_opregion(struct intel_vgpu *vgpu)
 	return ret;
 }
 
-static int kvmgt_set_edid(struct intel_vgpu *vgpu, int port_num)
+int intel_gvt_set_edid(struct intel_vgpu *vgpu, int port_num)
 {
 	struct intel_vgpu_port *port = intel_vgpu_port(vgpu, port_num);
 	struct vfio_edid_region *base;
@@ -2011,8 +2011,6 @@ static const struct intel_gvt_mpt kvmgt_mpt = {
 	.dma_map_guest_page = kvmgt_dma_map_guest_page,
 	.dma_unmap_guest_page = kvmgt_dma_unmap_guest_page,
 	.dma_pin_guest_page = kvmgt_dma_pin_guest_page,
-	.set_opregion = kvmgt_set_opregion,
-	.set_edid = kvmgt_set_edid,
 	.is_valid_gfn = kvmgt_is_valid_gfn,
 };
 
drivers/gpu/drm/i915/gvt/mpt.h +0 -32
index 2196187203af..9738aa3377b4 100644
@@ -210,38 +210,6 @@ intel_gvt_hypervisor_dma_pin_guest_page(struct intel_vgpu *vgpu,
 	return intel_gvt_host.mpt->dma_pin_guest_page(vgpu, dma_addr);
 }
 
-/**
- * intel_gvt_hypervisor_set_opregion - Set opregion for guest
- * @vgpu: a vGPU
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_set_opregion(struct intel_vgpu *vgpu)
-{
-	if (!intel_gvt_host.mpt->set_opregion)
-		return 0;
-
-	return intel_gvt_host.mpt->set_opregion(vgpu);
-}
-
-/**
- * intel_gvt_hypervisor_set_edid - Set EDID region for guest
- * @vgpu: a vGPU
- * @port_num: display port number
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_set_edid(struct intel_vgpu *vgpu,
-						int port_num)
-{
-	if (!intel_gvt_host.mpt->set_edid)
-		return 0;
-
-	return intel_gvt_host.mpt->set_edid(vgpu, port_num);
-}
-
 /**
  * intel_gvt_hypervisor_is_valid_gfn - check if a visible gfn
  * @vgpu: a vGPU
drivers/gpu/drm/i915/gvt/vgpu.c +3 -3
index 9e8fa9f388eb..2fadd6fea5ac 100644
@@ -426,14 +426,14 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
 
 	intel_gvt_debugfs_add_vgpu(vgpu);
 
-	ret = intel_gvt_hypervisor_set_opregion(vgpu);
+	ret = intel_gvt_set_opregion(vgpu);
 	if (ret)
 		goto out_clean_sched_policy;
 
 	if (IS_BROADWELL(dev_priv) || IS_BROXTON(dev_priv))
-		ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_B);
+		ret = intel_gvt_set_edid(vgpu, PORT_B);
 	else
-		ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_D);
+		ret = intel_gvt_set_edid(vgpu, PORT_D);
 	if (ret)
 		goto out_clean_sched_policy;
 
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#17 lore raw

PATCH 14/21 drm/i915/gvt: devirtualize ->detach_vgpu

In reply to Christoph Hellwig

Just call the function directly.

---
 drivers/gpu/drm/i915/gvt/gvt.h       |  1 +
 drivers/gpu/drm/i915/gvt/hypercall.h |  1 -
 drivers/gpu/drm/i915/gvt/kvmgt.c     |  3 +--
 drivers/gpu/drm/i915/gvt/mpt.h       | 16 ----------------
 drivers/gpu/drm/i915/gvt/vgpu.c      |  2 +-
 5 files changed, 3 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.h +1 -0
index 1cb4b48d9a25..82cd00a5b904 100644
@@ -580,6 +580,7 @@ void populate_pvinfo_page(struct intel_vgpu *vgpu);
 
 int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload);
 void enter_failsafe_mode(struct intel_vgpu *vgpu, int reason);
+void intel_vgpu_detach_regions(struct intel_vgpu *vgpu);
 
 enum {
 	GVT_FAILSAFE_UNSUPPORTED_GUEST,
drivers/gpu/drm/i915/gvt/hypercall.h +0 -1
index 091249a924a8..08c622c4079b 100644
@@ -45,7 +45,6 @@ struct intel_vgpu;
 struct intel_gvt_mpt {
 	int (*host_init)(struct device *dev, void *gvt);
 	void (*host_exit)(struct device *dev, void *gvt);
-	void (*detach_vgpu)(struct intel_vgpu *vgpu);
 	int (*inject_msi)(struct intel_vgpu *vgpu, u32 addr, u16 data);
 	int (*enable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
 	int (*disable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
drivers/gpu/drm/i915/gvt/kvmgt.c +1 -2
index 572d51950abb..218c3deaf2b4 100644
@@ -1839,7 +1839,7 @@ static bool kvmgt_guest_exit(struct intel_vgpu *info)
 	return true;
 }
 
-static void kvmgt_detach_vgpu(struct intel_vgpu *vgpu)
+void intel_vgpu_detach_regions(struct intel_vgpu *vgpu)
 {
 	int i;
 
@@ -2003,7 +2003,6 @@ static bool kvmgt_is_valid_gfn(struct intel_vgpu *vgpu, unsigned long gfn)
 static const struct intel_gvt_mpt kvmgt_mpt = {
 	.host_init = kvmgt_host_init,
 	.host_exit = kvmgt_host_exit,
-	.detach_vgpu = kvmgt_detach_vgpu,
 	.inject_msi = kvmgt_inject_msi,
 	.enable_page_track = kvmgt_page_track_add,
 	.disable_page_track = kvmgt_page_track_remove,
drivers/gpu/drm/i915/gvt/mpt.h +0 -16
index 9738aa3377b4..78efcf1e6946 100644
@@ -71,22 +71,6 @@ static inline void intel_gvt_hypervisor_host_exit(struct device *dev, void *gvt)
 	intel_gvt_host.mpt->host_exit(dev, gvt);
 }
 
-/**
- * intel_gvt_hypervisor_detach_vgpu - call hypervisor to release vGPU
- * related stuffs inside hypervisor.
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline void intel_gvt_hypervisor_detach_vgpu(struct intel_vgpu *vgpu)
-{
-	/* optional to provide */
-	if (!intel_gvt_host.mpt->detach_vgpu)
-		return;
-
-	intel_gvt_host.mpt->detach_vgpu(vgpu);
-}
-
 #define MSI_CAP_CONTROL(offset) (offset + 2)
 #define MSI_CAP_ADDRESS(offset) (offset + 4)
 #define MSI_CAP_DATA(offset) (offset + 8)
drivers/gpu/drm/i915/gvt/vgpu.c +1 -1
index 2fadd6fea5ac..7a7f768083d2 100644
@@ -293,7 +293,7 @@ void intel_gvt_destroy_vgpu(struct intel_vgpu *vgpu)
 	intel_vgpu_clean_opregion(vgpu);
 	intel_vgpu_reset_ggtt(vgpu, true);
 	intel_vgpu_clean_gtt(vgpu);
-	intel_gvt_hypervisor_detach_vgpu(vgpu);
+	intel_vgpu_detach_regions(vgpu);
 	intel_vgpu_free_resource(vgpu);
 	intel_vgpu_clean_mmio(vgpu);
 	intel_vgpu_dmabuf_cleanup(vgpu);
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#18 lore raw

PATCH 15/21 drm/i915/gvt: devirtualize ->inject_msi

In reply to Christoph Hellwig

Just open code the MSI injection in a single place instead of going through the method table.

---
 drivers/gpu/drm/i915/gvt/hypercall.h |  1 -
 drivers/gpu/drm/i915/gvt/interrupt.c | 38 +++++++++++++++++++++++++++-
 drivers/gpu/drm/i915/gvt/kvmgt.c     | 24 ------------------
 drivers/gpu/drm/i915/gvt/mpt.h       | 37 ---------------------------
 4 files changed, 37 insertions(+), 63 deletions(-)
drivers/gpu/drm/i915/gvt/hypercall.h +0 -1
index 08c622c4079b..de63bd8dd05b 100644
@@ -45,7 +45,6 @@ struct intel_vgpu;
 struct intel_gvt_mpt {
 	int (*host_init)(struct device *dev, void *gvt);
 	void (*host_exit)(struct device *dev, void *gvt);
-	int (*inject_msi)(struct intel_vgpu *vgpu, u32 addr, u16 data);
 	int (*enable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
 	int (*disable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
 	unsigned long (*gfn_to_mfn)(struct intel_vgpu *vgpu, unsigned long gfn);
drivers/gpu/drm/i915/gvt/interrupt.c +37 -1
index 614b951d919f..f3c350a9a80f 100644
@@ -396,9 +396,45 @@ static void init_irq_map(struct intel_gvt_irq *irq)
 }
 
 /* =======================vEvent injection===================== */
+
+#define MSI_CAP_CONTROL(offset) (offset + 2)
+#define MSI_CAP_ADDRESS(offset) (offset + 4)
+#define MSI_CAP_DATA(offset) (offset + 8)
+#define MSI_CAP_EN 0x1
+
 static int inject_virtual_interrupt(struct intel_vgpu *vgpu)
 {
-	return intel_gvt_hypervisor_inject_msi(vgpu);
+	unsigned long offset = vgpu->gvt->device_info.msi_cap_offset;
+	u16 control, data;
+	u32 addr;
+
+	control = *(u16 *)(vgpu_cfg_space(vgpu) + MSI_CAP_CONTROL(offset));
+	addr = *(u32 *)(vgpu_cfg_space(vgpu) + MSI_CAP_ADDRESS(offset));
+	data = *(u16 *)(vgpu_cfg_space(vgpu) + MSI_CAP_DATA(offset));
+
+	/* Do not generate MSI if MSIEN is disabled */
+	if (!(control & MSI_CAP_EN))
+		return 0;
+
+	if (WARN(control & GENMASK(15, 1), "only support one MSI format\n"))
+		return -EINVAL;
+
+	trace_inject_msi(vgpu->id, addr, data);
+
+	/*
+	 * When guest is powered off, msi_trigger is set to NULL, but vgpu's
+	 * config and mmio register isn't restored to default during guest
+	 * poweroff. If this vgpu is still used in next vm, this vgpu's pipe
+	 * may be enabled, then once this vgpu is active, it will get inject
+	 * vblank interrupt request. But msi_trigger is null until msi is
+	 * enabled by guest. so if msi_trigger is null, success is still
+	 * returned and don't inject interrupt into guest.
+	 */
+	if (!vgpu->attached)
+		return -ESRCH;
+	if (vgpu->msi_trigger && eventfd_signal(vgpu->msi_trigger, 1) != 1)
+		return -EFAULT;
+	return 0;
 }
 
 static void propagate_event(struct intel_gvt_irq *irq,
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -24
index 218c3deaf2b4..3a035802e4f0 100644
@@ -1855,29 +1855,6 @@ void intel_vgpu_detach_regions(struct intel_vgpu *vgpu)
 	vgpu->region = NULL;
 }
 
-static int kvmgt_inject_msi(struct intel_vgpu *vgpu, u32 addr, u16 data)
-{
-	if (!vgpu->attached)
-		return -ESRCH;
-
-	/*
-	 * When guest is poweroff, msi_trigger is set to NULL, but vgpu's
-	 * config and mmio register isn't restored to default during guest
-	 * poweroff. If this vgpu is still used in next vm, this vgpu's pipe
-	 * may be enabled, then once this vgpu is active, it will get inject
-	 * vblank interrupt request. But msi_trigger is null until msi is
-	 * enabled by guest. so if msi_trigger is null, success is still
-	 * returned and don't inject interrupt into guest.
-	 */
-	if (vgpu->msi_trigger == NULL)
-		return 0;
-
-	if (eventfd_signal(vgpu->msi_trigger, 1) == 1)
-		return 0;
-
-	return -EFAULT;
-}
-
 static unsigned long kvmgt_gfn_to_pfn(struct intel_vgpu *vgpu,
 		unsigned long gfn)
 {
@@ -2003,7 +1980,6 @@ static bool kvmgt_is_valid_gfn(struct intel_vgpu *vgpu, unsigned long gfn)
 static const struct intel_gvt_mpt kvmgt_mpt = {
 	.host_init = kvmgt_host_init,
 	.host_exit = kvmgt_host_exit,
-	.inject_msi = kvmgt_inject_msi,
 	.enable_page_track = kvmgt_page_track_add,
 	.disable_page_track = kvmgt_page_track_remove,
 	.gfn_to_mfn = kvmgt_gfn_to_pfn,
drivers/gpu/drm/i915/gvt/mpt.h +0 -37
index 78efcf1e6946..59369e8b3b69 100644
@@ -71,43 +71,6 @@ static inline void intel_gvt_hypervisor_host_exit(struct device *dev, void *gvt)
 	intel_gvt_host.mpt->host_exit(dev, gvt);
 }
 
-#define MSI_CAP_CONTROL(offset) (offset + 2)
-#define MSI_CAP_ADDRESS(offset) (offset + 4)
-#define MSI_CAP_DATA(offset) (offset + 8)
-#define MSI_CAP_EN 0x1
-
-/**
- * intel_gvt_hypervisor_inject_msi - inject a MSI interrupt into vGPU
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_inject_msi(struct intel_vgpu *vgpu)
-{
-	unsigned long offset = vgpu->gvt->device_info.msi_cap_offset;
-	u16 control, data;
-	u32 addr;
-	int ret;
-
-	control = *(u16 *)(vgpu_cfg_space(vgpu) + MSI_CAP_CONTROL(offset));
-	addr = *(u32 *)(vgpu_cfg_space(vgpu) + MSI_CAP_ADDRESS(offset));
-	data = *(u16 *)(vgpu_cfg_space(vgpu) + MSI_CAP_DATA(offset));
-
-	/* Do not generate MSI if MSIEN is disable */
-	if (!(control & MSI_CAP_EN))
-		return 0;
-
-	if (WARN(control & GENMASK(15, 1), "only support one MSI format\n"))
-		return -EINVAL;
-
-	trace_inject_msi(vgpu->id, addr, data);
-
-	ret = intel_gvt_host.mpt->inject_msi(vgpu, addr, data);
-	if (ret)
-		return ret;
-	return 0;
-}
-
 /**
  * intel_gvt_hypervisor_enable_page_track - track a guest page
  * @vgpu: a vGPU
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#19 lore raw

PATCH 16/21 drm/i915/gvt: devirtualize ->is_valid_gfn

In reply to Christoph Hellwig

Just call the code directly and move towards the callers.

---
 drivers/gpu/drm/i915/gvt/gtt.c       | 20 ++++++++++++++++++--
 drivers/gpu/drm/i915/gvt/hypercall.h |  1 -
 drivers/gpu/drm/i915/gvt/kvmgt.c     | 17 -----------------
 drivers/gpu/drm/i915/gvt/mpt.h       | 17 -----------------
 4 files changed, 18 insertions(+), 37 deletions(-)
drivers/gpu/drm/i915/gvt/gtt.c +18 -2
index 0a953ab7a38b..5783642d4d79 100644
@@ -47,6 +47,22 @@
 static bool enable_out_of_sync = false;
 static int preallocated_oos_pages = 8192;
 
+static bool intel_gvt_is_valid_gfn(struct intel_vgpu *vgpu, unsigned long gfn)
+{
+	struct kvm *kvm = vgpu->kvm;
+	int idx;
+	bool ret;
+
+	if (!vgpu->attached)
+		return false;
+
+	idx = srcu_read_lock(&kvm->srcu);
+	ret = kvm_is_visible_gfn(kvm, gfn);
+	srcu_read_unlock(&kvm->srcu, idx);
+
+	return ret;
+}
+
 /*
  * validate a gm address and related range size,
  * translate it to host gm address
@@ -1329,7 +1345,7 @@ static int ppgtt_populate_spt(struct intel_vgpu_ppgtt_spt *spt)
 			ppgtt_set_shadow_entry(spt, &se, i);
 		} else {
 			gfn = ops->get_pfn(&ge);
-			if (!intel_gvt_hypervisor_is_valid_gfn(vgpu, gfn)) {
+			if (!intel_gvt_is_valid_gfn(vgpu, gfn)) {
 				ops->set_pfn(&se, gvt->gtt.scratch_mfn);
 				ppgtt_set_shadow_entry(spt, &se, i);
 				continue;
@@ -2313,7 +2329,7 @@ static int emulate_ggtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off,
 		/* one PTE update may be issued in multiple writes and the
 		 * first write may not construct a valid gfn
 		 */
-		if (!intel_gvt_hypervisor_is_valid_gfn(vgpu, gfn)) {
+		if (!intel_gvt_is_valid_gfn(vgpu, gfn)) {
 			ops->set_pfn(&m, gvt->gtt.scratch_mfn);
 			goto out;
 		}
drivers/gpu/drm/i915/gvt/hypercall.h +0 -1
index de63bd8dd05b..c1a9eeed0460 100644
@@ -55,7 +55,6 @@ struct intel_gvt_mpt {
 				dma_addr_t dma_addr);
 
 	int (*dma_pin_guest_page)(struct intel_vgpu *vgpu, dma_addr_t dma_addr);
-	bool (*is_valid_gfn)(struct intel_vgpu *vgpu, unsigned long gfn);
 };
 
 #endif /* _GVT_HYPERCALL_H_ */
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -17
index 3a035802e4f0..2d3ef59e7227 100644
@@ -1961,22 +1961,6 @@ static void kvmgt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
 	mutex_unlock(&vgpu->cache_lock);
 }
 
-static bool kvmgt_is_valid_gfn(struct intel_vgpu *vgpu, unsigned long gfn)
-{
-	struct kvm *kvm = vgpu->kvm;
-	int idx;
-	bool ret;
-
-	if (!vgpu->attached)
-		return false;
-
-	idx = srcu_read_lock(&kvm->srcu);
-	ret = kvm_is_visible_gfn(kvm, gfn);
-	srcu_read_unlock(&kvm->srcu, idx);
-
-	return ret;
-}
-
 static const struct intel_gvt_mpt kvmgt_mpt = {
 	.host_init = kvmgt_host_init,
 	.host_exit = kvmgt_host_exit,
@@ -1986,7 +1970,6 @@ static const struct intel_gvt_mpt kvmgt_mpt = {
 	.dma_map_guest_page = kvmgt_dma_map_guest_page,
 	.dma_unmap_guest_page = kvmgt_dma_unmap_guest_page,
 	.dma_pin_guest_page = kvmgt_dma_pin_guest_page,
-	.is_valid_gfn = kvmgt_is_valid_gfn,
 };
 
 struct intel_gvt_host intel_gvt_host = {
drivers/gpu/drm/i915/gvt/mpt.h +0 -17
index 59369e8b3b69..1a796f2181ba 100644
@@ -157,21 +157,4 @@ intel_gvt_hypervisor_dma_pin_guest_page(struct intel_vgpu *vgpu,
 	return intel_gvt_host.mpt->dma_pin_guest_page(vgpu, dma_addr);
 }
 
-/**
- * intel_gvt_hypervisor_is_valid_gfn - check if a visible gfn
- * @vgpu: a vGPU
- * @gfn: guest PFN
- *
- * Returns:
- * true on valid gfn, false on not.
- */
-static inline bool intel_gvt_hypervisor_is_valid_gfn(
-		struct intel_vgpu *vgpu, unsigned long gfn)
-{
-	if (!intel_gvt_host.mpt->is_valid_gfn)
-		return true;
-
-	return intel_gvt_host.mpt->is_valid_gfn(vgpu, gfn);
-}
-
 #endif /* _GVT_MPT_H_ */
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#20 lore raw

PATCH 17/21 drm/i915/gvt: devirtualize ->gfn_to_mfn

In reply to Christoph Hellwig

Just open code it in the only caller.

---
 drivers/gpu/drm/i915/gvt/gtt.c       |  9 +++++----
 drivers/gpu/drm/i915/gvt/hypercall.h |  1 -
 drivers/gpu/drm/i915/gvt/kvmgt.c     | 16 ----------------
 drivers/gpu/drm/i915/gvt/mpt.h       | 14 --------------
 4 files changed, 5 insertions(+), 35 deletions(-)
drivers/gpu/drm/i915/gvt/gtt.c +5 -4
index 5783642d4d79..75782f59df8e 100644
@@ -1176,15 +1176,16 @@ static int is_2MB_gtt_possible(struct intel_vgpu *vgpu,
 	struct intel_gvt_gtt_entry *entry)
 {
 	struct intel_gvt_gtt_pte_ops *ops = vgpu->gvt->gtt.pte_ops;
-	unsigned long pfn;
+	kvm_pfn_t pfn;
 
 	if (!HAS_PAGE_SIZES(vgpu->gvt->gt->i915, I915_GTT_PAGE_SIZE_2M))
 		return 0;
 
-	pfn = intel_gvt_hypervisor_gfn_to_mfn(vgpu, ops->get_pfn(entry));
-	if (pfn == INTEL_GVT_INVALID_ADDR)
+	if (!vgpu->attached)
+		return -EINVAL;
+	pfn = gfn_to_pfn(vgpu->kvm, ops->get_pfn(entry));
+	if (is_error_noslot_pfn(pfn))
 		return -EINVAL;
-
 	return PageTransHuge(pfn_to_page(pfn));
 }
 
drivers/gpu/drm/i915/gvt/hypercall.h +0 -1
index c1a9eeed0460..dbde492cafc8 100644
@@ -47,7 +47,6 @@ struct intel_gvt_mpt {
 	void (*host_exit)(struct device *dev, void *gvt);
 	int (*enable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
 	int (*disable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
-	unsigned long (*gfn_to_mfn)(struct intel_vgpu *vgpu, unsigned long gfn);
 
 	int (*dma_map_guest_page)(struct intel_vgpu *vgpu, unsigned long gfn,
 				  unsigned long size, dma_addr_t *dma_addr);
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -16
index 2d3ef59e7227..226e3f3c41df 100644
@@ -1855,21 +1855,6 @@ void intel_vgpu_detach_regions(struct intel_vgpu *vgpu)
 	vgpu->region = NULL;
 }
 
-static unsigned long kvmgt_gfn_to_pfn(struct intel_vgpu *vgpu,
-		unsigned long gfn)
-{
-	kvm_pfn_t pfn;
-
-	if (!vgpu->attached)
-		return INTEL_GVT_INVALID_ADDR;
-
-	pfn = gfn_to_pfn(vgpu->kvm, gfn);
-	if (is_error_noslot_pfn(pfn))
-		return INTEL_GVT_INVALID_ADDR;
-
-	return pfn;
-}
-
 static int kvmgt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
 		unsigned long size, dma_addr_t *dma_addr)
 {
@@ -1966,7 +1951,6 @@ static const struct intel_gvt_mpt kvmgt_mpt = {
 	.host_exit = kvmgt_host_exit,
 	.enable_page_track = kvmgt_page_track_add,
 	.disable_page_track = kvmgt_page_track_remove,
-	.gfn_to_mfn = kvmgt_gfn_to_pfn,
 	.dma_map_guest_page = kvmgt_dma_map_guest_page,
 	.dma_unmap_guest_page = kvmgt_dma_unmap_guest_page,
 	.dma_pin_guest_page = kvmgt_dma_pin_guest_page,
drivers/gpu/drm/i915/gvt/mpt.h +0 -14
index 1a796f2181ba..2d4bb6eaa08e 100644
@@ -99,20 +99,6 @@ static inline int intel_gvt_hypervisor_disable_page_track(
 	return intel_gvt_host.mpt->disable_page_track(vgpu, gfn);
 }
 
-/**
- * intel_gvt_hypervisor_gfn_to_mfn - translate a GFN to MFN
- * @vgpu: a vGPU
- * @gpfn: guest pfn
- *
- * Returns:
- * MFN on success, INTEL_GVT_INVALID_ADDR if failed.
- */
-static inline unsigned long intel_gvt_hypervisor_gfn_to_mfn(
-		struct intel_vgpu *vgpu, unsigned long gfn)
-{
-	return intel_gvt_host.mpt->gfn_to_mfn(vgpu, gfn);
-}
-
 /**
  * intel_gvt_hypervisor_dma_map_guest_page - setup dma map for guest page
  * @vgpu: a vGPU
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#21 lore raw

PATCH 18/21 drm/i915/gvt: devirtualize ->{enable,disable}_page_track

In reply to Christoph Hellwig

Just call the kvmgt functions directly.

---
 drivers/gpu/drm/i915/gvt/gvt.h        |  3 +++
 drivers/gpu/drm/i915/gvt/hypercall.h  |  2 --
 drivers/gpu/drm/i915/gvt/kvmgt.c      |  6 ++----
 drivers/gpu/drm/i915/gvt/mpt.h        | 28 ---------------------------
 drivers/gpu/drm/i915/gvt/page_track.c |  8 ++++----
 5 files changed, 9 insertions(+), 38 deletions(-)
drivers/gpu/drm/i915/gvt/gvt.h +3 -0
index 82cd00a5b904..e186ded7ec68 100644
@@ -764,6 +764,9 @@ void intel_gvt_debugfs_remove_vgpu(struct intel_vgpu *vgpu);
 void intel_gvt_debugfs_init(struct intel_gvt *gvt);
 void intel_gvt_debugfs_clean(struct intel_gvt *gvt);
 
+int intel_gvt_page_track_add(struct intel_vgpu *info, u64 gfn);
+int intel_gvt_page_track_remove(struct intel_vgpu *info, u64 gfn);
+
 #include "trace.h"
 #include "mpt.h"
 
drivers/gpu/drm/i915/gvt/hypercall.h +0 -2
index dbde492cafc8..ded13a63ab66 100644
@@ -45,8 +45,6 @@ struct intel_vgpu;
 struct intel_gvt_mpt {
 	int (*host_init)(struct device *dev, void *gvt);
 	void (*host_exit)(struct device *dev, void *gvt);
-	int (*enable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
-	int (*disable_page_track)(struct intel_vgpu *vgpu, u64 gfn);
 
 	int (*dma_map_guest_page)(struct intel_vgpu *vgpu, unsigned long gfn,
 				  unsigned long size, dma_addr_t *dma_addr);
drivers/gpu/drm/i915/gvt/kvmgt.c +2 -4
index 226e3f3c41df..72e33332c412 100644
@@ -1683,7 +1683,7 @@ static void kvmgt_host_exit(struct device *dev, void *gvt)
 	intel_gvt_cleanup_vgpu_type_groups((struct intel_gvt *)gvt);
 }
 
-static int kvmgt_page_track_add(struct intel_vgpu *info, u64 gfn)
+int intel_gvt_page_track_add(struct intel_vgpu *info, u64 gfn)
 {
 	struct kvm *kvm = info->kvm;
 	struct kvm_memory_slot *slot;
@@ -1713,7 +1713,7 @@ static int kvmgt_page_track_add(struct intel_vgpu *info, u64 gfn)
 	return 0;
 }
 
-static int kvmgt_page_track_remove(struct intel_vgpu *info, u64 gfn)
+int intel_gvt_page_track_remove(struct intel_vgpu *info, u64 gfn)
 {
 	struct kvm *kvm = info->kvm;
 	struct kvm_memory_slot *slot;
@@ -1949,8 +1949,6 @@ static void kvmgt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
 static const struct intel_gvt_mpt kvmgt_mpt = {
 	.host_init = kvmgt_host_init,
 	.host_exit = kvmgt_host_exit,
-	.enable_page_track = kvmgt_page_track_add,
-	.disable_page_track = kvmgt_page_track_remove,
 	.dma_map_guest_page = kvmgt_dma_map_guest_page,
 	.dma_unmap_guest_page = kvmgt_dma_unmap_guest_page,
 	.dma_pin_guest_page = kvmgt_dma_pin_guest_page,
drivers/gpu/drm/i915/gvt/mpt.h +0 -28
index 2d4bb6eaa08e..d2723ac8bb04 100644
@@ -71,34 +71,6 @@ static inline void intel_gvt_hypervisor_host_exit(struct device *dev, void *gvt)
 	intel_gvt_host.mpt->host_exit(dev, gvt);
 }
 
-/**
- * intel_gvt_hypervisor_enable_page_track - track a guest page
- * @vgpu: a vGPU
- * @gfn: the gfn of guest
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_enable_page_track(
-		struct intel_vgpu *vgpu, unsigned long gfn)
-{
-	return intel_gvt_host.mpt->enable_page_track(vgpu, gfn);
-}
-
-/**
- * intel_gvt_hypervisor_disable_page_track - untrack a guest page
- * @vgpu: a vGPU
- * @gfn: the gfn of guest
- *
- * Returns:
- * Zero on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_disable_page_track(
-		struct intel_vgpu *vgpu, unsigned long gfn)
-{
-	return intel_gvt_host.mpt->disable_page_track(vgpu, gfn);
-}
-
 /**
  * intel_gvt_hypervisor_dma_map_guest_page - setup dma map for guest page
  * @vgpu: a vGPU
drivers/gpu/drm/i915/gvt/page_track.c +4 -4
index 84856022528e..3375b51c75f1 100644
@@ -87,7 +87,7 @@ void intel_vgpu_unregister_page_track(struct intel_vgpu *vgpu,
 	track = radix_tree_delete(&vgpu->page_track_tree, gfn);
 	if (track) {
 		if (track->tracked)
-			intel_gvt_hypervisor_disable_page_track(vgpu, gfn);
+			intel_gvt_page_track_remove(vgpu, gfn);
 		kfree(track);
 	}
 }
@@ -112,7 +112,7 @@ int intel_vgpu_enable_page_track(struct intel_vgpu *vgpu, unsigned long gfn)
 	if (track->tracked)
 		return 0;
 
-	ret = intel_gvt_hypervisor_enable_page_track(vgpu, gfn);
+	ret = intel_gvt_page_track_add(vgpu, gfn);
 	if (ret)
 		return ret;
 	track->tracked = true;
@@ -139,7 +139,7 @@ int intel_vgpu_disable_page_track(struct intel_vgpu *vgpu, unsigned long gfn)
 	if (!track->tracked)
 		return 0;
 
-	ret = intel_gvt_hypervisor_disable_page_track(vgpu, gfn);
+	ret = intel_gvt_page_track_remove(vgpu, gfn);
 	if (ret)
 		return ret;
 	track->tracked = false;
@@ -172,7 +172,7 @@ int intel_vgpu_page_track_handler(struct intel_vgpu *vgpu, u64 gpa,
 
 	if (unlikely(vgpu->failsafe)) {
 		/* Remove write protection to prevent furture traps. */
-		intel_vgpu_disable_page_track(vgpu, gpa >> PAGE_SHIFT);
+		intel_gvt_page_track_remove(vgpu, gpa >> PAGE_SHIFT);
 	} else {
 		ret = page_track->handler(page_track, gpa, data, bytes);
 		if (ret)
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#22 lore raw

PATCH 19/21 drm/i915/gvt: devirtualize ->dma_{,un}map_guest_page

In reply to Christoph Hellwig

Just call the functions directly. Also remove a pointless wrapper.

---
 drivers/gpu/drm/i915/gvt/dmabuf.c    | 10 ++--------
 drivers/gpu/drm/i915/gvt/gtt.c       | 20 +++++++++----------
 drivers/gpu/drm/i915/gvt/gvt.h       |  4 ++++
 drivers/gpu/drm/i915/gvt/hypercall.h |  5 -----
 drivers/gpu/drm/i915/gvt/kvmgt.c     |  6 ++----
 drivers/gpu/drm/i915/gvt/mpt.h       | 29 ----------------------------
 6 files changed, 17 insertions(+), 57 deletions(-)
drivers/gpu/drm/i915/gvt/dmabuf.c +2 -8
index bc53a0c60b44..03d82f4f9aa2 100644
@@ -48,12 +48,6 @@ static int vgpu_pin_dma_address(struct intel_vgpu *vgpu,
 	return ret;
 }
 
-static void vgpu_unpin_dma_address(struct intel_vgpu *vgpu,
-				   dma_addr_t dma_addr)
-{
-	intel_gvt_hypervisor_dma_unmap_guest_page(vgpu, dma_addr);
-}
-
 static int vgpu_gem_get_pages(
 		struct drm_i915_gem_object *obj)
 {
@@ -108,7 +102,7 @@ static int vgpu_gem_get_pages(
 		for_each_sg(st->sgl, sg, i, j) {
 			dma_addr = sg_dma_address(sg);
 			if (dma_addr)
-				vgpu_unpin_dma_address(vgpu, dma_addr);
+				intel_gvt_dma_unmap_guest_page(vgpu, dma_addr);
 		}
 		sg_free_table(st);
 		kfree(st);
@@ -130,7 +124,7 @@ static void vgpu_gem_put_pages(struct drm_i915_gem_object *obj,
 		int i;
 
 		for_each_sg(pages->sgl, sg, fb_info->size, i)
-			vgpu_unpin_dma_address(vgpu,
+			intel_gvt_dma_unmap_guest_page(vgpu,
 					       sg_dma_address(sg));
 	}
 
drivers/gpu/drm/i915/gvt/gtt.c +9 -11
index 75782f59df8e..0ae28b7f5c07 100644
@@ -1011,7 +1011,7 @@ static inline void ppgtt_invalidate_pte(struct intel_vgpu_ppgtt_spt *spt,
 	if (!pfn || pfn == vgpu->gtt.scratch_pt[type].page_mfn)
 		return;
 
-	intel_gvt_hypervisor_dma_unmap_guest_page(vgpu, pfn << PAGE_SHIFT);
+	intel_gvt_dma_unmap_guest_page(vgpu, pfn << PAGE_SHIFT);
 }
 
 static int ppgtt_invalidate_spt(struct intel_vgpu_ppgtt_spt *spt)
@@ -1210,8 +1210,8 @@ static int split_2MB_gtt_entry(struct intel_vgpu *vgpu,
 		return PTR_ERR(sub_spt);
 
 	for_each_shadow_entry(sub_spt, &sub_se, sub_index) {
-		ret = intel_gvt_hypervisor_dma_map_guest_page(vgpu,
-				start_gfn + sub_index, PAGE_SIZE, &dma_addr);
+		ret = intel_gvt_dma_map_guest_page(vgpu, start_gfn + sub_index,
+						   PAGE_SIZE, &dma_addr);
 		if (ret) {
 			ppgtt_invalidate_spt(spt);
 			return ret;
@@ -1256,8 +1256,8 @@ static int split_64KB_gtt_entry(struct intel_vgpu *vgpu,
 	ops->set_64k_splited(&entry);
 
 	for (i = 0; i < GTT_64K_PTE_STRIDE; i++) {
-		ret = intel_gvt_hypervisor_dma_map_guest_page(vgpu,
-					start_gfn + i, PAGE_SIZE, &dma_addr);
+		ret = intel_gvt_dma_map_guest_page(vgpu, start_gfn + i,
+						   PAGE_SIZE, &dma_addr);
 		if (ret)
 			return ret;
 
@@ -1311,8 +1311,7 @@ static int ppgtt_populate_shadow_entry(struct intel_vgpu *vgpu,
 	}
 
 	/* direct shadow */
-	ret = intel_gvt_hypervisor_dma_map_guest_page(vgpu, gfn, page_size,
-						      &dma_addr);
+	ret = intel_gvt_dma_map_guest_page(vgpu, gfn, page_size, &dma_addr);
 	if (ret)
 		return -ENXIO;
 
@@ -2243,8 +2242,7 @@ static void ggtt_invalidate_pte(struct intel_vgpu *vgpu,
 
 	pfn = pte_ops->get_pfn(entry);
 	if (pfn != vgpu->gvt->gtt.scratch_mfn)
-		intel_gvt_hypervisor_dma_unmap_guest_page(vgpu,
-						pfn << PAGE_SHIFT);
+		intel_gvt_dma_unmap_guest_page(vgpu, pfn << PAGE_SHIFT);
 }
 
 static int emulate_ggtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off,
@@ -2335,8 +2333,8 @@ static int emulate_ggtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off,
 			goto out;
 		}
 
-		ret = intel_gvt_hypervisor_dma_map_guest_page(vgpu, gfn,
-							PAGE_SIZE, &dma_addr);
+		ret = intel_gvt_dma_map_guest_page(vgpu, gfn, PAGE_SIZE,
+						   &dma_addr);
 		if (ret) {
 			gvt_vgpu_err("fail to populate guest ggtt entry\n");
 			/* guest driver may read/write the entry when partial
drivers/gpu/drm/i915/gvt/gvt.h +4 -0
index e186ded7ec68..9d5a286e1269 100644
@@ -766,6 +766,10 @@ void intel_gvt_debugfs_clean(struct intel_gvt *gvt);
 
 int intel_gvt_page_track_add(struct intel_vgpu *info, u64 gfn);
 int intel_gvt_page_track_remove(struct intel_vgpu *info, u64 gfn);
+int intel_gvt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
+		unsigned long size, dma_addr_t *dma_addr);
+void intel_gvt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
+		dma_addr_t dma_addr);
 
 #include "trace.h"
 #include "mpt.h"
drivers/gpu/drm/i915/gvt/hypercall.h +0 -5
index ded13a63ab66..ba03b3368a95 100644
@@ -46,11 +46,6 @@ struct intel_gvt_mpt {
 	int (*host_init)(struct device *dev, void *gvt);
 	void (*host_exit)(struct device *dev, void *gvt);
 
-	int (*dma_map_guest_page)(struct intel_vgpu *vgpu, unsigned long gfn,
-				  unsigned long size, dma_addr_t *dma_addr);
-	void (*dma_unmap_guest_page)(struct intel_vgpu *vgpu,
-				dma_addr_t dma_addr);
-
 	int (*dma_pin_guest_page)(struct intel_vgpu *vgpu, dma_addr_t dma_addr);
 };
 
drivers/gpu/drm/i915/gvt/kvmgt.c +2 -4
index 72e33332c412..8101c1485f12 100644
@@ -1855,7 +1855,7 @@ void intel_vgpu_detach_regions(struct intel_vgpu *vgpu)
 	vgpu->region = NULL;
 }
 
-static int kvmgt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
+int intel_gvt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
 		unsigned long size, dma_addr_t *dma_addr)
 {
 	struct gvt_dma *entry;
@@ -1931,7 +1931,7 @@ static void __gvt_dma_release(struct kref *ref)
 	__gvt_cache_remove_entry(entry->vgpu, entry);
 }
 
-static void kvmgt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
+void intel_gvt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
 		dma_addr_t dma_addr)
 {
 	struct gvt_dma *entry;
@@ -1949,8 +1949,6 @@ static void kvmgt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
 static const struct intel_gvt_mpt kvmgt_mpt = {
 	.host_init = kvmgt_host_init,
 	.host_exit = kvmgt_host_exit,
-	.dma_map_guest_page = kvmgt_dma_map_guest_page,
-	.dma_unmap_guest_page = kvmgt_dma_unmap_guest_page,
 	.dma_pin_guest_page = kvmgt_dma_pin_guest_page,
 };
 
drivers/gpu/drm/i915/gvt/mpt.h +0 -29
index d2723ac8bb04..26c1ee690f7e 100644
@@ -71,35 +71,6 @@ static inline void intel_gvt_hypervisor_host_exit(struct device *dev, void *gvt)
 	intel_gvt_host.mpt->host_exit(dev, gvt);
 }
 
-/**
- * intel_gvt_hypervisor_dma_map_guest_page - setup dma map for guest page
- * @vgpu: a vGPU
- * @gfn: guest pfn
- * @size: page size
- * @dma_addr: retrieve allocated dma addr
- *
- * Returns:
- * 0 on success, negative error code if failed.
- */
-static inline int intel_gvt_hypervisor_dma_map_guest_page(
-		struct intel_vgpu *vgpu, unsigned long gfn, unsigned long size,
-		dma_addr_t *dma_addr)
-{
-	return intel_gvt_host.mpt->dma_map_guest_page(vgpu, gfn, size,
-						      dma_addr);
-}
-
-/**
- * intel_gvt_hypervisor_dma_unmap_guest_page - cancel dma map for guest page
- * @vgpu: a vGPU
- * @dma_addr: the mapped dma addr
- */
-static inline void intel_gvt_hypervisor_dma_unmap_guest_page(
-		struct intel_vgpu *vgpu, dma_addr_t dma_addr)
-{
-	intel_gvt_host.mpt->dma_unmap_guest_page(vgpu, dma_addr);
-}
-
 /**
  * intel_gvt_hypervisor_dma_pin_guest_page - pin guest dma buf
  * @vgpu: a vGPU
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#23 lore raw

PATCH 20/21 drm/i915/gvt: devirtualize dma_pin_guest_page

In reply to Christoph Hellwig

Just call the function directly and remove a pointless wrapper.

---
 drivers/gpu/drm/i915/gvt/dmabuf.c    | 14 +-------------
 drivers/gpu/drm/i915/gvt/gvt.h       |  1 +
 drivers/gpu/drm/i915/gvt/hypercall.h |  2 --
 drivers/gpu/drm/i915/gvt/kvmgt.c     |  4 +---
 drivers/gpu/drm/i915/gvt/mpt.h       | 15 ---------------
 5 files changed, 3 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/gvt/dmabuf.c +1 -13
index 03d82f4f9aa2..eacfe7beaaf6 100644
@@ -36,18 +36,6 @@
 
 #define GEN8_DECODE_PTE(pte) (pte & GENMASK_ULL(63, 12))
 
-static int vgpu_pin_dma_address(struct intel_vgpu *vgpu,
-				unsigned long size,
-				dma_addr_t dma_addr)
-{
-	int ret = 0;
-
-	if (intel_gvt_hypervisor_dma_pin_guest_page(vgpu, dma_addr))
-		ret = -EINVAL;
-
-	return ret;
-}
-
 static int vgpu_gem_get_pages(
 		struct drm_i915_gem_object *obj)
 {
@@ -83,7 +71,7 @@ static int vgpu_gem_get_pages(
 	for_each_sg(st->sgl, sg, page_num, i) {
 		dma_addr_t dma_addr =
 			GEN8_DECODE_PTE(readq(&gtt_entries[i]));
-		if (vgpu_pin_dma_address(vgpu, PAGE_SIZE, dma_addr)) {
+		if (intel_gvt_dma_pin_guest_page(vgpu, dma_addr)) {
 			ret = -EINVAL;
 			goto out;
 		}
drivers/gpu/drm/i915/gvt/gvt.h +1 -0
index 9d5a286e1269..a8fc381f558e 100644
@@ -766,6 +766,7 @@ void intel_gvt_debugfs_clean(struct intel_gvt *gvt);
 
 int intel_gvt_page_track_add(struct intel_vgpu *info, u64 gfn);
 int intel_gvt_page_track_remove(struct intel_vgpu *info, u64 gfn);
+int intel_gvt_dma_pin_guest_page(struct intel_vgpu *vgpu, dma_addr_t dma_addr);
 int intel_gvt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
 		unsigned long size, dma_addr_t *dma_addr);
 void intel_gvt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
drivers/gpu/drm/i915/gvt/hypercall.h +0 -2
index ba03b3368a95..d49437aeabac 100644
@@ -45,8 +45,6 @@ struct intel_vgpu;
 struct intel_gvt_mpt {
 	int (*host_init)(struct device *dev, void *gvt);
 	void (*host_exit)(struct device *dev, void *gvt);
-
-	int (*dma_pin_guest_page)(struct intel_vgpu *vgpu, dma_addr_t dma_addr);
 };
 
 #endif /* _GVT_HYPERCALL_H_ */
drivers/gpu/drm/i915/gvt/kvmgt.c +1 -3
index 8101c1485f12..5f10ed5eccde 100644
@@ -1902,8 +1902,7 @@ int intel_gvt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
 	return ret;
 }
 
-static int kvmgt_dma_pin_guest_page(struct intel_vgpu *vgpu,
-		dma_addr_t dma_addr)
+int intel_gvt_dma_pin_guest_page(struct intel_vgpu *vgpu, dma_addr_t dma_addr)
 {
 	struct gvt_dma *entry;
 	int ret = 0;
@@ -1949,7 +1948,6 @@ void intel_gvt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
 static const struct intel_gvt_mpt kvmgt_mpt = {
 	.host_init = kvmgt_host_init,
 	.host_exit = kvmgt_host_exit,
-	.dma_pin_guest_page = kvmgt_dma_pin_guest_page,
 };
 
 struct intel_gvt_host intel_gvt_host = {
drivers/gpu/drm/i915/gvt/mpt.h +0 -15
index 26c1ee690f7e..3be602a3f764 100644
@@ -71,19 +71,4 @@ static inline void intel_gvt_hypervisor_host_exit(struct device *dev, void *gvt)
 	intel_gvt_host.mpt->host_exit(dev, gvt);
 }
 
-/**
- * intel_gvt_hypervisor_dma_pin_guest_page - pin guest dma buf
- * @vgpu: a vGPU
- * @dma_addr: guest dma addr
- *
- * Returns:
- * 0 on success, negative error code if failed.
- */
-static inline int
-intel_gvt_hypervisor_dma_pin_guest_page(struct intel_vgpu *vgpu,
-					dma_addr_t dma_addr)
-{
-	return intel_gvt_host.mpt->dma_pin_guest_page(vgpu, dma_addr);
-}
-
 #endif /* _GVT_MPT_H_ */
Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#24 lore raw

PATCH 21/21 drm/i915/gvt: remove struct intel_gvt_mpt

In reply to Christoph Hellwig

Just call the initializion and exit functions directly and remove this abstraction entirely.

---
 drivers/gpu/drm/i915/gvt/gvt.c       | 11 ++++-
 drivers/gpu/drm/i915/gvt/gvt.h       | 12 ++---
 drivers/gpu/drm/i915/gvt/hypercall.h | 50 -------------------
 drivers/gpu/drm/i915/gvt/kvmgt.c     | 39 ++-------------
 drivers/gpu/drm/i915/gvt/mpt.h       | 74 ----------------------------
 5 files changed, 17 insertions(+), 169 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/gvt/hypercall.h
 delete mode 100644 drivers/gpu/drm/i915/gvt/mpt.h
drivers/gpu/drm/i915/gvt/gvt.c +9 -2
index 2b59e79f5e3b..c55c542e3c75 100644
@@ -135,7 +135,8 @@ static void intel_gvt_clean_device(struct drm_i915_private *i915)
 	if (drm_WARN_ON(&i915->drm, !gvt))
 		return;
 
-	intel_gvt_hypervisor_host_exit(i915->drm.dev, gvt);
+	mdev_unregister_device(i915->drm.dev);
+	intel_gvt_cleanup_vgpu_type_groups(gvt);
 	intel_gvt_destroy_idle_vgpu(gvt->idle_vgpu);
 	intel_gvt_clean_vgpu_types(gvt);
 
@@ -235,13 +236,19 @@ static int intel_gvt_init_device(struct drm_i915_private *i915)
 
 	intel_gvt_debugfs_init(gvt);
 
-	ret = intel_gvt_hypervisor_host_init(i915->drm.dev, gvt);
+	ret = intel_gvt_init_vgpu_type_groups(gvt);
 	if (ret)
 		goto out_destroy_idle_vgpu;
 
+	ret = mdev_register_device(i915->drm.dev, &intel_vgpu_ops);
+	if (ret)
+		goto out_cleanup_vgpu_type_groups;
+
 	gvt_dbg_core("gvt device initialization is done\n");
 	return 0;
 
+out_cleanup_vgpu_type_groups:
+	intel_gvt_cleanup_vgpu_type_groups(gvt);
 out_destroy_idle_vgpu:
 	intel_gvt_destroy_idle_vgpu(gvt->idle_vgpu);
 	intel_gvt_debugfs_clean(gvt);
drivers/gpu/drm/i915/gvt/gvt.h +4 -8
index a8fc381f558e..a1fba27462b7 100644
@@ -40,7 +40,6 @@
 #include "i915_drv.h"
 
 #include "debug.h"
-#include "hypercall.h"
 #include "mmio.h"
 #include "reg.h"
 #include "interrupt.h"
@@ -58,12 +57,6 @@
 
 #define GVT_MAX_VGPU 8
 
-struct intel_gvt_host {
-	const struct intel_gvt_mpt *mpt;
-};
-
-extern struct intel_gvt_host intel_gvt_host;
-
 /* Describe per-platform limitations. */
 struct intel_gvt_device_info {
 	u32 max_support_vgpus;
@@ -772,9 +765,12 @@ int intel_gvt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
 void intel_gvt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
 		dma_addr_t dma_addr);
 
+int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt);
+void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt);
+
 #include "trace.h"
-#include "mpt.h"
 
+extern const struct mdev_parent_ops intel_vgpu_ops;
 extern const struct i915_virtual_gpu_ops intel_gvt_vgpu_ops;
 
 #endif
drivers/gpu/drm/i915/gvt/hypercall.h deleted +0 -50

50 lines not on this page · raw message

drivers/gpu/drm/i915/gvt/kvmgt.c +4 -35
index 5f10ed5eccde..5c72dcf205fb 100644
@@ -153,7 +153,7 @@ static struct attribute_group *gvt_vgpu_type_groups[] = {
 	[0 ... NR_MAX_INTEL_VGPU_TYPES - 1] = NULL,
 };
 
-static int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
+int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
 {
 	int i, j;
 	struct intel_vgpu_type *type;
@@ -182,7 +182,7 @@ static int intel_gvt_init_vgpu_type_groups(struct intel_gvt *gvt)
 	return -ENOMEM;
 }
 
-static void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt)
+void intel_gvt_cleanup_vgpu_type_groups(struct intel_gvt *gvt)
 {
 	int i;
 	struct attribute_group *group;
@@ -1646,8 +1646,9 @@ static const struct attribute_group *intel_vgpu_groups[] = {
 	NULL,
 };
 
-static struct mdev_parent_ops intel_vgpu_ops = {
+const struct mdev_parent_ops intel_vgpu_ops = {
 	.mdev_attr_groups       = intel_vgpu_groups,
+	.supported_type_groups	= gvt_vgpu_type_groups,
 	.create			= intel_vgpu_create,
 	.remove			= intel_vgpu_remove,
 
@@ -1660,29 +1661,6 @@ static struct mdev_parent_ops intel_vgpu_ops = {
 	.ioctl			= intel_vgpu_ioctl,
 };
 
-static int kvmgt_host_init(struct device *dev, void *gvt)
-{
-	int ret;
-
-	ret = intel_gvt_init_vgpu_type_groups((struct intel_gvt *)gvt);
-	if (ret)
-		return ret;
-
-	intel_vgpu_ops.supported_type_groups = gvt_vgpu_type_groups;
-
-	ret = mdev_register_device(dev, &intel_vgpu_ops);
-	if (ret)
-		intel_gvt_cleanup_vgpu_type_groups((struct intel_gvt *)gvt);
-
-	return ret;
-}
-
-static void kvmgt_host_exit(struct device *dev, void *gvt)
-{
-	mdev_unregister_device(dev);
-	intel_gvt_cleanup_vgpu_type_groups((struct intel_gvt *)gvt);
-}
-
 int intel_gvt_page_track_add(struct intel_vgpu *info, u64 gfn)
 {
 	struct kvm *kvm = info->kvm;
@@ -1945,14 +1923,5 @@ void intel_gvt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
 	mutex_unlock(&vgpu->cache_lock);
 }
 
-static const struct intel_gvt_mpt kvmgt_mpt = {
-	.host_init = kvmgt_host_init,
-	.host_exit = kvmgt_host_exit,
-};
-
-struct intel_gvt_host intel_gvt_host = {
-	.mpt		= &kvmgt_mpt,
-};
-
 MODULE_LICENSE("GPL and additional rights");
 MODULE_AUTHOR("Intel Corporation");
drivers/gpu/drm/i915/gvt/mpt.h deleted +0 -74

74 lines not on this page · raw message

Signature · 6 lines
2.30.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#25 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [01/21] drm/i915/gvt: integrate into the main Makefile

In reply to Christoph Hellwig
== Series Details ==

== Series Details ==

Series: series starting with [01/21] drm/i915/gvt: integrate into the main Makefile
URL : https://patchwork.freedesktop.org/series/92829/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
fb4910938868 drm/i915/gvt: integrate into the main Makefile
-:53: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating?
#53: 
deleted file mode 100644

-:76: CHECK:SPACING: spaces preferred around that '/' (ctx:VxV) #76: FILE: drivers/gpu/drm/i915/gvt/trace.h:382:
+#define TRACE_INCLUDE_FILE gvt/trace

                               ^

total: 0 errors, 1 warnings, 1 checks, 41 lines checked
db6b61277669 drm/i915/gvt: remove module refcounting in intel_gvt_{, un}register_hypervisor ab572add6f55 drm/i915/gvt: remove enum hypervisor_type
-:228: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #228: FILE: drivers/gpu/drm/i915/gvt/opregion.c:427:
+ gvt_vgpu_err("guest opregion read error %d, gpa 0x%llx, len %lu\n",
+ ret, scic_pa, sizeof(scic));

-:239: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #239: FILE: drivers/gpu/drm/i915/gvt/opregion.c:434:
+ gvt_vgpu_err("guest opregion read error %d, gpa 0x%llx, len %lu\n",
+ ret, scic_pa, sizeof(scic));

-:275: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #275: FILE: drivers/gpu/drm/i915/gvt/opregion.c:472:
+ gvt_vgpu_err("guest opregion write error %d, gpa 0x%llx, len %lu\n",
+ ret, scic_pa, sizeof(scic));

-:287: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #287: FILE: drivers/gpu/drm/i915/gvt/opregion.c:480:
+ gvt_vgpu_err("guest opregion write error %d, gpa 0x%llx, len %lu\n",
+ ret, scic_pa, sizeof(scic));

total: 0 errors, 0 warnings, 4 checks, 251 lines checked
4a615848a361 drm/i915/gvt: move the gvt code into kvmgt.ko
-:400: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #400: FILE: drivers/gpu/drm/i915/intel_gvt.c:184:
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_init, I915_GVT);

-:401: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #401: FILE: drivers/gpu/drm/i915/intel_gvt.c:185:
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_ggtt_pin_ww, I915_GVT);

-:402: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #402: FILE: drivers/gpu/drm/i915/intel_gvt.c:186:
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_pin_map, I915_GVT);

-:403: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #403: FILE: drivers/gpu/drm/i915/intel_gvt.c:187:
+EXPORT_SYMBOL_NS_GPL(i915_gem_object_set_to_cpu_domain, I915_GVT);

-:404: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #404: FILE: drivers/gpu/drm/i915/intel_gvt.c:188:
+EXPORT_SYMBOL_NS_GPL(__i915_gem_object_flush_map, I915_GVT);

-:405: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #405: FILE: drivers/gpu/drm/i915/intel_gvt.c:189:
+EXPORT_SYMBOL_NS_GPL(__i915_gem_object_set_pages, I915_GVT);

-:406: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #406: FILE: drivers/gpu/drm/i915/intel_gvt.c:190:
+EXPORT_SYMBOL_NS_GPL(i915_gem_gtt_insert, I915_GVT);

-:407: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #407: FILE: drivers/gpu/drm/i915/intel_gvt.c:191:
+EXPORT_SYMBOL_NS_GPL(i915_gem_prime_export, I915_GVT);

-:408: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #408: FILE: drivers/gpu/drm/i915/intel_gvt.c:192:
+EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_init, I915_GVT);

-:409: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #409: FILE: drivers/gpu/drm/i915/intel_gvt.c:193:
+EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_backoff, I915_GVT);

-:410: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #410: FILE: drivers/gpu/drm/i915/intel_gvt.c:194:
+EXPORT_SYMBOL_NS_GPL(i915_gem_ww_ctx_fini, I915_GVT);

-:411: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #411: FILE: drivers/gpu/drm/i915/intel_gvt.c:195:
+EXPORT_SYMBOL_NS_GPL(i915_ppgtt_create, I915_GVT);

-:412: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #412: FILE: drivers/gpu/drm/i915/intel_gvt.c:196:
+EXPORT_SYMBOL_NS_GPL(i915_request_add, I915_GVT);

-:413: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #413: FILE: drivers/gpu/drm/i915/intel_gvt.c:197:
+EXPORT_SYMBOL_NS_GPL(i915_request_create, I915_GVT);

-:414: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #414: FILE: drivers/gpu/drm/i915/intel_gvt.c:198:
+EXPORT_SYMBOL_NS_GPL(i915_request_wait, I915_GVT);

-:415: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #415: FILE: drivers/gpu/drm/i915/intel_gvt.c:199:
+EXPORT_SYMBOL_NS_GPL(i915_reserve_fence, I915_GVT);

-:416: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #416: FILE: drivers/gpu/drm/i915/intel_gvt.c:200:
+EXPORT_SYMBOL_NS_GPL(i915_unreserve_fence, I915_GVT);

-:417: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #417: FILE: drivers/gpu/drm/i915/intel_gvt.c:201:
+EXPORT_SYMBOL_NS_GPL(i915_vm_release, I915_GVT);

-:418: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #418: FILE: drivers/gpu/drm/i915/intel_gvt.c:202:
+EXPORT_SYMBOL_NS_GPL(i915_vma_move_to_active, I915_GVT);

-:419: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #419: FILE: drivers/gpu/drm/i915/intel_gvt.c:203:
+EXPORT_SYMBOL_NS_GPL(intel_context_create, I915_GVT);

-:420: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #420: FILE: drivers/gpu/drm/i915/intel_gvt.c:204:
+EXPORT_SYMBOL_NS_GPL(intel_context_unpin, I915_GVT);

-:421: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #421: FILE: drivers/gpu/drm/i915/intel_gvt.c:205:
+EXPORT_SYMBOL_NS_GPL(__intel_context_do_pin, I915_GVT);

-:422: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #422: FILE: drivers/gpu/drm/i915/intel_gvt.c:206:
+EXPORT_SYMBOL_NS_GPL(intel_ring_begin, I915_GVT);

-:423: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #423: FILE: drivers/gpu/drm/i915/intel_gvt.c:207:
+EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_get, I915_GVT);

-:424: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #424: FILE: drivers/gpu/drm/i915/intel_gvt.c:208:
+EXPORT_SYMBOL_NS_GPL(intel_runtime_pm_put_unchecked, I915_GVT);

-:425: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #425: FILE: drivers/gpu/drm/i915/intel_gvt.c:209:
+EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_for_reg, I915_GVT);

-:426: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #426: FILE: drivers/gpu/drm/i915/intel_gvt.c:210:
+EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_get, I915_GVT);

-:427: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #427: FILE: drivers/gpu/drm/i915/intel_gvt.c:211:
+EXPORT_SYMBOL_NS_GPL(intel_uncore_forcewake_put, I915_GVT);

-:428: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #428: FILE: drivers/gpu/drm/i915/intel_gvt.c:212:
+EXPORT_SYMBOL_NS_GPL(shmem_pin_map, I915_GVT);

-:429: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #429: FILE: drivers/gpu/drm/i915/intel_gvt.c:213:
+EXPORT_SYMBOL_NS_GPL(shmem_unpin_map, I915_GVT);

-:430: WARNING:EXPORT_SYMBOL: EXPORT_SYMBOL(foo); should immediately follow its function/variable #430: FILE: drivers/gpu/drm/i915/intel_gvt.c:214:
+EXPORT_SYMBOL_NS_GPL(__px_dma, I915_GVT);

total: 0 errors, 31 warnings, 0 checks, 366 lines checked 4a9718b0e2cd drm/i915/gvt: remove intel_gvt_ops
-:164: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #164: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1057:
+ ret = intel_vgpu_emulate_mmio_write(vgpu,
bar_start + off, buf, count);

-:168: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #168: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1060:
+ ret = intel_vgpu_emulate_mmio_read(vgpu,
bar_start + off, buf, count);

-:177: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #177: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1116:
+ ret = intel_vgpu_emulate_cfg_write(vgpu, pos,
buf, count);

-:181: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #181: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1119:
+ ret = intel_vgpu_emulate_cfg_read(vgpu, pos,
buf, count);

-:241: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #241: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1861:
+ intel_vgpu_page_track_handler(info->vgpu, gpa,
(void *)val, len);

total: 0 errors, 0 warnings, 5 checks, 214 lines checked 17f9380f85ac drm/i915/gvt: remove the map_gfn_to_mfn and set_trap_area ops -:119: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #119: FILE: drivers/gpu/drm/i915/gvt/cfg_space.c:181:
+static void emulate_pci_bar_write(struct intel_vgpu *vgpu, unsigned int offset,
void *p_data, unsigned int bytes)

total: 0 errors, 0 warnings, 1 checks, 217 lines checked b9000b54cb4f drm/i915/gvt: remove the unused from_virt_to_mfn op -:7: WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one

total: 0 errors, 1 warnings, 0 checks, 43 lines checked 47581e8b69e6 drm/i915/gvt: merge struct kvmgt_vdev into struct intel_vgpu -:46: CHECK:UNCOMMENTED_DEFINITION: struct mutex definition without comment #46: FILE: drivers/gpu/drm/i915/gvt/gvt.h:229:
+ struct mutex cache_lock;

-:303: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #303: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:649:
+ region = krealloc(vgpu->region,
+ (vgpu->num_regions + 1) * sizeof(*region),

-:335: CHECK:OPEN_ENDED_LINE: Lines should not end with a '(' #335: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:669:
+ vgpu->vfio_device = vfio_device_get_from_dev(

-:523: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #523: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:936:
+ ret = vfio_unregister_notifier(mdev_dev(vgpu->mdev), VFIO_IOMMU_NOTIFY,
+ &vgpu->iommu_notifier);

-:530: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #530: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:941:
+ ret = vfio_unregister_notifier(mdev_dev(vgpu->mdev), VFIO_GROUP_NOTIFY,
+ &vgpu->group_notifier);

-:736: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "!vgpu->msi_trigger" #736: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1948:
+ if (vgpu->msi_trigger == NULL)

total: 0 errors, 0 warnings, 6 checks, 821 lines checked 462f7fb6be15 drm/i915/gvt: merge struct kvmgt_guest_info into strut intel_vgpu -:201: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #201: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1795:
+ intel_vgpu_page_track_handler(info, gpa,
(void *)val, len);

total: 0 errors, 0 warnings, 1 checks, 358 lines checked c033dc22a0e6 drm/i915/gvt: remove vgpu->handle
-:71: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #71: FILE: drivers/gpu/drm/i915/gvt/hypercall.h:61:
+ void (*dma_unmap_guest_page)(struct intel_vgpu *vgpu,
+ dma_addr_t dma_addr);

-:296: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #296: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1903:
+static unsigned long kvmgt_gfn_to_pfn(struct intel_vgpu *vgpu,
+ unsigned long gfn)

-:316: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #316: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1918:
+static int kvmgt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
unsigned long size, dma_addr_t *dma_addr)

-:337: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #337: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1965:
+static int kvmgt_dma_pin_guest_page(struct intel_vgpu *vgpu,
+ dma_addr_t dma_addr)

-:358: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #358: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1994:
+static void kvmgt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
+ dma_addr_t dma_addr)

-:393: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #393: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:2017:
+static int kvmgt_read_gpa(struct intel_vgpu *vgpu, unsigned long gpa,
void *buf, unsigned long len)

-:401: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #401: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:2023:
+static int kvmgt_write_gpa(struct intel_vgpu *vgpu, unsigned long gpa,
void *buf, unsigned long len)

-:531: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #531: FILE: drivers/gpu/drm/i915/gvt/vgpu.c:374:
+ gvt_dbg_core("low %llu MB high %llu MB fence %llu\n",
+ param->low_gm_sz, param->high_gm_sz,

total: 0 errors, 0 warnings, 8 checks, 483 lines checked 24f596a8d272 drm/i915/gvt: devirtualize ->{read, write}_gpa -:21: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #21: FILE: drivers/gpu/drm/i915/gvt/cmd_parser.c:1013:
+ intel_gvt_read_gpa(s->vgpu,
s->workload->ring_context_gpa + 12, &ctx_sr_ctl, 4);

-:48: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #48: FILE: drivers/gpu/drm/i915/gvt/execlist.c:163:
+ intel_gvt_write_gpa(vgpu,
+ hwsp_gpa + I915_HWS_CSB_BUF0_INDEX * 4 + write_pointer * 8,

-:51: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #51: FILE: drivers/gpu/drm/i915/gvt/execlist.c:166:
+ intel_gvt_write_gpa(vgpu,
+ hwsp_gpa + intel_hws_csb_write_index(execlist->engine->i915) * 4,

-:84: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #84: FILE: drivers/gpu/drm/i915/gvt/gtt.c:1499:
+ ret = intel_gvt_read_gpa(spt->vgpu,
spt->guest_page.gfn << I915_GTT_PAGE_SHIFT,

-:114: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #114: FILE: drivers/gpu/drm/i915/gvt/gvt.h:734:
+static inline int intel_gvt_read_gpa(struct intel_vgpu *vgpu, unsigned long gpa,
+ void *buf, unsigned long len)

-:132: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #132: FILE: drivers/gpu/drm/i915/gvt/gvt.h:752:
+static inline int intel_gvt_write_gpa(struct intel_vgpu *vgpu,
+ unsigned long gpa, void *buf, unsigned long len)

-:333: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #333: FILE: drivers/gpu/drm/i915/gvt/scheduler.c:169:
+ intel_gvt_read_gpa(vgpu,
workload->ring_context_gpa +

-:342: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #342: FILE: drivers/gpu/drm/i915/gvt/scheduler.c:180:
+ intel_gvt_read_gpa(vgpu,
workload->ring_context_gpa +

-:395: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #395: FILE: drivers/gpu/drm/i915/gvt/scheduler.c:1037:
+ intel_gvt_write_gpa(vgpu,
workload->ring_context_gpa +

-:404: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #404: FILE: drivers/gpu/drm/i915/gvt/scheduler.c:1574:
+ intel_gvt_read_gpa(vgpu,
gpa + i * 8, &pdp[7 - i], 4);

total: 0 errors, 0 warnings, 10 checks, 367 lines checked
e0e73ad94224 drm/i915/gvt: devirtualize ->{get, put}_vfio_device
d36971595ad1 drm/i915/gvt: devirtualize ->set_edid and ->set_opregion
81a08bb01447 drm/i915/gvt: devirtualize ->detach_vgpu
ecb0f9df6783 drm/i915/gvt: devirtualize ->inject_msi
-:32: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'offset' may be better as '(offset)' to avoid precedence issues #32: FILE: drivers/gpu/drm/i915/gvt/interrupt.c:400:
+#define MSI_CAP_CONTROL(offset) (offset + 2)

-:33: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'offset' may be better as '(offset)' to avoid precedence issues #33: FILE: drivers/gpu/drm/i915/gvt/interrupt.c:401:
+#define MSI_CAP_ADDRESS(offset) (offset + 4)

-:34: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'offset' may be better as '(offset)' to avoid precedence issues #34: FILE: drivers/gpu/drm/i915/gvt/interrupt.c:402:
+#define MSI_CAP_DATA(offset) (offset + 8)

total: 0 errors, 0 warnings, 3 checks, 132 lines checked 5d78c64848e6 drm/i915/gvt: devirtualize ->is_valid_gfn 16963db2e084 drm/i915/gvt: devirtualize ->gfn_to_mfn 6cd11c2afa9d drm/i915/gvt: devirtualize ->{enable, disable}_page_track 35d7761f42d7 drm/i915/gvt: devirtualize ->dma_{, un}map_guest_page -:42: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #42: FILE: drivers/gpu/drm/i915/gvt/dmabuf.c:128:
+ intel_gvt_dma_unmap_guest_page(vgpu,
sg_dma_address(sg));

-:120: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #120: FILE: drivers/gpu/drm/i915/gvt/gvt.h:770:
+int intel_gvt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
+ unsigned long size, dma_addr_t *dma_addr);

-:122: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #122: FILE: drivers/gpu/drm/i915/gvt/gvt.h:772:
+void intel_gvt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
+ dma_addr_t dma_addr);

-:152: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #152: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1859:
+int intel_gvt_dma_map_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
unsigned long size, dma_addr_t *dma_addr)

-:161: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #161: FILE: drivers/gpu/drm/i915/gvt/kvmgt.c:1935:
+void intel_gvt_dma_unmap_guest_page(struct intel_vgpu *vgpu,
dma_addr_t dma_addr)

total: 0 errors, 0 warnings, 5 checks, 164 lines checked
a93f04904e69 drm/i915/gvt: devirtualize dma_pin_guest_page
2c36e1260150 drm/i915/gvt: remove struct intel_gvt_mpt
-:86: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #86:
deleted file mode 100644

total: 0 errors, 1 warnings, 0 checks, 130 lines checked

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#26 lore raw

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [01/21] drm/i915/gvt: integrate into the main Makefile

In reply to Christoph Hellwig
== Series Details ==

== Series Details ==

Series: series starting with [01/21] drm/i915/gvt: integrate into the main Makefile
URL : https://patchwork.freedesktop.org/series/92829/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
-
+drivers/gpu/drm/i915/display/intel_display.c:1896:21:    expected struct i915_vma *[assigned] vma
+drivers/gpu/drm/i915/display/intel_display.c:1896:21:    got void [noderef] __iomem *[assigned] iomem
+drivers/gpu/drm/i915/display/intel_display.c:1896:21: warning: incorrect type in assignment (different address spaces)
+drivers/gpu/drm/i915/gem/i915_gem_context.c:1412:34:    expected struct i915_address_space *vm
+drivers/gpu/drm/i915/gem/i915_gem_context.c:1412:34:    got struct i915_address_space [noderef] __rcu *vm
+drivers/gpu/drm/i915/gem/i915_gem_context.c:1412:34: warning: incorrect type in argument 1 (different address spaces)
+drivers/gpu/drm/i915/gem/selftests/mock_context.c:43:25:    expected struct i915_address_space [noderef] __rcu *vm
+drivers/gpu/drm/i915/gem/selftests/mock_context.c:43:25:    got struct i915_address_space *
+drivers/gpu/drm/i915/gem/selftests/mock_context.c:43:25: warning: incorrect type in assignment (different address spaces)
+drivers/gpu/drm/i915/gem/selftests/mock_context.c:60:34:    expected struct i915_address_space *vm
+drivers/gpu/drm/i915/gem/selftests/mock_context.c:60:34:    got struct i915_address_space [noderef] __rcu *vm
+drivers/gpu/drm/i915/gem/selftests/mock_context.c:60:34: warning: incorrect type in argument 1 (different address spaces)
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:27:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:32:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:32:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:49:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:56:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_engine_stats.h:56:9: warning: trying to copy expression type 31
+drivers/gpu/drm/i915/gt/intel_reset.c:1396:5: warning: context imbalance in 'intel_gt_reset_trylock' - different lock contexts for basic block
+drivers/gpu/drm/i915/gt/intel_ring_submission.c:1210:24: warning: Using plain integer as NULL pointer
+drivers/gpu/drm/i915/i915_perf.c:1434:15: warning: memset with byte count of 16777216
+drivers/gpu/drm/i915/i915_perf.c:1488:15: warning: memset with byte count of 16777216
+./include/asm-generic/bitops/find.h:112:45: warning: shift count is negative (-262080)
+./include/asm-generic/bitops/find.h:32:31: warning: shift count is negative (-262080)
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen11_fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen12_fwtable_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read64' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_read8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen6_write8' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write16' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write32' - different lock contexts for basic block
+./include/linux/spinlock.h:409:9: warning: context imbalance in 'gen8_write8' - different lock contexts for basic block

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#27 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [01/21] drm/i915/gvt: integrate into the main Makefile

In reply to Christoph Hellwig
== Series Details ==

== Series Details ==

Series: series starting with [01/21] drm/i915/gvt: integrate into the main Makefile
URL : https://patchwork.freedesktop.org/series/92829/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10366 -> Patchwork_20665
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/index.html

Known issues
------------

Here are the changes found in Patchwork_20665 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@runner@aborted:
- fi-bdw-5557u: NOTRUN -> [FAIL][1] ([i915#1602] / [i915#2029])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/fi-bdw-5557u/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live@hangcheck:
- {fi-jsl-1}: [INCOMPLETE][2] -> [PASS][3]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/fi-jsl-1/igt@i915_selftest@[email protected]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/fi-jsl-1/igt@i915_selftest@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#112080]: https://bugs.freedesktop.org/show_bug.cgi?id=112080
[i915#1602]: https://gitlab.freedesktop.org/drm/intel/issues/1602
[i915#2029]: https://gitlab.freedesktop.org/drm/intel/issues/2029

Participating hosts (38 -> 35)
------------------------------

Missing (3): fi-ilk-m540 fi-bdw-samus fi-hsw-4200u

Build changes
-------------

* Linux: CI_DRM_10366 -> Patchwork_20665

CI-20190529: 20190529
CI_DRM_10366: d3aa39a7c367b272a467428fb921eec1610c6155 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6146: 6caef22e4aafed275771f564d4ea4cab09896ebc @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_20665: 2c36e1260150346ecc6f8edaffa5835926325a02 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

2c36e1260150 drm/i915/gvt: remove struct intel_gvt_mpt
a93f04904e69 drm/i915/gvt: devirtualize dma_pin_guest_page
35d7761f42d7 drm/i915/gvt: devirtualize ->dma_{, un}map_guest_page 6cd11c2afa9d drm/i915/gvt: devirtualize ->{enable, disable}_page_track 16963db2e084 drm/i915/gvt: devirtualize ->gfn_to_mfn
5d78c64848e6 drm/i915/gvt: devirtualize ->is_valid_gfn
ecb0f9df6783 drm/i915/gvt: devirtualize ->inject_msi
81a08bb01447 drm/i915/gvt: devirtualize ->detach_vgpu
d36971595ad1 drm/i915/gvt: devirtualize ->set_edid and ->set_opregion e0e73ad94224 drm/i915/gvt: devirtualize ->{get, put}_vfio_device 24f596a8d272 drm/i915/gvt: devirtualize ->{read, write}_gpa
c033dc22a0e6 drm/i915/gvt: remove vgpu->handle
462f7fb6be15 drm/i915/gvt: merge struct kvmgt_guest_info into strut intel_vgpu 47581e8b69e6 drm/i915/gvt: merge struct kvmgt_vdev into struct intel_vgpu b9000b54cb4f drm/i915/gvt: remove the unused from_virt_to_mfn op 17f9380f85ac drm/i915/gvt: remove the map_gfn_to_mfn and set_trap_area ops 4a9718b0e2cd drm/i915/gvt: remove intel_gvt_ops
4a615848a361 drm/i915/gvt: move the gvt code into kvmgt.ko
ab572add6f55 drm/i915/gvt: remove enum hypervisor_type
db6b61277669 drm/i915/gvt: remove module refcounting in intel_gvt_{, un}register_hypervisor fb4910938868 drm/i915/gvt: integrate into the main Makefile

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#28 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for series starting with [01/21] drm/i915/gvt: integrate into the main Makefile

In reply to Christoph Hellwig
== Series Details ==

== Series Details ==

Series: series starting with [01/21] drm/i915/gvt: integrate into the main Makefile
URL : https://patchwork.freedesktop.org/series/92829/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10366_full -> Patchwork_20665_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_20665_full:

### IGT changes ###

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* igt@i915_pm_rpm@cursor:
- {shard-rkl}: [SKIP][1] ([i915#1849]) -> [SKIP][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@i915_pm_rpm@drm-resources-equal:
- {shard-rkl}: [SKIP][3] ([fdo#109308]) -> [SKIP][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@i915_pm_rpm@modeset-lpsp-stress-no-wait:
- {shard-rkl}: [SKIP][5] ([i915#1397]) -> [SKIP][6] +1 similar issue
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* {igt@kms_dp_dsc@xrgb8888-dsc-compression}:
- {shard-rkl}: NOTRUN -> [SKIP][7]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-1/igt@[email protected]

* igt@kms_vblank@pipe-b-ts-continuation-dpms-rpm:
- {shard-rkl}: [SKIP][8] ([i915#1845]) -> [SKIP][9]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-2/igt@[email protected]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@perf_pmu@rc6-runtime-pm-long:
- {shard-rkl}: [PASS][10] -> [SKIP][11] +2 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

Known issues
------------

Here are the changes found in Patchwork_20665_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@feature_discovery@display-4x:
- shard-tglb: NOTRUN -> [SKIP][12] ([i915#1839])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-tglb6/igt@[email protected]

* igt@gem_create@create-massive:
- shard-apl: NOTRUN -> [DMESG-WARN][13] ([i915#3002])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl2/igt@[email protected]

* igt@gem_ctx_persistence@legacy-engines-mixed-process:
- shard-snb: NOTRUN -> [SKIP][14] ([fdo#109271] / [i915#1099]) +3 similar issues
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-snb7/igt@[email protected]

* igt@gem_eio@unwedge-stress:
- shard-tglb: [PASS][15] -> [TIMEOUT][16] ([i915#2369] / [i915#3063] / [i915#3648])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-tglb7/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-tglb3/igt@[email protected]
- shard-snb: NOTRUN -> [FAIL][17] ([i915#3354])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-snb7/igt@[email protected]

* igt@gem_exec_fair@basic-none-solo@rcs0:
- shard-kbl: [PASS][18] -> [FAIL][19] ([i915#2842]) +2 similar issues
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-kbl6/igt@gem_exec_fair@[email protected]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-kbl1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-share@rcs0:
- shard-glk: [PASS][20] -> [FAIL][21] ([i915#2842]) +1 similar issue
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-glk4/igt@gem_exec_fair@[email protected]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-glk7/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-iclb: NOTRUN -> [FAIL][22] ([i915#2842])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-iclb1/igt@gem_exec_fair@[email protected]

* igt@i915_pm_rpm@dpms-mode-unset-lpsp:
- shard-tglb: NOTRUN -> [SKIP][23] ([i915#579])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-tglb2/igt@[email protected]

* igt@i915_selftest@live@hangcheck:
- shard-snb: [PASS][24] -> [INCOMPLETE][25] ([i915#2782])
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-snb2/igt@i915_selftest@[email protected]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-snb2/igt@i915_selftest@[email protected]

* igt@kms_big_fb@y-tiled-32bpp-rotate-0:
- shard-glk: [PASS][26] -> [DMESG-WARN][27] ([i915#118] / [i915#95])
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-glk7/igt@[email protected]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-glk1/igt@[email protected]

* igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-0-hflip:
- shard-apl: NOTRUN -> [SKIP][28] ([fdo#109271] / [i915#3777])
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl3/igt@[email protected]

* igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-0:
- shard-apl: NOTRUN -> [SKIP][29] ([fdo#109271]) +107 similar issues
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl8/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-enable-disable-mode:
- shard-snb: NOTRUN -> [SKIP][30] ([fdo#109271] / [fdo#111827]) +13 similar issues
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-snb7/igt@[email protected]

* igt@kms_color_chamelium@pipe-a-ctm-0-5:
- shard-apl: NOTRUN -> [SKIP][31] ([fdo#109271] / [fdo#111827]) +9 similar issues
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl8/igt@[email protected]

* igt@kms_color_chamelium@pipe-d-ctm-0-25:
- shard-tglb: NOTRUN -> [SKIP][32] ([fdo#109284] / [fdo#111827])
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-tglb6/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-32x10-sliding:
- shard-tglb: NOTRUN -> [SKIP][33] ([i915#3359])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-tglb2/igt@[email protected]

* igt@kms_cursor_edge_walk@pipe-a-64x64-right-edge:
- shard-skl: [PASS][34] -> [DMESG-WARN][35] ([i915#1982])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-skl3/igt@[email protected]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-skl5/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-skl: [PASS][36] -> [FAIL][37] ([i915#2346])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-skl10/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-skl10/igt@[email protected]

* igt@kms_draw_crc@draw-method-xrgb2101010-mmap-cpu-ytiled:
- shard-skl: [PASS][38] -> [FAIL][39] ([i915#3451])
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-skl3/igt@[email protected]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-skl9/igt@[email protected]

* igt@kms_flip@2x-absolute-wf_vblank:
- shard-kbl: NOTRUN -> [SKIP][40] ([fdo#109271]) +2 similar issues
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-kbl2/igt@kms_flip@2x-absolute-wf_vblank.html

* igt@kms_flip@flip-vs-expired-vblank@c-edp1:
- shard-skl: [PASS][41] -> [FAIL][42] ([i915#79]) +1 similar issue
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-skl6/igt@kms_flip@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-skl6/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend@b-dp1:
- shard-apl: NOTRUN -> [DMESG-WARN][43] ([i915#180])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl3/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate@c-edp1:
- shard-skl: [PASS][44] -> [FAIL][45] ([i915#2122])
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-skl9/igt@kms_flip@[email protected]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-skl4/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-2p-scndscrn-cur-indfb-move:
- shard-tglb: NOTRUN -> [SKIP][46] ([fdo#111825]) +2 similar issues
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-tglb2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-farfromfence-mmap-gtt:
- shard-skl: NOTRUN -> [SKIP][47] ([fdo#109271]) +9 similar issues
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-skl10/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-alpha-7efc:
- shard-apl: NOTRUN -> [FAIL][48] ([fdo#108145] / [i915#265])
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl3/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [PASS][49] -> [FAIL][50] ([fdo#108145] / [i915#265]) +2 similar issues
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-skl2/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-skl7/igt@[email protected]

* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-3:
- shard-apl: NOTRUN -> [SKIP][51] ([fdo#109271] / [i915#658]) +2 similar issues
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl8/igt@[email protected]

* igt@kms_psr@psr2_cursor_render:
- shard-iclb: [PASS][52] -> [SKIP][53] ([fdo#109441]) +1 similar issue
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-iclb2/igt@kms_psr@psr2_cursor_render.html
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-iclb8/igt@kms_psr@psr2_cursor_render.html

* igt@kms_universal_plane@disable-primary-vs-flip-pipe-d:
- shard-snb: NOTRUN -> [SKIP][54] ([fdo#109271]) +293 similar issues
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-snb5/igt@[email protected]

* igt@kms_vblank@pipe-b-ts-continuation-suspend:
- shard-apl: [PASS][55] -> [DMESG-WARN][56] ([i915#180])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-apl7/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl8/igt@[email protected]

* igt@perf@polling-parameterized:
- shard-glk: [PASS][57] -> [FAIL][58] ([i915#1542])
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-glk4/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-glk7/igt@[email protected]

* igt@perf_pmu@rc6-runtime-pm:
- shard-tglb: NOTRUN -> [SKIP][59] ([fdo#111719])
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-tglb1/igt@[email protected]

* igt@sysfs_clients@pidname:
- shard-apl: NOTRUN -> [SKIP][60] ([fdo#109271] / [i915#2994])
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl8/igt@[email protected]

#### Possible fixes ####

* igt@feature_discovery@psr1:
- {shard-rkl}: [SKIP][61] ([i915#658]) -> [PASS][62]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-2/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@gem_ctx_persistence@engines-hostile@rcs0:
- {shard-rkl}: [FAIL][63] ([i915#2410]) -> [PASS][64]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-6/igt@gem_ctx_persistence@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-5/igt@gem_ctx_persistence@[email protected]

* igt@gem_eio@reset-stress:
- {shard-rkl}: [FAIL][65] ([i915#3115]) -> [PASS][66] +1 similar issue
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@gem_exec_fair@basic-none@rcs0:
- shard-glk: [FAIL][67] ([i915#2842]) -> [PASS][68]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-glk1/igt@gem_exec_fair@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-glk5/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace-solo@rcs0:
- shard-kbl: [FAIL][69] ([i915#2842]) -> [PASS][70]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-kbl7/igt@gem_exec_fair@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-kbl1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-tglb: [FAIL][71] ([i915#2842]) -> [PASS][72]
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-tglb2/igt@gem_exec_fair@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-tglb6/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vecs0:
- shard-iclb: [FAIL][73] ([i915#2842]) -> [PASS][74]
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-iclb5/igt@gem_exec_fair@[email protected]
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-iclb1/igt@gem_exec_fair@[email protected]

* igt@gem_spin_batch@engines@vcs0:
- shard-apl: [FAIL][75] ([i915#2898]) -> [PASS][76]
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-apl8/igt@gem_spin_batch@[email protected]
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl1/igt@gem_spin_batch@[email protected]

* igt@gem_workarounds@reset-context:
- shard-snb: [TIMEOUT][77] ([i915#2808]) -> [PASS][78]
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-snb5/igt@[email protected]
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-snb5/igt@[email protected]

* igt@i915_pm_backlight@basic-brightness:
- {shard-rkl}: [SKIP][79] ([i915#3012]) -> [PASS][80]
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-2/igt@[email protected]
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_big_fb@linear-32bpp-rotate-0:
- shard-glk: [DMESG-WARN][81] ([i915#118] / [i915#95]) -> [PASS][82]
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-glk3/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-glk9/igt@[email protected]

* igt@kms_big_fb@y-tiled-16bpp-rotate-180:
- {shard-rkl}: [SKIP][83] ([i915#3638]) -> [PASS][84]
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_big_fb@y-tiled-16bpp-rotate-90:
- {shard-rkl}: [SKIP][85] ([fdo#111614]) -> [PASS][86] +1 similar issue
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip:
- {shard-rkl}: [SKIP][87] ([i915#3721]) -> [PASS][88] +6 similar issues
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip.html
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@kms_big_fb@y-tiled-max-hw-stride-32bpp-rotate-180-hflip-async-flip.html

* igt@kms_ccs@pipe-b-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc:
- {shard-rkl}: [FAIL][89] ([i915#3678]) -> [PASS][90] +7 similar issues
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@kms_ccs@pipe-b-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc.html
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@kms_ccs@pipe-b-crc-primary-rotation-180-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_color@pipe-c-ctm-max:
- {shard-rkl}: [SKIP][91] ([i915#1149] / [i915#1849]) -> [PASS][92] +7 similar issues
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-128x42-random:
- {shard-rkl}: [SKIP][93] ([fdo#112022]) -> [PASS][94] +18 similar issues
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-2/igt@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_cursor_legacy@cursora-vs-flipa-toggle:
- {shard-rkl}: [SKIP][95] ([fdo#111825]) -> [PASS][96] +5 similar issues
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_draw_crc@draw-method-xrgb8888-blt-xtiled:
- {shard-rkl}: [SKIP][97] ([fdo#111314]) -> [PASS][98] +8 similar issues
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_fbcon_fbt@psr:
- {shard-rkl}: [SKIP][99] ([fdo#110189]) -> [PASS][100]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@a-dp1:
- shard-apl: [FAIL][101] ([i915#79]) -> [PASS][102]
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-apl2/igt@kms_flip@[email protected]
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl6/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-expired-vblank@c-hdmi-a1:
- shard-glk: [FAIL][103] ([i915#79]) -> [PASS][104]
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-glk9/igt@kms_flip@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-glk2/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible@b-edp1:
- shard-skl: [FAIL][105] ([i915#2122]) -> [PASS][106]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-skl4/igt@kms_flip@[email protected]
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-skl8/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-apl: [DMESG-WARN][107] ([i915#180]) -> [PASS][108]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-apl8/igt@[email protected]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl2/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-gtt:
- {shard-rkl}: [SKIP][109] ([i915#1849]) -> [PASS][110] +52 similar issues
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-gtt.html
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-spr-indfb-draw-mmap-gtt.html

* igt@kms_plane_alpha_blend@pipe-c-coverage-vs-premult-vs-constant:
- shard-iclb: [SKIP][111] ([fdo#109278]) -> [PASS][112]
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-iclb2/igt@kms_plane_alpha_blend@pipe-c-coverage-vs-premult-vs-constant.html
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-iclb1/igt@kms_plane_alpha_blend@pipe-c-coverage-vs-premult-vs-constant.html

* igt@kms_plane_multiple@atomic-pipe-a-tiling-none:
- {shard-rkl}: [SKIP][113] ([i915#1849] / [i915#3558]) -> [PASS][114] +1 similar issue
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@kms_psr@psr2_sprite_plane_move:
- shard-iclb: [SKIP][115] ([fdo#109441]) -> [PASS][116]
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-iclb6/igt@kms_psr@psr2_sprite_plane_move.html
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html

* igt@kms_psr@sprite_blt:
- {shard-rkl}: [SKIP][117] ([i915#1072]) -> [PASS][118] +3 similar issues
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-2/igt@kms_psr@sprite_blt.html
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@kms_psr@sprite_blt.html

* igt@kms_vblank@pipe-a-ts-continuation-modeset:
- {shard-rkl}: [SKIP][119] ([i915#1845]) -> [PASS][120] +29 similar issues
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

* igt@perf@blocking:
- {shard-rkl}: [FAIL][121] ([i915#1542]) -> [PASS][122]
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-rkl-5/igt@[email protected]
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-rkl-6/igt@[email protected]

#### Warnings ####

* igt@i915_pm_rc6_residency@rc6-fence:
- shard-iclb: [WARN][123] ([i915#1804] / [i915#2684]) -> [WARN][124] ([i915#2684]) +1 similar issue
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-iclb6/igt@[email protected]
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-iclb2/igt@[email protected]

* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-1:
- shard-iclb: [SKIP][125] ([i915#2920]) -> [SKIP][126] ([i915#658]) +1 similar issue
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-iclb2/igt@[email protected]
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-iclb8/igt@[email protected]

* igt@kms_psr2_sf@primary-plane-update-sf-dmg-area-1:
- shard-iclb: [SKIP][127] ([i915#658]) -> [SKIP][128] ([i915#2920]) +1 similar issue
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-iclb6/igt@[email protected]
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-iclb2/igt@[email protected]

* igt@runner@aborted:
- shard-kbl: ([FAIL][129], [FAIL][130]) ([i915#3002] / [i915#3363]) -> ([FAIL][131], [FAIL][132]) ([i915#2505] / [i915#3002] / [i915#3363])
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-kbl3/igt@[email protected]
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-kbl7/igt@[email protected]
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-kbl6/igt@[email protected]
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-kbl7/igt@[email protected]
- shard-apl: ([FAIL][133], [FAIL][134], [FAIL][135]) ([fdo#109271] / [i915#1814] / [i915#3002] / [i915#3363]) -> ([FAIL][136], [FAIL][137], [FAIL][138]) ([i915#180] / [i915#1814] / [i915#3002] / [i915#3363])
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-apl8/igt@[email protected]
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-apl1/igt@[email protected]
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10366/shard-apl1/igt@[email protected]
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl3/igt@[email protected]
[137]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl8/igt@[email protected]
[138]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/shard-apl2/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109279]: https://bugs.freedesktop.org/show_bug.cgi?id=109279
[fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
[fdo#109291]: https://bugs.freedesktop.org/show_bug.cgi?id=109291
[fdo#109300]: https://bugs.freedesktop.org/show_bug.cgi?id=109300
[fdo#109308]: https://bugs.freedesktop.org/show_bug.cgi?id=109308
[fdo#109314]: https://bugs.freedesktop.org/show_bug.cgi?id=109314
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109506]: https://bugs.freedesktop.org/show_bug.cgi?id=109506
[fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
[fdo#111314]: https://bugs.freedesktop.org/show_bug.cgi?id=111314
[fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
[fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
[fdo#111719]: https://bugs.freedesktop.org/show_bug.cgi?id=111719
[fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[fdo#112022]: https://bugs.freedesktop.org/show_bug.cgi?id=112022
[fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
[i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
[i915#1099]: https://gitlab.freedesktop.org/drm/intel/issues/1099
[i915#1149]: https://gitlab.freedesktop.org/drm/intel/issues/1149
[i915#118]: https://gitlab.freedesktop.org/drm/intel/issues/118
[i915#1257]: https://gitlab.freedesktop.org/drm/intel/issues/1257
[i915#132]: https://gitlab.freedesktop.org/drm/intel/issues/132
[i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
[i915#1542]: https://gitlab.freedesktop.org/drm/intel/issues/1542
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#1804]: https://gitlab.freedesktop.org/drm/intel/issues/1804
[i915#1814]: https://gitlab.freedesktop.org/drm/intel/issues/1814
[i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
[i915#1836]: https://gitlab.freedesktop.org/drm/intel/issues/1836
[i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
[i915#1845]: https://gitlab.freedesktop.org/drm/intel/issues/1845
[i915#1849]: https://gitlab.freedesktop.org/drm/intel/issues/1849
[i915#1850]: https://gitlab.freedesktop.org/drm/intel/issues/1850
[i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
[i915#2122]: https://gitlab.freedesktop.org

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_20665/index.html

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#29 lore raw
In reply to Christoph Hellwig
Quoted 8 lines · Christoph Hellwig

Hi all,

the GVT code in the i915 is a bit of a mess right now due to strange abstractions and lots of indirect calls. This series refactors various bits to clean that up. The main user visible change is that almost all of the GVT code moves out of the main i915 driver and into the kvmgt module.

The reason we isolated hypervisor specific code from core vgpu emulation is to make multiple hypervisor support possible. Yes, we do have Xen support but never got way into upstream...And we also have third party hypervisors which leverage gvt function through current hypervisor interface.

Sorry I may not have more time to check in details for now, but some of them look fine to me. I'll review more after vacation or let Zhi check details.

Thanks!

Quoted 29 lines

Tested on my Thinkpad with a Kaby Lake CPU and integrated graphics.

Git tree:

    git://git.infradead.org/users/hch/misc.git i915-gvt

Gitweb:

http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/i915-gvt

Diffstat:

 b/drivers/gpu/drm/i915/Kconfig                         |   31 
 b/drivers/gpu/drm/i915/Makefile                        |   30 
 b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c |    4 
 b/drivers/gpu/drm/i915/gvt/cfg_space.c                 |   89 --
 b/drivers/gpu/drm/i915/gvt/cmd_parser.c                |    4 
 b/drivers/gpu/drm/i915/gvt/dmabuf.c                    |   36 
 b/drivers/gpu/drm/i915/gvt/execlist.c                  |   12 
 b/drivers/gpu/drm/i915/gvt/gtt.c                       |   55 -
 b/drivers/gpu/drm/i915/gvt/gvt.c                       |  100 --
 b/drivers/gpu/drm/i915/gvt/gvt.h                       |  132 ++-
 b/drivers/gpu/drm/i915/gvt/interrupt.c                 |   38 -
 b/drivers/gpu/drm/i915/gvt/kvmgt.c                     |  634 ++++-------------
 b/drivers/gpu/drm/i915/gvt/mmio.c                      |    4 
 b/drivers/gpu/drm/i915/gvt/opregion.c                  |  148 ---
 b/drivers/gpu/drm/i915/gvt/page_track.c                |    8 
 b/drivers/gpu/drm/i915/gvt/scheduler.c                 |   37 
 b/drivers/gpu/drm/i915/gvt/trace.h                     |    2 
 b/drivers/gpu/drm/i915/gvt/vgpu.c                      |   22 
Quoted 8 lines
 b/drivers/gpu/drm/i915/i915_drv.h                      |    7 
 b/drivers/gpu/drm/i915/i915_params.c                   |    2 
 b/drivers/gpu/drm/i915/intel_gvt.c                     |   64 +
 b/drivers/gpu/drm/i915/intel_gvt.h                     |    4 
 drivers/gpu/drm/i915/gvt/Makefile                      |    9 
 drivers/gpu/drm/i915/gvt/hypercall.h                   |   82 --
 drivers/gpu/drm/i915/gvt/mpt.h                         |  400 ----------
 25 files changed, 541 insertions(+), 1413 deletions(-)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#30 lore raw
Quoted 5 lines · Zhenyu Wang

The reason we isolated hypervisor specific code from core vgpu emulation is to make multiple hypervisor support possible. Yes, we do have Xen support but never got way into upstream...And we also have third party hypervisors which leverage gvt function through current hypervisor interface.

Out of tree stuff simply does not matter for the upstream kernel, especially when it creates such a huge burden.

As a background: I started this refactoring as a lot of the code did not make much sense when reviewing the mdev integration in preparation to switching them to the new mdev interface from Jason.
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#31 lore raw
In reply to Christoph Hellwig

Hi Christoph:

Thanks so much for the patches and the testing.

The abstraction between i915 and KVMGT module is for our customers who can easily port GVT-g into their own hypervisors. As you can see, all the hypervisor related functions were put in "hypervisor" module. The GVT-g module talks with the "hypervisor" module through the MPT layer. The customers just need to focus on their "hypervisor" module, implement and attach their own "hypervisor" modules to the MPT layer without touching the GVT-g core logic, which reduce great efforts during the porting as the core logic of GVT-g in i915 is pretty vendor-specific and customers aren't motivated to touch it unless they have to.

The boundary between GVT-g core logic and "hypervisor" module also helps a lot on narrowing down the problems when supporting our customers. According to our experience during the support, the less a customer touches the core logic, the less problem will be introduced.

We get many customers who are using commercial hypervisors like QNX or their private hypervisors in many areas in the industry. An reference implementation of "Xen hypervisor" module to demonstrate our customer how to port GVT-g to a type-1 hypervisor instead of KVM can be found here:
https://github.com/intel/gvt-linux/blob/topic/gvt-xengt/drivers/gpu/drm/i915/gvt/xengt.c

But it's hard for some customers to contribute their own "hypervisor" module to the upstream Linux kernel. I am thinking what would be a better solution here? The MPT layer in the kernel helps a lot for customers, but only one open-source "hypervisor" module is there in the kernel. That can confuse people which don't know the story. One thing I was thinking is to put a document about the background and more description in the MPT headers. So it won't confuse more people.

Feel free to drop more comments. 😊

Thanks,
Zhi.

-----Original Message-----
From: Christoph Hellwig <[email protected]>
Sent: Wednesday, July 21, 2021 6:54 PM
To: Jani Nikula <[email protected]>; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; Zhenyu Wang <[email protected]>; Wang, Zhi A <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: refactor the i915 GVT support

Hi all,

the GVT code in the i915 is a bit of a mess right now due to strange abstractions and lots of indirect calls. This series refactors various bits to clean that up. The main user visible change is that almost all of the GVT code moves out of the main i915 driver and into the kvmgt module.

Tested on my Thinkpad with a Kaby Lake CPU and integrated graphics.

Git tree:

    git://git.infradead.org/users/hch/misc.git i915-gvt

Gitweb:

http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/i915-gvt

Diffstat:

 b/drivers/gpu/drm/i915/Kconfig                         |   31 
 b/drivers/gpu/drm/i915/Makefile                        |   30 
 b/drivers/gpu/drm/i915/gt/intel_execlists_submission.c |    4 
 b/drivers/gpu/drm/i915/gvt/cfg_space.c                 |   89 --
 b/drivers/gpu/drm/i915/gvt/cmd_parser.c                |    4 
 b/drivers/gpu/drm/i915/gvt/dmabuf.c                    |   36 
 b/drivers/gpu/drm/i915/gvt/execlist.c                  |   12 
 b/drivers/gpu/drm/i915/gvt/gtt.c                       |   55 -
 b/drivers/gpu/drm/i915/gvt/gvt.c                       |  100 --
 b/drivers/gpu/drm/i915/gvt/gvt.h                       |  132 ++-
 b/drivers/gpu/drm/i915/gvt/interrupt.c                 |   38 -
 b/drivers/gpu/drm/i915/gvt/kvmgt.c                     |  634 ++++-------------
 b/drivers/gpu/drm/i915/gvt/mmio.c                      |    4 
 b/drivers/gpu/drm/i915/gvt/opregion.c                  |  148 ---
 b/drivers/gpu/drm/i915/gvt/page_track.c                |    8 
 b/drivers/gpu/drm/i915/gvt/scheduler.c                 |   37 
 b/drivers/gpu/drm/i915/gvt/trace.h                     |    2 
 b/drivers/gpu/drm/i915/gvt/vgpu.c                      |   22 
 b/drivers/gpu/drm/i915/i915_drv.h                      |    7 
 b/drivers/gpu/drm/i915/i915_params.c                   |    2 
 b/drivers/gpu/drm/i915/intel_gvt.c                     |   64 +
 b/drivers/gpu/drm/i915/intel_gvt.h                     |    4 
 drivers/gpu/drm/i915/gvt/Makefile                      |    9 
 drivers/gpu/drm/i915/gvt/hypercall.h                   |   82 --
 drivers/gpu/drm/i915/gvt/mpt.h                         |  400 ----------
 25 files changed, 541 insertions(+), 1413 deletions(-)
#32 lore raw

Hi,

Quoted 9 lines

https://github.com/intel/gvt-linux/blob/topic/gvt-xengt/drivers/gpu/drm/i915/gvt/xengt.c

But it's hard for some customers to contribute their own "hypervisor" module to the upstream Linux kernel. I am thinking what would be a better solution here? The MPT layer in the kernel helps a lot for customers, but only one open-source "hypervisor" module is there in the kernel. That can confuse people which don't know the story. One thing I was thinking is to put a document about the background and more description in the MPT headers. So it won't confuse more people.

Getting the xengt module linked above merged into mainline would also nicely explain why there are hypervisor modules.

take care,
Gerd

#33 lore raw
Quoted 12 lines · Gerd Hoffmann

Hi,

Quoted 9 lines

https://github.com/intel/gvt-linux/blob/topic/gvt-xengt/drivers/gpu/drm/i915/gvt/xengt.c

But it's hard for some customers to contribute their own "hypervisor" module to the upstream Linux kernel. I am thinking what would be a better solution here? The MPT layer in the kernel helps a lot for customers, but only one open-source "hypervisor" module is there in the kernel. That can confuse people which don't know the story. One thing I was thinking is to put a document about the background and more description in the MPT headers. So it won't confuse more people.

Quoted 2 lines

Getting the xengt module linked above merged into mainline would also nicely explain why there are hypervisor modules.

It would also be nice to explain why a GPU driver needs a hypervisor specific shim like this in the first place.

        enum hypervisor_type type;
        int (*host_init)(struct device *dev, void *gvt, const void *ops);
        void (*host_exit)(struct device *dev, void *gvt);
        int (*attach_vgpu)(void *vgpu, unsigned long *handle);
        void (*detach_vgpu)(void *vgpu);

Doesn't vfio provide all this generically with notifiers?

        int (*inject_msi)(unsigned long handle, u32 addr, u16 data);

Isn't this one just an eventfd?

        unsigned long (*from_virt_to_mfn)(void *p);
        int (*read_gpa)(unsigned long handle, unsigned long gpa, void *buf,
                        unsigned long len);
        int (*write_gpa)(unsigned long handle, unsigned long gpa, void *buf,
                         unsigned long len);
        unsigned long (*gfn_to_mfn)(unsigned long handle, unsigned long gfn);

        int (*dma_map_guest_page)(unsigned long handle, unsigned long gfn,
                                  unsigned long size, dma_addr_t *dma_addr);
        void (*dma_unmap_guest_page)(unsigned long handle, dma_addr_t dma_addr);

        int (*dma_pin_guest_page)(unsigned long handle, dma_addr_t dma_addr);

        int (*map_gfn_to_mfn)(unsigned long handle, unsigned long gfn,
                              unsigned long mfn, unsigned int nr, bool map);
        bool (*is_valid_gfn)(unsigned long handle, unsigned long gfn);

Shouldn't the vfio page SW IOMMU do all of this generically?

        int (*enable_page_track)(unsigned long handle, u64 gfn);
        int (*disable_page_track)(unsigned long handle, u64 gfn);
        int (*set_trap_area)(unsigned long handle, u64 start, u64 end,
                             bool map);
        int (*set_opregion)(void *vgpu);
        int (*set_edid)(void *vgpu, int port_num);

edid depends on hypervisor??

        int (*get_vfio_device)(void *vgpu);
        void (*put_vfio_device)(void *vgpu);

Jason
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#34 lore raw

Hi Jason:

I guess those APIs you were talking about are KVM-only. For other hypervisors, e.g. Xen, ARCN cannot use the APIs you mentioned. Not sure if you have already noticed that VFIO is KVM-only right now.

GVT-g is designed for many hypervisors not only KVM. In the design, we implemented an abstraction layer for different hypervisors. You can check the link in the previous email which has an example of how the MPT module "xengt" supports GVT-g running under Xen.
For example, injecting a msi in VFIO/KVM is via playing with eventfd. But in Xen, we need to issue a hypercall from Dom0. So does others, like querying mappings between GFN and HFN. Some GPU related emulation logic might be implemented differently under different hypervisors because different hypervisors might provide not exact the APIs we want. That's the reason why they get a callback in the MPT (yet not perfect.)

As you can see, to survive from this situation, we have to rely on an abstraction layer so that we can prevent introducing coding blocks like in the core logic:

If (in_hypervisor_xen)
Issue hypercalls
else if (in_hypervisor_kvm)
Play with eventfds.
Else if (in_hypervisor_other)
xxxx

Thus some of the APIs have to be wrapped in the MPT module in GVT-g design.

Sadly, not all customers are motivated or allowed to get their hypervisor-specific modules into the kernel. We have a customer who runs GVT-g with their private hypervisor. In this case, they don't want to get their "xxxgt" MPT module into upstream since their hypervisor has been in the kernel yet. Also, we have customers who ported the GVT-g to QNX which is another widely used commercial hypervisor in the industry. They can't get the "qnxgt" MPT module into upstream since it's not allowed.

We do understand the situation and try to figure out a solution that can fulfill expectations from different people in the community and also customers.

According to Greg KH's comments, we are collecting the requirements of MPT modules from other open-source hypervisors in the kernel, e.g. ACRN, to see if they can get another MPT module into the kernel, which will show an example that how the MPT abstraction can benefit. Also, we are evaluating the impact on our customers if we have to remove MPT abstraction in the kernel because there is only one MPT module.

Thanks so much for the comments.

Thanks,
Zhi.

-----Original Message-----
From: Jason Gunthorpe <[email protected]>
Sent: Tuesday, July 27, 2021 3:12 PM
To: Gerd Hoffmann <[email protected]>
Cc: Wang, Zhi A <[email protected]>; Christoph Hellwig <[email protected]>; Jani Nikula <[email protected]>; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; Zhenyu Wang <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: refactor the i915 GVT support

Quoted 13 lines · Gerd Hoffmann

Hi,

Quoted 10 lines

https://github.com/intel/gvt-linux/blob/topic/gvt-xengt/drivers/gpu/
drm/i915/gvt/xengt.c

But it's hard for some customers to contribute their own "hypervisor" module to the upstream Linux kernel. I am thinking what would be a better solution here? The MPT layer in the kernel helps a lot for customers, but only one open-source "hypervisor" module is there in the kernel. That can confuse people which don't know the story. One thing I was thinking is to put a document about the background and more description in the MPT headers. So it won't confuse more people.

Quoted 2 lines

Getting the xengt module linked above merged into mainline would also nicely explain why there are hypervisor modules.

It would also be nice to explain why a GPU driver needs a hypervisor specific shim like this in the first place.

        enum hypervisor_type type;
        int (*host_init)(struct device *dev, void *gvt, const void *ops);
        void (*host_exit)(struct device *dev, void *gvt);
        int (*attach_vgpu)(void *vgpu, unsigned long *handle);
        void (*detach_vgpu)(void *vgpu);

Doesn't vfio provide all this generically with notifiers?

        int (*inject_msi)(unsigned long handle, u32 addr, u16 data);

Isn't this one just an eventfd?

        unsigned long (*from_virt_to_mfn)(void *p);
        int (*read_gpa)(unsigned long handle, unsigned long gpa, void *buf,
                        unsigned long len);
        int (*write_gpa)(unsigned long handle, unsigned long gpa, void *buf,
                         unsigned long len);
        unsigned long (*gfn_to_mfn)(unsigned long handle, unsigned long gfn);

        int (*dma_map_guest_page)(unsigned long handle, unsigned long gfn,
                                  unsigned long size, dma_addr_t *dma_addr);
        void (*dma_unmap_guest_page)(unsigned long handle, dma_addr_t dma_addr);

        int (*dma_pin_guest_page)(unsigned long handle, dma_addr_t dma_addr);

        int (*map_gfn_to_mfn)(unsigned long handle, unsigned long gfn,
                              unsigned long mfn, unsigned int nr, bool map);
        bool (*is_valid_gfn)(unsigned long handle, unsigned long gfn);

Shouldn't the vfio page SW IOMMU do all of this generically?

        int (*enable_page_track)(unsigned long handle, u64 gfn);
        int (*disable_page_track)(unsigned long handle, u64 gfn);
        int (*set_trap_area)(unsigned long handle, u64 start, u64 end,
                             bool map);
        int (*set_opregion)(void *vgpu);
        int (*set_edid)(void *vgpu, int port_num);

edid depends on hypervisor??

        int (*get_vfio_device)(void *vgpu);
        void (*put_vfio_device)(void *vgpu);

Jason

#35 lore raw

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 3 lines · Zhi A

Hi Jason:

I guess those APIs you were talking about are KVM-only. For other hypervisors, e.g. Xen, ARCN cannot use the APIs you mentioned. Not sure if you have already noticed that VFIO is KVM-only right now.

Please wrap your lines properly :(

Quoted 11 lines

GVT-g is designed for many hypervisors not only KVM. In the design, we implemented an abstraction layer for different hypervisors. You can check the link in the previous email which has an example of how the MPT module "xengt" supports GVT-g running under Xen.
For example, injecting a msi in VFIO/KVM is via playing with eventfd. But in Xen, we need to issue a hypercall from Dom0. So does others, like querying mappings between GFN and HFN. Some GPU related emulation logic might be implemented differently under different hypervisors because different hypervisors might provide not exact the APIs we want. That's the reason why they get a callback in the MPT (yet not perfect.)

As you can see, to survive from this situation, we have to rely on an abstraction layer so that we can prevent introducing coding blocks like in the core logic:

If (in_hypervisor_xen)
Issue hypercalls
else if (in_hypervisor_kvm)
Play with eventfds.
Else if (in_hypervisor_other)
xxxx

That's horrid, and slow, please do this properly.

Quoted 3 lines

Thus some of the APIs have to be wrapped in the MPT module in GVT-g design.

Sadly, not all customers are motivated or allowed to get their hypervisor-specific modules into the kernel. We have a customer who runs GVT-g with their private hypervisor. In this case, they don't want to get their "xxxgt" MPT module into upstream since their hypervisor has been in the kernel yet. Also, we have customers who ported the GVT-g to QNX which is another widely used commercial hypervisor in the industry. They can't get the "qnxgt" MPT module into upstream since it's not allowed.

Why is it not allowed?

Quoted 3 lines

We do understand the situation and try to figure out a solution that can fulfill expectations from different people in the community and also customers.

According to Greg KH's comments, we are collecting the requirements of MPT modules from other open-source hypervisors in the kernel, e.g. ACRN, to see if they can get another MPT module into the kernel, which will show an example that how the MPT abstraction can benefit. Also, we are evaluating the impact on our customers if we have to remove MPT abstraction in the kernel because there is only one MPT module.

Until that happens, can we please just remove the unneeded layer here as no one is using it? Then, when you have a real user for this type of middle-layer, you can add it back? We have no need for it now.

thanks,

greg k-h

#36 lore raw
In reply to Wang, Zhi A
Quoted 3 lines · Zhi A

I guess those APIs you were talking about are KVM-only. For other hypervisors, e.g. Xen, ARCN cannot use the APIs you mentioned. Not sure if you have already noticed that VFIO is KVM-only right now.

There is very little hard connection between VFIO and KVM, so no, I don't think that is completely true.

In an event, an in-tree version of other hypervisor support for GVT needs to go through enabling VFIO support so that the existing API multiplexers we have can be used properly, not adding a shim layer trying to recreate VFIO inside a GPU driver.

Quoted 6 lines

GVT-g is designed for many hypervisors not only KVM. In the design, we implemented an abstraction layer for different hypervisors. You can check the link in the previous email which has an example of how the MPT module "xengt" supports GVT-g running under Xen. For example, injecting a msi in VFIO/KVM is via playing with eventfd. But in Xen, we need to issue a hypercall from Dom0.

This is obviously bad design, Xen should plug into the standardized eventfd scheme as well and trigger its hypercall this way. Then it can integrate with the existing VFIO interrupt abstraction infrastructure.

Quoted 1 line

others, like querying mappings between GFN and HFN.

This should be done through VFIO containers, there is nothing KVM specific there.

Quoted 3 lines

As you can see, to survive from this situation, we have to rely on an abstraction layer so that we can prevent introducing coding blocks like in the core logic:

No, you have to fix the abstractions we already have to support the matrix of things you care about. If this can't be done then maybe we can add new abstractions, but abstractions like this absoultely should not be done inside drivers.

Jason

#37 lore raw
Quoted 8 lines · Jason Gunthorpe
Quoted 3 lines · Zhi A

I guess those APIs you were talking about are KVM-only. For other hypervisors, e.g. Xen, ARCN cannot use the APIs you mentioned. Not sure if you have already noticed that VFIO is KVM-only right now.

There is very little hard connection between VFIO and KVM, so no, I don't think that is completely true.

The only connection is the SET_KVM notifier as far as I can tell. Which is used by a total of two drivers, including i915/gvt. That being said gvt does not only use vfio, but also does quite a few direct cals to KVM.

Quoted 4 lines

In an event, an in-tree version of other hypervisor support for GVT needs to go through enabling VFIO support so that the existing API multiplexers we have can be used properly, not adding a shim layer trying to recreate VFIO inside a GPU driver.

Yes. And if we go back to actually looking at the series a lot of it just removes entirely pointless indirect calls that go to generic code and not even the kvm code, or questionable data structure designs. If we were to support another upstream hypervisor we'd just need to union a few fields in struct intel_gpu and maybe introduce a few methods. Preferably in a way that avoids expensive indirect calls in the fast path.

#38 lore raw
Quoted 20 lines · Christoph Hellwig
Quoted 8 lines · Jason Gunthorpe
Quoted 3 lines · Zhi A

I guess those APIs you were talking about are KVM-only. For other hypervisors, e.g. Xen, ARCN cannot use the APIs you mentioned. Not sure if you have already noticed that VFIO is KVM-only right now.

There is very little hard connection between VFIO and KVM, so no, I don't think that is completely true.

The only connection is the SET_KVM notifier as far as I can tell. Which is used by a total of two drivers, including i915/gvt. That being said gvt does not only use vfio, but also does quite a few direct cals to KVM.

Quoted 4 lines

In an event, an in-tree version of other hypervisor support for GVT needs to go through enabling VFIO support so that the existing API multiplexers we have can be used properly, not adding a shim layer trying to recreate VFIO inside a GPU driver.

Quoted 7 lines

Yes. And if we go back to actually looking at the series a lot of it just removes entirely pointless indirect calls that go to generic code and not even the kvm code, or questionable data structure designs. If we were to support another upstream hypervisor we'd just need to union a few fields in struct intel_gpu and maybe introduce a few methods. Preferably in a way that avoids expensive indirect calls in the fast path.

fwiw I concur with the direction of this series. gvt landed 5 years ago, that should have been plenty of time to merge at least one of the other backends that float around. If it didn't happen in 5 years it aint suddenly happening in the next few, and the abstraction layer should be sunset.

Also yes structuring it more as a helper layer with some unions/subclassing than full blown backend abstractor layer would be a good idea too I guess (it usually is the right thing to do). -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Acked-by
#39 lore raw
In reply to Christoph Hellwig
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Jason Gunthorpe
Quoted 3 lines · Zhi A

I guess those APIs you were talking about are KVM-only. For other hypervisors, e.g. Xen, ARCN cannot use the APIs you mentioned. Not sure if you have already noticed that VFIO is KVM-only right now.

Quoted 7 lines
Quoted 2 lines

There is very little hard connection between VFIO and KVM, so no, I don't think that is completely true.

The only connection is the SET_KVM notifier as far as I can tell. Which is used by a total of two drivers, including i915/gvt. That being said gvt does not only use vfio, but also does quite a few direct cals to KVM.

yeah, we mostly combined VFIO into hypervisor specific thing before, e.g interface to set vgpu edid, etc. along with kvm specific calls.

Quoted 6 lines
Quoted 5 lines

In an event, an in-tree version of other hypervisor support for GVT needs to go through enabling VFIO support so that the existing API multiplexers we have can be used properly, not adding a shim layer trying to recreate VFIO inside a GPU driver.

Quoted 7 lines

Yes. And if we go back to actually looking at the series a lot of it just removes entirely pointless indirect calls that go to generic code and not even the kvm code, or questionable data structure designs. If we were to support another upstream hypervisor we'd just need to union a few fields in struct intel_gpu and maybe introduce a few methods. Preferably in a way that avoids expensive indirect calls in the fast path.

ok, agree on that.

Thanks a lot for this effort!

#40 lore raw
Quoted 3 lines · Zhenyu Wang

Thanks a lot for this effort!

Great, do we have a submission plan for this? how much does it clash with my open_device/etc patch? ie does the whole thing have to go through the vfio tree?

Thanks,
Jason

#41 lore raw
Quoted 8 lines · Jason Gunthorpe
Quoted 3 lines · Zhenyu Wang

Thanks a lot for this effort!

Great, do we have a submission plan for this? how much does it clash with my open_device/etc patch? ie does the whole thing have to go through the vfio tree?

The two series merge cleanly and build fine. So if we don't need the actual conversion of the i915 gvt code to the new mdev registration scheme this merge window there is no need to synchronize.

#42 lore raw
In reply to Jason Gunthorpe
Quoted 9 lines · Jason Gunthorpe
Quoted 3 lines · Zhenyu Wang

Thanks a lot for this effort!

Great, do we have a submission plan for this? how much does it clash with my open_device/etc patch? ie does the whole thing have to go through the vfio tree?

I think Alex would determine when to merge open_device series, gvt part can be through vfio tree without problem. For this refactor, I would first merge for gvt staging to do more regression testing before sending through i915 tree.

Thanks

#43 lore raw
Quoted 11 lines · Zhenyu Wang
Quoted 9 lines · Jason Gunthorpe
Quoted 3 lines · Zhenyu Wang

Thanks a lot for this effort!

Great, do we have a submission plan for this? how much does it clash with my open_device/etc patch? ie does the whole thing have to go through the vfio tree?

Quoted 4 lines

I think Alex would determine when to merge open_device series, gvt part can be through vfio tree without problem. For this refactor, I would first merge for gvt staging to do more regression testing before sending through i915 tree.

Any updates on this? I'd really hate to miss this merge window.

#44 lore raw
Quoted 12 lines · Christoph Hellwig
Quoted 11 lines · Zhenyu Wang
Quoted 9 lines · Jason Gunthorpe
Quoted 3 lines · Zhenyu Wang

Thanks a lot for this effort!

Great, do we have a submission plan for this? how much does it clash with my open_device/etc patch? ie does the whole thing have to go through the vfio tree?

Quoted 6 lines
Quoted 4 lines

I think Alex would determine when to merge open_device series, gvt part can be through vfio tree without problem. For this refactor, I would first merge for gvt staging to do more regression testing before sending through i915 tree.

Any updates on this? I'd really hate to miss this merge window.

I'm still waiting for our validation team's report on this. I'm afraid it might be missing for next version as i915 merge window is mostly till rc5...and for any change outside of gvt, it still needs to be acked by i915 maintainers.

#45 lore raw
Quoted 18 lines · Zhenyu Wang
Quoted 17 lines · Christoph Hellwig
Quoted 15 lines · Zhenyu Wang
Quoted 9 lines · Jason Gunthorpe
Quoted 3 lines · Zhenyu Wang

Thanks a lot for this effort!

Great, do we have a submission plan for this? how much does it clash with my open_device/etc patch? ie does the whole thing have to go through the vfio tree?

I think Alex would determine when to merge open_device series, gvt part can be through vfio tree without problem. For this refactor, I would first merge for gvt staging to do more regression testing before sending through i915 tree.

Quoted 6 lines
Quoted 1 line

Any updates on this? I'd really hate to miss this merge window.

I'm still waiting for our validation team's report on this. I'm afraid it might be missing for next version as i915 merge window is mostly till rc5...and for any change outside of gvt, it still needs to be acked by i915 maintainers.

Looks our validation team did have problem against recent i915 change. If you like to try, we have a gvt-staging branch on
https://github.com/intel/gvt-linux which is generated against drm-tip with gvt changes for testing, currently it's broken.

One issue is with i915 export that intel_context_unpin has been changed into static inline function. Another is that intel_gvt.c should be part of i915 for gvt interface instead of depending on KVMGT config.

But the problem I see is that after moving gvt device model (gvt/*.c except kvmgt.c) into kvmgt module, we'll have issue with initial mmio state which current gvt relies on, that is in design supposed to get initial HW state before i915 driver has taken any operation. Before we can ensure that, I think we may only remove MPT part first but still keep gvt device model as part of i915 with config. I'll try to split that out.

#46 lore raw
Quoted 13 lines · Zhenyu Wang
Quoted 7 lines · Christoph Hellwig
Quoted 1 line

Any updates on this? I'd really hate to miss this merge window.

I'm still waiting for our validation team's report on this. I'm afraid it might be missing for next version as i915 merge window is mostly till rc5...and for any change outside of gvt, it still needs to be acked by i915 maintainers.

Looks our validation team did have problem against recent i915 change. If you like to try, we have a gvt-staging branch on
https://github.com/intel/gvt-linux which is generated against drm-tip with gvt changes for testing, currently it's broken.

Quoted 4 lines

One issue is with i915 export that intel_context_unpin has been changed into static inline function. Another is that intel_gvt.c should be part of i915 for gvt interface instead of depending on KVMGT config.

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Quoted 7 lines

But the problem I see is that after moving gvt device model (gvt/*.c except kvmgt.c) into kvmgt module, we'll have issue with initial mmio state which current gvt relies on, that is in design supposed to get initial HW state before i915 driver has taken any operation. Before we can ensure that, I think we may only remove MPT part first but still keep gvt device model as part of i915 with config. I'll try to split that out.

Sorry I misread the code that as we always request kvmgt module when gvt init, so it should still apply original method that this isn't a problem. Our current validation result has shown no regression as well.

---8<---
From 58ff84572f1a0f9d79ca1d7ec0cff5ecbe78d280 Mon Sep 17 00:00:00 2001
From: Zhenyu Wang <[email protected]>
Date: Thu, 19 Aug 2021 16:36:33 +0800
Subject: [PATCH] TESTONLY:drm/i915/gvt: potential fix for refactor against
current tip

---
 drivers/gpu/drm/i915/Makefile           | 4 +++-
 drivers/gpu/drm/i915/gt/intel_context.c | 5 +++++
 drivers/gpu/drm/i915/gt/intel_context.h | 3 ++-
 drivers/gpu/drm/i915/i915_trace.h       | 1 +
 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/Makefile +3 -1
index c4f953837f72..2248574428a1 100644
@@ -296,7 +296,9 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
 
 # virtual gpu code
 i915-y += i915_vgpu.o
-i915-$(CONFIG_DRM_I915_GVT_KVMGT) += intel_gvt.o
+ifneq ($(CONFIG_DRM_I915_GVT_KVMGT),)
+i915-y += intel_gvt.o
+endif
 
 kvmgt-y += gvt/kvmgt.o \
 	gvt/gvt.o \
drivers/gpu/drm/i915/gt/intel_context.c +5 -0
index 745e84c72c90..20e7522fed84 100644
@@ -328,6 +328,11 @@ void __intel_context_do_unpin(struct intel_context *ce, int sub)
 	intel_context_put(ce);
 }
 
+void intel_context_unpin(struct intel_context *ce)
+{
+	_intel_context_unpin(ce);
+}
+
 static void __intel_context_retire(struct i915_active *active)
 {
 	struct intel_context *ce = container_of(active, typeof(*ce), active);
drivers/gpu/drm/i915/gt/intel_context.h +2 -1
index c41098950746..f942cbf6300a 100644
@@ -131,7 +131,7 @@ static inline void intel_context_sched_disable_unpin(struct intel_context *ce)
 	__intel_context_do_unpin(ce, 2);
 }
 
-static inline void intel_context_unpin(struct intel_context *ce)
+static inline void _intel_context_unpin(struct intel_context *ce)
 {
 	if (!ce->ops->sched_disable) {
 		__intel_context_do_unpin(ce, 1);
@@ -150,6 +150,7 @@ static inline void intel_context_unpin(struct intel_context *ce)
 		}
 	}
 }
+void intel_context_unpin(struct intel_context *ce);
 
 void intel_context_enter_engine(struct intel_context *ce);
 void intel_context_exit_engine(struct intel_context *ce);
drivers/gpu/drm/i915/i915_trace.h +1 -0
index 806ad688274b..2c6a8bcef7c1 100644
@@ -17,6 +17,7 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM i915
+#undef TRACE_INCLUDE_FILE
 #define TRACE_INCLUDE_FILE i915_trace
 
 /* watermark/fifo updates */
Signature · 2 lines
2.32.0
---8<---
maintainer
#47 lore raw

Quoting Zhenyu Wang (2021-08-19 11:29:29)

Quoted 19 lines · Zhenyu Wang
Quoted 13 lines
Quoted 7 lines · Christoph Hellwig
Quoted 1 line

Any updates on this? I'd really hate to miss this merge window.

I'm still waiting for our validation team's report on this. I'm afraid it might be missing for next version as i915 merge window is mostly till rc5...and for any change outside of gvt, it still needs to be acked by i915 maintainers.

Looks our validation team did have problem against recent i915 change. If you like to try, we have a gvt-staging branch on
https://github.com/intel/gvt-linux which is generated against drm-tip with gvt changes for testing, currently it's broken.

Quoted 4 lines

One issue is with i915 export that intel_context_unpin has been changed into static inline function. Another is that intel_gvt.c should be part of i915 for gvt interface instead of depending on KVMGT config.

Quoted 9 lines

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Quoted 4 lines

But the problem I see is that after moving gvt device model (gvt/*.c except kvmgt.c) into kvmgt module, we'll have issue with initial mmio state which current gvt relies on, that is in design supposed to get initial HW state before i915 driver has taken any operation.

As mentioned in some past discussions, I think it would be best rely on golden MMIO located in /lib/firmware or elsewhere. This way we will better isolate the guest system from host system updates/changes.

This should also hopefully allow enabling kvmgt module after i915 has already loaded, as the initialization would not be conditional to capture the MMIO.

Regards, Joonas

Quoted 92 lines
Quoted 4 lines

Before
we can ensure that, I think we may only remove MPT part first but still keep gvt device model as part of i915 with config. I'll try to split that out.

Sorry I misread the code that as we always request kvmgt module when gvt init, so it should still apply original method that this isn't a problem. Our current validation result has shown no regression as well.

---8<---
From 58ff84572f1a0f9d79ca1d7ec0cff5ecbe78d280 Mon Sep 17 00:00:00 2001
From: Zhenyu Wang <[email protected]>
Date: Thu, 19 Aug 2021 16:36:33 +0800
Subject: [PATCH] TESTONLY:drm/i915/gvt: potential fix for refactor against
current tip

---
 drivers/gpu/drm/i915/Makefile           | 4 +++-
 drivers/gpu/drm/i915/gt/intel_context.c | 5 +++++
 drivers/gpu/drm/i915/gt/intel_context.h | 3 ++-
 drivers/gpu/drm/i915/i915_trace.h       | 1 +
 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/Makefile +3 -1
index c4f953837f72..2248574428a1 100644
@@ -296,7 +296,9 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
 
 # virtual gpu code
 i915-y += i915_vgpu.o
-i915-$(CONFIG_DRM_I915_GVT_KVMGT) += intel_gvt.o
+ifneq ($(CONFIG_DRM_I915_GVT_KVMGT),)
+i915-y += intel_gvt.o
+endif
 
 kvmgt-y += gvt/kvmgt.o \
        gvt/gvt.o \
drivers/gpu/drm/i915/gt/intel_context.c +5 -0
index 745e84c72c90..20e7522fed84 100644
@@ -328,6 +328,11 @@ void __intel_context_do_unpin(struct intel_context *ce, int sub)
        intel_context_put(ce);
 }
 
+void intel_context_unpin(struct intel_context *ce)
+{
+       _intel_context_unpin(ce);
+}
+
 static void __intel_context_retire(struct i915_active *active)
 {
        struct intel_context *ce = container_of(active, typeof(*ce), active);
drivers/gpu/drm/i915/gt/intel_context.h +2 -1
index c41098950746..f942cbf6300a 100644
@@ -131,7 +131,7 @@ static inline void intel_context_sched_disable_unpin(struct intel_context *ce)
        __intel_context_do_unpin(ce, 2);
 }
 
-static inline void intel_context_unpin(struct intel_context *ce)
+static inline void _intel_context_unpin(struct intel_context *ce)
 {
        if (!ce->ops->sched_disable) {
                __intel_context_do_unpin(ce, 1);
@@ -150,6 +150,7 @@ static inline void intel_context_unpin(struct intel_context *ce)
                }
        }
 }
+void intel_context_unpin(struct intel_context *ce);
 
 void intel_context_enter_engine(struct intel_context *ce);
 void intel_context_exit_engine(struct intel_context *ce);
drivers/gpu/drm/i915/i915_trace.h +1 -0
index 806ad688274b..2c6a8bcef7c1 100644
@@ -17,6 +17,7 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM i915
+#undef TRACE_INCLUDE_FILE
 #define TRACE_INCLUDE_FILE i915_trace
 
 /* watermark/fifo updates */
Signature · 2 lines
2.32.0
---8<---
#48 lore raw
Quoted 30 lines · Joonas Lahtinen

Quoting Zhenyu Wang (2021-08-19 11:29:29)

Quoted 19 lines · Zhenyu Wang
Quoted 13 lines
Quoted 7 lines · Christoph Hellwig
Quoted 1 line

Any updates on this? I'd really hate to miss this merge window.

I'm still waiting for our validation team's report on this. I'm afraid it might be missing for next version as i915 merge window is mostly till rc5...and for any change outside of gvt, it still needs to be acked by i915 maintainers.

Looks our validation team did have problem against recent i915 change. If you like to try, we have a gvt-staging branch on
https://github.com/intel/gvt-linux which is generated against drm-tip with gvt changes for testing, currently it's broken.

Quoted 4 lines

One issue is with i915 export that intel_context_unpin has been changed into static inline function. Another is that intel_gvt.c should be part of i915 for gvt interface instead of depending on KVMGT config.

Quoted 9 lines

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Quoted 4 lines

But the problem I see is that after moving gvt device model (gvt/*.c except kvmgt.c) into kvmgt module, we'll have issue with initial mmio state which current gvt relies on, that is in design supposed to get initial HW state before i915 driver has taken any operation.

Quoted 8 lines

As mentioned in some past discussions, I think it would be best rely on golden MMIO located in /lib/firmware or elsewhere. This way we will better isolate the guest system from host system updates/changes.

This should also hopefully allow enabling kvmgt module after i915 has already loaded, as the initialization would not be conditional to capture the MMIO.

I think the concern is that even for same GEN hw there could be many variant platforms e.g APL with gen9, etc. To verify golden states for them all might take too much effort...

Quoted 93 lines
Quoted 93 lines
Quoted 5 lines

Before
we can ensure that, I think we may only remove MPT part first but still keep gvt device model as part of i915 with config. I'll try to split that out.

Sorry I misread the code that as we always request kvmgt module when gvt init, so it should still apply original method that this isn't a problem. Our current validation result has shown no regression as well.

---8<---
From 58ff84572f1a0f9d79ca1d7ec0cff5ecbe78d280 Mon Sep 17 00:00:00 2001
From: Zhenyu Wang <[email protected]>
Date: Thu, 19 Aug 2021 16:36:33 +0800
Subject: [PATCH] TESTONLY:drm/i915/gvt: potential fix for refactor against
current tip

---
 drivers/gpu/drm/i915/Makefile           | 4 +++-
 drivers/gpu/drm/i915/gt/intel_context.c | 5 +++++
 drivers/gpu/drm/i915/gt/intel_context.h | 3 ++-
 drivers/gpu/drm/i915/i915_trace.h       | 1 +
 4 files changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/Makefile +3 -1
index c4f953837f72..2248574428a1 100644
@@ -296,7 +296,9 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
 
 # virtual gpu code
 i915-y += i915_vgpu.o
-i915-$(CONFIG_DRM_I915_GVT_KVMGT) += intel_gvt.o
+ifneq ($(CONFIG_DRM_I915_GVT_KVMGT),)
+i915-y += intel_gvt.o
+endif
 
 kvmgt-y += gvt/kvmgt.o \
        gvt/gvt.o \
drivers/gpu/drm/i915/gt/intel_context.c +5 -0
index 745e84c72c90..20e7522fed84 100644
@@ -328,6 +328,11 @@ void __intel_context_do_unpin(struct intel_context *ce, int sub)
        intel_context_put(ce);
 }
 
+void intel_context_unpin(struct intel_context *ce)
+{
+       _intel_context_unpin(ce);
+}
+
 static void __intel_context_retire(struct i915_active *active)
 {
        struct intel_context *ce = container_of(active, typeof(*ce), active);
drivers/gpu/drm/i915/gt/intel_context.h +2 -1
index c41098950746..f942cbf6300a 100644
@@ -131,7 +131,7 @@ static inline void intel_context_sched_disable_unpin(struct intel_context *ce)
        __intel_context_do_unpin(ce, 2);
 }
 
-static inline void intel_context_unpin(struct intel_context *ce)
+static inline void _intel_context_unpin(struct intel_context *ce)
 {
        if (!ce->ops->sched_disable) {
                __intel_context_do_unpin(ce, 1);
@@ -150,6 +150,7 @@ static inline void intel_context_unpin(struct intel_context *ce)
                }
        }
 }
+void intel_context_unpin(struct intel_context *ce);
 
 void intel_context_enter_engine(struct intel_context *ce);
 void intel_context_exit_engine(struct intel_context *ce);
drivers/gpu/drm/i915/i915_trace.h +1 -0
index 806ad688274b..2c6a8bcef7c1 100644
@@ -17,6 +17,7 @@
 
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM i915
+#undef TRACE_INCLUDE_FILE
 #define TRACE_INCLUDE_FILE i915_trace
 
 /* watermark/fifo updates */
Signature · 2 lines
2.32.0
---8<---
#49 lore raw
In reply to Zhenyu Wang
Quoted 4 lines · Zhenyu Wang

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Luis, do you know if there is a problem with a request_module from a driver ->probe routine that is probably called by a module_init function itself?

In the meantime I'll try to reproduce it locally, but I always had a hard time getting useful results out of a modular i915, especially when combined with module paramters. (no blame on i915, just the problem with modules needed early on).

Quoted 9 lines
Quoted 8 lines

But the problem I see is that after moving gvt device model (gvt/*.c except kvmgt.c) into kvmgt module, we'll have issue with initial mmio state which current gvt relies on, that is in design supposed to get initial HW state before i915 driver has taken any operation. Before we can ensure that, I think we may only remove MPT part first but still keep gvt device model as part of i915 with config. I'll try to split that out.

Quoted 3 lines

Sorry I misread the code that as we always request kvmgt module when gvt init, so it should still apply original method that this isn't a problem. Our current validation result has shown no regression as well.

What does initial mmio state mean? This is something new to me. But as you said in this mail unless I missed something very big it should work the same as before.

drivers/gpu/drm/i915/gt/intel_context.h static inline void intel_context_unpin(struct intel_context *ce) · line 153

Quoted 10 lines
drivers/gpu/drm/i915/gt/intel_context.h +2 -1
-static inline void intel_context_unpin(struct intel_context *ce)
+static inline void _intel_context_unpin(struct intel_context *ce)
 {
 	if (!ce->ops->sched_disable) {
 		__intel_context_do_unpin(ce, 1);
@@ -150,6 +150,7 @@ static inline void intel_context_unpin(struct intel_context *ce)
 		}
 	}
 }
+void intel_context_unpin(struct intel_context *ce);

Looking at intel_context_unpin/_intel_context_unpin is there really a need to have this inline to start with? It don't see much the compiler could optimize by inlining it.

#50 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Zhenyu Wang

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Luis, do you know if there is a problem with a request_module from a driver ->probe routine that is probably called by a module_init function itself?

Generally no, but you can easily foot yourself in the feet by creating cross dependencies and not dealing with them properly. I'd make sure to keep module initialization as simple as possible, and run whatever takes more time asynchronously, then use a state machine to allow you to verify where you are in the initialization phase or query it or wait for a completion with a timeout.

It seems the code in question is getting some spring cleaning, and its unclear where the code is I can inspect. If there's a tree somewhere I can take a peak I'd be happy to review possible oddities that may stick out.

My goto model for these sorts of problems is to abstract the issue *outside* of the driver in question and implement new selftests to try to reproduce. This serves two purposes, 1) helps with testing
2) may allow you to see the problem more clearly.

Luis

#51 lore raw
Quoted 18 lines · Luis Chamberlain
Quoted 9 lines · Christoph Hellwig
Quoted 4 lines · Zhenyu Wang

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Luis, do you know if there is a problem with a request_module from a driver ->probe routine that is probably called by a module_init function itself?

Generally no, but you can easily foot yourself in the feet by creating cross dependencies and not dealing with them properly. I'd make sure to keep module initialization as simple as possible, and run whatever takes more time asynchronously, then use a state machine to allow you to verify where you are in the initialization phase or query it or wait for a completion with a timeout.

Quoted 4 lines

It seems the code in question is getting some spring cleaning, and its unclear where the code is I can inspect. If there's a tree somewhere I can take a peak I'd be happy to review possible oddities that may stick out.

I tried to put current patches under test here: https://github.com/intel/gvt-linux/tree/gvt-staging
The issue can be produced with CONFIG_DRM_I915=m and CONFIG_DRM_I915_GVT_KVMGT=m.

Quoted 6 lines

My goto model for these sorts of problems is to abstract the issue *outside* of the driver in question and implement new selftests to try to reproduce. This serves two purposes, 1) helps with testing
2) may allow you to see the problem more clearly.

I'll see if can abstract that.

Thanks, Luis.

Acked-by Zhenyu Wang
#52 lore raw

Hey guys:

After some investigation, I found the root cause this problem ("i915" module loading will be stuck with Christoph's refactor patches), which can be reproduced by building both i915 and kvmgt as kernel module and the loading i915.

The root cause is: in Linux kernel loading, before a kernel module loading is finished, its symbols can not be reached by other module when resolving the symbols (even they can be found in /proc/kallsyms). Because the status of the kernel module is MODULE_STATE_COMING and resolve_symbol() from another kernel module will check this and return a -EBUSY.

In this case, before i915 loading is finished, the requested module "kvmgt" cannot reach the symbols in module i915. Thus it kept waiting and left message like below in the dmesg:

[  644.152021] kvmgt: gave up waiting for init of module i915. [  644.152039] kvmgt: Unknown symbol i915_gem_object_set_to_cpu_domain (err -16)
[  674.871409] kvmgt: gave up waiting for init of module i915. [  674.871427] kvmgt: Unknown symbol intel_ring_begin (err -16) [  705.590586] kvmgt: gave up waiting for init of module i915. [  705.590604] kvmgt: Unknown symbol i915_vma_move_to_active (err -16) [  736.310230] kvmgt: gave up waiting for init of module i915. [  736.310248] kvmgt: Unknown symbol shmem_unpin_map (err -16)
...

The error message is from execution path below:

kernel/module.c:

[i915 module loading] -> request_module("kvmgt")->[modprobe]->init_module("kvmgt")->load_module()->simplify_symbols()->resolve_symbol_wait():

static const struct kernel_symbol *
resolve_symbol_wait(struct module *mod,
            const struct load_info *info,
            const char *name)
{
    const struct kernel_symbol *ksym;
    char owner[MODULE_NAME_LEN];

    if (wait_event_interruptible_timeout(module_wq, !IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) || PTR_ERR(ksym) != -EBUSY,
                         30 * HZ) <= 0) {
        pr_warn("%s: gave up waiting for init of module %s.\n", mod->name, owner);

}

code:
https://github.com/intel/gvt-linux/blob/bd950a66c7919d7121d2530f30984351534a96dc/kernel/module.c#L1452

In resolve_symbol_wait(), it calls resolve_symbol() to resolve the symbols in "i915". In resolve_symbol() -> ref_module() -> strong_try_module_get(), it will check the status of the module which owns the symbol.

static inline int strong_try_module_get(struct module *mod) {
    BUG_ON(mod && mod->state == MODULE_STATE_UNFORMED); if (mod && mod->state == MODULE_STATE_COMING) return -EBUSY;
    if (try_module_get(mod))
        return 0;
    else
        return -ENOENT;
}

code:https://github.com/intel/gvt-linux/blob/bd950a66c7919d7121d2530f30984351534a96dc/kernel/module.c#L318

But unfortunately, this execution path begins in i915 module loading, at this time, the status of kernel module "i915" is MODULE_STATE_COMING until loading of "kvmgt" is finished. Thus a -EBUSY is always returned when kernel is trying to resolve symbols for "kvmgt".

This patch below might need re-work:

Author: Christoph Hellwig <[email protected]>
Date:   Wed Jul 21 17:53:38 2021 +0200

    drm/i915/gvt: move the gvt code into kvmgt.ko

    Instead of having an option to build the gvt code into the main i915 module, just move it into the kvmgt.ko module.  This only requires a new struct with three entries that the main i915 module needs to request before enabling VGPU passthrough operations.

    This also conveniently streamlines the GVT initialization and avoids the need for the global device pointer.

    Link:
http://patchwork.freedesktop.org/patch/msgid/[email protected]

Quoted 32 lines · Zhenyu Wang
Quoted 16 lines · Luis Chamberlain
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Zhenyu Wang

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Luis, do you know if there is a problem with a request_module from a driver ->probe routine that is probably called by a module_init function itself?

Generally no, but you can easily foot yourself in the feet by creating cross dependencies and not dealing with them properly. I'd make sure to keep module initialization as simple as possible, and run whatever takes more time asynchronously, then use a state machine to allow you to verify where you are in the initialization phase or query it or wait for a completion with a timeout.

Quoted 4 lines

It seems the code in question is getting some spring cleaning, and its unclear where the code is I can inspect. If there's a tree somewhere I can take a peak I'd be happy to review possible oddities that may stick out.

I tried to put current patches under test here: https://github.com/intel/gvt-linux/tree/gvt-staging
The issue can be produced with CONFIG_DRM_I915=m and CONFIG_DRM_I915_GVT_KVMGT=m.

Quoted 5 lines

My goto model for these sorts of problems is to abstract the issue *outside* of the driver in question and implement new selftests to try to reproduce. This serves two purposes, 1) helps with testing
2) may allow you to see the problem more clearly.

I'll see if can abstract that.

Thanks, Luis.

#53 lore raw
Quoted 6 lines · Zhi A

Hey guys:

After some investigation, I found the root cause this problem ("i915" module loading will be stuck with Christoph's refactor patches), which can be reproduced by building both i915 and kvmgt as kernel module and the loading i915.

Thanks for looking into this!

Quoted 6 lines

The root cause is: in Linux kernel loading, before a kernel module loading is finished, its symbols can not be reached by other module when resolving the symbols (even they can be found in /proc/kallsyms). Because the status of the kernel module is MODULE_STATE_COMING and resolve_symbol() from another kernel module will check this and return a -EBUSY.

Well, it would seem that way but...

Quoted 30 lines

In this case, before i915 loading is finished, the requested module "kvmgt" cannot reach the symbols in module i915. Thus it kept waiting and left message like below in the dmesg:

[  644.152021] kvmgt: gave up waiting for init of module i915. [  644.152039] kvmgt: Unknown symbol i915_gem_object_set_to_cpu_domain (err -16)
[  674.871409] kvmgt: gave up waiting for init of module i915. [  674.871427] kvmgt: Unknown symbol intel_ring_begin (err -16) [  705.590586] kvmgt: gave up waiting for init of module i915. [  705.590604] kvmgt: Unknown symbol i915_vma_move_to_active (err -16) [  736.310230] kvmgt: gave up waiting for init of module i915. [  736.310248] kvmgt: Unknown symbol shmem_unpin_map (err -16)
...

The error message is from execution path below:

kernel/module.c:

[i915 module loading] -> request_module("kvmgt")->[modprobe]->init_module("kvmgt")->load_module()->simplify_symbols()->resolve_symbol_wait():

static const struct kernel_symbol *
resolve_symbol_wait(struct module *mod,
            const struct load_info *info,
            const char *name)
{
    const struct kernel_symbol *ksym;
    char owner[MODULE_NAME_LEN];

Quoted 8 lines

    if (wait_event_interruptible_timeout(module_wq, !IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) || PTR_ERR(ksym) != -EBUSY,
                         30 * HZ) <= 0) {
        pr_warn("%s: gave up waiting for init of module %s.\n", mod->name, owner);

}

Commit 9bea7f23952d5 ("module: fix bne2 "gave up waiting for init of module libcrc32c") is worth reviewing. It dealt with a similar issue, and in particular it addressed the issue with -EBUSY being returned by ref_module().

And so, in theory that case should be dealt with in resolve_symbol_wait() already. And so can you try this just to verify something:

kernel/module.c +1 -1
index 40ec9a030eec..98f87cbb37de 100644
@@ -1459,7 +1459,7 @@ resolve_symbol_wait(struct module *mod,
 	if (wait_event_interruptible_timeout(module_wq,
 			!IS_ERR(ksym = resolve_symbol(mod, info, name, owner))
 			|| PTR_ERR(ksym) != -EBUSY,
-					     30 * HZ) <= 0) {
+					     160 * HZ) <= 0) {
 		pr_warn("%s: gave up waiting for init of module %s.\n",
 			mod->name, owner);
 	}
Quoted 21 lines

code:
https://github.com/intel/gvt-linux/blob/bd950a66c7919d7121d2530f30984351534a96dc/kernel/module.c#L1452

In resolve_symbol_wait(), it calls resolve_symbol() to resolve the symbols in "i915". In resolve_symbol() -> ref_module() -> strong_try_module_get(), it will check the status of the module which owns the symbol.

static inline int strong_try_module_get(struct module *mod) {
    BUG_ON(mod && mod->state == MODULE_STATE_UNFORMED); if (mod && mod->state == MODULE_STATE_COMING) return -EBUSY;
    if (try_module_get(mod))
        return 0;
    else
        return -ENOENT;
}

code:https://github.com/intel/gvt-linux/blob/bd950a66c7919d7121d2530f30984351534a96dc/kernel/module.c#L318

Quoted 7 lines

But unfortunately, this execution path begins in i915 module loading, at this time, the status of kernel module "i915" is MODULE_STATE_COMING until loading of "kvmgt" is finished. Thus a -EBUSY is always returned when kernel is trying to resolve symbols for "kvmgt".

This patch below might need re-work:

If the above test patch still fails, well.. that might be telling of another issue which is perhaps difficult to see at first glance. If resolve_symbol_wait() won't succeed until request_module("kvmgt") completes and if this means having kvmgt's init routine complete, that could end up in some longer chain or in the worst case a sort of circular dependency which is only implicated by module loading. It'd be really odd... but I cannot rule it out.

This is one reason I hinted that you should strive to not do much on a module's init. If you can punt work off for later that's best.

Luis

Quoted 55 lines

Author: Christoph Hellwig <[email protected]>
Date:   Wed Jul 21 17:53:38 2021 +0200

    drm/i915/gvt: move the gvt code into kvmgt.ko

    Instead of having an option to build the gvt code into the main i915 module, just move it into the kvmgt.ko module.  This only requires a new struct with three entries that the main i915 module needs to request before enabling VGPU passthrough operations.

    This also conveniently streamlines the GVT initialization and avoids the need for the global device pointer.

    Link:
http://patchwork.freedesktop.org/patch/msgid/[email protected]

Quoted 32 lines · Zhenyu Wang
Quoted 16 lines · Luis Chamberlain
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Zhenyu Wang

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Luis, do you know if there is a problem with a request_module from a driver ->probe routine that is probably called by a module_init function itself?

Generally no, but you can easily foot yourself in the feet by creating cross dependencies and not dealing with them properly. I'd make sure to keep module initialization as simple as possible, and run whatever takes more time asynchronously, then use a state machine to allow you to verify where you are in the initialization phase or query it or wait for a completion with a timeout.

Quoted 4 lines

It seems the code in question is getting some spring cleaning, and its unclear where the code is I can inspect. If there's a tree somewhere I can take a peak I'd be happy to review possible oddities that may stick out.

I tried to put current patches under test here: https://github.com/intel/gvt-linux/tree/gvt-staging
The issue can be produced with CONFIG_DRM_I915=m and CONFIG_DRM_I915_GVT_KVMGT=m.

Quoted 5 lines

My goto model for these sorts of problems is to abstract the issue *outside* of the driver in question and implement new selftests to try to reproduce. This serves two purposes, 1) helps with testing
2) may allow you to see the problem more clearly.

I'll see if can abstract that.

Thanks, Luis.

#54 lore raw
Quoted 69 lines · Luis Chamberlain
Quoted 6 lines · Zhi A

Hey guys:

After some investigation, I found the root cause this problem ("i915" module loading will be stuck with Christoph's refactor patches), which can be reproduced by building both i915 and kvmgt as kernel module and the loading i915.

Thanks for looking into this!

Quoted 6 lines

The root cause is: in Linux kernel loading, before a kernel module loading is finished, its symbols can not be reached by other module when resolving the symbols (even they can be found in /proc/kallsyms). Because the status of the kernel module is MODULE_STATE_COMING and resolve_symbol() from another kernel module will check this and return a -EBUSY.

Well, it would seem that way but...

Quoted 30 lines

In this case, before i915 loading is finished, the requested module "kvmgt" cannot reach the symbols in module i915. Thus it kept waiting and left message like below in the dmesg:

[  644.152021] kvmgt: gave up waiting for init of module i915. [  644.152039] kvmgt: Unknown symbol i915_gem_object_set_to_cpu_domain (err -16)
[  674.871409] kvmgt: gave up waiting for init of module i915. [  674.871427] kvmgt: Unknown symbol intel_ring_begin (err -16) [  705.590586] kvmgt: gave up waiting for init of module i915. [  705.590604] kvmgt: Unknown symbol i915_vma_move_to_active (err -16) [  736.310230] kvmgt: gave up waiting for init of module i915. [  736.310248] kvmgt: Unknown symbol shmem_unpin_map (err -16)
...

The error message is from execution path below:

kernel/module.c:

[i915 module loading] -> request_module("kvmgt")->[modprobe]->init_module("kvmgt")->load_module()->simplify_symbols()->resolve_symbol_wait():

static const struct kernel_symbol *
resolve_symbol_wait(struct module *mod,
            const struct load_info *info,
            const char *name)
{
    const struct kernel_symbol *ksym;
    char owner[MODULE_NAME_LEN];

Quoted 8 lines

    if (wait_event_interruptible_timeout(module_wq, !IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) || PTR_ERR(ksym) != -EBUSY,
                         30 * HZ) <= 0) {
        pr_warn("%s: gave up waiting for init of module %s.\n", mod->name, owner);

}

Commit 9bea7f23952d5 ("module: fix bne2 "gave up waiting for init of module libcrc32c") is worth reviewing. It dealt with a similar issue, and in particular it addressed the issue with -EBUSY being returned by ref_module().

And so, in theory that case should be dealt with in resolve_symbol_wait() already. And so can you try this just to verify something:

kernel/module.c +0 -0
index 40ec9a030eec..98f87cbb37de 100644

kernel/module.c resolve_symbol_wait(struct module *mod, · line 1465

Quoted 8 lines
kernel/module.c +1 -1
@@ -1459,7 +1459,7 @@ resolve_symbol_wait(struct module *mod,
  	if (wait_event_interruptible_timeout(module_wq,
  			!IS_ERR(ksym = resolve_symbol(mod, info, name, owner))
  			|| PTR_ERR(ksym) != -EBUSY,
-					     30 * HZ) <= 0) {
+					     160 * HZ) <= 0) {
  		pr_warn("%s: gave up waiting for init of module %s.\n",
  			mod->name, owner);
  	}

Hi Luis:

Thanks so much for the reply and patch.:)

I am afraid that this patch wouldn't work in this case as the request_module("kvmgt") happens in the init_module of i915. Before the initialization path is finished in i915, the i915 symbols are not available to be referenced. Unfortunately, It's matter of sequence, not of delay. :(

Quoted 36 lines
Quoted 21 lines

code:
https://github.com/intel/gvt-linux/blob/bd950a66c7919d7121d2530f30984351534a96dc/kernel/module.c#L1452

In resolve_symbol_wait(), it calls resolve_symbol() to resolve the symbols in "i915". In resolve_symbol() -> ref_module() -> strong_try_module_get(), it will check the status of the module which owns the symbol.

static inline int strong_try_module_get(struct module *mod) {
    BUG_ON(mod && mod->state == MODULE_STATE_UNFORMED); if (mod && mod->state == MODULE_STATE_COMING) return -EBUSY;
    if (try_module_get(mod))
        return 0;
    else
        return -ENOENT;
}

code:https://github.com/intel/gvt-linux/blob/bd950a66c7919d7121d2530f30984351534a96dc/kernel/module.c#L318

Quoted 7 lines

But unfortunately, this execution path begins in i915 module loading, at this time, the status of kernel module "i915" is MODULE_STATE_COMING until loading of "kvmgt" is finished. Thus a -EBUSY is always returned when kernel is trying to resolve symbols for "kvmgt".

This patch below might need re-work:

If the above test patch still fails, well.. that might be telling of another issue which is perhaps difficult to see at first glance. If resolve_symbol_wait() won't succeed until request_module("kvmgt") completes and if this means having kvmgt's init routine complete, that could end up in some longer chain or in the worst case a sort of circular dependency which is only implicated by module loading. It'd be really odd... but I cannot rule it out.

Quoted 2 lines

This is one reason I hinted that you should strive to not do much on a module's init. If you can punt work off for later that's best.

Yes. I was thinking of the possibility of putting off some work later so that we don't need to make a lot of changes. GVT-g needs to take a snapshot of GPU registers as the initial virtual states for other vGPUs, which requires the initialization happens at a certain early time of initialization of i915. I was thinking maybe we can take other patches from Christoph like "de-virtualize*" except this one because currently we have to maintain a TEST-ONLY patch on our tree to prevent i915 built as kernel module.

Zhi.

Quoted 55 lines

Luis

Quoted 53 lines

Author: Christoph Hellwig <[email protected]>
Date:   Wed Jul 21 17:53:38 2021 +0200

    drm/i915/gvt: move the gvt code into kvmgt.ko

    Instead of having an option to build the gvt code into the main i915 module, just move it into the kvmgt.ko module.  This only requires a new struct with three entries that the main i915 module needs to request before enabling VGPU passthrough operations.

    This also conveniently streamlines the GVT initialization and avoids the need for the global device pointer.

    Link:
http://patchwork.freedesktop.org/patch/msgid/[email protected]

Quoted 32 lines · Zhenyu Wang
Quoted 16 lines · Luis Chamberlain
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · Zhenyu Wang

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Luis, do you know if there is a problem with a request_module from a driver ->probe routine that is probably called by a module_init function itself?

Generally no, but you can easily foot yourself in the feet by creating cross dependencies and not dealing with them properly. I'd make sure to keep module initialization as simple as possible, and run whatever takes more time asynchronously, then use a state machine to allow you to verify where you are in the initialization phase or query it or wait for a completion with a timeout.

Quoted 4 lines

It seems the code in question is getting some spring cleaning, and its unclear where the code is I can inspect. If there's a tree somewhere I can take a peak I'd be happy to review possible oddities that may stick out.

I tried to put current patches under test here: https://github.com/intel/gvt-linux/tree/gvt-staging
The issue can be produced with CONFIG_DRM_I915=m and CONFIG_DRM_I915_GVT_KVMGT=m.

Quoted 5 lines

My goto model for these sorts of problems is to abstract the issue *outside* of the driver in question and implement new selftests to try to reproduce. This serves two purposes, 1) helps with testing
2) may allow you to see the problem more clearly.

I'll see if can abstract that.

Thanks, Luis.

#55 lore raw
Quoted 8 lines · Zhi A

Yes. I was thinking of the possibility of putting off some work later so that we don't need to make a lot of changes. GVT-g needs to take a snapshot of GPU registers as the initial virtual states for other vGPUs, which requires the initialization happens at a certain early time of initialization of i915. I was thinking maybe we can take other patches from Christoph like "de-virtualize*" except this one because currently we have to maintain a TEST-ONLY patch on our tree to prevent i915 built as kernel module.

How about just capture these registers in the main module/device and not try so hard to isolate it to the gvt stuff?

Jason

#56 lore raw
Quoted 10 lines · Jason Gunthorpe
Quoted 8 lines · Zhi A

Yes. I was thinking of the possibility of putting off some work later so that we don't need to make a lot of changes. GVT-g needs to take a snapshot of GPU registers as the initial virtual states for other vGPUs, which requires the initialization happens at a certain early time of initialization of i915. I was thinking maybe we can take other patches from Christoph like "de-virtualize*" except this one because currently we have to maintain a TEST-ONLY patch on our tree to prevent i915 built as kernel module.

Quoted 2 lines

How about just capture these registers in the main module/device and not try so hard to isolate it to the gvt stuff?

Hi Jason:

Thanks for the idea. I am not sure i915 guys would take this idea since that it's only for GVT-g, i915 doesn't use this at all. We need to take a snapshot of both PCI configuration space and MMIO registers before i915 driver starts to touch the HW.

One idea is we capture the registers in intel_gvt.c during the early initialization and do everything else when i915.ko is fully loaded. But how about dependence between i915.ko and kvmgt.ko? We cannot do request_module("kvmgt") in i915.ko.

Maybe Christoph can give more input on this and how we can deal with this? Before we figure out an solution, we have to pick that patch out since it blocks our pull request schedule.

Also I was thinking if moving gvt into kvmgt.ko is the right direction. It seems the module loading system in kernel is not designed for "module A loading module B, which needs symbols from module A, in the initialization path of module A".

Thanks,

Zhi.

Quoted 1 line

Jason

#57 lore raw
Quoted 14 lines · Zhi A
Quoted 10 lines · Jason Gunthorpe
Quoted 8 lines · Zhi A

Yes. I was thinking of the possibility of putting off some work later so that we don't need to make a lot of changes. GVT-g needs to take a snapshot of GPU registers as the initial virtual states for other vGPUs, which requires the initialization happens at a certain early time of initialization of i915. I was thinking maybe we can take other patches from Christoph like "de-virtualize*" except this one because currently we have to maintain a TEST-ONLY patch on our tree to prevent i915 built as kernel module.

Quoted 2 lines

How about just capture these registers in the main module/device and not try so hard to isolate it to the gvt stuff?

Quoted 6 lines

Hi Jason:

Thanks for the idea. I am not sure i915 guys would take this idea since that it's only for GVT-g, i915 doesn't use this at all. We need to take a snapshot of both PCI configuration space and MMIO registers before i915 driver starts to touch the HW.

Given the code is already linked into i915 I don't see there is much to object to here. It can remain conditional on the kernel parameter as today.

As a general philosophy this would all be much less strange if the mdev .ko is truely optional. It should be cleanly seperate from its base device and never request_module'd..

In this case auxiliary device might be a good option, have i915 create one and the mdev module be loaded against it.

In the mean time is there some shortcut to get this series to move ahead? Is patch 4 essential to the rest of the series?

A really awful hack would be to push the pci_driver_register into a WQ so that the request_module is guarenteed to not be part of the module_init callchain.

Quoted 4 lines

Also I was thinking if moving gvt into kvmgt.ko is the right direction. It seems the module loading system in kernel is not designed for "module A loading module B, which needs symbols from module A, in the initialization path of module A".

Of course not, that is a circular module dependency, it should not be that way. The SW layers need to be clean and orderly - meaning the i915 module needs to have the minimal amount of code to support the mdev module.

Jason

#58 lore raw
Quoted 31 lines · Jason Gunthorpe
Quoted 11 lines · Zhi A
Quoted 10 lines · Jason Gunthorpe
Quoted 8 lines · Zhi A

Yes. I was thinking of the possibility of putting off some work later so that we don't need to make a lot of changes. GVT-g needs to take a snapshot of GPU registers as the initial virtual states for other vGPUs, which requires the initialization happens at a certain early time of initialization of i915. I was thinking maybe we can take other patches from Christoph like "de-virtualize*" except this one because currently we have to maintain a TEST-ONLY patch on our tree to prevent i915 built as kernel module.

Quoted 8 lines
Quoted 2 lines

How about just capture these registers in the main module/device and not try so hard to isolate it to the gvt stuff?

Hi Jason:

Thanks for the idea. I am not sure i915 guys would take this idea since that it's only for GVT-g, i915 doesn't use this at all. We need to take a snapshot of both PCI configuration space and MMIO registers before i915 driver starts to touch the HW.

Given the code is already linked into i915 I don't see there is much to object to here. It can remain conditional on the kernel parameter as today.

As a general philosophy this would all be much less strange if the mdev .ko is truely optional. It should be cleanly seperate from its base device and never request_module'd..

In this case auxiliary device might be a good option, have i915 create one and the mdev module be loaded against it.

Quoted 6 lines

In the mean time is there some shortcut to get this series to move ahead? Is patch 4 essential to the rest of the series?

A really awful hack would be to push the pci_driver_register into a WQ so that the request_module is guarenteed to not be part of the module_init callchain.

Hi Jason and folks:

Thanks so much for the ideas. That sounds great and I was keeping thinking how to make progress on this. How about we do like this: We don't do request_module("kvmgt") in i915.ko, which resolves the circular module dependency. We keep the code of doing snapshot of registers in intel_gvt.c. When i915.enable_gvt=1, we do the snapshot. Then we export functions for kvmgt.ko in intel_gvt.c to check if gvt in i915 is enabled or not and get the snapshots.

How does that sounds? I just need to write another patch and put it on top of Christoph's series.

Thanks,

Zhi.

Quoted 10 lines
Quoted 4 lines

Also I was thinking if moving gvt into kvmgt.ko is the right direction. It seems the module loading system in kernel is not designed for "module A loading module B, which needs symbols from module A, in the initialization path of module A".

Of course not, that is a circular module dependency, it should not be that way. The SW layers need to be clean and orderly - meaning the i915 module needs to have the minimal amount of code to support the mdev module.

Jason

#59 lore raw

Hi folks:

It seems we haven't reached a possible solution of this refactor patch series. The current patch series needs to be re-worked because of the module/symbol dependency(The root cause has been discussed in another email). I have to get them off from our gvt-next repo so that we can continue our development and pull-request to upstream. Thanks so much for the patch and the discussion.

Thanks,
Zhi.

Quoted 74 lines · Zhi A
Quoted 36 lines · Jason Gunthorpe
Quoted 16 lines · Zhi A
Quoted 15 lines · Jason Gunthorpe
Quoted 13 lines · Zhi A

Yes. I was thinking of the possibility of putting off some work later so
that we don't need to make a lot of changes. GVT-g needs to take a snapshot of GPU registers as the initial virtual states for other vGPUs,
which requires the initialization happens at a certain early time of initialization of i915. I was thinking maybe we can take other patches
from Christoph like "de-virtualize*" except this one because currently
we have to maintain a TEST-ONLY patch on our tree to prevent i915 built
as kernel module.

Quoted 8 lines
Quoted 2 lines

How about just capture these registers in the main module/device and not try so hard to isolate it to the gvt stuff?

Hi Jason:

Thanks for the idea. I am not sure i915 guys would take this idea since that it's only for GVT-g, i915 doesn't use this at all. We need to take a snapshot of both PCI configuration space and MMIO registers before i915 driver starts to touch the HW.

Given the code is already linked into i915 I don't see there is much to object to here. It can remain conditional on the kernel parameter as today.

As a general philosophy this would all be much less strange if the mdev .ko is truely optional. It should be cleanly seperate from its base device and never request_module'd..

In this case auxiliary device might be a good option, have i915 create one and the mdev module be loaded against it.

Quoted 6 lines

In the mean time is there some shortcut to get this series to move ahead? Is patch 4 essential to the rest of the series?

A really awful hack would be to push the pci_driver_register into a WQ so that the request_module is guarenteed to not be part of the module_init callchain.

Hi Jason and folks:

Thanks so much for the ideas. That sounds great and I was keeping thinking how to make progress on this. How about we do like this: We don't do request_module("kvmgt") in i915.ko, which resolves the circular module dependency. We keep the code of doing snapshot of registers in intel_gvt.c. When i915.enable_gvt=1, we do the snapshot. Then we export functions for kvmgt.ko in intel_gvt.c to check if gvt in i915 is enabled or not and get the snapshots.

How does that sounds? I just need to write another patch and put it on top of Christoph's series.

Thanks,

Zhi.

Quoted 11 lines
Quoted 5 lines

Also I was thinking if moving gvt into kvmgt.ko is the right direction. It seems the module loading system in kernel is not designed for "module
A loading module B, which needs symbols from module A, in the initialization path of module A".

Of course not, that is a circular module dependency, it should not be that way. The SW layers need to be clean and orderly - meaning the i915 module needs to have the minimal amount of code to support the mdev module.

Jason

#60 lore raw
In reply to Wang, Zhi A
Quoted 10 lines · Zhi A

Thanks for the idea. I am not sure i915 guys would take this idea since that it's only for GVT-g, i915 doesn't use this at all. We need to take a snapshot of both PCI configuration space and MMIO registers before i915 driver starts to touch the HW.

One idea is we capture the registers in intel_gvt.c during the early initialization and do everything else when i915.ko is fully loaded. But how about dependence between i915.ko and kvmgt.ko? We cannot do request_module("kvmgt") in i915.ko.

Quoted 8 lines

Maybe Christoph can give more input on this and how we can deal with this? Before we figure out an solution, we have to pick that patch out since it blocks our pull request schedule.

Also I was thinking if moving gvt into kvmgt.ko is the right direction. It seems the module loading system in kernel is not designed for "module A loading module B, which needs symbols from module A, in the initialization path of module A".

I have a few idea on how to sort this "deadlock" out. But I'm completely swamped until the end of next week, so I won't get to anything before that.

#61 lore raw
In reply to Christoph Hellwig
Quoted 24 lines · Christoph Hellwig
Quoted 4 lines · Zhenyu Wang

I'm working on below patch to resolve this. But I met a weird issue in case when building i915 as module and also kvmgt module, it caused busy wait on request_module("kvmgt") when boot, it doesn't happen if building i915 into kernel. I'm not sure what could be the reason?

Luis, do you know if there is a problem with a request_module from a driver ->probe routine that is probably called by a module_init function itself?

In the meantime I'll try to reproduce it locally, but I always had a hard time getting useful results out of a modular i915, especially when combined with module paramters. (no blame on i915, just the problem with modules needed early on).

Quoted 9 lines
Quoted 8 lines

But the problem I see is that after moving gvt device model (gvt/*.c except kvmgt.c) into kvmgt module, we'll have issue with initial mmio state which current gvt relies on, that is in design supposed to get initial HW state before i915 driver has taken any operation. Before we can ensure that, I think we may only remove MPT part first but still keep gvt device model as part of i915 with config. I'll try to split that out.

Quoted 8 lines
Quoted 3 lines

Sorry I misread the code that as we always request kvmgt module when gvt init, so it should still apply original method that this isn't a problem. Our current validation result has shown no regression as well.

What does initial mmio state mean? This is something new to me. But as you said in this mail unless I missed something very big it should work the same as before.

It's gvt internal track for all gfx mmio state, and yes with your current change it should still work as before.

Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/gt/intel_context.h +1 -1
-static inline void intel_context_unpin(struct intel_context *ce)
+static inline void _intel_context_unpin(struct intel_context *ce)
 {
 	if (!ce->ops->sched_disable) {
 		__intel_context_do_unpin(ce, 1);
@@ -150,6 +150,7 @@ static inline void intel_context_unpin(struct intel_context *ce)
Quoted 8 lines

drivers/gpu/drm/i915/gt/intel_context.h static inline void intel_context_unpin(struct intel_context *ce) · line 153

Quoted 4 lines
drivers/gpu/drm/i915/gt/intel_context.h +1 -0
 		}
 	}
 }
+void intel_context_unpin(struct intel_context *ce);

Looking at intel_context_unpin/_intel_context_unpin is there really a need to have this inline to start with? It don't see much the compiler could optimize by inlining it.

I'll send patch to i915 for this, and get more comments there.

thanks

#62 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for refactor the i915 GVT support (rev2)

In reply to Jason Gunthorpe
== Series Details ==

== Series Details ==

Series: refactor the i915 GVT support (rev2)
URL : https://patchwork.freedesktop.org/series/93816/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
6ed5d9205804 refactor the i915 GVT support
-:48: WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#48: 
Quoted 1 line

request_module("kvmgt")->[modprobe]->init_module("kvmgt")->load_module()->simplify_symbols()->resolve_symbol_wait():

-:67: ERROR:GIT_COMMIT_ID: Please use git commit description style 'commit <12+ chars of sha1> ("<title line>")' - ie: 'Commit 9bea7f23952d ("module: fix bne2 "gave up waiting for init of module libcrc32c"")' #67:
Commit 9bea7f23952d5 ("module: fix bne2 "gave up waiting for init of
module libcrc32c") is worth reviewing. It dealt with a similar issue,

-:185: ERROR:MISSING_SIGN_OFF: Missing Signed-off-by: line(s)

total: 2 errors, 1 warnings, 0 checks, 8 lines checked

#63 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for refactor the i915 GVT support (rev2)

In reply to Jason Gunthorpe
== Series Details ==

== Series Details ==

Series: refactor the i915 GVT support (rev2)
URL : https://patchwork.freedesktop.org/series/93816/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10654 -> Patchwork_21176
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/index.html

Changes
-------

No changes found

Participating hosts (45 -> 35)
------------------------------

Missing (10): fi-kbl-soraka fi-ilk-m540 bat-adls-5 fi-hsw-4200u fi-bsw-cyan bat-adlp-4 fi-ctg-p8600 fi-tgl-y bat-jsl-2 bat-jsl-1

Build changes
-------------

* Linux: CI_DRM_10654 -> Patchwork_21176

CI-20190529: 20190529
CI_DRM_10654: 7006e15e0a109ce092026c4b576fe8a206e8b756 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6224: 2f4e6430a97f04284d1cafb1479e7c1b0b2d596a @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21176: 6ed5d9205804044b34a03ffb8f235fa101689f17 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

6ed5d9205804 refactor the i915 GVT support

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/index.html

#64 lore raw

[Intel-gfx] ✓ Fi.CI.IGT: success for refactor the i915 GVT support (rev2)

In reply to Jason Gunthorpe
== Series Details ==

== Series Details ==

Series: refactor the i915 GVT support (rev2)
URL : https://patchwork.freedesktop.org/series/93816/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_10654_full -> Patchwork_21176_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_21176_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@feature_discovery@display-3x:
- shard-glk: NOTRUN -> [SKIP][1] ([fdo#109271]) +39 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk3/igt@[email protected]

* igt@gem_create@create-massive:
- shard-snb: NOTRUN -> [DMESG-WARN][2] ([i915#3002])
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-snb7/igt@[email protected]
- shard-tglb: NOTRUN -> [DMESG-WARN][3] ([i915#3002])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb6/igt@[email protected]

* igt@gem_ctx_persistence@legacy-engines-mixed:
- shard-snb: NOTRUN -> [SKIP][4] ([fdo#109271] / [i915#1099]) +2 similar issues
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-snb6/igt@[email protected]

* igt@gem_eio@in-flight-suspend:
- shard-kbl: NOTRUN -> [DMESG-WARN][5] ([i915#180])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]

* igt@gem_exec_fair@basic-deadline:
- shard-glk: NOTRUN -> [FAIL][6] ([i915#2846])
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk3/igt@[email protected]

* igt@gem_exec_fair@basic-none-vip@rcs0:
- shard-kbl: [PASS][7] -> [FAIL][8] ([i915#2842])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl1/igt@gem_exec_fair@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@vcs1:
- shard-iclb: NOTRUN -> [FAIL][9] ([i915#2842])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb4/igt@gem_exec_fair@[email protected]

* igt@gem_huc_copy@huc-copy:
- shard-tglb: NOTRUN -> [SKIP][10] ([i915#2190])
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb6/igt@[email protected]

* igt@gem_pread@exhaustion:
- shard-apl: NOTRUN -> [WARN][11] ([i915#2658])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl6/igt@[email protected]

* igt@gen9_exec_parse@batch-zero-length:
- shard-tglb: NOTRUN -> [SKIP][12] ([i915#2856])
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@i915_module_load@reload:
- shard-skl: [PASS][13] -> [DMESG-WARN][14] ([i915#1982])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl6/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl7/igt@[email protected]

* igt@i915_pm_sseu@full-enable:
- shard-tglb: NOTRUN -> [SKIP][15] ([fdo#109288])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb7/igt@[email protected]

* igt@kms_addfb_basic@invalid-smem-bo-on-discrete:
- shard-tglb: NOTRUN -> [SKIP][16] ([i915#3826])
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@kms_atomic@plane-primary-overlay-mutable-zpos:
- shard-tglb: NOTRUN -> [SKIP][17] ([i915#404])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@kms_big_fb@linear-64bpp-rotate-90:
- shard-tglb: NOTRUN -> [SKIP][18] ([fdo#111614])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb3/igt@[email protected]

* igt@kms_big_fb@x-tiled-max-hw-stride-64bpp-rotate-180-hflip:
- shard-glk: NOTRUN -> [SKIP][19] ([fdo#109271] / [i915#3777])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk3/igt@[email protected]

* igt@kms_big_fb@y-tiled-max-hw-stride-64bpp-rotate-180-hflip:
- shard-kbl: NOTRUN -> [SKIP][20] ([fdo#109271] / [i915#3777]) +1 similar issue
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]

* igt@kms_big_fb@yf-tiled-max-hw-stride-64bpp-rotate-180:
- shard-tglb: NOTRUN -> [SKIP][21] ([fdo#111615])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@kms_ccs@pipe-b-bad-aux-stride-y_tiled_gen12_rc_ccs_cc:
- shard-skl: NOTRUN -> [SKIP][22] ([fdo#109271] / [i915#3886])
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl4/igt@kms_ccs@pipe-b-bad-aux-stride-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_ccs@pipe-b-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc:
- shard-apl: NOTRUN -> [SKIP][23] ([fdo#109271] / [i915#3886]) +7 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl7/igt@kms_ccs@pipe-b-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_ccs@pipe-c-crc-primary-basic-y_tiled_gen12_rc_ccs_cc:
- shard-kbl: NOTRUN -> [SKIP][24] ([fdo#109271] / [i915#3886]) +1 similar issue
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@kms_ccs@pipe-c-crc-primary-basic-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc:
- shard-glk: NOTRUN -> [SKIP][25] ([fdo#109271] / [i915#3886]) +1 similar issue
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk3/igt@kms_ccs@pipe-c-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_ccs@pipe-c-missing-ccs-buffer-yf_tiled_ccs:
- shard-tglb: NOTRUN -> [SKIP][26] ([i915#3689]) +6 similar issues
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb3/igt@kms_ccs@pipe-c-missing-ccs-buffer-yf_tiled_ccs.html

* igt@kms_chamelium@hdmi-edid-change-during-suspend:
- shard-apl: NOTRUN -> [SKIP][27] ([fdo#109271] / [fdo#111827]) +16 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl3/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd:
- shard-glk: NOTRUN -> [SKIP][28] ([fdo#109271] / [fdo#111827]) +3 similar issues
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk3/igt@[email protected]

* igt@kms_chamelium@vga-hpd-after-suspend:
- shard-skl: NOTRUN -> [SKIP][29] ([fdo#109271] / [fdo#111827]) +1 similar issue
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl4/igt@[email protected]

* igt@kms_color_chamelium@pipe-a-ctm-blue-to-red:
- shard-snb: NOTRUN -> [SKIP][30] ([fdo#109271] / [fdo#111827]) +16 similar issues
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-snb7/igt@[email protected]

* igt@kms_color_chamelium@pipe-b-gamma:
- shard-kbl: NOTRUN -> [SKIP][31] ([fdo#109271] / [fdo#111827])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]

* igt@kms_color_chamelium@pipe-d-ctm-limited-range:
- shard-tglb: NOTRUN -> [SKIP][32] ([fdo#109284] / [fdo#111827]) +7 similar issues
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@kms_content_protection@atomic:
- shard-apl: NOTRUN -> [TIMEOUT][33] ([i915#1319])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl2/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-size-change:
- shard-snb: NOTRUN -> [FAIL][34] ([i915#4024])
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-snb6/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-32x10-rapid-movement:
- shard-tglb: NOTRUN -> [SKIP][35] ([i915#3359]) +1 similar issue
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-tglb: [PASS][36] -> [INCOMPLETE][37] ([i915#2411] / [i915#456])
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-tglb2/igt@[email protected]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb7/igt@[email protected]

* igt@kms_cursor_crc@pipe-d-cursor-512x170-offscreen:
- shard-tglb: NOTRUN -> [SKIP][38] ([fdo#109279] / [i915#3359]) +1 similar issue
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb6/igt@[email protected]

* igt@kms_cursor_edge_walk@pipe-d-128x128-right-edge:
- shard-snb: NOTRUN -> [SKIP][39] ([fdo#109271]) +339 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-snb7/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
- shard-skl: [PASS][40] -> [FAIL][41] ([i915#2346])
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl6/igt@[email protected]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl2/igt@[email protected]

* igt@kms_cursor_legacy@pipe-d-torture-bo:
- shard-kbl: NOTRUN -> [SKIP][42] ([fdo#109271] / [i915#533])
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]

* igt@kms_fbcon_fbt@fbc-suspend:
- shard-kbl: [PASS][43] -> [INCOMPLETE][44] ([i915#155] / [i915#180] / [i915#636])
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl6/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl3/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank-interruptible@ab-hdmi-a1-hdmi-a2:
- shard-glk: [PASS][45] -> [FAIL][46] ([i915#2122])
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-glk9/igt@kms_flip@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk4/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible@c-dp1:
- shard-apl: [PASS][47] -> [DMESG-WARN][48] ([i915#180]) +1 similar issue
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-apl3/igt@kms_flip@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl7/igt@kms_flip@[email protected]

* igt@kms_flip_scaled_crc@flip-32bpp-ytile-to-32bpp-ytileccs:
- shard-tglb: NOTRUN -> [SKIP][49] ([i915#2587])
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-cur-indfb-draw-blt:
- shard-kbl: NOTRUN -> [SKIP][50] ([fdo#109271]) +27 similar issues
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-2p-primscrn-cur-indfb-onoff:
- shard-tglb: NOTRUN -> [SKIP][51] ([fdo#111825]) +14 similar issues
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@kms_hdr@bpc-switch-suspend:
- shard-skl: [PASS][52] -> [FAIL][53] ([i915#1188])
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl2/igt@[email protected]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl2/igt@[email protected]

* igt@kms_hdr@static-swap:
- shard-tglb: NOTRUN -> [SKIP][54] ([i915#1187])
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb3/igt@[email protected]

* igt@kms_invalid_dotclock:
- shard-tglb: NOTRUN -> [SKIP][55] ([fdo#110577])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@kms_invalid_dotclock.html

* igt@kms_multipipe_modeset@basic-max-pipe-crc-check:
- shard-tglb: NOTRUN -> [SKIP][56] ([i915#1839])
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-kbl: [PASS][57] -> [DMESG-WARN][58] ([i915#180]) +3 similar issues
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl4/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl7/igt@[email protected]
- shard-tglb: [PASS][59] -> [INCOMPLETE][60] ([i915#456])
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-tglb6/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb7/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
- shard-tglb: [PASS][61] -> [INCOMPLETE][62] ([i915#2828] / [i915#456])
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-tglb8/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb7/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-alpha-transparent-fb:
- shard-apl: NOTRUN -> [FAIL][63] ([i915#265])
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl3/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-b-constant-alpha-max:
- shard-glk: NOTRUN -> [FAIL][64] ([fdo#108145] / [i915#265])
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk3/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-max:
- shard-apl: NOTRUN -> [FAIL][65] ([fdo#108145] / [i915#265])
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl3/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: [PASS][66] -> [FAIL][67] ([fdo#108145] / [i915#265]) +1 similar issue
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl7/igt@[email protected]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl3/igt@[email protected]

* igt@kms_plane_cursor@pipe-d-overlay-size-256:
- shard-iclb: NOTRUN -> [SKIP][68] ([fdo#109278])
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb2/igt@[email protected]

* igt@kms_plane_lowres@pipe-c-tiling-yf:
- shard-tglb: NOTRUN -> [SKIP][69] ([fdo#112054])
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb6/igt@[email protected]

* igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area-1:
- shard-tglb: NOTRUN -> [SKIP][70] ([i915#2920]) +1 similar issue
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb3/igt@[email protected]

* igt@kms_psr2_sf@overlay-primary-update-sf-dmg-area-4:
- shard-apl: NOTRUN -> [SKIP][71] ([fdo#109271] / [i915#658]) +1 similar issue
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl3/igt@[email protected]

* igt@kms_psr@psr2_sprite_mmap_cpu:
- shard-iclb: [PASS][72] -> [SKIP][73] ([fdo#109441]) +1 similar issue
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-iclb2/igt@kms_psr@psr2_sprite_mmap_cpu.html
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb8/igt@kms_psr@psr2_sprite_mmap_cpu.html

* igt@kms_vblank@pipe-d-query-forked-busy:
- shard-skl: NOTRUN -> [SKIP][74] ([fdo#109271]) +15 similar issues
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl9/igt@[email protected]

* igt@kms_vblank@pipe-d-wait-idle:
- shard-apl: NOTRUN -> [SKIP][75] ([fdo#109271] / [i915#533]) +1 similar issue
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl7/igt@[email protected]

* igt@kms_vrr@flip-suspend:
- shard-tglb: NOTRUN -> [SKIP][76] ([fdo#109502])
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb7/igt@[email protected]

* igt@kms_writeback@writeback-check-output:
- shard-apl: NOTRUN -> [SKIP][77] ([fdo#109271] / [i915#2437])
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl7/igt@[email protected]

* igt@kms_writeback@writeback-pixel-formats:
- shard-tglb: NOTRUN -> [SKIP][78] ([i915#2437])
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@[email protected]

* igt@nouveau_crc@pipe-b-ctx-flip-skip-current-frame:
- shard-apl: NOTRUN -> [SKIP][79] ([fdo#109271]) +157 similar issues
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl2/igt@[email protected]

* igt@nouveau_crc@pipe-c-source-outp-inactive:
- shard-tglb: NOTRUN -> [SKIP][80] ([i915#2530]) +1 similar issue
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb7/igt@[email protected]

* igt@perf@polling-small-buf:
- shard-skl: [PASS][81] -> [FAIL][82] ([i915#1722])
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl9/igt@[email protected]
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl4/igt@[email protected]

* igt@prime_nv_pcopy@test3_5:
- shard-tglb: NOTRUN -> [SKIP][83] ([fdo#109291])
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@prime_nv_pcopy@test3_5.html

* igt@runner@aborted:
- shard-tglb: NOTRUN -> [FAIL][84] ([i915#3002])
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb6/igt@[email protected]
- shard-snb: NOTRUN -> [FAIL][85] ([i915#3002])
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-snb7/igt@[email protected]

* igt@sysfs_clients@fair-1:
- shard-apl: NOTRUN -> [SKIP][86] ([fdo#109271] / [i915#2994]) +2 similar issues
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl7/igt@[email protected]

* igt@sysfs_clients@recycle-many:
- shard-kbl: NOTRUN -> [SKIP][87] ([fdo#109271] / [i915#2994])
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]

* igt@sysfs_clients@split-50:
- shard-tglb: NOTRUN -> [SKIP][88] ([i915#2994])
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb6/igt@[email protected]

#### Possible fixes ####

* igt@feature_discovery@psr2:
- shard-iclb: [SKIP][89] ([i915#658]) -> [PASS][90]
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-iclb1/igt@[email protected]
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb2/igt@[email protected]

* igt@gem_ctx_isolation@preservation-s3@bcs0:
- shard-tglb: [INCOMPLETE][91] ([i915#456]) -> [PASS][92] +1 similar issue
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-tglb7/igt@gem_ctx_isolation@[email protected]
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb5/igt@gem_ctx_isolation@[email protected]

* igt@gem_eio@in-flight-contexts-immediate:
- shard-tglb: [TIMEOUT][93] ([i915#3063]) -> [PASS][94]
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-tglb3/igt@[email protected]
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb7/igt@[email protected]

* igt@gem_exec_fair@basic-none@rcs0:
- shard-glk: [FAIL][95] ([i915#2842]) -> [PASS][96]
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-glk2/igt@gem_exec_fair@[email protected]
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk7/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vecs0:
- shard-kbl: [FAIL][97] ([i915#2842]) -> [PASS][98] +1 similar issue
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl2/igt@gem_exec_fair@[email protected]
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl4/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-throttle@rcs0:
- shard-iclb: [FAIL][99] ([i915#2849]) -> [PASS][100]
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-iclb7/igt@gem_exec_fair@[email protected]
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb1/igt@gem_exec_fair@[email protected]

* igt@gem_mmap_wc@copy:
- shard-skl: [DMESG-WARN][101] ([i915#1982]) -> [PASS][102] +1 similar issue
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl5/igt@[email protected]
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl5/igt@[email protected]

* igt@i915_suspend@fence-restore-tiled2untiled:
- shard-apl: [DMESG-WARN][103] ([i915#180]) -> [PASS][104] +1 similar issue
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-apl6/igt@[email protected]
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-apl2/igt@[email protected]

* igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size:
- shard-skl: [FAIL][105] ([i915#2346] / [i915#533]) -> [PASS][106]
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl5/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl5/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions-varying-size.html

* igt@kms_flip@2x-flip-vs-expired-vblank@ab-hdmi-a1-hdmi-a2:
- shard-glk: [FAIL][107] ([i915#2122]) -> [PASS][108]
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-glk8/igt@kms_flip@[email protected]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-glk1/igt@kms_flip@[email protected]

* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [FAIL][109] ([i915#1188]) -> [PASS][110]
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl8/igt@[email protected]
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl8/igt@[email protected]

* igt@kms_hdr@bpc-switch-suspend:
- shard-kbl: [DMESG-WARN][111] ([i915#180]) -> [PASS][112] +1 similar issue
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl6/igt@[email protected]
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]

* igt@kms_plane@plane-panning-bottom-right-suspend@pipe-a-planes:
- shard-tglb: [INCOMPLETE][113] ([i915#4182]) -> [PASS][114]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-tglb7/igt@kms_plane@[email protected]
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-tglb6/igt@kms_plane@[email protected]

* igt@kms_psr@psr2_cursor_render:
- shard-iclb: [SKIP][115] ([fdo#109441]) -> [PASS][116]
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-iclb1/igt@kms_psr@psr2_cursor_render.html
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb2/igt@kms_psr@psr2_cursor_render.html

#### Warnings ####

* igt@i915_pm_rc6_residency@rc6-fence:
- shard-iclb: [WARN][117] ([i915#1804] / [i915#2684]) -> [WARN][118] ([i915#2684])
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-iclb6/igt@[email protected]
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb5/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area-2:
- shard-iclb: [SKIP][119] ([i915#658]) -> [SKIP][120] ([i915#2920]) +3 similar issues
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-iclb5/igt@[email protected]
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb2/igt@[email protected]

* igt@kms_psr2_sf@plane-move-sf-dmg-area-3:
- shard-iclb: [SKIP][121] ([i915#2920]) -> [SKIP][122] ([i915#658]) +1 similar issue
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-iclb2/igt@[email protected]
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-iclb3/igt@[email protected]

* igt@runner@aborted:
- shard-kbl: ([FAIL][123], [FAIL][124], [FAIL][125], [FAIL][126], [FAIL][127], [FAIL][128], [FAIL][129]) ([fdo#109271] / [i915#1436] / [i915#180] / [i915#1814] / [i915#3002] / [i915#3363]) -> ([FAIL][130], [FAIL][131], [FAIL][132], [FAIL][133], [FAIL][134], [FAIL][135], [FAIL][136], [FAIL][137], [FAIL][138], [FAIL][139], [FAIL][140]) ([i915#1436] / [i915#180] / [i915#1814] / [i915#3002] / [i915#3363] / [i915#602] / [i915#92])
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl3/igt@[email protected]
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl1/igt@[email protected]
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl2/igt@[email protected]
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl1/igt@[email protected]
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl6/igt@[email protected]
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl6/igt@[email protected]
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-kbl7/igt@[email protected]
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl7/igt@[email protected]
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl4/igt@[email protected]
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl3/igt@[email protected]
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl7/igt@[email protected]
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl3/igt@[email protected]
[137]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl1/igt@[email protected]
[138]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl3/igt@[email protected]
[139]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl1/igt@[email protected]
[140]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-kbl6/igt@[email protected]
- shard-skl: ([FAIL][141], [FAIL][142]) ([i915#1814] / [i915#2029] / [i915#3002] / [i915#3363]) -> [FAIL][143] ([i915#3002] / [i915#3363])
[141]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl3/igt@[email protected]
[142]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_10654/shard-skl8/igt@[email protected]
[143]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/shard-skl8/igt@[email protected]

### Piglit changes ###

#### Issues hit ####

* [email protected]@execution@fs-dfdx-accuracy:
- pig-kbl-iris: NOTRUN -> [WARN][144] ([i915#3105]) +3 similar issues
[144]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/pig-kbl-iris/[email protected]@[email protected]

* [email protected]@execution@tex-miplevel-selection textureoffset 2darrayshadow:
- pig-kbl-iris: NOTRUN -> [FAIL][145] ([i915#3105]) +6 similar issues
[145]: None

* [email protected]@execution@geometry@clip-distance-out-values:
- pig-kbl-iris: NOTRUN -> [FAIL][146] ([i915#3045])
[146]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/pig-kbl-iris/spe

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21176/index.html

#65 lore raw
In reply to Jason Gunthorpe
Quoted 5 lines · Jason Gunthorpe
Quoted 3 lines · Zhi A

I guess those APIs you were talking about are KVM-only. For other hypervisors, e.g. Xen, ARCN cannot use the APIs you mentioned. Not sure if you have already noticed that VFIO is KVM-only right now.

Quoted 7 lines

There is very little hard connection between VFIO and KVM, so no, I don't think that is completely true.

In an event, an in-tree version of other hypervisor support for GVT needs to go through enabling VFIO support so that the existing API multiplexers we have can be used properly, not adding a shim layer trying to recreate VFIO inside a GPU driver.

We were delivering the presentation of GVT-g in Xen summit 2018 and we were thinking and talking about supporting VFIO in Xen during the presentation (the video can be found from Youtube). But we didn't see any motiviation from the Xen community to adopt it.

If people take a look into the code in QEMU, in the PCI-passthrough part, Xen is actually not using VFIO even nowadays. We would be glad to see someone can influence on that part, especically making all the in-kernel hypervisor to use VFIO in PCI-passthrough and supporting mdev. That would be a huge benefit for all the users.

Quoted 17 lines
Quoted 6 lines

GVT-g is designed for many hypervisors not only KVM. In the design, we implemented an abstraction layer for different hypervisors. You can check the link in the previous email which has an example of how the MPT module "xengt" supports GVT-g running under Xen. For example, injecting a msi in VFIO/KVM is via playing with eventfd. But in Xen, we need to issue a hypercall from Dom0.

This is obviously bad design, Xen should plug into the standardized eventfd scheme as well and trigger its hypercall this way. Then it can integrate with the existing VFIO interrupt abstraction infrastructure.

Quoted 1 line

others, like querying mappings between GFN and HFN.

This should be done through VFIO containers, there is nothing KVM specific there.

Quoted 3 lines

As you can see, to survive from this situation, we have to rely on an abstraction layer so that we can prevent introducing coding blocks like in the core logic:

Quoted 6 lines

No, you have to fix the abstractions we already have to support the matrix of things you care about. If this can't be done then maybe we can add new abstractions, but abstractions like this absoultely should not be done inside drivers.

Jason

That's a good point and we were actually thinking about this before and I believe that's the correct direction. But just like the situation mentioned above, it would be nice if people can really put a great influence on all in-kernel hypervisors to use VFIO which can really benefit all the users.

For now, we are just going to take christoph's patches.

Zhi

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#66 lore raw

[Intel-gfx] ✗ Fi.CI.BUILD: failure for refactor the i915 GVT support

In reply to Jason Gunthorpe
== Series Details ==

== Series Details ==

Series: refactor the i915 GVT support
URL : https://patchwork.freedesktop.org/series/93816/
State : failure

== Summary ==

Patch is empty.
When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

#67 lore raw
In reply to Wang, Zhi A
Quoted 2 lines · Zhi A

But it's hard for some customers to contribute their own "hypervisor" module to the upstream Linux kernel.

What prevents them from doing this? We will take any code that meets our standards, what format is this external code in?

Quoted 6 lines

I am thinking what would be a
better solution here? The MPT layer in the kernel helps a lot for customers, but only one open-source "hypervisor" module is there in the kernel. That can confuse people which don't know the story. One thing I was thinking is to put a document about the background and more description in the MPT headers. So it won't confuse more people.

If no one is using it in the kernel, it needs to be removed. No abstractions should be added that are not required by the in-tree code.

So this series should be accepted, _or_ the external code needs to be submitted for inclusion.

thanks,

greg k-h
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx