<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>I wonder if some sort of self-test like the ring/ib tests we do is a good idea. Either from the UMD or KMD.</p>
<p><br>
</p>
<p>In this specific case though are you working around a CU that results in a GPU lockup? Or does it just not respond correctly?</p>
<p><br>
</p>
<p>Tom</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Nicolai Hähnle <nhaehnle@gmail.com><br>
<b>Sent:</b> Friday, June 17, 2016 09:17<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Haehnle, Nicolai<br>
<b>Subject:</b> [amd-gfx] [PATCH 1/3] drm/amdgpu: add disable_cu parameter</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">From: Nicolai Hähnle <nicolai.haehnle@amd.com><br>
<br>
This parameter will allow disabling individual CUs on module load, e.g.<br>
amdgpu.disable_cu=2.0.3,2.0.4 to disable CUs 3 and 4 of SE2.<br>
<br>
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 +++<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 44 +++++++++++++++++++++++++++++++++<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 ++<br>
4 files changed, 51 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index 01c36b8..2d35e11 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -87,6 +87,7 @@ extern int amdgpu_sched_hw_submission;<br>
extern int amdgpu_powerplay;<br>
extern unsigned amdgpu_pcie_gen_cap;<br>
extern unsigned amdgpu_pcie_lane_cap;<br>
+extern char *amdgpu_disable_cu;<br>
<br>
#define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000<br>
#define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
index f888c01..235f732 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
@@ -84,6 +84,7 @@ int amdgpu_sched_hw_submission = 2;<br>
int amdgpu_powerplay = -1;<br>
unsigned amdgpu_pcie_gen_cap = 0;<br>
unsigned amdgpu_pcie_lane_cap = 0;<br>
+char *amdgpu_disable_cu = NULL;<br>
<br>
MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");<br>
module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);<br>
@@ -168,6 +169,9 @@ module_param_named(pcie_gen_cap, amdgpu_pcie_gen_cap, uint, 0444);<br>
MODULE_PARM_DESC(pcie_lane_cap, "PCIE Lane Caps (0: autodetect (default))");<br>
module_param_named(pcie_lane_cap, amdgpu_pcie_lane_cap, uint, 0444);<br>
<br>
+MODULE_PARM_DESC(disable_cu, "Disable CUs (se.sh.cu,...)");<br>
+module_param_named(disable_cu, amdgpu_disable_cu, charp, 0444);<br>
+<br>
static const struct pci_device_id pciidlist[] = {<br>
#ifdef CONFIG_DRM_AMDGPU_CIK<br>
/* Kaveri */<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c<br>
index 9f95da4..a074edd 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c<br>
@@ -70,3 +70,47 @@ void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg)<br>
}<br>
}<br>
}<br>
+<br>
+/**<br>
+ * amdgpu_gfx_parse_disable_cu - Parse the disable_cu module parameter<br>
+ *<br>
+ * @mask: array in which the per-shader array disable masks will be stored<br>
+ * @max_se: number of SEs<br>
+ * @max_sh: number of SHs<br>
+ *<br>
+ * The bitmask of CUs to be disabled in the shader array determined by se and<br>
+ * sh is stored in mask[se * max_sh + sh].<br>
+ */<br>
+void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sh)<br>
+{<br>
+ unsigned se, sh, cu;<br>
+ const char *p;<br>
+<br>
+ memset(mask, 0, sizeof(*mask) * max_se * max_sh);<br>
+<br>
+ if (!amdgpu_disable_cu || !*amdgpu_disable_cu)<br>
+ return;<br>
+<br>
+ p = amdgpu_disable_cu;<br>
+ for (;;) {<br>
+ char *next;<br>
+ int ret = sscanf(p, "%u.%u.%u", &se, &sh, &cu);<br>
+ if (ret < 3) {<br>
+ DRM_ERROR("amdgpu: could not parse disable_cu\n");<br>
+ return;<br>
+ }<br>
+<br>
+ if (se < max_se && sh < max_sh && cu < 16) {<br>
+ DRM_INFO("amdgpu: disabling CU %u.%u.%u\n", se, sh, cu);<br>
+ mask[se * max_sh + sh] |= 1u << cu;<br>
+ } else {<br>
+ DRM_ERROR("amdgpu: disable_cu %u.%u.%u is out of range\n",<br>
+ se, sh, cu);<br>
+ }<br>
+<br>
+ next = strchr(p, ',');<br>
+ if (!next)<br>
+ break;<br>
+ p = next + 1;<br>
+ }<br>
+}<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h<br>
index dc06cbd..51321e1 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h<br>
@@ -27,4 +27,6 @@<br>
int amdgpu_gfx_scratch_get(struct amdgpu_device *adev, uint32_t *reg);<br>
void amdgpu_gfx_scratch_free(struct amdgpu_device *adev, uint32_t reg);<br>
<br>
+unsigned amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se, unsigned max_sh);<br>
+<br>
#endif<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx" id="LPlnk75311">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</div>
</body>
</html>