Skip to contentSkip to conversation

i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access

PATCH Applied Heiner Kallweit 4 participants 4 messages Jun 6, 2021 – Jun 20, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 i2c: i801: Ensure that SMBHSTSTS_INUSE_STS is cleared when leaving i801_access

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

---
v2:
- add proper stable tag

---
 drivers/i2c/busses/i2c-i801.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/i2c/busses/i2c-i801.c +3 -0
index c7d96cf5e..ab3470e77 100644
@@ -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);
Signature · 1 line
2.31.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Heiner Kallweit

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:

drivers/i2c/busses/i2c-i801.c static s32 i801_access(struct i2c_adapter *adap, u16 addr, · line 954

Quoted 4 lines
drivers/i2c/busses/i2c-i801.c +3 -0
+	/* 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 :)

Signature · 2 lines
Hector Martin ([email protected])
Public Key: https://mrcn.st/pub
Reviewed-by Tested-by on v2 1/1
#2 lore raw
In reply to Heiner Kallweit

Hi Heiner, Hector,

Quoted 27 lines · Heiner Kallweit

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

---
v2:
- add proper stable tag

---
 drivers/i2c/busses/i2c-i801.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/i2c/busses/i2c-i801.c +0 -0
index c7d96cf5e..ab3470e77 100644

drivers/i2c/busses/i2c-i801.c static s32 i801_access(struct i2c_adapter *adap, u16 addr, · line 956

Quoted 9 lines
drivers/i2c/busses/i2c-i801.c +3 -0
@@ -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.

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,

Signature · 2 lines
Jean Delvare
SUSE L3 Support
Applied
#3 lore raw
In reply to Heiner Kallweit
Quoted 9 lines · Heiner Kallweit

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.

Quoted 6 lines

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

Fixes 01590f361e94 ("i2c: i801: Instantiate SPD EEPROMs automatically")

Applied to for-current, thanks!