* [PATCH] drm/amdgpu: Check kernel version for 'hypervisor_is_type'
@ 2022-05-09 17:07 Yongqiang Sun
2022-05-10 7:12 ` Paul Menzel
0 siblings, 1 reply; 3+ messages in thread
From: Yongqiang Sun @ 2022-05-09 17:07 UTC (permalink / raw)
To: alexander.deucher, amd-gfx; +Cc: Yongqiang Sun
hypervisor_is_type is added since kernel 4.15, dkms package failed to
install on older kernel e.g. 3.10.
Use marcro check kernel version to determine whether the function is
used.
---
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 4 +++-
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index 88b852b3a2cb..963b2e68205e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -28,7 +28,7 @@
#ifdef CONFIG_X86
#include <asm/hypervisor.h>
#endif
-
+#include <linux/version.h>
#include "amdgpu.h"
#include "amdgpu_gmc.h"
#include "amdgpu_ras.h"
@@ -653,10 +653,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
* VEGA10 SRIOV VF with MS_HYPERV host needs some firmware reserved area.
*/
#ifdef CONFIG_X86
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
if (amdgpu_sriov_vf(adev) && hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
adev->mman.stolen_reserved_offset = 0x500000;
adev->mman.stolen_reserved_size = 0x200000;
}
+#endif
#endif
break;
case CHIP_RAVEN:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 02b161a1287b..5a50122a1161 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -26,7 +26,7 @@
#ifdef CONFIG_X86
#include <asm/hypervisor.h>
#endif
-
+#include <linux/version.h>
#include <drm/drm_drv.h>
#include <xen/xen.h>
@@ -728,8 +728,10 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
case CHIP_VEGA10:
soc15_set_virt_ops(adev);
#ifdef CONFIG_X86
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
/* not send GPU_INIT_DATA with MS_HYPERV*/
if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
+#endif
#endif
/* send a dummy GPU_INIT_DATA request to host on vega10 */
amdgpu_virt_request_init_data(adev);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: Check kernel version for 'hypervisor_is_type'
2022-05-09 17:07 [PATCH] drm/amdgpu: Check kernel version for 'hypervisor_is_type' Yongqiang Sun
@ 2022-05-10 7:12 ` Paul Menzel
2022-05-10 13:48 ` Alex Deucher
0 siblings, 1 reply; 3+ messages in thread
From: Paul Menzel @ 2022-05-10 7:12 UTC (permalink / raw)
To: Yongqiang Sun; +Cc: alexander.deucher, amd-gfx
Dear Yongqiang,
Thank you for your patch.
Am 09.05.22 um 19:07 schrieb Yongqiang Sun:
> hypervisor_is_type is added since kernel 4.15, dkms package failed to
Also mention the commit hash and summary of the commit adding that.
> install on older kernel e.g. 3.10.
>
> Use marcro check kernel version to determine whether the function is
macro (found by my spell checker)
> used.
Please reflow for 75 characters per line.
The Signed-off-by line is missing.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 4 +++-
> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index 88b852b3a2cb..963b2e68205e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -28,7 +28,7 @@
> #ifdef CONFIG_X86
> #include <asm/hypervisor.h>
> #endif
> -
> +#include <linux/version.h>
> #include "amdgpu.h"
> #include "amdgpu_gmc.h"
> #include "amdgpu_ras.h"
> @@ -653,10 +653,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
> * VEGA10 SRIOV VF with MS_HYPERV host needs some firmware reserved area.
> */
> #ifdef CONFIG_X86
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
> if (amdgpu_sriov_vf(adev) && hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
> adev->mman.stolen_reserved_offset = 0x500000;
> adev->mman.stolen_reserved_size = 0x200000;
> }
> +#endif
`scripts/checkpatch.pl` warns about using `LINUX_VERSION_CODE`.
> #endif
> break;
> case CHIP_RAVEN:
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 02b161a1287b..5a50122a1161 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -26,7 +26,7 @@
> #ifdef CONFIG_X86
> #include <asm/hypervisor.h>
> #endif
> -
> +#include <linux/version.h>
> #include <drm/drm_drv.h>
> #include <xen/xen.h>
>
> @@ -728,8 +728,10 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
> case CHIP_VEGA10:
> soc15_set_virt_ops(adev);
> #ifdef CONFIG_X86
> +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
> /* not send GPU_INIT_DATA with MS_HYPERV*/
> if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
> +#endif
> #endif
> /* send a dummy GPU_INIT_DATA request to host on vega10 */
> amdgpu_virt_request_init_data(adev);
Is this patch for inclusion to the Linux kernel or just for people
building the newer code as module for older Linux kernel versions?
Kind regards,
Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/amdgpu: Check kernel version for 'hypervisor_is_type'
2022-05-10 7:12 ` Paul Menzel
@ 2022-05-10 13:48 ` Alex Deucher
0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2022-05-10 13:48 UTC (permalink / raw)
To: Paul Menzel; +Cc: Deucher, Alexander, Yongqiang Sun, amd-gfx list
On Tue, May 10, 2022 at 3:12 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> Dear Yongqiang,
>
>
> Thank you for your patch.
>
> Am 09.05.22 um 19:07 schrieb Yongqiang Sun:
> > hypervisor_is_type is added since kernel 4.15, dkms package failed to
>
> Also mention the commit hash and summary of the commit adding that.
>
> > install on older kernel e.g. 3.10.
> >
> > Use marcro check kernel version to determine whether the function is
>
> macro (found by my spell checker)
>
> > used.
>
> Please reflow for 75 characters per line.
>
> The Signed-off-by line is missing.
>
> > ---
> > drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 4 +++-
> > drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 4 +++-
> > 2 files changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> > index 88b852b3a2cb..963b2e68205e 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> > @@ -28,7 +28,7 @@
> > #ifdef CONFIG_X86
> > #include <asm/hypervisor.h>
> > #endif
> > -
> > +#include <linux/version.h>
> > #include "amdgpu.h"
> > #include "amdgpu_gmc.h"
> > #include "amdgpu_ras.h"
> > @@ -653,10 +653,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
> > * VEGA10 SRIOV VF with MS_HYPERV host needs some firmware reserved area.
> > */
> > #ifdef CONFIG_X86
> > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
> > if (amdgpu_sriov_vf(adev) && hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
> > adev->mman.stolen_reserved_offset = 0x500000;
> > adev->mman.stolen_reserved_size = 0x200000;
> > }
> > +#endif
>
> `scripts/checkpatch.pl` warns about using `LINUX_VERSION_CODE`.
>
> > #endif
> > break;
> > case CHIP_RAVEN:
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > index 02b161a1287b..5a50122a1161 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> > @@ -26,7 +26,7 @@
> > #ifdef CONFIG_X86
> > #include <asm/hypervisor.h>
> > #endif
> > -
> > +#include <linux/version.h>
> > #include <drm/drm_drv.h>
> > #include <xen/xen.h>
> >
> > @@ -728,8 +728,10 @@ void amdgpu_detect_virtualization(struct amdgpu_device *adev)
> > case CHIP_VEGA10:
> > soc15_set_virt_ops(adev);
> > #ifdef CONFIG_X86
> > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
> > /* not send GPU_INIT_DATA with MS_HYPERV*/
> > if (!hypervisor_is_type(X86_HYPER_MS_HYPERV))
> > +#endif
> > #endif
> > /* send a dummy GPU_INIT_DATA request to host on vega10 */
> > amdgpu_virt_request_init_data(adev);
>
> Is this patch for inclusion to the Linux kernel or just for people
> building the newer code as module for older Linux kernel versions?
This was meant for our dkms branches for building against enterprise
distro kernels not for upstream.
Alex
>
>
> Kind regards,
>
> Paul
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-05-10 13:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-09 17:07 [PATCH] drm/amdgpu: Check kernel version for 'hypervisor_is_type' Yongqiang Sun
2022-05-10 7:12 ` Paul Menzel
2022-05-10 13:48 ` 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.