drm/i915/gvt: fix kvmgt_mpt symbol export issue

Submitted by hang.yuan@linux.intel.com on Nov. 20, 2018, 9:09 a.m.

Details

Message ID 1542704953-8402-1-git-send-email-hang.yuan@linux.intel.com
State New
Series "drm/i915/gvt: fix kvmgt_mpt symbol export issue"
Headers show

Commit Message

hang.yuan@linux.intel.com Nov. 20, 2018, 9:09 a.m.
From: Hang Yuan <hang.yuan@linux.intel.com>

Update gvt to reference kvmgt_mpt directly. This prevents the
exported symbol kvmgt_mpt being dropped when kernel config
CONFIG_TRIM_UNUSED_KSYMS is set.

Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com>
---
 drivers/gpu/drm/i915/gvt/gvt.c | 7 +------
 drivers/gpu/drm/i915/gvt/gvt.h | 4 ++++
 2 files changed, 5 insertions(+), 6 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
index 733a2a0..a176e88 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.c
+++ b/drivers/gpu/drm/i915/gvt/gvt.c
@@ -216,8 +216,7 @@  int intel_gvt_init_host(void)
 	} else {
 #if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
 		/* not in Xen. Try KVMGT */
-		intel_gvt_host.mpt = try_then_request_module(
-				symbol_get(kvmgt_mpt), "kvmgt");
+		intel_gvt_host.mpt = &kvmgt_mpt;
 		intel_gvt_host.hypervisor_type = INTEL_GVT_HYPERVISOR_KVM;
 #endif
 	}
@@ -466,7 +465,3 @@  int intel_gvt_init_device(struct drm_i915_private *dev_priv)
 	kfree(gvt);
 	return ret;
 }
-
-#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
-MODULE_SOFTDEP("pre: kvmgt");
-#endif
diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h
index 31f6cdb..a3c9fa4 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.h
+++ b/drivers/gpu/drm/i915/gvt/gvt.h
@@ -65,6 +65,10 @@  struct intel_gvt_host {
 
 extern struct intel_gvt_host intel_gvt_host;
 
+#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
+extern struct intel_gvt_mpt kvmgt_mpt;
+#endif
+
 /* Describe per-platform limitations. */
 struct intel_gvt_device_info {
 	u32 max_support_vgpus;

Comments

gvt@intel.com Nov. 20, 2018, 11:05 a.m.

Zhenyu Wang Nov. 22, 2018, 6:16 a.m.
On 2018.11.20 17:09:13 +0800, hang.yuan@linux.intel.com wrote:
> From: Hang Yuan <hang.yuan@linux.intel.com>
> 
> Update gvt to reference kvmgt_mpt directly. This prevents the
> exported symbol kvmgt_mpt being dropped when kernel config
> CONFIG_TRIM_UNUSED_KSYMS is set.
>

Now I think we could fix it in better way, although we tried to split
kvmgt module but it's really not seperated, we still try to actively
load it when i915/gvt init. I think better way is to provide "mpt" register
interface from gvt and call host_init hook at that time. That would make
kvmgt module to be really splitted.