AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pixel Ding <Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Gary.Sun-5C7GfCeVMHo@public.gmane.org,
	pding <Pixel.Ding-5C7GfCeVMHo@public.gmane.org>,
	Bingley.Li-5C7GfCeVMHo@public.gmane.org
Subject: [PATCH 6/7] drm/amdgpu/virt: add wait_reset virt ops
Date: Mon, 23 Oct 2017 18:03:31 +0800	[thread overview]
Message-ID: <1508753012-2196-7-git-send-email-Pixel.Ding@amd.com> (raw)
In-Reply-To: <1508753012-2196-1-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>

From: pding <Pixel.Ding@amd.com>

Driver can use this interface to check if there's a function level
reset done in hypervisor.

Signed-off-by: pding <Pixel.Ding@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 16 ++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h |  2 ++
 drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c    |  1 +
 drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c    |  6 ++++++
 4 files changed, 25 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 33dac7e..6a4a901 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
@@ -231,6 +231,22 @@ int amdgpu_virt_reset_gpu(struct amdgpu_device *adev)
 }
 
 /**
+ * amdgpu_virt_wait_reset() - wait for reset gpu completed
+ * @amdgpu:	amdgpu device.
+ * Wait for GPU reset completed.
+ * Return: Zero if reset success, otherwise will return error.
+ */
+int amdgpu_virt_wait_reset(struct amdgpu_device *adev)
+{
+	struct amdgpu_virt *virt = &adev->virt;
+
+	if (!virt->ops || !virt->ops->wait_reset)
+		return -EINVAL;
+
+	return virt->ops->wait_reset(adev);
+}
+
+/**
  * amdgpu_virt_alloc_mm_table() - alloc memory for mm table
  * @amdgpu:	amdgpu device.
  * MM table is used by UVD and VCE for its initialization
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
index 81efb9d..d149aca 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
@@ -55,6 +55,7 @@ struct amdgpu_virt_ops {
 	int (*req_full_gpu)(struct amdgpu_device *adev, bool init);
 	int (*rel_full_gpu)(struct amdgpu_device *adev, bool init);
 	int (*reset_gpu)(struct amdgpu_device *adev);
+	int (*wait_reset)(struct amdgpu_device *adev);
 	void (*trans_msg)(struct amdgpu_device *adev, u32 req, u32 data1, u32 data2, u32 data3);
 };
 
@@ -286,6 +287,7 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v);
 int amdgpu_virt_request_full_gpu(struct amdgpu_device *adev, bool init);
 int amdgpu_virt_release_full_gpu(struct amdgpu_device *adev, bool init);
 int amdgpu_virt_reset_gpu(struct amdgpu_device *adev);
+int amdgpu_virt_wait_reset(struct amdgpu_device *adev);
 int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, struct amdgpu_job *job);
 int amdgpu_virt_alloc_mm_table(struct amdgpu_device *adev);
 void amdgpu_virt_free_mm_table(struct amdgpu_device *adev);
diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
index b4906d2..f91aab3 100644
--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
+++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_ai.c
@@ -353,5 +353,6 @@ const struct amdgpu_virt_ops xgpu_ai_virt_ops = {
 	.req_full_gpu	= xgpu_ai_request_full_gpu_access,
 	.rel_full_gpu	= xgpu_ai_release_full_gpu_access,
 	.reset_gpu = xgpu_ai_request_reset,
+	.wait_reset = NULL,
 	.trans_msg = xgpu_ai_mailbox_trans_msg,
 };
diff --git a/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c b/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
index c25a831..27b03c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
+++ b/drivers/gpu/drm/amd/amdgpu/mxgpu_vi.c
@@ -458,6 +458,11 @@ static int xgpu_vi_request_reset(struct amdgpu_device *adev)
 	return xgpu_vi_send_access_requests(adev, IDH_REQ_GPU_RESET_ACCESS);
 }
 
+static int xgpu_vi_wait_reset_cmpl(struct amdgpu_device *adev)
+{
+	return xgpu_vi_poll_msg(adev, IDH_FLR_NOTIFICATION_CMPL);
+}
+
 static int xgpu_vi_request_full_gpu_access(struct amdgpu_device *adev,
 					   bool init)
 {
@@ -613,5 +618,6 @@ const struct amdgpu_virt_ops xgpu_vi_virt_ops = {
 	.req_full_gpu		= xgpu_vi_request_full_gpu_access,
 	.rel_full_gpu		= xgpu_vi_release_full_gpu_access,
 	.reset_gpu		= xgpu_vi_request_reset,
+	.wait_reset             = xgpu_vi_wait_reset_cmpl,
 	.trans_msg		= NULL, /* Does not need to trans VF errors to host. */
 };
-- 
2.9.5

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  parent reply	other threads:[~2017-10-23 10:03 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 10:03 Init timing changes for SRIOV VF Pixel Ding
     [not found] ` <1508753012-2196-1-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-10-23 10:03   ` [PATCH 1/7] drm/amdgpu: release VF exclusive accessing after hw_init Pixel Ding
     [not found]     ` <1508753012-2196-2-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-10-23 16:23       ` Deucher, Alexander
     [not found]         ` <BN6PR12MB16528E993E985FB6B21F7022F7460-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-25  1:11           ` Ding, Pixel
     [not found]             ` <C93A21B6-251A-47B5-BC30-C199564D46CA-5C7GfCeVMHo@public.gmane.org>
2017-10-25  1:39               ` Li, Bingley
2017-10-23 10:03   ` [PATCH 2/7] drm/amdgpu: add init_log param to control logs in exclusive mode Pixel Ding
     [not found]     ` <1508753012-2196-3-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-10-23 16:34       ` Deucher, Alexander
2017-10-23 10:03   ` [PATCH 3/7] drm/amdgpu: avoid soft lockup when waiting for RLC serdes Pixel Ding
     [not found]     ` <1508753012-2196-4-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-10-23 16:22       ` Deucher, Alexander
2017-10-23 10:03   ` [PATCH 4/7] drm/amdgpu/virt: add function to check MMIO accessing Pixel Ding
     [not found]     ` <1508753012-2196-5-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-10-23 16:33       ` Deucher, Alexander
     [not found]         ` <BN6PR12MB165261DE3E8A751BD8250C77F7460-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-24  1:42           ` Ding, Pixel
     [not found]             ` <F836DB5B-E4E7-4593-A838-FB852B50510B-5C7GfCeVMHo@public.gmane.org>
2017-10-24 20:42               ` Deucher, Alexander
2017-10-23 10:03   ` [PATCH 5/7] drm/amdgpu: don't disable MSI for GPU virtual function Pixel Ding
     [not found]     ` <1508753012-2196-6-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-10-23 10:57       ` Liu, Monk
     [not found]         ` <BLUPR12MB04494B5ECC666B264207A24A84460-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-24  1:31           ` Ding, Pixel
     [not found]             ` <2237B231-2EE3-4DDE-9C55-71FF3F589D40-5C7GfCeVMHo@public.gmane.org>
2017-10-24  2:04               ` Ding, Pixel
2017-10-24  3:03               ` Liu, Monk
     [not found]                 ` <SN1PR12MB04627B3E054A9BF1D3408CAA84470-z7L1TMIYDg7VaWpRXmIMygdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-24  7:52                   ` Ding, Pixel
     [not found]                     ` <E41D1A06-AB17-4BF4-B98A-CF0B79ABD814-5C7GfCeVMHo@public.gmane.org>
2017-10-24  7:56                       ` Liu, Monk
2017-10-23 10:03   ` Pixel Ding [this message]
     [not found]     ` <1508753012-2196-7-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-10-23 11:01       ` [PATCH 6/7] drm/amdgpu/virt: add wait_reset virt ops Liu, Monk
     [not found]         ` <BLUPR12MB0449ECFA70529779A41D856D84460-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-24  1:33           ` Ding, Pixel
     [not found]             ` <CC2BFABD-8E5A-4E7F-B435-3CA25B1D46C4-5C7GfCeVMHo@public.gmane.org>
2017-10-24  3:00               ` Liu, Monk
2017-10-23 16:28       ` Deucher, Alexander
2017-10-23 10:03   ` [PATCH 7/7] drm/amdgpu: retry init if it fails due to exclusive mode timeout Pixel Ding
     [not found]     ` <1508753012-2196-8-git-send-email-Pixel.Ding-5C7GfCeVMHo@public.gmane.org>
2017-10-23 15:44       ` Andres Rodriguez
     [not found]         ` <04e77adc-085b-6bea-d08d-73a0980bcdc4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-25  1:38           ` Ding, Pixel

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=1508753012-2196-7-git-send-email-Pixel.Ding@amd.com \
    --to=pixel.ding-5c7gfcevmho@public.gmane.org \
    --cc=Bingley.Li-5C7GfCeVMHo@public.gmane.org \
    --cc=Gary.Sun-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.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