From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhenyu Wang Subject: Re: [PATCH 1/5] drm/i915: make intel_gvt_init() later instead of too early Date: Wed, 11 Jan 2017 11:29:23 +0800 Message-ID: <20170111032923.tyqgo7vgqdeurhku@zhen-hp.sh.intel.com> References: <20170110065252.1730-1-zhenyuw@linux.intel.com> <20170110065252.1730-2-zhenyuw@linux.intel.com> <5875A2C2.8020609@intel.com> Reply-To: Zhenyu Wang Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2014936241==" Return-path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BA326E330 for ; Wed, 11 Jan 2017 03:34:00 +0000 (UTC) In-Reply-To: <5875A2C2.8020609@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Jike Song Cc: intel-gfx@lists.freedesktop.org, igvt-g-dev@lists.01.org List-Id: intel-gfx@lists.freedesktop.org --===============2014936241== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sy2j4ow76tobelic" Content-Disposition: inline --sy2j4ow76tobelic Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2017.01.11 11:13:06 +0800, Jike Song wrote: > On 01/10/2017 02:52 PM, Zhenyu Wang wrote: > > Previously intel_gvt_init() was called very early even before > > MMIO initialization which had several drawbacks: > > - Have to handle MMIO access for initial MMIO state dump if golden > > state firmware is not available > > - Hypervisor detection should depend on pvinfo only instead of detecting > > hypervisor status. > > - Don't know hw resource size e.g aperture, ggtt size to determine > > for vGPU type, etc. > >=20 > > This trys to move intel_gvt_init() call late after required info > > has already been initialized for GVT host. > >=20 > > Signed-off-by: Zhenyu Wang > > --- > > drivers/gpu/drm/i915/gvt/gvt.c | 20 ++++++++------------ > > drivers/gpu/drm/i915/i915_drv.c | 14 +++++++------- > > drivers/gpu/drm/i915/intel_gvt.c | 5 +++++ > > 3 files changed, 20 insertions(+), 19 deletions(-) > >=20 > > diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/= gvt.c > > index e6bf5c533fbe..35264a991776 100644 > > --- a/drivers/gpu/drm/i915/gvt/gvt.c > > +++ b/drivers/gpu/drm/i915/gvt/gvt.c > > @@ -73,23 +73,19 @@ int intel_gvt_init_host(void) > > if (intel_gvt_host.initialized) > > return 0; > > =20 > > - /* Xen DOM U */ > > - if (xen_domain() && !xen_initial_domain()) > > - return -ENODEV; > > - > > /* Try to load MPT modules for hypervisors */ > > - if (xen_initial_domain()) { > > +#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT) > > + /* Try KVMGT */ > > + intel_gvt_host.mpt =3D try_then_request_module( > > + symbol_get(kvmgt_mpt), "kvmgt"); > > + intel_gvt_host.hypervisor_type =3D INTEL_GVT_HYPERVISOR_KVM; > > +#endif > > + > > + if (!intel_gvt_host.mpt && xen_initial_domain()) { > > /* In Xen dom0 */ > > intel_gvt_host.mpt =3D try_then_request_module( > > symbol_get(xengt_mpt), "xengt"); > > intel_gvt_host.hypervisor_type =3D INTEL_GVT_HYPERVISOR_XEN; > > - } else { > > -#if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT) > > - /* not in Xen. Try KVMGT */ > > - intel_gvt_host.mpt =3D try_then_request_module( > > - symbol_get(kvmgt_mpt), "kvmgt"); > > - intel_gvt_host.hypervisor_type =3D INTEL_GVT_HYPERVISOR_KVM; > > -#endif > > } > > =20 >=20 > Hi Zhenyu, >=20 > It is always easy for xengt to detect dom0 case, but difficult for kvmgt > to detect host, so I guess xen_initial_domain() should be removed from he= re, > and placed in xengt.ko. >=20 > [xengt.ko] >=20 > static int __init xengt_init(void) > { > if (!xen_initial_domain()) > return -EINVAL; > ... >=20 > [gvt] > request xengt_mpt > if (failed) > request kvmgt_mpt >=20 > With logic above, we can avoid calling xen_initial_domain(), and remove > "#include " from gvt.c. >=20 > What'd you say? :) >=20 yep, sounds good to me. --=20 Open Source Technology Center, Intel ltd. $gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827 --sy2j4ow76tobelic Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iEYEARECAAYFAlh1ppMACgkQsQQaM014GCfEJQCeO20h8/X0i+ZFe8V4t59Ex7Zb rGQAoJXg+e0bc73hKcDTvjn/Q4h0WBf3 =xp7i -----END PGP SIGNATURE----- --sy2j4ow76tobelic-- --===============2014936241== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============2014936241==--