linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [char-misc 0/2] mei updates for 4.14-rc2
@ 2017-09-24  8:35 Tomas Winkler
  2017-09-24  8:35 ` [char-misc 1/2] mei: always use domain runtime pm callbacks Tomas Winkler
  2017-09-24  8:35 ` [char-misc 2/2] mei: me: add gemini lake devices id Tomas Winkler
  0 siblings, 2 replies; 5+ messages in thread
From: Tomas Winkler @ 2017-09-24  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alexander Usyskin, linux-kernel, Tomas Winkler

Hello Greg, here are updates for 4.14-rc2 containing:

A regression fix that hit us in 4.13,
unfortunately we haven't spotted it during the 4.13 cycle.

A new device id, for Gemini Lake SoC. This particular patch doesn't
apply cleanly to stable kernels so I will post separated backport patches 
for 4.4 and newer kernel versions.

Alexander Usyskin (1):
  mei: always use domain runtime pm callbacks.

Tomas Winkler (1):
  mei: me: add gemini lake devices id

 drivers/misc/mei/hw-me-regs.h |  2 ++
 drivers/misc/mei/pci-me.c     | 23 +++++++++++++----------
 drivers/misc/mei/pci-txe.c    | 30 +++++++++++-------------------
 3 files changed, 26 insertions(+), 29 deletions(-)

-- 
2.9.5

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

* [char-misc 1/2] mei: always use domain runtime pm callbacks.
  2017-09-24  8:35 [char-misc 0/2] mei updates for 4.14-rc2 Tomas Winkler
@ 2017-09-24  8:35 ` Tomas Winkler
  2017-09-24 22:37   ` Rafael J. Wysocki
  2017-09-24  8:35 ` [char-misc 2/2] mei: me: add gemini lake devices id Tomas Winkler
  1 sibling, 1 reply; 5+ messages in thread
From: Tomas Winkler @ 2017-09-24  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Alexander Usyskin, linux-kernel, #4 . 13+,
	Rafael J . Wysocki, Tomas Winkler

From: Alexander Usyskin <alexander.usyskin@intel.com>

This patch fixes a regression caused by the new changes
in the run wake handlers, pci_dev_run_wake() return true
when wake is possible from the software perspective
not whether it is actually enabled.

The mei devices that support D0i3 are no longer receiving an interrupt
after entering runtime suspend state and will stall.

MEI maps runtime suspend/resume to its own defined
power gating (PG) states, (D0i3 or other depending on generation),
hence we need to go around the native PCI runtime service which
eventually brings the device into D3cold/hot state,
but the mei devices cannot wake up from D3 unlike from D0i3/PG state,
which keeps irq running.
To get around PCI device native runtime pm,
MEI uses runtime pm domain handlers which take precedence.

Cc: <stable@vger.kernel.org> #4.13+
Cc: Rafael J. Wysocki <rafael@kernel.org>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/pci-me.c  | 21 +++++++++++----------
 drivers/misc/mei/pci-txe.c | 30 +++++++++++-------------------
 2 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 4ff40d319676..630757a4b36a 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -226,12 +226,15 @@ static int mei_me_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	pdev->dev_flags |= PCI_DEV_FLAGS_NEEDS_RESUME;
 
 	/*
-	* For not wake-able HW runtime pm framework
-	* can't be used on pci device level.
-	* Use domain runtime pm callbacks instead.
-	*/
-	if (!pci_dev_run_wake(pdev))
-		mei_me_set_pm_domain(dev);
+	 * ME maps runtime suspend/resume to D0i states,
+	 * hence we need to go around native PCI runtime service which
+	 * eventually brings the device into D3cold/hot state,
+	 * but the mei device cannot wake up from D3 unlike from D0i3.
+	 * To get around the PCI device native runtime pm,
+	 * ME uses runtime pm domain handlers which take precedence
+	 * over the driver's pm handlers.
+	 */
+	mei_me_set_pm_domain(dev);
 
 	if (mei_pg_is_enabled(dev))
 		pm_runtime_put_noidle(&pdev->dev);
@@ -271,8 +274,7 @@ static void mei_me_shutdown(struct pci_dev *pdev)
 	dev_dbg(&pdev->dev, "shutdown\n");
 	mei_stop(dev);
 
-	if (!pci_dev_run_wake(pdev))
-		mei_me_unset_pm_domain(dev);
+	mei_me_unset_pm_domain(dev);
 
 	mei_disable_interrupts(dev);
 	free_irq(pdev->irq, dev);
@@ -300,8 +302,7 @@ static void mei_me_remove(struct pci_dev *pdev)
 	dev_dbg(&pdev->dev, "stop\n");
 	mei_stop(dev);
 
-	if (!pci_dev_run_wake(pdev))
-		mei_me_unset_pm_domain(dev);
+	mei_me_unset_pm_domain(dev);
 
 	mei_disable_interrupts(dev);
 
diff --git a/drivers/misc/mei/pci-txe.c b/drivers/misc/mei/pci-txe.c
index e38a5f144373..0566f9bfa7de 100644
--- a/drivers/misc/mei/pci-txe.c
+++ b/drivers/misc/mei/pci-txe.c
@@ -144,12 +144,14 @@ static int mei_txe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	pdev->dev_flags |= PCI_DEV_FLAGS_NEEDS_RESUME;
 
 	/*
-	* For not wake-able HW runtime pm framework
-	* can't be used on pci device level.
-	* Use domain runtime pm callbacks instead.
-	*/
-	if (!pci_dev_run_wake(pdev))
-		mei_txe_set_pm_domain(dev);
+	 * TXE maps runtime suspend/resume to own power gating states,
+	 * hence we need to go around native PCI runtime service which
+	 * eventually brings the device into D3cold/hot state.
+	 * But the TXE device cannot wake up from D3 unlike from own
+	 * power gating. To get around PCI device native runtime pm,
+	 * TXE uses runtime pm domain handlers which take precedence.
+	 */
+	mei_txe_set_pm_domain(dev);
 
 	pm_runtime_put_noidle(&pdev->dev);
 
@@ -186,8 +188,7 @@ static void mei_txe_shutdown(struct pci_dev *pdev)
 	dev_dbg(&pdev->dev, "shutdown\n");
 	mei_stop(dev);
 
-	if (!pci_dev_run_wake(pdev))
-		mei_txe_unset_pm_domain(dev);
+	mei_txe_unset_pm_domain(dev);
 
 	mei_disable_interrupts(dev);
 	free_irq(pdev->irq, dev);
@@ -215,8 +216,7 @@ static void mei_txe_remove(struct pci_dev *pdev)
 
 	mei_stop(dev);
 
-	if (!pci_dev_run_wake(pdev))
-		mei_txe_unset_pm_domain(dev);
+	mei_txe_unset_pm_domain(dev);
 
 	mei_disable_interrupts(dev);
 	free_irq(pdev->irq, dev);
@@ -318,15 +318,7 @@ static int mei_txe_pm_runtime_suspend(struct device *device)
 	else
 		ret = -EAGAIN;
 
-	/*
-	 * If everything is okay we're about to enter PCI low
-	 * power state (D3) therefor we need to disable the
-	 * interrupts towards host.
-	 * However if device is not wakeable we do not enter
-	 * D-low state and we need to keep the interrupt kicking
-	 */
-	if (!ret && pci_dev_run_wake(pdev))
-		mei_disable_interrupts(dev);
+	/* keep irq on we are staying in D0 */
 
 	dev_dbg(&pdev->dev, "rpm: txe: runtime suspend ret=%d\n", ret);
 
-- 
2.9.5

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

* [char-misc 2/2] mei: me: add gemini lake devices id
  2017-09-24  8:35 [char-misc 0/2] mei updates for 4.14-rc2 Tomas Winkler
  2017-09-24  8:35 ` [char-misc 1/2] mei: always use domain runtime pm callbacks Tomas Winkler
@ 2017-09-24  8:35 ` Tomas Winkler
  1 sibling, 0 replies; 5+ messages in thread
From: Tomas Winkler @ 2017-09-24  8:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Alexander Usyskin, linux-kernel, Tomas Winkler

Add Gemini Lake (GLK) device id.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/hw-me-regs.h | 2 ++
 drivers/misc/mei/pci-me.c     | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
index c8307e8b4c16..0ccccbaf530d 100644
--- a/drivers/misc/mei/hw-me-regs.h
+++ b/drivers/misc/mei/hw-me-regs.h
@@ -127,6 +127,8 @@
 #define MEI_DEV_ID_BXT_M      0x1A9A  /* Broxton M */
 #define MEI_DEV_ID_APL_I      0x5A9A  /* Apollo Lake I */
 
+#define MEI_DEV_ID_GLK        0x319A  /* Gemini Lake */
+
 #define MEI_DEV_ID_KBP        0xA2BA  /* Kaby Point */
 #define MEI_DEV_ID_KBP_2      0xA2BB  /* Kaby Point 2 */
 
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 630757a4b36a..78b3172c8e6e 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -93,6 +93,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
 	{MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, MEI_ME_PCH8_CFG)},
 	{MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, MEI_ME_PCH8_CFG)},
 
+	{MEI_PCI_DEVICE(MEI_DEV_ID_GLK, MEI_ME_PCH8_CFG)},
+
 	{MEI_PCI_DEVICE(MEI_DEV_ID_KBP, MEI_ME_PCH8_CFG)},
 	{MEI_PCI_DEVICE(MEI_DEV_ID_KBP_2, MEI_ME_PCH8_CFG)},
 
-- 
2.9.5

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

* Re: [char-misc 1/2] mei: always use domain runtime pm callbacks.
  2017-09-24  8:35 ` [char-misc 1/2] mei: always use domain runtime pm callbacks Tomas Winkler
@ 2017-09-24 22:37   ` Rafael J. Wysocki
  2017-09-25  6:16     ` Winkler, Tomas
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-09-24 22:37 UTC (permalink / raw)
  To: Tomas Winkler
  Cc: Greg Kroah-Hartman, Alexander Usyskin, Linux Kernel Mailing List,
	#4 . 13+,
	Rafael J . Wysocki

On Sun, Sep 24, 2017 at 10:35 AM, Tomas Winkler <tomas.winkler@intel.com> wrote:
> From: Alexander Usyskin <alexander.usyskin@intel.com>
>
> This patch fixes a regression caused by the new changes
> in the run wake handlers, pci_dev_run_wake() return true
> when wake is possible from the software perspective
> not whether it is actually enabled.

This isn't exactly accurate, because "run wake" used to mean "wakeup
signals can be generated for this device in the working state of the
system", so it could not be enabled or disabled before too.  It's just
that the function returns "true" for (at least) some devices for which
it used to return "false" (arguably incorrectly).

Other than that I agree with the patch.

Thanks,
Rafael

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

* Re: [char-misc 1/2] mei: always use domain runtime pm callbacks.
  2017-09-24 22:37   ` Rafael J. Wysocki
@ 2017-09-25  6:16     ` Winkler, Tomas
  0 siblings, 0 replies; 5+ messages in thread
From: Winkler, Tomas @ 2017-09-25  6:16 UTC (permalink / raw)
  To: rafael; +Cc: linux-kernel, gregkh, Usyskin, Alexander, stable

	On Mon, 2017-09-25 at 00:37 +0200, Rafael J. Wysocki wrote:
> On Sun, Sep 24, 2017 at 10:35 AM, Tomas Winkler <tomas.winkler@intel.com> wrote:
> > From: Alexander Usyskin <alexander.usyskin@intel.com>
> > 
> > This patch fixes a regression caused by the new changes
> > in the run wake handlers, pci_dev_run_wake() return true
> > when wake is possible from the software perspective
> > not whether it is actually enabled.
> 
> This isn't exactly accurate, because "run wake" used to mean "wakeup
> signals can be generated for this device in the working state of the
> system", so it could not be enabled or disabled before too.  It's just
> that the function returns "true" for (at least) some devices for which
> it used to return "false" (arguably incorrectly).
> 
> Other than that I agree with the patch.

Thanks for the correction, I will respin the patch with your
explanation.

Thanks
Tomas

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

end of thread, other threads:[~2017-09-25  6:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-24  8:35 [char-misc 0/2] mei updates for 4.14-rc2 Tomas Winkler
2017-09-24  8:35 ` [char-misc 1/2] mei: always use domain runtime pm callbacks Tomas Winkler
2017-09-24 22:37   ` Rafael J. Wysocki
2017-09-25  6:16     ` Winkler, Tomas
2017-09-24  8:35 ` [char-misc 2/2] mei: me: add gemini lake devices id Tomas Winkler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).