public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jack Zhang <Jack.Zhang1@amd.com>, Feifei Xu <Feifei.Xu@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Sasha Levin <sashal@kernel.org>,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 5.3 010/292] drm/amdgpu/sriov: add ring_stop before ring_create in psp v11 code
Date: Tue, 10 Dec 2019 16:20:29 -0500	[thread overview]
Message-ID: <20191210212511.11392-10-sashal@kernel.org> (raw)
In-Reply-To: <20191210212511.11392-1-sashal@kernel.org>

From: Jack Zhang <Jack.Zhang1@amd.com>

[ Upstream commit 51c0f58e9f6af3a387d14608033e6796a7ad90ee ]

psp  v11 code missed ring stop in ring create function(VMR)
while psp v3.1 code had the code. This will cause VM destroy1
fail and psp ring create fail.

For SIOV-VF, ring_stop should not be deleted in ring_create
function.

Signed-off-by: Jack Zhang <Jack.Zhang1@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 61 ++++++++++++++------------
 1 file changed, 34 insertions(+), 27 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
index 41b72588adcf5..68774524e58bb 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
@@ -373,6 +373,34 @@ static bool psp_v11_0_support_vmr_ring(struct psp_context *psp)
 	return false;
 }
 
+static int psp_v11_0_ring_stop(struct psp_context *psp,
+			      enum psp_ring_type ring_type)
+{
+	int ret = 0;
+	struct amdgpu_device *adev = psp->adev;
+
+	/* Write the ring destroy command*/
+	if (psp_v11_0_support_vmr_ring(psp))
+		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
+				     GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
+	else
+		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
+				     GFX_CTRL_CMD_ID_DESTROY_RINGS);
+
+	/* there might be handshake issue with hardware which needs delay */
+	mdelay(20);
+
+	/* Wait for response flag (bit 31) */
+	if (psp_v11_0_support_vmr_ring(psp))
+		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
+				   0x80000000, 0x80000000, false);
+	else
+		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
+				   0x80000000, 0x80000000, false);
+
+	return ret;
+}
+
 static int psp_v11_0_ring_create(struct psp_context *psp,
 				enum psp_ring_type ring_type)
 {
@@ -382,6 +410,12 @@ static int psp_v11_0_ring_create(struct psp_context *psp,
 	struct amdgpu_device *adev = psp->adev;
 
 	if (psp_v11_0_support_vmr_ring(psp)) {
+		ret = psp_v11_0_ring_stop(psp, ring_type);
+		if (ret) {
+			DRM_ERROR("psp_v11_0_ring_stop_sriov failed!\n");
+			return ret;
+		}
+
 		/* Write low address of the ring to C2PMSG_102 */
 		psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr);
 		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_ring_reg);
@@ -426,33 +460,6 @@ static int psp_v11_0_ring_create(struct psp_context *psp,
 	return ret;
 }
 
-static int psp_v11_0_ring_stop(struct psp_context *psp,
-			      enum psp_ring_type ring_type)
-{
-	int ret = 0;
-	struct amdgpu_device *adev = psp->adev;
-
-	/* Write the ring destroy command*/
-	if (psp_v11_0_support_vmr_ring(psp))
-		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
-				     GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
-	else
-		WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
-				     GFX_CTRL_CMD_ID_DESTROY_RINGS);
-
-	/* there might be handshake issue with hardware which needs delay */
-	mdelay(20);
-
-	/* Wait for response flag (bit 31) */
-	if (psp_v11_0_support_vmr_ring(psp))
-		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
-				   0x80000000, 0x80000000, false);
-	else
-		ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
-				   0x80000000, 0x80000000, false);
-
-	return ret;
-}
 
 static int psp_v11_0_ring_destroy(struct psp_context *psp,
 				 enum psp_ring_type ring_type)
-- 
2.20.1


  parent reply	other threads:[~2019-12-10 21:27 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-10 21:20 [PATCH AUTOSEL 5.3 001/292] drm/vc4/vc4_hdmi: fill in connector info Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 002/292] drm: mst: Fix query_payload ack reply struct Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 003/292] drm/mipi-dbi: fix a loop in debugfs code Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 004/292] drm/panel: Add missing drm_panel_init() in panel drivers Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 005/292] drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 006/292] drm/amd/display: verify stream link before link test Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 007/292] drm/bridge: analogix-anx78xx: silence -EPROBE_DEFER warnings Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 008/292] iio: max31856: add missing of_node and parent references to iio_dev Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 009/292] iio: light: bh1750: Resolve compiler warning and make code more readable Sasha Levin
2019-12-10 21:20 ` Sasha Levin [this message]
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 011/292] drm/amdgpu: grab the id mgr lock while accessing passid_mapping Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 012/292] ath10k: add cleanup in ath10k_sta_state() Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 013/292] drm/amd/display: Handle virtual signal type in disable_link() Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 014/292] iio: tcs3414: fix iio_triggered_buffer_{pre,post}enable positions Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 015/292] ath10k: Check if station exists before forwarding tx airtime report Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 016/292] spi: Add call to spi_slave_abort() function when spidev driver is released Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 017/292] staging: rtl8192u: fix multiple memory leaks on error path Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 018/292] staging: rtl8188eu: fix possible null dereference Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 019/292] objtool: add kunit_try_catch_throw to the noreturn list Sasha Levin
2019-12-10 21:31   ` Brendan Higgins
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 020/292] rtlwifi: prevent memory leak in rtl_usb_probe Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 021/292] libertas: fix a potential NULL pointer dereference Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 022/292] Revert "pinctrl: sh-pfc: r8a77990: Fix MOD_SEL1 bit30 when using SSI_SCK2 and SSI_WS2" Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 023/292] Revert "pinctrl: sh-pfc: r8a77990: Fix MOD_SEL1 bit31 when using SIM0_D" Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 024/292] ath10k: fix backtrace on coredump Sasha Levin
2019-12-10 21:20 ` [PATCH AUTOSEL 5.3 025/292] IB/iser: bound protection_sg size by data_sg size Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191210212511.11392-10-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Feifei.Xu@amd.com \
    --cc=Jack.Zhang1@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox