Skip to contentSkip to conversation

drm/amd/amdgpu: Only reserve vram for firmware with vega10 MS_HYPERV host.

PATCH In review Yongqiang Sun 2 participants 2 messages Apr 7, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: Only reserve vram for firmware with vega10 MS_HYPERV host.

Fixes 8011a76ad370

("drm/amdgpu: Add stolen reserved memory for MI25 SRIOV.")

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 hypervisor type to only reserve memory for it, and the range of the reserved vram can be limited to between 5M-7M area.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +5 -4
index a66a0881a934..3e9582c245bb 100644
@@ -25,6 +25,7 @@
  */
 
 #include <linux/io-64-nonatomic-lo-hi.h>
+#include <asm/hypervisor.h>
 
 #include "amdgpu.h"
 #include "amdgpu_gmc.h"
@@ -647,11 +648,11 @@ 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 MS_HYPERV 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) && hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
+			adev->mman.stolen_reserved_offset = 0x500000;
+			adev->mman.stolen_reserved_size = 0x200000;
 		}
 		break;
 	case CHIP_RAVEN:
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Yongqiang Sun
Fixes 8011a76ad370

("drm/amdgpu: Add stolen reserved memory for MI25 SRIOV.")

Please put this line between the commit message and your signed-off-by.

Quoted 9 lines

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 hypervisor type to only reserve memory for it, and the range of the reserved vram can be limited to between 5M-7M area.

Quoted 35 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +5 -5
index a66a0881a934..3e9582c245bb 100644
@@ -25,6 +25,7 @@
  */
 
 #include <linux/io-64-nonatomic-lo-hi.h>
+#include <asm/hypervisor.h>
 
 #include "amdgpu.h"
 #include "amdgpu_gmc.h"
@@ -647,11 +648,11 @@ 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 MS_HYPERV 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) && hypervisor_is_type(X86_HYPER_MS_HYPERV)) {
+                       adev->mman.stolen_reserved_offset = 0x500000;
+                       adev->mman.stolen_reserved_size = 0x200000;
                }
                break;
        case CHIP_RAVEN:
--

2.25.1