linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sp5100_tco: properly check for new register layouts
@ 2016-05-03 17:15 Lucas Stach
  2016-05-04  2:43 ` Guenter Roeck
  2016-05-14 16:44 ` Wim Van Sebroeck
  0 siblings, 2 replies; 4+ messages in thread
From: Lucas Stach @ 2016-05-03 17:15 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, linux-kernel

Commits 190aa4304de6 (Add AMD Mullins platform support) and
cca118fa2a0a94 (Add AMD Carrizo platform support) enabled the
driver on a lot more devices, but the following commit missed
a single location in the code when checking if the SB800 register
offsets should be used. This leads to the wrong register being
written which in turn causes ACPI to go haywire.

Fix this by introducing a helper function to check for the new
register layout and use this consistently.

https://bugzilla.kernel.org/show_bug.cgi?id=114201
https://bugzilla.redhat.com/show_bug.cgi?id=1329910
Fixes: bdecfcdb5461 (sp5100_tco: fix the device check for SB800
and later chipsets)
Cc: stable@vger.kernel.org (4.5+)
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 drivers/watchdog/sp5100_tco.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c
index 6467b91..028618c 100644
--- a/drivers/watchdog/sp5100_tco.c
+++ b/drivers/watchdog/sp5100_tco.c
@@ -73,6 +73,13 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started."
 /*
  * Some TCO specific functions
  */
+
+static bool tco_has_sp5100_reg_layout(struct pci_dev *dev)
+{
+	return dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
+	       dev->revision < 0x40;
+}
+
 static void tco_timer_start(void)
 {
 	u32 val;
@@ -129,7 +136,7 @@ static void tco_timer_enable(void)
 {
 	int val;
 
-	if (sp5100_tco_pci->revision >= 0x40) {
+	if (!tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
 		/* For SB800 or later */
 		/* Set the Watchdog timer resolution to 1 sec */
 		outb(SB800_PM_WATCHDOG_CONFIG, SB800_IO_PM_INDEX_REG);
@@ -342,8 +349,7 @@ static unsigned char sp5100_tco_setupdevice(void)
 	/*
 	 * Determine type of southbridge chipset.
 	 */
-	if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
-	    sp5100_tco_pci->revision < 0x40) {
+	if (tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
 		dev_name = SP5100_DEVNAME;
 		index_reg = SP5100_IO_PM_INDEX_REG;
 		data_reg = SP5100_IO_PM_DATA_REG;
@@ -388,8 +394,7 @@ static unsigned char sp5100_tco_setupdevice(void)
 	 * Secondly, Find the watchdog timer MMIO address
 	 * from SBResource_MMIO register.
 	 */
-	if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
-	    sp5100_tco_pci->revision < 0x40) {
+	if (tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
 		/* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */
 		pci_read_config_dword(sp5100_tco_pci,
 				      SP5100_SB_RESOURCE_MMIO_BASE, &val);
-- 
2.5.5

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

* Re: [PATCH] sp5100_tco: properly check for new register layouts
  2016-05-03 17:15 [PATCH] sp5100_tco: properly check for new register layouts Lucas Stach
@ 2016-05-04  2:43 ` Guenter Roeck
  2016-05-13 14:27   ` Takashi Iwai
  2016-05-14 16:44 ` Wim Van Sebroeck
  1 sibling, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2016-05-04  2:43 UTC (permalink / raw)
  To: Lucas Stach, Wim Van Sebroeck; +Cc: linux-watchdog, linux-kernel

On 05/03/2016 10:15 AM, Lucas Stach wrote:
> Commits 190aa4304de6 (Add AMD Mullins platform support) and
> cca118fa2a0a94 (Add AMD Carrizo platform support) enabled the
> driver on a lot more devices, but the following commit missed
> a single location in the code when checking if the SB800 register
> offsets should be used. This leads to the wrong register being
> written which in turn causes ACPI to go haywire.
>
> Fix this by introducing a helper function to check for the new
> register layout and use this consistently.
>
> https://bugzilla.kernel.org/show_bug.cgi?id=114201
> https://bugzilla.redhat.com/show_bug.cgi?id=1329910
> Fixes: bdecfcdb5461 (sp5100_tco: fix the device check for SB800
> and later chipsets)
> Cc: stable@vger.kernel.org (4.5+)
> Signed-off-by: Lucas Stach <dev@lynxeye.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/sp5100_tco.c | 15 ++++++++++-----
>   1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c
> index 6467b91..028618c 100644
> --- a/drivers/watchdog/sp5100_tco.c
> +++ b/drivers/watchdog/sp5100_tco.c
> @@ -73,6 +73,13 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started."
>   /*
>    * Some TCO specific functions
>    */
> +
> +static bool tco_has_sp5100_reg_layout(struct pci_dev *dev)
> +{
> +	return dev->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
> +	       dev->revision < 0x40;
> +}
> +
>   static void tco_timer_start(void)
>   {
>   	u32 val;
> @@ -129,7 +136,7 @@ static void tco_timer_enable(void)
>   {
>   	int val;
>
> -	if (sp5100_tco_pci->revision >= 0x40) {
> +	if (!tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
>   		/* For SB800 or later */
>   		/* Set the Watchdog timer resolution to 1 sec */
>   		outb(SB800_PM_WATCHDOG_CONFIG, SB800_IO_PM_INDEX_REG);
> @@ -342,8 +349,7 @@ static unsigned char sp5100_tco_setupdevice(void)
>   	/*
>   	 * Determine type of southbridge chipset.
>   	 */
> -	if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
> -	    sp5100_tco_pci->revision < 0x40) {
> +	if (tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
>   		dev_name = SP5100_DEVNAME;
>   		index_reg = SP5100_IO_PM_INDEX_REG;
>   		data_reg = SP5100_IO_PM_DATA_REG;
> @@ -388,8 +394,7 @@ static unsigned char sp5100_tco_setupdevice(void)
>   	 * Secondly, Find the watchdog timer MMIO address
>   	 * from SBResource_MMIO register.
>   	 */
> -	if (sp5100_tco_pci->device == PCI_DEVICE_ID_ATI_SBX00_SMBUS &&
> -	    sp5100_tco_pci->revision < 0x40) {
> +	if (tco_has_sp5100_reg_layout(sp5100_tco_pci)) {
>   		/* Read SBResource_MMIO from PCI config(PCI_Reg: 9Ch) */
>   		pci_read_config_dword(sp5100_tco_pci,
>   				      SP5100_SB_RESOURCE_MMIO_BASE, &val);
>

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

* Re: [PATCH] sp5100_tco: properly check for new register layouts
  2016-05-04  2:43 ` Guenter Roeck
@ 2016-05-13 14:27   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2016-05-13 14:27 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Lucas Stach, Wim Van Sebroeck, linux-watchdog, linux-kernel

On Wed, 04 May 2016 04:43:33 +0200,
Guenter Roeck wrote:
> 
> On 05/03/2016 10:15 AM, Lucas Stach wrote:
> > Commits 190aa4304de6 (Add AMD Mullins platform support) and
> > cca118fa2a0a94 (Add AMD Carrizo platform support) enabled the
> > driver on a lot more devices, but the following commit missed
> > a single location in the code when checking if the SB800 register
> > offsets should be used. This leads to the wrong register being
> > written which in turn causes ACPI to go haywire.
> >
> > Fix this by introducing a helper function to check for the new
> > register layout and use this consistently.
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=114201
> > https://bugzilla.redhat.com/show_bug.cgi?id=1329910
> > Fixes: bdecfcdb5461 (sp5100_tco: fix the device check for SB800
> > and later chipsets)
> > Cc: stable@vger.kernel.org (4.5+)
> > Signed-off-by: Lucas Stach <dev@lynxeye.de>
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

What is the status of this patch?  I still can't find it in
linux-next.

We've got more and more bug reports about this, so would love to get
this resolved soonish.


thanks,

Takashi

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

* Re: [PATCH] sp5100_tco: properly check for new register layouts
  2016-05-03 17:15 [PATCH] sp5100_tco: properly check for new register layouts Lucas Stach
  2016-05-04  2:43 ` Guenter Roeck
@ 2016-05-14 16:44 ` Wim Van Sebroeck
  1 sibling, 0 replies; 4+ messages in thread
From: Wim Van Sebroeck @ 2016-05-14 16:44 UTC (permalink / raw)
  To: Lucas Stach; +Cc: Guenter Roeck, linux-watchdog, linux-kernel

Hi Lucas,

> Commits 190aa4304de6 (Add AMD Mullins platform support) and
> cca118fa2a0a94 (Add AMD Carrizo platform support) enabled the
> driver on a lot more devices, but the following commit missed
> a single location in the code when checking if the SB800 register
> offsets should be used. This leads to the wrong register being
> written which in turn causes ACPI to go haywire.
> 
> Fix this by introducing a helper function to check for the new
> register layout and use this consistently.
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=114201
> https://bugzilla.redhat.com/show_bug.cgi?id=1329910
> Fixes: bdecfcdb5461 (sp5100_tco: fix the device check for SB800
> and later chipsets)
> Cc: stable@vger.kernel.org (4.5+)
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
>  drivers/watchdog/sp5100_tco.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 

This patch has been added to linux-watchdog-next.

Kind regards,
Wim.

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

end of thread, other threads:[~2016-05-14 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-03 17:15 [PATCH] sp5100_tco: properly check for new register layouts Lucas Stach
2016-05-04  2:43 ` Guenter Roeck
2016-05-13 14:27   ` Takashi Iwai
2016-05-14 16:44 ` Wim Van Sebroeck

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).