From: "Christian König" <deathsimple@vodafone.de>
To: Alex Deucher <alexdeucher@gmail.com>, dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>, stable@vger.kernel.org
Subject: Re: [PATCH] drm/radeon: fix runpm handling on APUs (v4)
Date: Fri, 11 Apr 2014 15:10:00 +0200 [thread overview]
Message-ID: <5347E9A8.6060001@vodafone.de> (raw)
In-Reply-To: <1397183343-1351-1-git-send-email-alexander.deucher@amd.com>
Am 11.04.2014 04:29, schrieb Alex Deucher:
> Don't try and runtime suspend the APU in PX systems. We
> only want to power down the dGPU.
>
> v2: fix harder
> v3: fix stupid typo
> v4: consolidate runpm enablement to a single flag
>
> bugs:
> https://bugs.freedesktop.org/show_bug.cgi?id=75127
> https://bugzilla.kernel.org/show_bug.cgi?id=72701
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: stable@vger.kernel.org
All three patches added to my drm-fixes-3.15 queue.
Is it correct that "[PATCH] drm/radeon: update CI DPM powertune
settings" doesn't have a "CC: stable..." ?
Christian.
> ---
> drivers/gpu/drm/radeon/radeon.h | 1 +
> drivers/gpu/drm/radeon/radeon_atpx_handler.c | 2 +-
> drivers/gpu/drm/radeon/radeon_device.c | 19 ++++++++++---------
> drivers/gpu/drm/radeon/radeon_drv.c | 24 ++++--------------------
> drivers/gpu/drm/radeon/radeon_family.h | 1 +
> drivers/gpu/drm/radeon/radeon_kms.c | 14 ++++++++++----
> 6 files changed, 27 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
> index f0fc2c8..3d94c0d 100644
> --- a/drivers/gpu/drm/radeon/radeon.h
> +++ b/drivers/gpu/drm/radeon/radeon.h
> @@ -2318,6 +2318,7 @@ struct radeon_device {
> bool have_disp_power_ref;
> };
>
> +bool radeon_is_px(struct drm_device *dev);
> int radeon_device_init(struct radeon_device *rdev,
> struct drm_device *ddev,
> struct pci_dev *pdev,
> diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
> index fa9a9c0..dedea72 100644
> --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
> +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
> @@ -59,7 +59,7 @@ struct atpx_mux {
> u16 mux;
> } __packed;
>
> -bool radeon_is_px(void) {
> +bool radeon_has_atpx(void) {
> return radeon_atpx_priv.atpx_detected;
> }
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 2e72dcd..00b19d0 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -102,11 +102,14 @@ static const char radeon_family_name[][16] = {
> "LAST",
> };
>
> -#if defined(CONFIG_VGA_SWITCHEROO)
> -bool radeon_is_px(void);
> -#else
> -static inline bool radeon_is_px(void) { return false; }
> -#endif
> +bool radeon_is_px(struct drm_device *dev)
> +{
> + struct radeon_device *rdev = dev->dev_private;
> +
> + if (rdev->flags & RADEON_IS_PX)
> + return true;
> + return false;
> +}
>
> /**
> * radeon_program_register_sequence - program an array of registers.
> @@ -1082,7 +1085,7 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero
> {
> struct drm_device *dev = pci_get_drvdata(pdev);
>
> - if (radeon_is_px() && state == VGA_SWITCHEROO_OFF)
> + if (radeon_is_px(dev) && state == VGA_SWITCHEROO_OFF)
> return;
>
> if (state == VGA_SWITCHEROO_ON) {
> @@ -1301,9 +1304,7 @@ int radeon_device_init(struct radeon_device *rdev,
> * ignore it */
> vga_client_register(rdev->pdev, rdev, NULL, radeon_vga_set_decode);
>
> - if (radeon_runtime_pm == 1)
> - runtime = true;
> - if ((radeon_runtime_pm == -1) && radeon_is_px())
> + if (rdev->flags & RADEON_IS_PX)
> runtime = true;
> vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime);
> if (runtime)
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 2dc2cc4..3811812 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -114,6 +114,7 @@ extern int radeon_get_crtc_scanoutpos(struct drm_device *dev, int crtc,
> unsigned int flags,
> int *vpos, int *hpos, ktime_t *stime,
> ktime_t *etime);
> +extern bool radeon_is_px(struct drm_device *dev);
> extern const struct drm_ioctl_desc radeon_ioctls_kms[];
> extern int radeon_max_kms_ioctl;
> int radeon_mmap(struct file *filp, struct vm_area_struct *vma);
> @@ -143,11 +144,9 @@ void radeon_debugfs_cleanup(struct drm_minor *minor);
> #if defined(CONFIG_VGA_SWITCHEROO)
> void radeon_register_atpx_handler(void);
> void radeon_unregister_atpx_handler(void);
> -bool radeon_is_px(void);
> #else
> static inline void radeon_register_atpx_handler(void) {}
> static inline void radeon_unregister_atpx_handler(void) {}
> -static inline bool radeon_is_px(void) { return false; }
> #endif
>
> int radeon_no_wb;
> @@ -404,12 +403,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev)
> struct drm_device *drm_dev = pci_get_drvdata(pdev);
> int ret;
>
> - if (radeon_runtime_pm == 0) {
> - pm_runtime_forbid(dev);
> - return -EBUSY;
> - }
> -
> - if (radeon_runtime_pm == -1 && !radeon_is_px()) {
> + if (!radeon_is_px(drm_dev)) {
> pm_runtime_forbid(dev);
> return -EBUSY;
> }
> @@ -433,10 +427,7 @@ static int radeon_pmops_runtime_resume(struct device *dev)
> struct drm_device *drm_dev = pci_get_drvdata(pdev);
> int ret;
>
> - if (radeon_runtime_pm == 0)
> - return -EINVAL;
> -
> - if (radeon_runtime_pm == -1 && !radeon_is_px())
> + if (!radeon_is_px(drm_dev))
> return -EINVAL;
>
> drm_dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
> @@ -461,14 +452,7 @@ static int radeon_pmops_runtime_idle(struct device *dev)
> struct drm_device *drm_dev = pci_get_drvdata(pdev);
> struct drm_crtc *crtc;
>
> - if (radeon_runtime_pm == 0) {
> - pm_runtime_forbid(dev);
> - return -EBUSY;
> - }
> -
> - /* are we PX enabled? */
> - if (radeon_runtime_pm == -1 && !radeon_is_px()) {
> - DRM_DEBUG_DRIVER("failing to power off - not px\n");
> + if (!radeon_is_px(drm_dev)) {
> pm_runtime_forbid(dev);
> return -EBUSY;
> }
> diff --git a/drivers/gpu/drm/radeon/radeon_family.h b/drivers/gpu/drm/radeon/radeon_family.h
> index 614ad54..9da5da4 100644
> --- a/drivers/gpu/drm/radeon/radeon_family.h
> +++ b/drivers/gpu/drm/radeon/radeon_family.h
> @@ -115,6 +115,7 @@ enum radeon_chip_flags {
> RADEON_NEW_MEMMAP = 0x00400000UL,
> RADEON_IS_PCI = 0x00800000UL,
> RADEON_IS_IGPGART = 0x01000000UL,
> + RADEON_IS_PX = 0x02000000UL,
> };
>
> #endif
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index 3e49342..9337820 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -35,9 +35,9 @@
> #include <linux/pm_runtime.h>
>
> #if defined(CONFIG_VGA_SWITCHEROO)
> -bool radeon_is_px(void);
> +bool radeon_has_atpx(void);
> #else
> -static inline bool radeon_is_px(void) { return false; }
> +static inline bool radeon_has_atpx(void) { return false; }
> #endif
>
> /**
> @@ -107,6 +107,13 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
> flags |= RADEON_IS_PCI;
> }
>
> + if (radeon_runtime_pm == 1)
> + flags |= RADEON_IS_PX;
> + else if ((radeon_runtime_pm == -1) &&
> + radeon_has_atpx() &&
> + ((flags & RADEON_IS_IGP) == 0))
> + flags |= RADEON_IS_PX;
> +
> /* radeon_device_init should report only fatal error
> * like memory allocation failure or iomapping failure,
> * or memory manager initialization failure, it must
> @@ -137,8 +144,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
> "Error during ACPI methods call\n");
> }
>
> - if ((radeon_runtime_pm == 1) ||
> - ((radeon_runtime_pm == -1) && radeon_is_px())) {
> + if (radeon_is_px(dev)) {
> pm_runtime_use_autosuspend(dev->dev);
> pm_runtime_set_autosuspend_delay(dev->dev, 5000);
> pm_runtime_set_active(dev->dev);
next prev parent reply other threads:[~2014-04-11 13:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-11 2:29 [PATCH] drm/radeon: fix runpm handling on APUs (v4) Alex Deucher
2014-04-11 2:29 ` [PATCH] drm/radeon: update CI DPM powertune settings Alex Deucher
2014-04-11 2:29 ` [PATCH] drm/radeon: disable mclk dpm on R7 260X Alex Deucher
2014-04-11 13:10 ` Christian König [this message]
2014-04-11 13:12 ` [PATCH] drm/radeon: fix runpm handling on APUs (v4) Deucher, Alexander
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=5347E9A8.6060001@vodafone.de \
--to=deathsimple@vodafone.de \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=dri-devel@lists.freedesktop.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 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.