Skip to contentSkip to conversation

drm/amdgpu: create a func to check vm size

PATCH NAK Junwei Zhang 4 participants 8 messages Mar 29, 2017 – Mar 31, 2017 5 messages not in the archive

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

PATCH 1/2 drm/amdgpu: create a func to check vm size

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 51 ++++++++++++++++++------------
 1 file changed, 31 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +31 -20
index 3500da3..1ad1113 100644
@@ -1078,6 +1078,36 @@ static void amdgpu_get_block_size(struct amdgpu_device *adev)
 	}
 }
 
+static void amdgpu_check_vm_size(struct amdgpu_device *adev)
+{
+	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
+		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	if (amdgpu_vm_size < 1) {
+		dev_warn(adev->dev, "VM size (%d) too small, min is 1GB\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	/*
+	 * Max GPUVM size for Cayman, SI, CI VI are 40 bits.
+	 */
+	if (amdgpu_vm_size > 1024) {
+		dev_warn(adev->dev, "VM size (%d) too large, max is 1TB\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	return;
+
+def_value:
+	amdgpu_vm_size = 8;
+	dev_info(adev->dev, "set default VM size %dGB\n", amdgpu_vm_size);
+}
+
 /**
  * amdgpu_check_arguments - validate module params
  *
@@ -1107,26 +1137,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
 		}
 	}
 
-	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
-		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
-
-	if (amdgpu_vm_size < 1) {
-		dev_warn(adev->dev, "VM size (%d) too small, min is 1GB\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
-
-	/*
-	 * Max GPUVM size for Cayman, SI and CI are 40 bits.
-	 */
-	if (amdgpu_vm_size > 1024) {
-		dev_warn(adev->dev, "VM size (%d) too large, max is 1TB\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
+	amdgpu_check_vm_size(adev);
 
 	amdgpu_get_block_size(adev);
 
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1490774912-583-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 2/2 drm/amdgpu: set vm size as 256TB for Vega10

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
index 1ad1113..4af4ea0 100644
@@ -1080,6 +1080,11 @@ static void amdgpu_get_block_size(struct amdgpu_device *adev)
 
 static void amdgpu_check_vm_size(struct amdgpu_device *adev)
 {
+	if (adev->asic_type >= CHIP_VEGA10) {
+		amdgpu_vm_size = 1U << 18; /* 256TB */
+		return;
+	}
+
 	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
 		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
 			 amdgpu_vm_size);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1490774912-583-2-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: set vm size as 256TB for Vega10

Am 29.03.2017 um 10:08 schrieb Junwei Zhang:

Quoted 10 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 1ad1113..4af4ea0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_get_block_size(struct amdgpu_device *adev) · line 1087

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -1080,6 +1080,11 @@ static void amdgpu_get_block_size(struct amdgpu_device *adev)
 
  static void amdgpu_check_vm_size(struct amdgpu_device *adev)
  {
+	if (adev->asic_type >= CHIP_VEGA10) {
+		amdgpu_vm_size = 1U << 18; /* 256TB */
+		return;
+	}
+

NAK, that would break in a mixed environment with APU+Vega10.

Instead just go into gmc_v9_0_sw_init() and set max_pfn = 1ULL << 36 and add a comment there why we hardcode this value for Vega10 and later.

Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_get_block_size(struct amdgpu_device *adev) · line 1090

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
  	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
  		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
  			 amdgpu_vm_size);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 0b86e484-9d24-039d-ec26-ed973b0a7f14-5C7GfCeVMHo@public.gmane.org

#6 lore raw

Re: [PATCH 2/2] drm/amdgpu: set vm size as 256TB for Vega10

Quoted 25 lines · Christian König

Am 29.03.2017 um 10:08 schrieb Junwei Zhang:

Quoted 12 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++
  1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 1ad1113..4af4ea0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_get_block_size(struct · line 1087

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -1080,6 +1080,11 @@ static void amdgpu_get_block_size(struct
 amdgpu_device *adev)
    static void amdgpu_check_vm_size(struct amdgpu_device *adev)
  {
+       if (adev->asic_type >= CHIP_VEGA10) {
+               amdgpu_vm_size = 1U << 18; /* 256TB */
+               return;
+       }
+

NAK, that would break in a mixed environment with APU+Vega10.

Quoted 3 lines

Instead just go into gmc_v9_0_sw_init() and set max_pfn = 1ULL << 36 and add a comment there why we hardcode this value for Vega10 and later.

We should fix this for real and move these variables into the driver vm structure and then set those based on the global parameter variables in the various gmc modules.

Alex

Quoted 8 lines

Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_get_block_size(struct amdgpu_device *adev) · line 1090

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
        if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
                dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
                         amdgpu_vm_size);
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): CADnq5_N+w++4ckC4pJkFBh5ouAH+zvwVwuP=XxDUuF=dsLEuLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#8 lore raw

Re: [PATCH 2/2] drm/amdgpu: set vm size as 256TB for Vega10

Am 29.03.2017 um 16:17 schrieb Alex Deucher:

Quoted 25 lines
Quoted 23 lines · Christian König

Am 29.03.2017 um 10:08 schrieb Junwei Zhang:

Quoted 11 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++
   1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 1ad1113..4af4ea0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_get_block_size(struct · line 1087

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -1080,6 +1080,11 @@ static void amdgpu_get_block_size(struct
 amdgpu_device *adev)
     static void amdgpu_check_vm_size(struct amdgpu_device *adev)
   {
+       if (adev->asic_type >= CHIP_VEGA10) {
+               amdgpu_vm_size = 1U << 18; /* 256TB */
+               return;
+       }
+

NAK, that would break in a mixed environment with APU+Vega10.

Quoted 6 lines
Quoted 3 lines

Instead just go into gmc_v9_0_sw_init() and set max_pfn = 1ULL << 36 and add a comment there why we hardcode this value for Vega10 and later.

We should fix this for real and move these variables into the driver vm structure and then set those based on the global parameter variables in the various gmc modules.

Yeah, that's exactly what I've suggested as well.

max_pfn is already part of the vm manager structure, so setting this different on Vega10 than on previous generations shouldn't be a problem.

We just need to add the block size there as well and should be done with it.

Christian.

Quoted 14 lines

Alex

Quoted 11 lines

Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_get_block_size(struct amdgpu_device *adev) · line 1090

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
         if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
                 dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
                          amdgpu_vm_size);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 117a4bc8-debb-76b4-dc2f-6eb4cd247049-5C7GfCeVMHo@public.gmane.org

#10 lore raw

Re: [PATCH 2/2] drm/amdgpu: set vm size as 256TB for Vega10

Quoted 33 lines · Christian König

Am 29.03.2017 um 16:17 schrieb Alex Deucher:

Quoted 25 lines
Quoted 23 lines · Christian König

Am 29.03.2017 um 10:08 schrieb Junwei Zhang:

Quoted 11 lines
---
   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++
   1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 1ad1113..4af4ea0 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_get_block_size(struct · line 1087

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -0
@@ -1080,6 +1080,11 @@ static void amdgpu_get_block_size(struct
 amdgpu_device *adev)
     static void amdgpu_check_vm_size(struct amdgpu_device *adev)
   {
+       if (adev->asic_type >= CHIP_VEGA10) {
+               amdgpu_vm_size = 1U << 18; /* 256TB */
+               return;
+       }
+

NAK, that would break in a mixed environment with APU+Vega10.

Quoted 6 lines
Quoted 3 lines

Instead just go into gmc_v9_0_sw_init() and set max_pfn = 1ULL << 36 and add a comment there why we hardcode this value for Vega10 and later.

We should fix this for real and move these variables into the driver vm structure and then set those based on the global parameter variables in the various gmc modules.

Quoted 6 lines

Yeah, that's exactly what I've suggested as well.

max_pfn is already part of the vm manager structure, so setting this different on Vega10 than on previous generations shouldn't be a problem.

We just need to add the block size there as well and should be done with it.

Thanks for all the comments above.
Prepared another patch to fix it.

Jerry.

Quoted 19 lines

Christian.

Quoted 14 lines

Alex

Quoted 11 lines

Christian.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_get_block_size(struct · line 1090

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
         if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
                 dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
                          amdgpu_vm_size);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Chunming Zhou
#11 lore raw
In reply to a message not in the archive
Quoted 64 lines · Junwei Zhang
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 51 ++++++++++++++++++------------
  1 file changed, 31 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +30 -14
index 3500da3..1ad1113 100644
@@ -1078,6 +1078,36 @@ static void amdgpu_get_block_size(struct amdgpu_device *adev)
  	}
  }
 
+static void amdgpu_check_vm_size(struct amdgpu_device *adev)
+{
+	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
+		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	if (amdgpu_vm_size < 1) {
+		dev_warn(adev->dev, "VM size (%d) too small, min is 1GB\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	/*
+	 * Max GPUVM size for Cayman, SI, CI VI are 40 bits.
+	 */
+	if (amdgpu_vm_size > 1024) {
+		dev_warn(adev->dev, "VM size (%d) too large, max is 1TB\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	return;
+
+def_value:
+	amdgpu_vm_size = 8;
+	dev_info(adev->dev, "set default VM size %dGB\n", amdgpu_vm_size);
+}
+
  /**
   * amdgpu_check_arguments - validate module params
   *
@@ -1107,26 +1137,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
  		}
  	}
 
-	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
-		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
-
-	if (amdgpu_vm_size < 1) {
-		dev_warn(adev->dev, "VM size (%d) too small, min is 1GB\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
-
-	/*
-	 * Max GPUVM size for Cayman, SI and CI are 40 bits.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_check_arguments(struct amdgpu_device *adev) · line 1143

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -6
-	 */
-	if (amdgpu_vm_size > 1024) {
-		dev_warn(adev->dev, "VM size (%d) too large, max is 1TB\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
+	amdgpu_check_vm_size(adev);
 
  	amdgpu_get_block_size(adev);
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#12 lore raw
In reply to a message not in the archive

Am 29.03.2017 um 10:08 schrieb Junwei Zhang:

Quoted 1 line
Quoted 63 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 51 ++++++++++++++++++------------
  1 file changed, 31 insertions(+), 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +30 -14
index 3500da3..1ad1113 100644
@@ -1078,6 +1078,36 @@ static void amdgpu_get_block_size(struct amdgpu_device *adev)
  	}
  }
 
+static void amdgpu_check_vm_size(struct amdgpu_device *adev)
+{
+	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
+		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	if (amdgpu_vm_size < 1) {
+		dev_warn(adev->dev, "VM size (%d) too small, min is 1GB\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	/*
+	 * Max GPUVM size for Cayman, SI, CI VI are 40 bits.
+	 */
+	if (amdgpu_vm_size > 1024) {
+		dev_warn(adev->dev, "VM size (%d) too large, max is 1TB\n",
+			 amdgpu_vm_size);
+		goto def_value;
+	}
+
+	return;
+
+def_value:
+	amdgpu_vm_size = 8;
+	dev_info(adev->dev, "set default VM size %dGB\n", amdgpu_vm_size);
+}
+
  /**
   * amdgpu_check_arguments - validate module params
   *
@@ -1107,26 +1137,7 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
  		}
  	}
 
-	if (!amdgpu_check_pot_argument(amdgpu_vm_size)) {
-		dev_warn(adev->dev, "VM size (%d) must be a power of 2\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
-
-	if (amdgpu_vm_size < 1) {
-		dev_warn(adev->dev, "VM size (%d) too small, min is 1GB\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
-
-	/*
-	 * Max GPUVM size for Cayman, SI and CI are 40 bits.

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_check_arguments(struct amdgpu_device *adev) · line 1143

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -6
-	 */
-	if (amdgpu_vm_size > 1024) {
-		dev_warn(adev->dev, "VM size (%d) too large, max is 1TB\n",
-			 amdgpu_vm_size);
-		amdgpu_vm_size = 8;
-	}
+	amdgpu_check_vm_size(adev);
 
  	amdgpu_get_block_size(adev);
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx