All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 5/5] drm/amdgpu/soc15: add support for baco reset with swSMU
Date: Thu, 10 Oct 2019 10:26:19 -0500	[thread overview]
Message-ID: <20191010152619.31011-6-alexander.deucher@amd.com> (raw)
In-Reply-To: <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>

Add support for vega20 when the swSMU path is used.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 53 +++++++++++++++++++-----------
 1 file changed, 34 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.c b/drivers/gpu/drm/amd/amdgpu/soc15.c
index d17568dd9e87..b3291a19a771 100644
--- a/drivers/gpu/drm/amd/amdgpu/soc15.c
+++ b/drivers/gpu/drm/amd/amdgpu/soc15.c
@@ -478,36 +478,51 @@ static int soc15_asic_mode1_reset(struct amdgpu_device *adev)
 
 static int soc15_asic_get_baco_capability(struct amdgpu_device *adev, bool *cap)
 {
-	void *pp_handle = adev->powerplay.pp_handle;
-	const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
+	if (is_support_sw_smu(adev)) {
+		struct smu_context *smu = &adev->smu;
 
-	if (!pp_funcs || !pp_funcs->get_asic_baco_capability) {
-		*cap = false;
-		return -ENOENT;
-	}
+		*cap = smu_baco_is_support(smu);
+		return 0;
+	} else {
+		void *pp_handle = adev->powerplay.pp_handle;
+		const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
 
-	return pp_funcs->get_asic_baco_capability(pp_handle, cap);
+		if (!pp_funcs || !pp_funcs->get_asic_baco_capability) {
+			*cap = false;
+			return -ENOENT;
+		}
+
+		return pp_funcs->get_asic_baco_capability(pp_handle, cap);
+	}
 }
 
 static int soc15_asic_baco_reset(struct amdgpu_device *adev)
 {
-	void *pp_handle = adev->powerplay.pp_handle;
-	const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
+	if (is_support_sw_smu(adev)) {
+		struct smu_context *smu = &adev->smu;
 
-	if (!pp_funcs ||!pp_funcs->get_asic_baco_state ||!pp_funcs->set_asic_baco_state)
-		return -ENOENT;
+		dev_info(adev->dev, "GPU BACO reset\n");
+
+		return smu_baco_reset(smu);
+	} else {
+		void *pp_handle = adev->powerplay.pp_handle;
+		const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs;
 
-	/* enter BACO state */
-	if (pp_funcs->set_asic_baco_state(pp_handle, 1))
-		return -EIO;
+		if (!pp_funcs ||!pp_funcs->get_asic_baco_state ||!pp_funcs->set_asic_baco_state)
+			return -ENOENT;
 
-	/* exit BACO state */
-	if (pp_funcs->set_asic_baco_state(pp_handle, 0))
-		return -EIO;
+		/* enter BACO state */
+		if (pp_funcs->set_asic_baco_state(pp_handle, 1))
+			return -EIO;
 
-	dev_info(adev->dev, "GPU BACO reset\n");
+		/* exit BACO state */
+		if (pp_funcs->set_asic_baco_state(pp_handle, 0))
+			return -EIO;
 
-	return 0;
+		dev_info(adev->dev, "GPU BACO reset\n");
+
+		return 0;
+	}
 }
 
 static int soc15_mode2_reset(struct amdgpu_device *adev)
-- 
2.20.1

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

  parent reply	other threads:[~2019-10-10 15:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-10 15:26 [PATCH 0/5] Misc runpm and baco fixes Alex Deucher
     [not found] ` <20191010152619.31011-1-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2019-10-10 15:26   ` [PATCH 1/5] drm/amdgpu: move pci_save_state into suspend path Alex Deucher
2019-10-10 15:26   ` [PATCH 2/5] drm/amdgpu: move gpu reset out of amdgpu_device_suspend Alex Deucher
     [not found]     ` <20191010152619.31011-3-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2019-10-11  4:07       ` Quan, Evan
     [not found]         ` <BN8PR12MB3329E4B5DE6B027D43B38F5AE4970-h6+T2+wrnx3WSNCBJ7MpiAdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-10-11  4:09           ` Quan, Evan
2019-10-11 13:25           ` Alex Deucher
     [not found]             ` <CADnq5_Pbi+K=62tY0sJdOARy74wpnh+Owfq3wQb0tcyXE2XtFw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-10-12  1:42               ` Quan, Evan
     [not found]                 ` <MN2PR12MB3344923284A5FF12F631B634E4960-rweVpJHSKToDMgCC8P//OwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-10-12  1:49                   ` Alex Deucher
2019-10-10 15:26   ` [PATCH 3/5] drm/amdgpu: simplify ATPX detection Alex Deucher
2019-10-10 15:26   ` [PATCH 4/5] drm/amdgpu: remove in_baco_reset hack Alex Deucher
2019-10-10 15:26   ` Alex Deucher [this message]
     [not found]     ` <20191010152619.31011-6-alexander.deucher-5C7GfCeVMHo@public.gmane.org>
2019-10-11  4:09       ` [PATCH 5/5] drm/amdgpu/soc15: add support for baco reset with swSMU Quan, Evan

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=20191010152619.31011-6-alexander.deucher@amd.com \
    --to=alexdeucher-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=alexander.deucher-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.