diff mbox series

[RFC,v5,1/1] Split i915_run_as_guest into x86 and non-x86

Message ID 20220331000908.1225343-2-casey.g.bowman@intel.com (mailing list archive)
State New, archived
Headers show
Series Splitting up platform-specific calls | expand

Commit Message

Casey Bowman March 31, 2022, 12:09 a.m. UTC
Splitting i915_run_as_guest into a more arch-friendly function
as non-x86 builds do not support this functionality.

Signed-off-by: Casey Bowman <casey.g.bowman@intel.com>
---
 drivers/gpu/drm/i915/i915_utils.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Lucas De Marchi March 31, 2022, 8:40 a.m. UTC | #1
On Wed, Mar 30, 2022 at 05:09:08PM -0700, Casey Bowman wrote:
>Splitting i915_run_as_guest into a more arch-friendly function
>as non-x86 builds do not support this functionality.
>
>Signed-off-by: Casey Bowman <casey.g.bowman@intel.com>


Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>


this is by no means and "RFC". For next patches please remove it when
you get an idea of what the patch should be.


The CI failure is unrelated, please re-trigger it in patchwork.

+Tomi: can I get super powers to retrigger others' people patches?
I promise I will use it responsibly :)

thanks
Lucas De Marchi

>---
> drivers/gpu/drm/i915/i915_utils.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
>index b2d89c43f24d..a42882e68eea 100644
>--- a/drivers/gpu/drm/i915/i915_utils.h
>+++ b/drivers/gpu/drm/i915/i915_utils.h
>@@ -428,7 +428,12 @@ static inline bool timer_expired(const struct timer_list *t)
>
> static inline bool i915_run_as_guest(void)
> {
>+#if IS_ENABLED(CONFIG_X86)
> 	return !hypervisor_is_type(X86_HYPER_NATIVE);
>+#else
>+	/* Not supported yet */
>+	return false;
>+#endif
> }
>
> bool i915_vtd_active(struct drm_i915_private *i915);
>-- 
>2.25.1
>
Tvrtko Ursulin March 31, 2022, 2:35 p.m. UTC | #2
On 31/03/2022 01:09, Casey Bowman wrote:
> Splitting i915_run_as_guest into a more arch-friendly function
> as non-x86 builds do not support this functionality.
> 
> Signed-off-by: Casey Bowman <casey.g.bowman@intel.com>
> ---
>   drivers/gpu/drm/i915/i915_utils.h | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
> index b2d89c43f24d..a42882e68eea 100644
> --- a/drivers/gpu/drm/i915/i915_utils.h
> +++ b/drivers/gpu/drm/i915/i915_utils.h
> @@ -428,7 +428,12 @@ static inline bool timer_expired(const struct timer_list *t)
>   
>   static inline bool i915_run_as_guest(void)
>   {
> +#if IS_ENABLED(CONFIG_X86)
>   	return !hypervisor_is_type(X86_HYPER_NATIVE);
> +#else
> +	/* Not supported yet */
> +	return false;
> +#endif

Works for me.

Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

You may want to #ifdef the inclusion of asm/hypervisor.h as well. It 
only happens to work by chance since Arm has that file. Although it 
becomes uglier at that point..

There is a function in there which appears may give you a way to query 
if under hypervisor, based on some feature flags, but you'd have to ask 
Arm experts if that would make sense.

Regards,

Tvrtko

>   }
>   
>   bool i915_vtd_active(struct drm_i915_private *i915);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h
index b2d89c43f24d..a42882e68eea 100644
--- a/drivers/gpu/drm/i915/i915_utils.h
+++ b/drivers/gpu/drm/i915/i915_utils.h
@@ -428,7 +428,12 @@  static inline bool timer_expired(const struct timer_list *t)
 
 static inline bool i915_run_as_guest(void)
 {
+#if IS_ENABLED(CONFIG_X86)
 	return !hypervisor_is_type(X86_HYPER_NATIVE);
+#else
+	/* Not supported yet */
+	return false;
+#endif
 }
 
 bool i915_vtd_active(struct drm_i915_private *i915);