All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: Only reserve vram for firmware with vega10 Hyper-V host.
@ 2022-04-06 14:03 Yongqiang Sun
  2022-04-07 16:21 ` Alex Deucher
  0 siblings, 1 reply; 2+ messages in thread
From: Yongqiang Sun @ 2022-04-06 14:03 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, Yongqiang Sun

driver loading failed on VEGA10 SRIOV VF with linux host due to a wide
range of stolen reserved vram.
Since VEGA10 SRIOV VF need to reserve vram for firmware with windows
Hyper_V host specifically, check high part of FB address
to only reserve memory for it, and the range of the reserved vram
can be limited to between 5M-7M area.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++----
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 3 +++
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
index a66a0881a934..324b43c1bc4c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
@@ -647,11 +647,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
 	case CHIP_VEGA10:
 		adev->mman.keep_stolen_vga_memory = true;
 		/*
-		 * VEGA10 SRIOV VF needs some firmware reserved area.
+		 * VEGA10 SRIOV VF with hyper-v host needs some firmware reserved area.
 		 */
-		if (amdgpu_sriov_vf(adev)) {
-			adev->mman.stolen_reserved_offset = 0x100000;
-			adev->mman.stolen_reserved_size = 0x600000;
+		if (amdgpu_sriov_vf(adev) &&
+		    (adev->gmc.vram_start & AMDGPU_GMC_HYPERV_FB_BASE_MASK)) {
+			adev->mman.stolen_reserved_offset = 0x500000;
+			adev->mman.stolen_reserved_size = 0x200000;
 		}
 		break;
 	case CHIP_RAVEN:
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
index 032b0313f277..906ec15e8dac 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
@@ -61,6 +61,9 @@
  */
 #define AMDGPU_GMC_FAULT_TIMEOUT	5000ULL
 
+/* High part (33 - 47bit) FB address for VEGA10 HYPERV Host*/
+#define AMDGPU_GMC_HYPERV_FB_BASE_MASK 0xF400000000ULL
+
 struct firmware;
 
 /*
-- 
2.25.1


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

* Re: [PATCH] drm/amd/amdgpu: Only reserve vram for firmware with vega10 Hyper-V host.
  2022-04-06 14:03 [PATCH] drm/amd/amdgpu: Only reserve vram for firmware with vega10 Hyper-V host Yongqiang Sun
@ 2022-04-07 16:21 ` Alex Deucher
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2022-04-07 16:21 UTC (permalink / raw)
  To: Yongqiang Sun; +Cc: Deucher, Alexander, amd-gfx list

On Wed, Apr 6, 2022 at 10:03 AM Yongqiang Sun <yongqiang.sun@amd.com> wrote:
>
> driver loading failed on VEGA10 SRIOV VF with linux host due to a wide
> range of stolen reserved vram.
> Since VEGA10 SRIOV VF need to reserve vram for firmware with windows
> Hyper_V host specifically, check high part of FB address
> to only reserve memory for it, and the range of the reserved vram
> can be limited to between 5M-7M area.

I'm not super familiar with how we set up things on the hypervisor
side, but I'll take your word for it that this would only affect
hyperv.  Please add:
Fixes: 8011a76ad370 ("drm/amdgpu: Add stolen reserved memory for MI25 SRIOV.")
With that:
Acked-by: Alex Deucher <alexander.deucher@amd.com>

>
> Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 3 +++
>  2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> index a66a0881a934..324b43c1bc4c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
> @@ -647,11 +647,12 @@ void amdgpu_gmc_get_vbios_allocations(struct amdgpu_device *adev)
>         case CHIP_VEGA10:
>                 adev->mman.keep_stolen_vga_memory = true;
>                 /*
> -                * VEGA10 SRIOV VF needs some firmware reserved area.
> +                * VEGA10 SRIOV VF with hyper-v host needs some firmware reserved area.
>                  */
> -               if (amdgpu_sriov_vf(adev)) {
> -                       adev->mman.stolen_reserved_offset = 0x100000;
> -                       adev->mman.stolen_reserved_size = 0x600000;
> +               if (amdgpu_sriov_vf(adev) &&
> +                   (adev->gmc.vram_start & AMDGPU_GMC_HYPERV_FB_BASE_MASK)) {
> +                       adev->mman.stolen_reserved_offset = 0x500000;
> +                       adev->mman.stolen_reserved_size = 0x200000;
>                 }
>                 break;
>         case CHIP_RAVEN:
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
> index 032b0313f277..906ec15e8dac 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h
> @@ -61,6 +61,9 @@
>   */
>  #define AMDGPU_GMC_FAULT_TIMEOUT       5000ULL
>
> +/* High part (33 - 47bit) FB address for VEGA10 HYPERV Host*/
> +#define AMDGPU_GMC_HYPERV_FB_BASE_MASK 0xF400000000ULL
> +
>  struct firmware;
>
>  /*
> --
> 2.25.1
>

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

end of thread, other threads:[~2022-04-07 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 14:03 [PATCH] drm/amd/amdgpu: Only reserve vram for firmware with vega10 Hyper-V host Yongqiang Sun
2022-04-07 16:21 ` 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.