<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">2025年1月8日 17:31,Lazar, Lijo <<a href="mailto:lijo.lazar@amd.com" class="">lijo.lazar@amd.com</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">On 1/8/2025 2:26 PM, Jiang Liu wrote:</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">Introduce new interface amdgpu_xcp_drm_dev_free() to free a specific<br class="">drm_device crreated by amdgpu_xcp_drm_dev_alloc(), which will be used<br class="">to do error recovery.<br class=""><br class="">Signed-off-by: Jiang Liu <<a href="mailto:gerry@linux.alibaba.com" class="">gerry@linux.alibaba.com</a>><br class="">---<br class="">drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 76 +++++++++++++++++----<br class="">drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h | 1 +<br class="">2 files changed, 63 insertions(+), 14 deletions(-)<br class=""><br class="">diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c<br class="">index faed84172dd4..fc92b5fe1040 100644<br class="">--- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c<br class="">+++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c<br class="">@@ -45,21 +45,32 @@ static const struct drm_driver amdgpu_xcp_driver = {<br class=""><br class="">static int8_t pdev_num;<br class="">static struct xcp_device *xcp_dev[MAX_XCP_PLATFORM_DEVICE];<br class="">+static DEFINE_MUTEX(xcp_mutex);<br class=""><br class="">int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)<br class="">{<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>struct platform_device *pdev;<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>struct xcp_device *pxcp_dev;<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>char dev_name[20];<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>int ret;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>int ret, index;<br class=""><br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>if (pdev_num >= MAX_XCP_PLATFORM_DEVICE)<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>return -ENODEV;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>mutex_lock(&xcp_mutex);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>if (pdev_num >= MAX_XCP_PLATFORM_DEVICE) {<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>ret = -ENODEV;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>goto out_unlock;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>for (index = 0; index < MAX_XCP_PLATFORM_DEVICE; index++) {<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>if (!xcp_dev[index])<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>break;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br class=""><br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", index);<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>pdev = platform_device_register_simple(dev_name, -1, NULL, 0);<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>if (IS_ERR(pdev))<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>return PTR_ERR(pdev);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>if (IS_ERR(pdev)) {<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>ret = PTR_ERR(pdev);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>goto out_unregister;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>if (!devres_open_group(&pdev->dev, NULL, GFP_KERNEL)) {<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>ret = -ENOMEM;<br class="">@@ -72,10 +83,11 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>goto out_devres;<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br class=""><br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>xcp_dev[pdev_num] = pxcp_dev;<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>xcp_dev[pdev_num]->pdev = pdev;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>xcp_dev[index] = pxcp_dev;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>xcp_dev[index]->pdev = pdev;<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>*ddev = &pxcp_dev->drm;<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>pdev_num++;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>mutex_unlock(&xcp_mutex);<br class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>return 0;<br class=""><br class="">@@ -83,21 +95,57 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>devres_release_group(&pdev->dev, NULL);<br class="">out_unregister:<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>platform_device_unregister(pdev);<br class="">+out_unlock:<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>mutex_unlock(&xcp_mutex);<br class=""><br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>return ret;<br class="">}<br class="">EXPORT_SYMBOL(amdgpu_xcp_drm_dev_alloc);<br class=""><br class="">+static void amdgpu_xcp_drm_dev_destroy(int index)<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""><Nit> Use something like __amdgpu_xcp_drm_dev_free(int index) to keep</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">the 'free' suffix.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">+{<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>struct platform_device *pdev;<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>pdev = xcp_dev[index]->pdev;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>devres_release_group(&pdev->dev, NULL);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>platform_device_unregister(pdev);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>xcp_dev[index] = NULL;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>pdev_num--;<br class="">+}<br class="">+<br class="">+void amdgpu_xcp_drm_dev_free(struct drm_device *ddev)<br class="">+{<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>int index;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>struct xcp_device *pxcp_dev;<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>if (ddev == NULL)<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Does it make sense to add !pdev_num check or a WARN_ON(!pdev_num) below?</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>return;<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>pxcp_dev = container_of(ddev, struct xcp_device, drm);<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>mutex_lock(&xcp_mutex);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>for (index = 0; index < MAX_XCP_PLATFORM_DEVICE; index++) {<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>if (xcp_dev[index] == pxcp_dev) {<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>amdgpu_xcp_drm_dev_destroy(index);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>break;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>}<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>mutex_unlock(&xcp_mutex);<br class="">+}<br class="">+EXPORT_SYMBOL(amdgpu_xcp_drm_dev_free);<br class="">+<br class="">void amdgpu_xcp_drv_release(void)<br class="">{<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>for (--pdev_num; pdev_num >= 0; --pdev_num) {<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>struct platform_device *pdev = xcp_dev[pdev_num]->pdev;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>int index;<br class=""><br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>devres_release_group(&pdev->dev, NULL);<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>platform_device_unregister(pdev);<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>xcp_dev[pdev_num] = NULL;<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">To better optimize, add one check like below.</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span class="Apple-tab-span" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"> </span><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">if (!pdev_num)</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span class="Apple-tab-span" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"> </span><span class="Apple-tab-span" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: pre; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"> </span><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">return;</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote><div>Thanks for review and suggestions, all comments will be addressed in next version.</div><br class=""><blockquote type="cite" class=""><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Thanks,</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Lijo</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>mutex_lock(&xcp_mutex);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>for (index = 0; index < MAX_XCP_PLATFORM_DEVICE; index++) {<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>if (xcp_dev[index]) {<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>amdgpu_xcp_drm_dev_destroy(index);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br class=""><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br class="">-<span class="Apple-tab-span" style="white-space: pre;"> </span>pdev_num = 0;<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>WARN_ON(pdev_num != 0);<br class="">+<span class="Apple-tab-span" style="white-space: pre;"> </span>mutex_unlock(&xcp_mutex);<br class="">}<br class="">EXPORT_SYMBOL(amdgpu_xcp_drv_release);<br class=""><br class="">diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h<br class="">index c1c4b679bf95..580a1602c8e3 100644<br class="">--- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h<br class="">+++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.h<br class="">@@ -25,5 +25,6 @@<br class="">#define _AMDGPU_XCP_DRV_H_<br class=""><br class="">int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev);<br class="">+void amdgpu_xcp_drm_dev_free(struct drm_device *ddev);<br class="">void amdgpu_xcp_drv_release(void);<br class="">#endif /* _AMDGPU_XCP_DRV_H_ */</blockquote></div></blockquote></div><br class=""></body></html>