* [PATCH 1/3] drm/amdgpu: add smu_memory_pool_size module parameter
@ 2017-10-10 10:39 Rex Zhu
[not found] ` <1507631973-14165-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Rex Zhu @ 2017-10-10 10:39 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Rex Zhu
used to clamp system memmoy for smu debug usage.
Change-Id: I8399f55069b8dcc05a3a79f9285744fcc8549af0
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index da48f97..43fbcfe 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -132,6 +132,7 @@
#ifdef CONFIG_DRM_AMDGPU_CIK
extern int amdgpu_cik_support;
#endif
+extern uint amdgpu_smu_memory_pool_size;
#define AMDGPU_DEFAULT_GTT_SIZE_MB 3072ULL /* 3GB by default */
#define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index ebcba56..d033904 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -126,6 +126,7 @@
int amdgpu_job_hang_limit = 0;
int amdgpu_lbpw = -1;
int amdgpu_compute_multipipe = -1;
+uint amdgpu_smu_memory_pool_size = 0;
MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
@@ -301,6 +302,10 @@
module_param_named(cik_support, amdgpu_cik_support, int, 0444);
#endif
+MODULE_PARM_DESC(smu_memory_pool_size,
+ "clamp max system memory for smu debug usage, 0 = disable,"
+ "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
+module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
static const struct pci_device_id pciidlist[] = {
#ifdef CONFIG_DRM_AMDGPU_SI
--
1.9.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] drm/amdgpu: validate module parameter smu_prv_buffer_size
[not found] ` <1507631973-14165-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
@ 2017-10-10 10:39 ` Rex Zhu
2017-10-10 10:39 ` [PATCH 3/3] drm/amd/powerplay: add new sysfs pp_alloc_mem_for_smu Rex Zhu
2017-10-10 16:33 ` [PATCH 1/3] drm/amdgpu: add smu_memory_pool_size module parameter Alex Deucher
2 siblings, 0 replies; 5+ messages in thread
From: Rex Zhu @ 2017-10-10 10:39 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Rex Zhu
Change-Id: I5f7025a357720c7553035c02519b2b6ac2c59358
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 43 ++++++++++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 ++
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 3 +++
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 2 ++
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 2 ++
6 files changed, 55 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index fdfe418..548f4dc 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -1152,6 +1152,46 @@ static void amdgpu_check_vm_size(struct amdgpu_device *adev)
amdgpu_vm_size = -1;
}
+static void amdgpu_device_check_smu_prv_buffer_size(struct amdgpu_device *adev)
+{
+ struct sysinfo si;
+ bool is_os_64 = (sizeof(void *) == 8) ? true : false;
+ uint64_t total_memory;
+ uint64_t dram_size_seven_GB = 0x1B8000000;
+ uint64_t dram_size_three_GB = 0xB8000000;
+
+ if (amdgpu_smu_memory_pool_size == 0)
+ return;
+
+ if (!is_os_64) {
+ DRM_WARN("Not 64-bit OS, feature not supported\n");
+ goto def_value;
+ }
+ si_meminfo(&si);
+ total_memory = (uint64_t)si.totalram * si.mem_unit;
+
+ if ((amdgpu_smu_memory_pool_size == 1) ||
+ (amdgpu_smu_memory_pool_size == 2)) {
+ if (total_memory < dram_size_three_GB)
+ goto def_value1;
+ } else if ((amdgpu_smu_memory_pool_size == 4) ||
+ (amdgpu_smu_memory_pool_size == 8)) {
+ if (total_memory < dram_size_seven_GB)
+ goto def_value1;
+ } else {
+ DRM_WARN("Smu memory pool size not supported\n");
+ goto def_value;
+ }
+ amdgpu_smu_memory_pool_size = amdgpu_smu_memory_pool_size << 28;
+
+ return;
+
+def_value1:
+ DRM_WARN("No enough system memory\n");
+def_value:
+ amdgpu_smu_memory_pool_size = 0;
+}
+
/**
* amdgpu_check_arguments - validate module params
*
@@ -1193,6 +1233,8 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
amdgpu_vm_fragment_size = -1;
}
+ amdgpu_device_check_smu_prv_buffer_size(adev);
+
amdgpu_check_vm_size(adev);
amdgpu_check_block_size(adev);
@@ -2430,6 +2472,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
release_firmware(adev->firmware.gpu_info_fw);
adev->firmware.gpu_info_fw = NULL;
}
+
adev->accel_working = false;
cancel_delayed_work_sync(&adev->late_init_work);
/* free i2c buses */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index fa2781b..9eab064 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -1280,6 +1280,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
adev->mc.mc_vram_size);
else
gtt_size = (uint64_t)amdgpu_gtt_size << 20;
+
+ gtt_size = gtt_size + amdgpu_smu_memory_pool_size;
+
r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_TT, gtt_size >> PAGE_SHIFT);
if (r) {
DRM_ERROR("Failed initializing GTT heap.\n");
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index f4603a7..e1f97b1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -350,6 +350,8 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
}
+ adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
gmc_v6_0_vram_gtt_location(adev, &adev->mc);
return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
index b0528ca..ac481a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
@@ -407,6 +407,9 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
}
+
+ adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
gmc_v7_0_vram_gtt_location(adev, &adev->mc);
return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index f368cfe..0f5bccc 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -582,6 +582,8 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
}
+ adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
gmc_v8_0_vram_gtt_location(adev, &adev->mc);
return 0;
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 6216993..09cf381 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -511,6 +511,8 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
}
+ adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
gmc_v9_0_vram_gtt_location(adev, &adev->mc);
return 0;
--
1.9.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] drm/amd/powerplay: add new sysfs pp_alloc_mem_for_smu
[not found] ` <1507631973-14165-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2017-10-10 10:39 ` [PATCH 2/3] drm/amdgpu: validate module parameter smu_prv_buffer_size Rex Zhu
@ 2017-10-10 10:39 ` Rex Zhu
2017-10-10 16:33 ` [PATCH 1/3] drm/amdgpu: add smu_memory_pool_size module parameter Alex Deucher
2 siblings, 0 replies; 5+ messages in thread
From: Rex Zhu @ 2017-10-10 10:39 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Rex Zhu
Change-Id: I3f689b8da288ba739aaf74340c056814f80713a9
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 +
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 89 ++++++++++++++++++++++++++++++
3 files changed, 96 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 43fbcfe..7139d3b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1637,6 +1637,8 @@ struct amdgpu_device {
bool has_hw_reset;
u8 reset_magic[AMDGPU_RESET_MAGIC_NUM];
+ struct amdgpu_bo *smu_prv_buffer;
+
/* record last mm index being written through WREG32*/
unsigned long last_mm_index;
bool in_sriov_reset;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 548f4dc..6f07a55 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2426,6 +2426,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
DRM_INFO("amdgpu: acceleration disabled, skipping benchmarks\n");
}
+
/* enable clockgating, etc. after ib tests, etc. since some blocks require
* explicit gating rather than handling it automatically.
*/
@@ -2472,7 +2473,10 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
release_firmware(adev->firmware.gpu_info_fw);
adev->firmware.gpu_info_fw = NULL;
}
-
+ if (adev->smu_prv_buffer) {
+ amdgpu_bo_free_kernel(&adev->smu_prv_buffer, NULL, NULL);
+ adev->smu_prv_buffer = NULL;
+ }
adev->accel_working = false;
cancel_delayed_work_sync(&adev->late_init_work);
/* free i2c buses */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index f3afa66..1c1aceb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -737,6 +737,84 @@ static ssize_t amdgpu_set_pp_compute_power_profile(struct device *dev,
return amdgpu_set_pp_power_profile(dev, buf, count, &request);
}
+static ssize_t amdgpu_get_pp_alloc_mem_for_smu(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ if (amdgpu_smu_memory_pool_size == 0)
+ return snprintf(buf, PAGE_SIZE, "Feature not enabled\n");
+ else
+ return snprintf(buf, PAGE_SIZE, "Max support: %d * 256Mb\n",
+ amdgpu_smu_memory_pool_size >> 28);
+}
+
+static int amdgpu_alloc_mem_for_smu(struct amdgpu_device *adev, uint32_t size)
+{
+ int r = -EINVAL;
+ void *cpu_ptr = NULL;
+ uint64_t gpu_addr;
+
+ if (amdgpu_bo_create_kernel(adev, size,
+ PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
+ &adev->smu_prv_buffer,
+ &gpu_addr,
+ &cpu_ptr)) {
+ DRM_ERROR("amdgpu: failed to create smu prv buffer\n");
+ return r;
+ }
+
+ if (adev->powerplay.pp_funcs->notify_smu_memory_info)
+ r = amdgpu_dpm_notify_smu_memory_info(adev,
+ lower_32_bits((unsigned long)cpu_ptr),
+ upper_32_bits((unsigned long)cpu_ptr),
+ lower_32_bits(gpu_addr),
+ upper_32_bits(gpu_addr),
+ size);
+
+ if (r) {
+ amdgpu_bo_free_kernel(&adev->smu_prv_buffer, NULL, NULL);
+ adev->smu_prv_buffer = NULL;
+ DRM_ERROR("amdgpu: failed to notify SMU buffer address.\n");
+ }
+
+ return r;
+}
+
+static ssize_t amdgpu_set_pp_alloc_mem_for_smu(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf,
+ size_t count)
+{
+ struct drm_device *ddev = dev_get_drvdata(dev);
+ struct amdgpu_device *adev = ddev->dev_private;
+ u32 size;
+ int err;
+
+ err = kstrtou32(buf, 10, &size);
+ if (err)
+ return err;
+
+ if (size == 0) {
+ if (adev->smu_prv_buffer) {
+ amdgpu_bo_free_kernel(&adev->smu_prv_buffer, NULL, NULL);
+ adev->smu_prv_buffer = NULL;
+ return count;
+ }
+ return -EINVAL;
+ }
+
+ size <<= 28;
+ if (size > amdgpu_smu_memory_pool_size) {
+ pr_info("Smu memory pool size not supported\n");
+ return -EINVAL;
+ }
+
+ if (amdgpu_alloc_mem_for_smu(adev, size))
+ count = -EINVAL;
+
+ return count;
+}
+
static DEVICE_ATTR(power_dpm_state, S_IRUGO | S_IWUSR, amdgpu_get_dpm_state, amdgpu_set_dpm_state);
static DEVICE_ATTR(power_dpm_force_performance_level, S_IRUGO | S_IWUSR,
amdgpu_get_dpm_forced_performance_level,
@@ -770,6 +848,10 @@ static DEVICE_ATTR(pp_gfx_power_profile, S_IRUGO | S_IWUSR,
static DEVICE_ATTR(pp_compute_power_profile, S_IRUGO | S_IWUSR,
amdgpu_get_pp_compute_power_profile,
amdgpu_set_pp_compute_power_profile);
+static DEVICE_ATTR(pp_alloc_mem_for_smu, S_IRUGO | S_IWUSR,
+ amdgpu_get_pp_alloc_mem_for_smu,
+ amdgpu_set_pp_alloc_mem_for_smu);
+
static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
struct device_attribute *attr,
@@ -1398,6 +1480,13 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
return ret;
}
+ ret = device_create_file(adev->dev,
+ &dev_attr_pp_alloc_mem_for_smu);
+ if (ret) {
+ DRM_ERROR("failed to create device file pp_alloc_mem_for_smu\n");
+ return ret;
+ }
+
ret = amdgpu_debugfs_pm_init(adev);
if (ret) {
DRM_ERROR("Failed to register debugfs file for dpm!\n");
--
1.9.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] drm/amdgpu: add smu_memory_pool_size module parameter
[not found] ` <1507631973-14165-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2017-10-10 10:39 ` [PATCH 2/3] drm/amdgpu: validate module parameter smu_prv_buffer_size Rex Zhu
2017-10-10 10:39 ` [PATCH 3/3] drm/amd/powerplay: add new sysfs pp_alloc_mem_for_smu Rex Zhu
@ 2017-10-10 16:33 ` Alex Deucher
[not found] ` <CADnq5_P4P_A4wNchSb5qk=65c-qJtnDQS+H1yZXzL4gv+qajFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2017-10-10 16:33 UTC (permalink / raw)
To: Rex Zhu; +Cc: amd-gfx list
On Tue, Oct 10, 2017 at 6:39 AM, Rex Zhu <Rex.Zhu@amd.com> wrote:
> used to clamp system memmoy for smu debug usage.
>
> Change-Id: I8399f55069b8dcc05a3a79f9285744fcc8549af0
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
> 2 files changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index da48f97..43fbcfe 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -132,6 +132,7 @@
> #ifdef CONFIG_DRM_AMDGPU_CIK
> extern int amdgpu_cik_support;
> #endif
> +extern uint amdgpu_smu_memory_pool_size;
>
> #define AMDGPU_DEFAULT_GTT_SIZE_MB 3072ULL /* 3GB by default */
> #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index ebcba56..d033904 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -126,6 +126,7 @@
> int amdgpu_job_hang_limit = 0;
> int amdgpu_lbpw = -1;
> int amdgpu_compute_multipipe = -1;
> +uint amdgpu_smu_memory_pool_size = 0;
>
> MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
> module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
> @@ -301,6 +302,10 @@
> module_param_named(cik_support, amdgpu_cik_support, int, 0444);
> #endif
>
> +MODULE_PARM_DESC(smu_memory_pool_size,
> + "clamp max system memory for smu debug usage, 0 = disable,"
> + "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
> +module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
Sorry, I should have been more clear. I want to avoid adding another
module parameter. I was thinking of a debugfs file (e.g.,
amdgpu_smu_log_size or something like that) and if you set the file to
0, it would disable smu power logging and if you set it to a different
size, it would allocate the memory and then send the smu messages to
enable the logging. Within the debugfs handler it would check the
size against the current gart size and return an error (-ENOMEM) if
the gart wasn't big enough or the allocation failed.
to disable:
echo 0 > /sys/kernel/debug/dri/0/amdgpu_smu_log_size
to enable a 64M SMU log:
echo 64 > /sys/kernel/debug/dri/0/amdgpu_smu_log_size
Alex
>
> static const struct pci_device_id pciidlist[] = {
> #ifdef CONFIG_DRM_AMDGPU_SI
> --
> 1.9.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] drm/amdgpu: add smu_memory_pool_size module parameter
[not found] ` <CADnq5_P4P_A4wNchSb5qk=65c-qJtnDQS+H1yZXzL4gv+qajFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-10-10 16:40 ` Christian König
0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2017-10-10 16:40 UTC (permalink / raw)
To: Alex Deucher, Rex Zhu; +Cc: amd-gfx list
Am 10.10.2017 um 18:33 schrieb Alex Deucher:
> On Tue, Oct 10, 2017 at 6:39 AM, Rex Zhu <Rex.Zhu@amd.com> wrote:
>> used to clamp system memmoy for smu debug usage.
>>
>> Change-Id: I8399f55069b8dcc05a3a79f9285744fcc8549af0
>> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
>> 2 files changed, 6 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index da48f97..43fbcfe 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -132,6 +132,7 @@
>> #ifdef CONFIG_DRM_AMDGPU_CIK
>> extern int amdgpu_cik_support;
>> #endif
>> +extern uint amdgpu_smu_memory_pool_size;
>>
>> #define AMDGPU_DEFAULT_GTT_SIZE_MB 3072ULL /* 3GB by default */
>> #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index ebcba56..d033904 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -126,6 +126,7 @@
>> int amdgpu_job_hang_limit = 0;
>> int amdgpu_lbpw = -1;
>> int amdgpu_compute_multipipe = -1;
>> +uint amdgpu_smu_memory_pool_size = 0;
>>
>> MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
>> module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
>> @@ -301,6 +302,10 @@
>> module_param_named(cik_support, amdgpu_cik_support, int, 0444);
>> #endif
>>
>> +MODULE_PARM_DESC(smu_memory_pool_size,
>> + "clamp max system memory for smu debug usage, 0 = disable,"
>> + "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
>> +module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
> Sorry, I should have been more clear. I want to avoid adding another
> module parameter. I was thinking of a debugfs file (e.g.,
> amdgpu_smu_log_size or something like that) and if you set the file to
> 0, it would disable smu power logging and if you set it to a different
> size, it would allocate the memory and then send the smu messages to
> enable the logging. Within the debugfs handler it would check the
> size against the current gart size and return an error (-ENOMEM) if
> the gart wasn't big enough or the allocation failed.
>
> to disable:
> echo 0 > /sys/kernel/debug/dri/0/amdgpu_smu_log_size
> to enable a 64M SMU log:
> echo 64 > /sys/kernel/debug/dri/0/amdgpu_smu_log_size
Seconded, assuming that you can send the message to the SMU while it is
running that sounds like a much better approach.
You also don't need to really check the size, allocating and pinning a
buffer which is bigger than GART should fail no matter what.
Christian.
>
> Alex
>
>> static const struct pci_device_id pciidlist[] = {
>> #ifdef CONFIG_DRM_AMDGPU_SI
>> --
>> 1.9.1
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-10 16:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-10 10:39 [PATCH 1/3] drm/amdgpu: add smu_memory_pool_size module parameter Rex Zhu
[not found] ` <1507631973-14165-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2017-10-10 10:39 ` [PATCH 2/3] drm/amdgpu: validate module parameter smu_prv_buffer_size Rex Zhu
2017-10-10 10:39 ` [PATCH 3/3] drm/amd/powerplay: add new sysfs pp_alloc_mem_for_smu Rex Zhu
2017-10-10 16:33 ` [PATCH 1/3] drm/amdgpu: add smu_memory_pool_size module parameter Alex Deucher
[not found] ` <CADnq5_P4P_A4wNchSb5qk=65c-qJtnDQS+H1yZXzL4gv+qajFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-10-10 16:40 ` Christian König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox