[Intel-gfx] [PATCH 1/5] drm/i915: make intel_gvt_init() later instead of too early
Zhenyu Wang
zhenyuw at linux.intel.com
Wed Jan 11 03:29:23 UTC 2017
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.
> >
> > This trys to move intel_gvt_init() call late after required info
> > has already been initialized for GVT host.
> >
> > Signed-off-by: Zhenyu Wang <zhenyuw at linux.intel.com>
> > ---
> > 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(-)
> >
> > 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;
> >
> > - /* 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 = try_then_request_module(
> > + symbol_get(kvmgt_mpt), "kvmgt");
> > + intel_gvt_host.hypervisor_type = INTEL_GVT_HYPERVISOR_KVM;
> > +#endif
> > +
> > + if (!intel_gvt_host.mpt && xen_initial_domain()) {
> > /* In Xen dom0 */
> > intel_gvt_host.mpt = try_then_request_module(
> > symbol_get(xengt_mpt), "xengt");
> > intel_gvt_host.hypervisor_type = INTEL_GVT_HYPERVISOR_XEN;
> > - } 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.hypervisor_type = INTEL_GVT_HYPERVISOR_KVM;
> > -#endif
> > }
> >
>
> Hi Zhenyu,
>
> 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 here,
> and placed in xengt.ko.
>
> [xengt.ko]
>
> static int __init xengt_init(void)
> {
> if (!xen_initial_domain())
> return -EINVAL;
> ...
>
> [gvt]
> request xengt_mpt
> if (failed)
> request kvmgt_mpt
>
> With logic above, we can avoid calling xen_initial_domain(), and remove
> "#include <xen/xen.h>" from gvt.c.
>
> What'd you say? :)
>
yep, sounds good to me.
--
Open Source Technology Center, Intel ltd.
$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20170111/4a70a3e4/attachment.sig>
More information about the Intel-gfx
mailing list