All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access
@ 2021-06-06 13:55 Heiner Kallweit
  2021-06-07  1:47 ` Hector Martin
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Heiner Kallweit @ 2021-06-06 13:55 UTC (permalink / raw)
  To: Jean Delvare, Hector Martin; +Cc: linux-i2c

As explained in [0] currently we may leave SMBHSTSTS_INUSE_STS set,
thus potentially breaking ACPI/BIOS usage of the SMBUS device.

Seems patch [0] needs a little bit more of review effort, therefore
I'd suggest to apply a part of it as quick win. Just clearing
SMBHSTSTS_INUSE_STS when leaving i801_access() should fix the
referenced issue and leaves more time for discussing a more
sophisticated locking handling.

[0] https://www.spinics.net/lists/linux-i2c/msg51558.html

Fixes: 01590f361e94 ("i2c: i801: Instantiate SPD EEPROMs automatically")
Cc: stable@vger.kernel.org
Suggested-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2:
- add proper stable tag
---
 drivers/i2c/busses/i2c-i801.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index c7d96cf5e..ab3470e77 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -948,6 +948,9 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
 	}
 
 out:
+	/* Unlock the SMBus device for use by BIOS/ACPI */
+	outb_p(SMBHSTSTS_INUSE_STS, SMBHSTSTS(priv));
+
 	pm_runtime_mark_last_busy(&priv->pci_dev->dev);
 	pm_runtime_put_autosuspend(&priv->pci_dev->dev);
 	mutex_unlock(&priv->acpi_lock);
-- 
2.31.1


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

* Re: [PATCH v2] i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access
  2021-06-06 13:55 [PATCH v2] i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access Heiner Kallweit
@ 2021-06-07  1:47 ` Hector Martin
  2021-06-07 15:22 ` Jean Delvare
  2021-06-20 20:59 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Hector Martin @ 2021-06-07  1:47 UTC (permalink / raw)
  To: Heiner Kallweit, Jean Delvare; +Cc: linux-i2c

On 06/06/2021 22.55, Heiner Kallweit wrote:
> As explained in [0] currently we may leave SMBHSTSTS_INUSE_STS set,
> thus potentially breaking ACPI/BIOS usage of the SMBUS device.
> 
> Seems patch [0] needs a little bit more of review effort, therefore
> I'd suggest to apply a part of it as quick win. Just clearing
> SMBHSTSTS_INUSE_STS when leaving i801_access() should fix the
> referenced issue and leaves more time for discussing a more
> sophisticated locking handling.

>   out:
> +	/* Unlock the SMBus device for use by BIOS/ACPI */
> +	outb_p(SMBHSTSTS_INUSE_STS, SMBHSTSTS(priv));
> +
>   	pm_runtime_mark_last_busy(&priv->pci_dev->dev);

Yup, I was thinking of suggesting just this part if the rest of the 
patch were deemed more controversial. Thanks :)

Reviewed-by: Hector Martin <marcan@marcan.st>

-- 
Hector Martin (marcan@marcan.st)
Public Key: https://mrcn.st/pub

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

* Re: [PATCH v2] i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access
  2021-06-06 13:55 [PATCH v2] i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access Heiner Kallweit
  2021-06-07  1:47 ` Hector Martin
@ 2021-06-07 15:22 ` Jean Delvare
  2021-06-20 20:59 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2021-06-07 15:22 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Hector Martin, linux-i2c

Hi Heiner, Hector,

On Sun, 6 Jun 2021 15:55:55 +0200, Heiner Kallweit wrote:
> As explained in [0] currently we may leave SMBHSTSTS_INUSE_STS set,
> thus potentially breaking ACPI/BIOS usage of the SMBUS device.
> 
> Seems patch [0] needs a little bit more of review effort, therefore
> I'd suggest to apply a part of it as quick win. Just clearing
> SMBHSTSTS_INUSE_STS when leaving i801_access() should fix the
> referenced issue and leaves more time for discussing a more
> sophisticated locking handling.
> 
> [0] https://www.spinics.net/lists/linux-i2c/msg51558.html
> 
> Fixes: 01590f361e94 ("i2c: i801: Instantiate SPD EEPROMs automatically")
> Cc: stable@vger.kernel.org
> Suggested-by: Hector Martin <marcan@marcan.st>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> v2:
> - add proper stable tag
> ---
>  drivers/i2c/busses/i2c-i801.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index c7d96cf5e..ab3470e77 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -948,6 +948,9 @@ static s32 i801_access(struct i2c_adapter *adap, u16 addr,
>  	}
>  
>  out:
> +	/* Unlock the SMBus device for use by BIOS/ACPI */
> +	outb_p(SMBHSTSTS_INUSE_STS, SMBHSTSTS(priv));
> +
>  	pm_runtime_mark_last_busy(&priv->pci_dev->dev);
>  	pm_runtime_put_autosuspend(&priv->pci_dev->dev);
>  	mutex_unlock(&priv->acpi_lock);

Good idea.

Reviewed-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Jean Delvare <jdelvare@suse.de>

Hector, can you please rebase your patch on top of this one? I'll
review it later when I have more time to allocate to the task.

Thanks,
-- 
Jean Delvare
SUSE L3 Support

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

* Re: [PATCH v2] i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access
  2021-06-06 13:55 [PATCH v2] i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access Heiner Kallweit
  2021-06-07  1:47 ` Hector Martin
  2021-06-07 15:22 ` Jean Delvare
@ 2021-06-20 20:59 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-06-20 20:59 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Jean Delvare, Hector Martin, linux-i2c

[-- Attachment #1: Type: text/plain, Size: 825 bytes --]

On Sun, Jun 06, 2021 at 03:55:55PM +0200, Heiner Kallweit wrote:
> As explained in [0] currently we may leave SMBHSTSTS_INUSE_STS set,
> thus potentially breaking ACPI/BIOS usage of the SMBUS device.
> 
> Seems patch [0] needs a little bit more of review effort, therefore
> I'd suggest to apply a part of it as quick win. Just clearing
> SMBHSTSTS_INUSE_STS when leaving i801_access() should fix the
> referenced issue and leaves more time for discussing a more
> sophisticated locking handling.
> 
> [0] https://www.spinics.net/lists/linux-i2c/msg51558.html
> 
> Fixes: 01590f361e94 ("i2c: i801: Instantiate SPD EEPROMs automatically")
> Cc: stable@vger.kernel.org
> Suggested-by: Hector Martin <marcan@marcan.st>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-06-20 20:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-06 13:55 [PATCH v2] i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access Heiner Kallweit
2021-06-07  1:47 ` Hector Martin
2021-06-07 15:22 ` Jean Delvare
2021-06-20 20:59 ` Wolfram Sang

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.