All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table
@ 2022-01-21 20:22 Alex Deucher
  2022-01-21 20:22 ` [PATCH 2/5] drm/amdgpu: move PX checking into amdgpu_device_ip_early_init Alex Deucher
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Alex Deucher @ 2022-01-21 20:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

Use the IP versions to set the APU flag when necessary.

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index e6a26b554254..ddbe13c9e4c7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -1253,6 +1253,19 @@ int amdgpu_discovery_set_ip_blocks(struct amdgpu_device *adev)
 		return -EINVAL;
 	}
 
+	switch (adev->ip_versions[GC_HWIP][0]) {
+	case IP_VERSION(9, 1, 0):
+	case IP_VERSION(9, 2, 2):
+	case IP_VERSION(9, 3, 0):
+	case IP_VERSION(10, 1, 3):
+	case IP_VERSION(10, 3, 1):
+	case IP_VERSION(10, 3, 3):
+		adev->flags |= AMD_IS_APU;
+		break;
+	default:
+		break;
+	}
+
 	if (adev->ip_versions[XGMI_HWIP][0] == IP_VERSION(4, 8, 0))
 		adev->gmc.xgmi.supported = true;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] drm/amdgpu: move PX checking into amdgpu_device_ip_early_init
  2022-01-21 20:22 [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Alex Deucher
@ 2022-01-21 20:22 ` Alex Deucher
  2022-01-21 20:22 ` [PATCH 3/5] drm/amdgpu: move runtime pm init after drm and fbdev init Alex Deucher
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2022-01-21 20:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

We need to set the APU flag from IP discovery before
we evaluate this code.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c    | 13 -------------
 2 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index 061ea30650cc..df78adecf157 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -31,6 +31,7 @@
 #include <linux/console.h>
 #include <linux/slab.h>
 #include <linux/iommu.h>
+#include <linux/pci.h>
 
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_probe_helper.h>
@@ -2073,6 +2074,8 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
  */
 static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 {
+	struct drm_device *dev = adev_to_drm(adev);
+	struct pci_dev *parent;
 	int i, r;
 
 	amdgpu_device_enable_virtual_display(adev);
@@ -2137,6 +2140,18 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 		break;
 	}
 
+	if (amdgpu_has_atpx() &&
+	    (amdgpu_is_atpx_hybrid() ||
+	     amdgpu_has_atpx_dgpu_power_cntl()) &&
+	    ((adev->flags & AMD_IS_APU) == 0) &&
+	    !pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
+		adev->flags |= AMD_IS_PX;
+
+	if (!(adev->flags & AMD_IS_APU)) {
+		parent = pci_upstream_bridge(adev->pdev);
+		adev->has_pr3 = parent ? pci_pr3_present(parent) : false;
+	}
+
 	amdgpu_amdkfd_device_probe(adev);
 
 	adev->pm.pp_feature = amdgpu_pp_feature_mask;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 56c2d988694a..16a6da09c924 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -152,23 +152,10 @@ static void amdgpu_get_audio_func(struct amdgpu_device *adev)
 int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
 {
 	struct drm_device *dev;
-	struct pci_dev *parent;
 	int r, acpi_status;
 
 	dev = adev_to_drm(adev);
 
-	if (amdgpu_has_atpx() &&
-	    (amdgpu_is_atpx_hybrid() ||
-	     amdgpu_has_atpx_dgpu_power_cntl()) &&
-	    ((flags & AMD_IS_APU) == 0) &&
-	    !pci_is_thunderbolt_attached(to_pci_dev(dev->dev)))
-		flags |= AMD_IS_PX;
-
-	if (!(flags & AMD_IS_APU)) {
-		parent = pci_upstream_bridge(adev->pdev);
-		adev->has_pr3 = parent ? pci_pr3_present(parent) : false;
-	}
-
 	/* amdgpu_device_init should report only fatal error
 	 * like memory allocation failure or iomapping failure,
 	 * or memory manager initialization failure, it must
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] drm/amdgpu: move runtime pm init after drm and fbdev init
  2022-01-21 20:22 [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Alex Deucher
  2022-01-21 20:22 ` [PATCH 2/5] drm/amdgpu: move PX checking into amdgpu_device_ip_early_init Alex Deucher
@ 2022-01-21 20:22 ` Alex Deucher
  2022-01-21 20:22 ` [PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs Alex Deucher
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2022-01-21 20:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

Seems more logical to enable runtime pm at the end of
the init sequence so we don't end up entering runtime
suspend before init is finished.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 65 +++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 69 +------------------------
 2 files changed, 66 insertions(+), 68 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 75ceb43392b1..89c3578bc818 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1968,6 +1968,22 @@ static bool amdgpu_is_fw_framebuffer(resource_size_t base,
 	return found;
 }
 
+static void amdgpu_get_audio_func(struct amdgpu_device *adev)
+{
+	struct pci_dev *p = NULL;
+
+	p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
+			adev->pdev->bus->number, 1);
+	if (p) {
+		pm_runtime_get_sync(&p->dev);
+
+		pm_runtime_mark_last_busy(&p->dev);
+		pm_runtime_put_autosuspend(&p->dev);
+
+		pci_dev_put(p);
+	}
+}
+
 static int amdgpu_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *ent)
 {
@@ -2100,6 +2116,48 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 	if (ret)
 		DRM_ERROR("Creating debugfs files failed (%d).\n", ret);
 
+	if (adev->runpm) {
+		/* only need to skip on ATPX */
+		if (amdgpu_device_supports_px(ddev))
+			dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
+		/* we want direct complete for BOCO */
+		if (amdgpu_device_supports_boco(ddev))
+			dev_pm_set_driver_flags(ddev->dev, DPM_FLAG_SMART_PREPARE |
+						DPM_FLAG_SMART_SUSPEND |
+						DPM_FLAG_MAY_SKIP_RESUME);
+		pm_runtime_use_autosuspend(ddev->dev);
+		pm_runtime_set_autosuspend_delay(ddev->dev, 5000);
+
+		pm_runtime_allow(ddev->dev);
+
+		pm_runtime_mark_last_busy(ddev->dev);
+		pm_runtime_put_autosuspend(ddev->dev);
+
+		/*
+		 * For runpm implemented via BACO, PMFW will handle the
+		 * timing for BACO in and out:
+		 *   - put ASIC into BACO state only when both video and
+		 *     audio functions are in D3 state.
+		 *   - pull ASIC out of BACO state when either video or
+		 *     audio function is in D0 state.
+		 * Also, at startup, PMFW assumes both functions are in
+		 * D0 state.
+		 *
+		 * So if snd driver was loaded prior to amdgpu driver
+		 * and audio function was put into D3 state, there will
+		 * be no PMFW-aware D-state transition(D0->D3) on runpm
+		 * suspend. Thus the BACO will be not correctly kicked in.
+		 *
+		 * Via amdgpu_get_audio_func(), the audio dev is put
+		 * into D0 state. Then there will be a PMFW-aware D-state
+		 * transition(D0->D3) on runpm suspend.
+		 */
+		if (amdgpu_device_supports_baco(ddev) &&
+		    !(adev->flags & AMD_IS_APU) &&
+		    (adev->asic_type >= CHIP_NAVI10))
+			amdgpu_get_audio_func(adev);
+	}
+
 	return 0;
 
 err_pci:
@@ -2111,8 +2169,15 @@ static void
 amdgpu_pci_remove(struct pci_dev *pdev)
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
+	struct amdgpu_device *adev = drm_to_adev(dev);
 
 	drm_dev_unplug(dev);
+
+	if (adev->runpm) {
+		pm_runtime_get_sync(dev->dev);
+		pm_runtime_forbid(dev->dev);
+	}
+
 	amdgpu_driver_unload_kms(dev);
 
 	/*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
index 16a6da09c924..4c437ad2dd9a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
@@ -87,11 +87,6 @@ void amdgpu_driver_unload_kms(struct drm_device *dev)
 	if (adev->rmmio == NULL)
 		return;
 
-	if (adev->runpm) {
-		pm_runtime_get_sync(dev->dev);
-		pm_runtime_forbid(dev->dev);
-	}
-
 	if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DRV_UNLOAD))
 		DRM_WARN("smart shift update failed\n");
 
@@ -124,22 +119,6 @@ void amdgpu_register_gpu_instance(struct amdgpu_device *adev)
 	mutex_unlock(&mgpu_info.mutex);
 }
 
-static void amdgpu_get_audio_func(struct amdgpu_device *adev)
-{
-	struct pci_dev *p = NULL;
-
-	p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
-			adev->pdev->bus->number, 1);
-	if (p) {
-		pm_runtime_get_sync(&p->dev);
-
-		pm_runtime_mark_last_busy(&p->dev);
-		pm_runtime_put_autosuspend(&p->dev);
-
-		pci_dev_put(p);
-	}
-}
-
 /**
  * amdgpu_driver_load_kms - Main load function for KMS.
  *
@@ -213,58 +192,12 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags)
 	if (acpi_status)
 		dev_dbg(dev->dev, "Error during ACPI methods call\n");
 
-	if (adev->runpm) {
-		/* only need to skip on ATPX */
-		if (amdgpu_device_supports_px(dev))
-			dev_pm_set_driver_flags(dev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
-		/* we want direct complete for BOCO */
-		if (amdgpu_device_supports_boco(dev))
-			dev_pm_set_driver_flags(dev->dev, DPM_FLAG_SMART_PREPARE |
-						DPM_FLAG_SMART_SUSPEND |
-						DPM_FLAG_MAY_SKIP_RESUME);
-		pm_runtime_use_autosuspend(dev->dev);
-		pm_runtime_set_autosuspend_delay(dev->dev, 5000);
-
-		pm_runtime_allow(dev->dev);
-
-		pm_runtime_mark_last_busy(dev->dev);
-		pm_runtime_put_autosuspend(dev->dev);
-
-		/*
-		 * For runpm implemented via BACO, PMFW will handle the
-		 * timing for BACO in and out:
-		 *   - put ASIC into BACO state only when both video and
-		 *     audio functions are in D3 state.
-		 *   - pull ASIC out of BACO state when either video or
-		 *     audio function is in D0 state.
-		 * Also, at startup, PMFW assumes both functions are in
-		 * D0 state.
-		 *
-		 * So if snd driver was loaded prior to amdgpu driver
-		 * and audio function was put into D3 state, there will
-		 * be no PMFW-aware D-state transition(D0->D3) on runpm
-		 * suspend. Thus the BACO will be not correctly kicked in.
-		 *
-		 * Via amdgpu_get_audio_func(), the audio dev is put
-		 * into D0 state. Then there will be a PMFW-aware D-state
-		 * transition(D0->D3) on runpm suspend.
-		 */
-		if (amdgpu_device_supports_baco(dev) &&
-		    !(adev->flags & AMD_IS_APU) &&
-		    (adev->asic_type >= CHIP_NAVI10))
-			amdgpu_get_audio_func(adev);
-	}
-
 	if (amdgpu_acpi_smart_shift_update(dev, AMDGPU_SS_DRV_LOAD))
 		DRM_WARN("smart shift update failed\n");
 
 out:
-	if (r) {
-		/* balance pm_runtime_get_sync in amdgpu_driver_unload_kms */
-		if (adev->rmmio && adev->runpm)
-			pm_runtime_put_noidle(dev->dev);
+	if (r)
 		amdgpu_driver_unload_kms(dev);
-	}
 
 	return r;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs
  2022-01-21 20:22 [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Alex Deucher
  2022-01-21 20:22 ` [PATCH 2/5] drm/amdgpu: move PX checking into amdgpu_device_ip_early_init Alex Deucher
  2022-01-21 20:22 ` [PATCH 3/5] drm/amdgpu: move runtime pm init after drm and fbdev init Alex Deucher
@ 2022-01-21 20:22 ` Alex Deucher
  2022-01-24  3:50   ` Quan, Evan
  2022-01-21 20:22 ` [PATCH 5/5] drm/amdgpu: convert amdgpu_display_supported_domains() to IP versions Alex Deucher
  2022-01-24  5:42 ` [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Liu, Aaron
  4 siblings, 1 reply; 7+ messages in thread
From: Alex Deucher @ 2022-01-21 20:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

Extend secondary function handling for runtime pm beyond audio
to USB and UCSI.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 30 +++++++++++++++----------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index 89c3578bc818..119a5798623e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -1968,19 +1968,25 @@ static bool amdgpu_is_fw_framebuffer(resource_size_t base,
 	return found;
 }
 
-static void amdgpu_get_audio_func(struct amdgpu_device *adev)
+static void amdgpu_get_secondary_funcs(struct amdgpu_device *adev)
 {
 	struct pci_dev *p = NULL;
+	int i;
 
-	p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
-			adev->pdev->bus->number, 1);
-	if (p) {
-		pm_runtime_get_sync(&p->dev);
-
-		pm_runtime_mark_last_busy(&p->dev);
-		pm_runtime_put_autosuspend(&p->dev);
-
-		pci_dev_put(p);
+	/* 0 - GPU
+	 * 1 - audio
+	 * 2 - USB
+	 * 3 - UCSI
+	 */
+	for (i = 1; i < 4; i++) {
+		p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev->bus),
+						adev->pdev->bus->number, i);
+		if (p) {
+			pm_runtime_get_sync(&p->dev);
+			pm_runtime_mark_last_busy(&p->dev);
+			pm_runtime_put_autosuspend(&p->dev);
+			pci_dev_put(p);
+		}
 	}
 }
 
@@ -2148,14 +2154,14 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
 		 * be no PMFW-aware D-state transition(D0->D3) on runpm
 		 * suspend. Thus the BACO will be not correctly kicked in.
 		 *
-		 * Via amdgpu_get_audio_func(), the audio dev is put
+		 * Via amdgpu_get_secondary_funcs(), the audio dev is put
 		 * into D0 state. Then there will be a PMFW-aware D-state
 		 * transition(D0->D3) on runpm suspend.
 		 */
 		if (amdgpu_device_supports_baco(ddev) &&
 		    !(adev->flags & AMD_IS_APU) &&
 		    (adev->asic_type >= CHIP_NAVI10))
-			amdgpu_get_audio_func(adev);
+			amdgpu_get_secondary_funcs(adev);
 	}
 
 	return 0;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] drm/amdgpu: convert amdgpu_display_supported_domains() to IP versions
  2022-01-21 20:22 [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Alex Deucher
                   ` (2 preceding siblings ...)
  2022-01-21 20:22 ` [PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs Alex Deucher
@ 2022-01-21 20:22 ` Alex Deucher
  2022-01-24  5:42 ` [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Liu, Aaron
  4 siblings, 0 replies; 7+ messages in thread
From: Alex Deucher @ 2022-01-21 20:22 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alex Deucher

Check IP versions rather than asic types.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 29 ++++++++++++---------
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
index 82011e75ed85..6cad39c31c58 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
@@ -510,19 +510,24 @@ uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
 		case CHIP_STONEY:
 			domain |= AMDGPU_GEM_DOMAIN_GTT;
 			break;
-		case CHIP_RAVEN:
-			/* enable S/G on PCO and RV2 */
-			if ((adev->apu_flags & AMD_APU_IS_RAVEN2) ||
-			    (adev->apu_flags & AMD_APU_IS_PICASSO))
-				domain |= AMDGPU_GEM_DOMAIN_GTT;
-			break;
-		case CHIP_RENOIR:
-		case CHIP_VANGOGH:
-		case CHIP_YELLOW_CARP:
-			domain |= AMDGPU_GEM_DOMAIN_GTT;
-			break;
-
 		default:
+			switch (adev->ip_versions[DCE_HWIP][0]) {
+			case IP_VERSION(1, 0, 0):
+			case IP_VERSION(1, 0, 1):
+				/* enable S/G on PCO and RV2 */
+				if ((adev->apu_flags & AMD_APU_IS_RAVEN2) ||
+				    (adev->apu_flags & AMD_APU_IS_PICASSO))
+					domain |= AMDGPU_GEM_DOMAIN_GTT;
+				break;
+			case IP_VERSION(2, 1, 0):
+			case IP_VERSION(3, 0, 1):
+			case IP_VERSION(3, 1, 2):
+			case IP_VERSION(3, 1, 3):
+				domain |= AMDGPU_GEM_DOMAIN_GTT;
+				break;
+			default:
+				break;
+			}
 			break;
 		}
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs
  2022-01-21 20:22 ` [PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs Alex Deucher
@ 2022-01-24  3:50   ` Quan, Evan
  0 siblings, 0 replies; 7+ messages in thread
From: Quan, Evan @ 2022-01-24  3:50 UTC (permalink / raw)
  To: Deucher, Alexander, amd-gfx; +Cc: Deucher, Alexander

[AMD Official Use Only]



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Saturday, January 22, 2022 4:22 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
> Subject: [PATCH 4/5] drm/amdgpu: handle BACO synchronization with
> secondary funcs
> 
> Extend secondary function handling for runtime pm beyond audio
> to USB and UCSI.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 30 +++++++++++++++------
> ----
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index 89c3578bc818..119a5798623e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -1968,19 +1968,25 @@ static bool
> amdgpu_is_fw_framebuffer(resource_size_t base,
>  	return found;
>  }
> 
> -static void amdgpu_get_audio_func(struct amdgpu_device *adev)
> +static void amdgpu_get_secondary_funcs(struct amdgpu_device *adev)
>  {
>  	struct pci_dev *p = NULL;
> +	int i;
> 
> -	p = pci_get_domain_bus_and_slot(pci_domain_nr(adev->pdev-
> >bus),
> -			adev->pdev->bus->number, 1);
> -	if (p) {
> -		pm_runtime_get_sync(&p->dev);
> -
> -		pm_runtime_mark_last_busy(&p->dev);
> -		pm_runtime_put_autosuspend(&p->dev);
> -
> -		pci_dev_put(p);
> +	/* 0 - GPU
> +	 * 1 - audio
> +	 * 2 - USB
> +	 * 3 - UCSI
> +	 */
> +	for (i = 1; i < 4; i++) {
> +		p = pci_get_domain_bus_and_slot(pci_domain_nr(adev-
> >pdev->bus),
> +						adev->pdev->bus->number,
> i);
> +		if (p) {
> +			pm_runtime_get_sync(&p->dev);
> +			pm_runtime_mark_last_busy(&p->dev);
> +			pm_runtime_put_autosuspend(&p->dev);
> +			pci_dev_put(p);
> +		}
>  	}
>  }
[Quan, Evan] Although PMFW does not care the status of those functions except audio. Logically this seems more reasonable and should be harmless.
Patch 3 & 4 are reviewed-by: Evan Quan <evan.quan@amd.com>
Patch 1, 2, 5 are acked-by: Evan Quan <evan.quan@amd.com>
> 
> @@ -2148,14 +2154,14 @@ static int amdgpu_pci_probe(struct pci_dev
> *pdev,
>  		 * be no PMFW-aware D-state transition(D0->D3) on runpm
>  		 * suspend. Thus the BACO will be not correctly kicked in.
>  		 *
> -		 * Via amdgpu_get_audio_func(), the audio dev is put
> +		 * Via amdgpu_get_secondary_funcs(), the audio dev is put
>  		 * into D0 state. Then there will be a PMFW-aware D-state
>  		 * transition(D0->D3) on runpm suspend.
>  		 */
>  		if (amdgpu_device_supports_baco(ddev) &&
>  		    !(adev->flags & AMD_IS_APU) &&
>  		    (adev->asic_type >= CHIP_NAVI10))
> -			amdgpu_get_audio_func(adev);
> +			amdgpu_get_secondary_funcs(adev);
>  	}
> 
>  	return 0;
> --
> 2.34.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table
  2022-01-21 20:22 [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Alex Deucher
                   ` (3 preceding siblings ...)
  2022-01-21 20:22 ` [PATCH 5/5] drm/amdgpu: convert amdgpu_display_supported_domains() to IP versions Alex Deucher
@ 2022-01-24  5:42 ` Liu, Aaron
  4 siblings, 0 replies; 7+ messages in thread
From: Liu, Aaron @ 2022-01-24  5:42 UTC (permalink / raw)
  To: Deucher, Alexander, amd-gfx; +Cc: Deucher, Alexander

[AMD Official Use Only]

Reviewed-by: Aaron Liu <aaron.liu@amd.com>

--
Best Regards
Aaron Liu

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Saturday, January 22, 2022 4:22 AM
> To: amd-gfx@lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher@amd.com>
> Subject: [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table
> 
> Use the IP versions to set the APU flag when necessary.
> 
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index e6a26b554254..ddbe13c9e4c7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -1253,6 +1253,19 @@ int amdgpu_discovery_set_ip_blocks(struct
> amdgpu_device *adev)
>  		return -EINVAL;
>  	}
> 
> +	switch (adev->ip_versions[GC_HWIP][0]) {
> +	case IP_VERSION(9, 1, 0):
> +	case IP_VERSION(9, 2, 2):
> +	case IP_VERSION(9, 3, 0):
> +	case IP_VERSION(10, 1, 3):
> +	case IP_VERSION(10, 3, 1):
> +	case IP_VERSION(10, 3, 3):
> +		adev->flags |= AMD_IS_APU;
> +		break;
> +	default:
> +		break;
> +	}
> +
>  	if (adev->ip_versions[XGMI_HWIP][0] == IP_VERSION(4, 8, 0))
>  		adev->gmc.xgmi.supported = true;
> 
> --
> 2.34.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-24  5:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-21 20:22 [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Alex Deucher
2022-01-21 20:22 ` [PATCH 2/5] drm/amdgpu: move PX checking into amdgpu_device_ip_early_init Alex Deucher
2022-01-21 20:22 ` [PATCH 3/5] drm/amdgpu: move runtime pm init after drm and fbdev init Alex Deucher
2022-01-21 20:22 ` [PATCH 4/5] drm/amdgpu: handle BACO synchronization with secondary funcs Alex Deucher
2022-01-24  3:50   ` Quan, Evan
2022-01-21 20:22 ` [PATCH 5/5] drm/amdgpu: convert amdgpu_display_supported_domains() to IP versions Alex Deucher
2022-01-24  5:42 ` [PATCH 1/5] drm/amdgpu: set APU flag based on IP discovery table Liu, Aaron

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.