All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
@ 2022-04-11 13:59 Yongqiang Sun
  2022-04-11 15:28 ` Paul Menzel
  0 siblings, 1 reply; 12+ messages in thread
From: Yongqiang Sun @ 2022-04-11 13:59 UTC (permalink / raw)
  To: amd-gfx, jingwen.chen2, monk.liu, zhigang.luo; +Cc: Yongqiang Sun

MS_HYPERV with vega10 doesn't have the interface to process
request init data msg.
Check hypervisor type to not send the request for MS_HYPERV.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 933c41f77c92..56b130ec44a9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -23,6 +23,10 @@
 
 #include <linux/module.h>
 
+#ifdef CONFIG_X86
+#include <asm/hypervisor.h>
+#endif
+
 #include <drm/drm_drv.h>
 
 #include "amdgpu.h"
@@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
 			break;
 		case CHIP_VEGA10:
 			soc15_set_virt_ops(adev);
-			/* send a dummy GPU_INIT_DATA request to host on vega10 */
-			amdgpu_virt_request_init_data(adev);
+#ifdef CONFIG_X86
+			/* not send GPU_INIT_DATA with MS_HYPERV*/
+			if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
+#endif
+				/* send a dummy GPU_INIT_DATA request to host on vega10 */
+				amdgpu_virt_request_init_data(adev);
 			break;
 		case CHIP_VEGA20:
 		case CHIP_ARCTURUS:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
  2022-04-11 13:59 [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10 Yongqiang Sun
@ 2022-04-11 15:28 ` Paul Menzel
  2022-04-11 16:28   ` Alex Deucher
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Menzel @ 2022-04-11 15:28 UTC (permalink / raw)
  To: Yongqiang Sun; +Cc: jingwen.chen2, zhigang.luo, monk.liu, amd-gfx

Dear Yongqiang,


Thank you for your patch.

Am 11.04.22 um 15:59 schrieb Yongqiang Sun:
> MS_HYPERV with vega10 doesn't have the interface to process
> request init data msg.

Should some Hyper-V folks be added to the reviewers list too?

> Check hypervisor type to not send the request for MS_HYPERV.

Please add a blank line between paragraphs.

> Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 933c41f77c92..56b130ec44a9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -23,6 +23,10 @@
>   
>   #include <linux/module.h>
>   
> +#ifdef CONFIG_X86
> +#include <asm/hypervisor.h>
> +#endif
> +
>   #include <drm/drm_drv.h>
>   
>   #include "amdgpu.h"
> @@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
>   			break;
>   		case CHIP_VEGA10:
>   			soc15_set_virt_ops(adev);
> -			/* send a dummy GPU_INIT_DATA request to host on vega10 */
> -			amdgpu_virt_request_init_data(adev);
> +#ifdef CONFIG_X86
> +			/* not send GPU_INIT_DATA with MS_HYPERV*/
> +			if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
> +#endif

Why guard everything with CONFIG_X86? (If it’s needed, it should be done 
in C code.)

> +				/* send a dummy GPU_INIT_DATA request to host on vega10 */
> +				amdgpu_virt_request_init_data(adev);
>   			break;
>   		case CHIP_VEGA20:
>   		case CHIP_ARCTURUS:


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
  2022-04-11 15:28 ` Paul Menzel
@ 2022-04-11 16:28   ` Alex Deucher
  2022-04-12  8:01       ` Paul Menzel
  0 siblings, 1 reply; 12+ messages in thread
From: Alex Deucher @ 2022-04-11 16:28 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Jingwen Chen, Yongqiang Sun, Luo, Zhigang, amd-gfx list, monk.liu

On Mon, Apr 11, 2022 at 11:28 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> Dear Yongqiang,
>
>
> Thank you for your patch.
>
> Am 11.04.22 um 15:59 schrieb Yongqiang Sun:
> > MS_HYPERV with vega10 doesn't have the interface to process
> > request init data msg.
>
> Should some Hyper-V folks be added to the reviewers list too?
>
> > Check hypervisor type to not send the request for MS_HYPERV.
>
> Please add a blank line between paragraphs.
>
> > Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
> > ---
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
> >   1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > index 933c41f77c92..56b130ec44a9 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > @@ -23,6 +23,10 @@
> >
> >   #include <linux/module.h>
> >
> > +#ifdef CONFIG_X86
> > +#include <asm/hypervisor.h>
> > +#endif
> > +
> >   #include <drm/drm_drv.h>
> >
> >   #include "amdgpu.h"
> > @@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
> >                       break;
> >               case CHIP_VEGA10:
> >                       soc15_set_virt_ops(adev);
> > -                     /* send a dummy GPU_INIT_DATA request to host on vega10 */
> > -                     amdgpu_virt_request_init_data(adev);
> > +#ifdef CONFIG_X86
> > +                     /* not send GPU_INIT_DATA with MS_HYPERV*/
> > +                     if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
> > +#endif
>
> Why guard everything with CONFIG_X86? (If it’s needed, it should be done
> in C code.)

X86_HYPER_MS_HYPERV only available on x86.

Alex

>
> > +                             /* send a dummy GPU_INIT_DATA request to host on vega10 */
> > +                             amdgpu_virt_request_init_data(adev);
> >                       break;
> >               case CHIP_VEGA20:
> >               case CHIP_ARCTURUS:
>
>
> Kind regards,
>
> Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
  2022-04-11 16:28   ` Alex Deucher
@ 2022-04-12  8:01       ` Paul Menzel
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Menzel @ 2022-04-12  8:01 UTC (permalink / raw)
  To: Alex Deucher, Yongqiang Sun
  Cc: x86, Luo, Zhigang, Jingwen Chen, Dave Hansen, LKML, amd-gfx,
	Ingo Molnar, Borislav Petkov, Thomas Gleixner, monk.liu

[Cc: +x86 folks]

Dear Alex, dear x86 folks,


x86 folks, can you think of alternatives to access `X86_HYPER_MS_HYPERV` 
from `arch/x86/include/asm/hypervisor.h` without any preprocessor ifdef-ery?


Am 11.04.22 um 18:28 schrieb Alex Deucher:
> On Mon, Apr 11, 2022 at 11:28 AM Paul Menzel wrote:

[…]

>> Am 11.04.22 um 15:59 schrieb Yongqiang Sun:
>>> MS_HYPERV with vega10 doesn't have the interface to process
>>> request init data msg.
>>
>> Should some Hyper-V folks be added to the reviewers list too?
>>
>>> Check hypervisor type to not send the request for MS_HYPERV.
>>
>> Please add a blank line between paragraphs.
>>
>>> Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
>>>    1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> index 933c41f77c92..56b130ec44a9 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> @@ -23,6 +23,10 @@
>>>
>>>    #include <linux/module.h>
>>>
>>> +#ifdef CONFIG_X86
>>> +#include <asm/hypervisor.h>
>>> +#endif
>>> +
>>>    #include <drm/drm_drv.h>
>>>
>>>    #include "amdgpu.h"
>>> @@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
>>>                        break;
>>>                case CHIP_VEGA10:
>>>                        soc15_set_virt_ops(adev);
>>> -                     /* send a dummy GPU_INIT_DATA request to host on vega10 */
>>> -                     amdgpu_virt_request_init_data(adev);
>>> +#ifdef CONFIG_X86
>>> +                     /* not send GPU_INIT_DATA with MS_HYPERV*/
>>> +                     if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
>>> +#endif
>>
>> Why guard everything with CONFIG_X86? (If it’s needed, it should be done
>> in C code.)
> 
> X86_HYPER_MS_HYPERV only available on x86.

Sorry, I missed the X86 dependency when quickly looking at the Hyper-V 
stub IOMMU driver `drivers/iommu/hyperv-iommu.c`, but missed that 
`HYPERV_IOMMU` has `depends on HYPERV && X86`.


Kind regards,

Paul


>>> +                             /* send a dummy GPU_INIT_DATA request to host on vega10 */
>>> +                             amdgpu_virt_request_init_data(adev);
>>>                        break;
>>>                case CHIP_VEGA20:
>>>                case CHIP_ARCTURUS:
>>
>>
>> Kind regards,
>>
>> Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
@ 2022-04-12  8:01       ` Paul Menzel
  0 siblings, 0 replies; 12+ messages in thread
From: Paul Menzel @ 2022-04-12  8:01 UTC (permalink / raw)
  To: Alex Deucher, Yongqiang Sun
  Cc: Jingwen Chen, Luo, Zhigang, amd-gfx, monk.liu, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, Dave Hansen, x86, LKML

[Cc: +x86 folks]

Dear Alex, dear x86 folks,


x86 folks, can you think of alternatives to access `X86_HYPER_MS_HYPERV` 
from `arch/x86/include/asm/hypervisor.h` without any preprocessor ifdef-ery?


Am 11.04.22 um 18:28 schrieb Alex Deucher:
> On Mon, Apr 11, 2022 at 11:28 AM Paul Menzel wrote:

[…]

>> Am 11.04.22 um 15:59 schrieb Yongqiang Sun:
>>> MS_HYPERV with vega10 doesn't have the interface to process
>>> request init data msg.
>>
>> Should some Hyper-V folks be added to the reviewers list too?
>>
>>> Check hypervisor type to not send the request for MS_HYPERV.
>>
>> Please add a blank line between paragraphs.
>>
>>> Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
>>> ---
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
>>>    1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> index 933c41f77c92..56b130ec44a9 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
>>> @@ -23,6 +23,10 @@
>>>
>>>    #include <linux/module.h>
>>>
>>> +#ifdef CONFIG_X86
>>> +#include <asm/hypervisor.h>
>>> +#endif
>>> +
>>>    #include <drm/drm_drv.h>
>>>
>>>    #include "amdgpu.h"
>>> @@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
>>>                        break;
>>>                case CHIP_VEGA10:
>>>                        soc15_set_virt_ops(adev);
>>> -                     /* send a dummy GPU_INIT_DATA request to host on vega10 */
>>> -                     amdgpu_virt_request_init_data(adev);
>>> +#ifdef CONFIG_X86
>>> +                     /* not send GPU_INIT_DATA with MS_HYPERV*/
>>> +                     if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
>>> +#endif
>>
>> Why guard everything with CONFIG_X86? (If it’s needed, it should be done
>> in C code.)
> 
> X86_HYPER_MS_HYPERV only available on x86.

Sorry, I missed the X86 dependency when quickly looking at the Hyper-V 
stub IOMMU driver `drivers/iommu/hyperv-iommu.c`, but missed that 
`HYPERV_IOMMU` has `depends on HYPERV && X86`.


Kind regards,

Paul


>>> +                             /* send a dummy GPU_INIT_DATA request to host on vega10 */
>>> +                             amdgpu_virt_request_init_data(adev);
>>>                        break;
>>>                case CHIP_VEGA20:
>>>                case CHIP_ARCTURUS:
>>
>>
>> Kind regards,
>>
>> Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
  2022-04-12  8:01       ` Paul Menzel
@ 2022-04-12 14:12         ` Alex Deucher
  -1 siblings, 0 replies; 12+ messages in thread
From: Alex Deucher @ 2022-04-12 14:12 UTC (permalink / raw)
  To: Paul Menzel
  Cc: Yongqiang Sun, Jingwen Chen, Luo, Zhigang, amd-gfx list,
	monk.liu, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, X86 ML, LKML

On Tue, Apr 12, 2022 at 4:01 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> [Cc: +x86 folks]
>
> Dear Alex, dear x86 folks,
>
>
> x86 folks, can you think of alternatives to access `X86_HYPER_MS_HYPERV`
> from `arch/x86/include/asm/hypervisor.h` without any preprocessor ifdef-ery?

I don't really see what problem that solves.  X86_HYPER_MS_HYPERV is
an X86 thing.  Why do we need a processor agnostic way to handle it?
Any code related to that is X86 specific.

Alex

>
>
> Am 11.04.22 um 18:28 schrieb Alex Deucher:
> > On Mon, Apr 11, 2022 at 11:28 AM Paul Menzel wrote:
>
> […]
>
> >> Am 11.04.22 um 15:59 schrieb Yongqiang Sun:
> >>> MS_HYPERV with vega10 doesn't have the interface to process
> >>> request init data msg.
> >>
> >> Should some Hyper-V folks be added to the reviewers list too?
> >>
> >>> Check hypervisor type to not send the request for MS_HYPERV.
> >>
> >> Please add a blank line between paragraphs.
> >>
> >>> Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
> >>> ---
> >>>    drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
> >>>    1 file changed, 10 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> >>> index 933c41f77c92..56b130ec44a9 100644
> >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> >>> @@ -23,6 +23,10 @@
> >>>
> >>>    #include <linux/module.h>
> >>>
> >>> +#ifdef CONFIG_X86
> >>> +#include <asm/hypervisor.h>
> >>> +#endif
> >>> +
> >>>    #include <drm/drm_drv.h>
> >>>
> >>>    #include "amdgpu.h"
> >>> @@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
> >>>                        break;
> >>>                case CHIP_VEGA10:
> >>>                        soc15_set_virt_ops(adev);
> >>> -                     /* send a dummy GPU_INIT_DATA request to host on vega10 */
> >>> -                     amdgpu_virt_request_init_data(adev);
> >>> +#ifdef CONFIG_X86
> >>> +                     /* not send GPU_INIT_DATA with MS_HYPERV*/
> >>> +                     if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
> >>> +#endif
> >>
> >> Why guard everything with CONFIG_X86? (If it’s needed, it should be done
> >> in C code.)
> >
> > X86_HYPER_MS_HYPERV only available on x86.
>
> Sorry, I missed the X86 dependency when quickly looking at the Hyper-V
> stub IOMMU driver `drivers/iommu/hyperv-iommu.c`, but missed that
> `HYPERV_IOMMU` has `depends on HYPERV && X86`.
>
>
> Kind regards,
>
> Paul
>
>
> >>> +                             /* send a dummy GPU_INIT_DATA request to host on vega10 */
> >>> +                             amdgpu_virt_request_init_data(adev);
> >>>                        break;
> >>>                case CHIP_VEGA20:
> >>>                case CHIP_ARCTURUS:
> >>
> >>
> >> Kind regards,
> >>
> >> Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
@ 2022-04-12 14:12         ` Alex Deucher
  0 siblings, 0 replies; 12+ messages in thread
From: Alex Deucher @ 2022-04-12 14:12 UTC (permalink / raw)
  To: Paul Menzel
  Cc: X86 ML, Luo, Zhigang, Jingwen Chen, Dave Hansen, LKML,
	amd-gfx list, Yongqiang Sun, Borislav Petkov, Thomas Gleixner,
	Ingo Molnar, monk.liu

On Tue, Apr 12, 2022 at 4:01 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> [Cc: +x86 folks]
>
> Dear Alex, dear x86 folks,
>
>
> x86 folks, can you think of alternatives to access `X86_HYPER_MS_HYPERV`
> from `arch/x86/include/asm/hypervisor.h` without any preprocessor ifdef-ery?

I don't really see what problem that solves.  X86_HYPER_MS_HYPERV is
an X86 thing.  Why do we need a processor agnostic way to handle it?
Any code related to that is X86 specific.

Alex

>
>
> Am 11.04.22 um 18:28 schrieb Alex Deucher:
> > On Mon, Apr 11, 2022 at 11:28 AM Paul Menzel wrote:
>
> […]
>
> >> Am 11.04.22 um 15:59 schrieb Yongqiang Sun:
> >>> MS_HYPERV with vega10 doesn't have the interface to process
> >>> request init data msg.
> >>
> >> Should some Hyper-V folks be added to the reviewers list too?
> >>
> >>> Check hypervisor type to not send the request for MS_HYPERV.
> >>
> >> Please add a blank line between paragraphs.
> >>
> >>> Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
> >>> ---
> >>>    drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
> >>>    1 file changed, 10 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> >>> index 933c41f77c92..56b130ec44a9 100644
> >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> >>> @@ -23,6 +23,10 @@
> >>>
> >>>    #include <linux/module.h>
> >>>
> >>> +#ifdef CONFIG_X86
> >>> +#include <asm/hypervisor.h>
> >>> +#endif
> >>> +
> >>>    #include <drm/drm_drv.h>
> >>>
> >>>    #include "amdgpu.h"
> >>> @@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
> >>>                        break;
> >>>                case CHIP_VEGA10:
> >>>                        soc15_set_virt_ops(adev);
> >>> -                     /* send a dummy GPU_INIT_DATA request to host on vega10 */
> >>> -                     amdgpu_virt_request_init_data(adev);
> >>> +#ifdef CONFIG_X86
> >>> +                     /* not send GPU_INIT_DATA with MS_HYPERV*/
> >>> +                     if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
> >>> +#endif
> >>
> >> Why guard everything with CONFIG_X86? (If it’s needed, it should be done
> >> in C code.)
> >
> > X86_HYPER_MS_HYPERV only available on x86.
>
> Sorry, I missed the X86 dependency when quickly looking at the Hyper-V
> stub IOMMU driver `drivers/iommu/hyperv-iommu.c`, but missed that
> `HYPERV_IOMMU` has `depends on HYPERV && X86`.
>
>
> Kind regards,
>
> Paul
>
>
> >>> +                             /* send a dummy GPU_INIT_DATA request to host on vega10 */
> >>> +                             amdgpu_virt_request_init_data(adev);
> >>>                        break;
> >>>                case CHIP_VEGA20:
> >>>                case CHIP_ARCTURUS:
> >>
> >>
> >> Kind regards,
> >>
> >> Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
  2022-04-12 14:12         ` Alex Deucher
  (?)
@ 2022-04-13 17:33         ` Michael Kelley (LINUX)
  -1 siblings, 0 replies; 12+ messages in thread
From: Michael Kelley (LINUX) @ 2022-04-13 17:33 UTC (permalink / raw)
  To: Alex Deucher, Paul Menzel
  Cc: X86 ML, Luo, Zhigang, Jingwen Chen, Dave Hansen, LKML,
	amd-gfx list, Yongqiang Sun, Borislav Petkov, Thomas Gleixner,
	Ingo Molnar, monk.liu

From: Alex Deucher <alexdeucher@gmail.com> Sent: Tuesday, April 12, 2022 7:13 AM
> 
> On Tue, Apr 12, 2022 at 4:01 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
> >
> > [Cc: +x86 folks]
> >
> > Dear Alex, dear x86 folks,
> >
> >
> > x86 folks, can you think of alternatives to access `X86_HYPER_MS_HYPERV`
> > from `arch/x86/include/asm/hypervisor.h` without any preprocessor ifdef-ery?
> 
> I don't really see what problem that solves.  X86_HYPER_MS_HYPERV is
> an X86 thing.  Why do we need a processor agnostic way to handle it?
> Any code related to that is X86 specific.
> 
> Alex

Try using hv_is_hyperv_initialized() without any #ifdef'ery.  If
CONFIG_HYPERV is defined, it will tell you if you are running as a guest
on Hyper-V on x86/x64 or on ARM64.  If CONFIG_HYPERV is not defined,
it will return "false".

You'll need to #include <asm/mshyperv.h>.

Michael

> 
> >
> >
> > Am 11.04.22 um 18:28 schrieb Alex Deucher:
> > > On Mon, Apr 11, 2022 at 11:28 AM Paul Menzel wrote:
> >
> > […]
> >
> > >> Am 11.04.22 um 15:59 schrieb Yongqiang Sun:
> > >>> MS_HYPERV with vega10 doesn't have the interface to process
> > >>> request init data msg.
> > >>
> > >> Should some Hyper-V folks be added to the reviewers list too?
> > >>
> > >>> Check hypervisor type to not send the request for MS_HYPERV.
> > >>
> > >> Please add a blank line between paragraphs.
> > >>
> > >>> Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
> > >>> ---
> > >>>    drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
> > >>>    1 file changed, 10 insertions(+), 2 deletions(-)
> > >>>
> > >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > >>> index 933c41f77c92..56b130ec44a9 100644
> > >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > >>> @@ -23,6 +23,10 @@
> > >>>
> > >>>    #include <linux/module.h>
> > >>>
> > >>> +#ifdef CONFIG_X86
> > >>> +#include <asm/hypervisor.h>
> > >>> +#endif
> > >>> +
> > >>>    #include <drm/drm_drv.h>
> > >>>
> > >>>    #include "amdgpu.h"
> > >>> @@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct
> amdgpu_device *adev)
> > >>>                        break;
> > >>>                case CHIP_VEGA10:
> > >>>                        soc15_set_virt_ops(adev);
> > >>> -                     /* send a dummy GPU_INIT_DATA request to host on vega10 */
> > >>> -                     amdgpu_virt_request_init_data(adev);
> > >>> +#ifdef CONFIG_X86
> > >>> +                     /* not send GPU_INIT_DATA with MS_HYPERV*/
> > >>> +                     if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
> > >>> +#endif
> > >>
> > >> Why guard everything with CONFIG_X86? (If it’s needed, it should be done
> > >> in C code.)
> > >
> > > X86_HYPER_MS_HYPERV only available on x86.
> >
> > Sorry, I missed the X86 dependency when quickly looking at the Hyper-V
> > stub IOMMU driver `drivers/iommu/hyperv-iommu.c`, but missed that
> > `HYPERV_IOMMU` has `depends on HYPERV && X86`.
> >
> >
> > Kind regards,
> >
> > Paul
> >
> >
> > >>> +                             /* send a dummy GPU_INIT_DATA request to host on vega10 */
> > >>> +                             amdgpu_virt_request_init_data(adev);
> > >>>                        break;
> > >>>                case CHIP_VEGA20:
> > >>>                case CHIP_ARCTURUS:
> > >>
> > >>
> > >> Kind regards,
> > >>
> > >> Paul

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
  2022-04-12 13:16 Yongqiang Sun
@ 2022-04-12 13:59 ` Wong, Alice
  0 siblings, 0 replies; 12+ messages in thread
From: Wong, Alice @ 2022-04-12 13:59 UTC (permalink / raw)
  To: Sun, Yongqiang, amd-gfx; +Cc: Yao, Yiqing(James)

[AMD Official Use Only]



-----Original Message-----
From: Sun, Yongqiang <Yongqiang.Sun@amd.com> 
Sent: April 12, 2022 9:16 AM
To: amd-gfx@lists.freedesktop.org; Wong, Alice <Shiwei.Wong@amd.com>
Cc: Yao, Yiqing(James) <YiQing.Yao@amd.com>; Sun, Yongqiang <Yongqiang.Sun@amd.com>
Subject: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10

MS_HYPERV with vega10 doesn't have the interface to process request init data msg.

Check hypervisor type to not send the request for MS_HYPERV.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Alice Wong <shiwei.wong@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 933c41f77c92..d5eea031c3e3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -23,6 +23,10 @@
 
 #include <linux/module.h>
 
+#ifdef CONFIG_X86
+#include <asm/hypervisor.h>
+#endif
+
 #include <drm/drm_drv.h>
 
 #include "amdgpu.h"
@@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
 			break;
 		case CHIP_VEGA10:
 			soc15_set_virt_ops(adev);
-			/* send a dummy GPU_INIT_DATA request to host on vega10 */
-			amdgpu_virt_request_init_data(adev);
+#ifdef CONFIG_X86
+			/* not send GPU_INIT_DATA with MS_HYPERV*/
+			if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
+#endif
+				/* send a dummy GPU_INIT_DATA request to host on vega10 */
+				amdgpu_virt_request_init_data(adev);
 			break;
 		case CHIP_VEGA20:
 		case CHIP_ARCTURUS:
--
2.25.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
@ 2022-04-12 13:16 Yongqiang Sun
  2022-04-12 13:59 ` Wong, Alice
  0 siblings, 1 reply; 12+ messages in thread
From: Yongqiang Sun @ 2022-04-12 13:16 UTC (permalink / raw)
  To: amd-gfx, shiwei.wong; +Cc: Yongqiang Sun, yiqing.yao

MS_HYPERV with vega10 doesn't have the interface to process
request init data msg.

Check hypervisor type to not send the request for MS_HYPERV.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 933c41f77c92..d5eea031c3e3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -23,6 +23,10 @@
 
 #include <linux/module.h>
 
+#ifdef CONFIG_X86
+#include <asm/hypervisor.h>
+#endif
+
 #include <drm/drm_drv.h>
 
 #include "amdgpu.h"
@@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
 			break;
 		case CHIP_VEGA10:
 			soc15_set_virt_ops(adev);
-			/* send a dummy GPU_INIT_DATA request to host on vega10 */
-			amdgpu_virt_request_init_data(adev);
+#ifdef CONFIG_X86
+			/* not send GPU_INIT_DATA with MS_HYPERV*/
+			if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
+#endif
+				/* send a dummy GPU_INIT_DATA request to host on vega10 */
+				amdgpu_virt_request_init_data(adev);
 			break;
 		case CHIP_VEGA20:
 		case CHIP_ARCTURUS:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
  2022-04-11 13:52 Yongqiang Sun
@ 2022-04-11 15:22 ` Alex Deucher
  0 siblings, 0 replies; 12+ messages in thread
From: Alex Deucher @ 2022-04-11 15:22 UTC (permalink / raw)
  To: Yongqiang Sun; +Cc: Jingwen Chen, monk.liu, amd-gfx list

On Mon, Apr 11, 2022 at 9:52 AM Yongqiang Sun <yongqiang.sun@amd.com> wrote:
>
> MS_HYPERV with vega10 doesn't have the interface to process
> request init data msg.
> Check hypervisor type to not send the request for MS_HYPERV.
>
> Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 933c41f77c92..56b130ec44a9 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -23,6 +23,10 @@
>
>  #include <linux/module.h>
>
> +#ifdef CONFIG_X86
> +#include <asm/hypervisor.h>
> +#endif
> +
>  #include <drm/drm_drv.h>
>
>  #include "amdgpu.h"
> @@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
>                         break;
>                 case CHIP_VEGA10:
>                         soc15_set_virt_ops(adev);
> -                       /* send a dummy GPU_INIT_DATA request to host on vega10 */
> -                       amdgpu_virt_request_init_data(adev);
> +#ifdef CONFIG_X86
> +                       /* not send GPU_INIT_DATA with MS_HYPERV*/
> +                       if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)

Preferred coding style would be:
if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
With that fixed:
Acked-by: Alex Deucher <alexander.deucher@amd.com>

> +#endif
> +                               /* send a dummy GPU_INIT_DATA request to host on vega10 */
> +                               amdgpu_virt_request_init_data(adev);
>                         break;
>                 case CHIP_VEGA20:
>                 case CHIP_ARCTURUS:
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10
@ 2022-04-11 13:52 Yongqiang Sun
  2022-04-11 15:22 ` Alex Deucher
  0 siblings, 1 reply; 12+ messages in thread
From: Yongqiang Sun @ 2022-04-11 13:52 UTC (permalink / raw)
  To: amd-gfx, jingwen.chen2, monk.liu; +Cc: Yongqiang Sun

MS_HYPERV with vega10 doesn't have the interface to process
request init data msg.
Check hypervisor type to not send the request for MS_HYPERV.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 933c41f77c92..56b130ec44a9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -23,6 +23,10 @@
 
 #include <linux/module.h>
 
+#ifdef CONFIG_X86
+#include <asm/hypervisor.h>
+#endif
+
 #include <drm/drm_drv.h>
 
 #include "amdgpu.h"
@@ -721,8 +725,12 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
 			break;
 		case CHIP_VEGA10:
 			soc15_set_virt_ops(adev);
-			/* send a dummy GPU_INIT_DATA request to host on vega10 */
-			amdgpu_virt_request_init_data(adev);
+#ifdef CONFIG_X86
+			/* not send GPU_INIT_DATA with MS_HYPERV*/
+			if (hypervisor_is_type(X86_HYPER_MS_HYPERV) == false)
+#endif
+				/* send a dummy GPU_INIT_DATA request to host on vega10 */
+				amdgpu_virt_request_init_data(adev);
 			break;
 		case CHIP_VEGA20:
 		case CHIP_ARCTURUS:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-04-13 17:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 13:59 [PATCH] drm/amd/amdgpu: Not request init data for MS_HYPERV with vega10 Yongqiang Sun
2022-04-11 15:28 ` Paul Menzel
2022-04-11 16:28   ` Alex Deucher
2022-04-12  8:01     ` Paul Menzel
2022-04-12  8:01       ` Paul Menzel
2022-04-12 14:12       ` Alex Deucher
2022-04-12 14:12         ` Alex Deucher
2022-04-13 17:33         ` Michael Kelley (LINUX)
  -- strict thread matches above, loose matches on Subject: below --
2022-04-12 13:16 Yongqiang Sun
2022-04-12 13:59 ` Wong, Alice
2022-04-11 13:52 Yongqiang Sun
2022-04-11 15:22 ` Alex Deucher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.