[2/5] drm/i915/gvt: move intel iommu detection to intel_gvt_init()
diff mbox

Message ID 20170110065252.1730-3-zhenyuw@linux.intel.com
State New
Headers show

Commit Message

Zhenyu Wang Jan. 10, 2017, 6:52 a.m. UTC
Prepare to remove detect_host() hook. Move intel iommu detection early
in intel_gvt_init().

Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
---
 drivers/gpu/drm/i915/gvt/gvt.c   | 7 +++++++
 drivers/gpu/drm/i915/gvt/kvmgt.c | 6 ------
 2 files changed, 7 insertions(+), 6 deletions(-)

Comments

Jike Song Jan. 11, 2017, 2:18 a.m. UTC | #1
On 01/10/2017 02:52 PM, Zhenyu Wang wrote:
> Prepare to remove detect_host() hook. Move intel iommu detection early
> in intel_gvt_init().
> 
> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/gvt.c   | 7 +++++++
>  drivers/gpu/drm/i915/gvt/kvmgt.c | 6 ------
>  2 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
> index 35264a991776..7a7886644acf 100644
> --- a/drivers/gpu/drm/i915/gvt/gvt.c
> +++ b/drivers/gpu/drm/i915/gvt/gvt.c
> @@ -73,6 +73,13 @@ int intel_gvt_init_host(void)
>  	if (intel_gvt_host.initialized)
>  		return 0;
>  
> +#ifdef CONFIG_INTEL_IOMMU
> +	if (intel_iommu_gfx_mapped) {
> +		gvt_err("Hardware IOMMU compatibility not yet supported, try to boot with intel_iommu=igfx_off\n");
> +		return -ENODEV;
> +	}
> +#endif
> +

Hi Zhenyu,

Per my understanding, the "intel_iommu=" parameter acts only on native (think about XenGT),
so it's better to keep it somewhere in kvmgt.c, maybe kvmgt_init()?

--
Thanks,
Jike
>  	/* Try to load MPT modules for hypervisors */
>  #if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
>  	/* Try KVMGT */
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index 0c9234a87a20..f29d2a27ccb1 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -1276,12 +1276,6 @@ static bool kvmgt_check_guest(void)
>   */
>  static int kvmgt_detect_host(void)
>  {
> -#ifdef CONFIG_INTEL_IOMMU
> -	if (intel_iommu_gfx_mapped) {
> -		gvt_err("Hardware IOMMU compatibility not yet supported, try to boot with intel_iommu=igfx_off\n");
> -		return -ENODEV;
> -	}
> -#endif
>  	return kvmgt_check_guest() ? -ENODEV : 0;
>  }
>  
>
Zhenyu Wang Jan. 11, 2017, 2:40 a.m. UTC | #2
On 2017.01.11 10:18:30 +0800, Jike Song wrote:
> On 01/10/2017 02:52 PM, Zhenyu Wang wrote:
> > Prepare to remove detect_host() hook. Move intel iommu detection early
> > in intel_gvt_init().
> > 
> > Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/gvt/gvt.c   | 7 +++++++
> >  drivers/gpu/drm/i915/gvt/kvmgt.c | 6 ------
> >  2 files changed, 7 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
> > index 35264a991776..7a7886644acf 100644
> > --- a/drivers/gpu/drm/i915/gvt/gvt.c
> > +++ b/drivers/gpu/drm/i915/gvt/gvt.c
> > @@ -73,6 +73,13 @@ int intel_gvt_init_host(void)
> >  	if (intel_gvt_host.initialized)
> >  		return 0;
> >  
> > +#ifdef CONFIG_INTEL_IOMMU
> > +	if (intel_iommu_gfx_mapped) {
> > +		gvt_err("Hardware IOMMU compatibility not yet supported, try to boot with intel_iommu=igfx_off\n");
> > +		return -ENODEV;
> > +	}
> > +#endif
> > +
> 
> Hi Zhenyu,
> 
> Per my understanding, the "intel_iommu=" parameter acts only on native (think about XenGT),
> so it's better to keep it somewhere in kvmgt.c, maybe kvmgt_init()?
> 

hmm, I think it's just a limit for current gvt device model but not related to hypervisor,
and it would bail out to disable gvt only. Anyway we'll fix it soon so not worry much for that.
Jike Song Jan. 11, 2017, 3:01 a.m. UTC | #3
On 01/11/2017 10:40 AM, Zhenyu Wang wrote:
> On 2017.01.11 10:18:30 +0800, Jike Song wrote:
>> On 01/10/2017 02:52 PM, Zhenyu Wang wrote:
>>> Prepare to remove detect_host() hook. Move intel iommu detection early
>>> in intel_gvt_init().
>>>
>>> Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
>>> ---
>>>  drivers/gpu/drm/i915/gvt/gvt.c   | 7 +++++++
>>>  drivers/gpu/drm/i915/gvt/kvmgt.c | 6 ------
>>>  2 files changed, 7 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
>>> index 35264a991776..7a7886644acf 100644
>>> --- a/drivers/gpu/drm/i915/gvt/gvt.c
>>> +++ b/drivers/gpu/drm/i915/gvt/gvt.c
>>> @@ -73,6 +73,13 @@ int intel_gvt_init_host(void)
>>>  	if (intel_gvt_host.initialized)
>>>  		return 0;
>>>  
>>> +#ifdef CONFIG_INTEL_IOMMU
>>> +	if (intel_iommu_gfx_mapped) {
>>> +		gvt_err("Hardware IOMMU compatibility not yet supported, try to boot with intel_iommu=igfx_off\n");
>>> +		return -ENODEV;
>>> +	}
>>> +#endif
>>> +
>>
>> Hi Zhenyu,
>>
>> Per my understanding, the "intel_iommu=" parameter acts only on native (think about XenGT),
>> so it's better to keep it somewhere in kvmgt.c, maybe kvmgt_init()?
>>
> 
> hmm, I think it's just a limit for current gvt device model but not related to hypervisor,
> and it would bail out to disable gvt only. Anyway we'll fix it soon so not worry much for that.
> 

I agree that it's only a temporary workaround, only want to point out that hypervisor does
matter: if we take XenGT considered, it has IOMMU hardware managed by Hypervisor, so its the
host (dom0) kernel doesn't need any special configuration for iommu :)

--
Thanks,
Jike

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
index 35264a991776..7a7886644acf 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.c
+++ b/drivers/gpu/drm/i915/gvt/gvt.c
@@ -73,6 +73,13 @@  int intel_gvt_init_host(void)
 	if (intel_gvt_host.initialized)
 		return 0;
 
+#ifdef CONFIG_INTEL_IOMMU
+	if (intel_iommu_gfx_mapped) {
+		gvt_err("Hardware IOMMU compatibility not yet supported, try to boot with intel_iommu=igfx_off\n");
+		return -ENODEV;
+	}
+#endif
+
 	/* Try to load MPT modules for hypervisors */
 #if IS_ENABLED(CONFIG_DRM_I915_GVT_KVMGT)
 	/* Try KVMGT */
diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 0c9234a87a20..f29d2a27ccb1 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1276,12 +1276,6 @@  static bool kvmgt_check_guest(void)
  */
 static int kvmgt_detect_host(void)
 {
-#ifdef CONFIG_INTEL_IOMMU
-	if (intel_iommu_gfx_mapped) {
-		gvt_err("Hardware IOMMU compatibility not yet supported, try to boot with intel_iommu=igfx_off\n");
-		return -ENODEV;
-	}
-#endif
 	return kvmgt_check_guest() ? -ENODEV : 0;
 }