Skip to contentSkip to conversation

i2c: piix4: Fix request_region size

PATCH Applied Ricardo Ribalda Delgado 3 participants 7 messages Jan 27, 2017 – Feb 9, 2017

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

PATCH 1/1 i2c: piix4: Fix request_region size

Since '701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")' we are using the SMBSLVCNT register at offset 0x8. We need to request it.

Fixes 701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")

---
Please note, not tested on hardware.

 drivers/i2c/busses/i2c-piix4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-piix4.c +1 -1
index e34d82e79b98..73cc6799cc59 100644
@@ -58,7 +58,7 @@
 #define SMBSLVDAT	(0xC + piix4_smba)
 
 /* count for request_region */
-#define SMBIOSIZE	8
+#define SMBIOSIZE	9
 
 /* PCI Address Constants */
 #define SMBBA		0x090
Signature · 1 line
2.11.0
#1 lore raw

Hi Ricardo,

Quoted 22 lines · Ricardo Ribalda Delgado

Since '701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")' we
are using the SMBSLVCNT register at offset 0x8. We need to request it.

Fixes 701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")

---
Please note, not tested on hardware.
 drivers/i2c/busses/i2c-piix4.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c- renamed from drivers/i2c/busses/i2c-piix4.c +0 -0

piix4.c
index e34d82e79b98..73cc6799cc59 100644

drivers/i2c/busses/i2c-piix4.c +0 -0
@@ -58,7 +58,7 @@
  #define SMBSLVDAT	(0xC + piix4_smba)


 /* count for request_region */

drivers/i2c/busses/i2c-piix4.c line 61

Quoted 2 lines
drivers/i2c/busses/i2c-piix4.c +1 -1
-#define SMBIOSIZE	8
+#define SMBIOSIZE	9

Are you certain that all supported devices have this extra register?

Quoted 3 lines


 /* PCI Address Constants */
 #define SMBBA 0x090

--
Jean Delvare
SUSE L3 Support

#2 lore raw
Quoted 7 lines

drivers/i2c/busses/i2c-piix4.c line 61

Quoted 5 lines

 /* count for request_region */

drivers/i2c/busses/i2c-piix4.c +1 -1
-#define SMBIOSIZE	8
+#define SMBIOSIZE	9

Are you certain that all supported devices have this extra register?

Isn't it better to have a potentially unused register mapped than a potentially used register unmapped?

#3 lore raw

Hi Wolfram,

Quoted 9 lines · Wolfram Sang
Quoted 6 lines

drivers/i2c/busses/i2c-piix4.c line 61

Quoted 4 lines

 /* count for request_region */

drivers/i2c/busses/i2c-piix4.c +1 -1
-#define SMBIOSIZE	8
+#define SMBIOSIZE	9

Are you certain that all supported devices have this extra register?

Isn't it better to have a potentially unused register mapped than a potentially used register unmapped?

My concern is that the region request could fail due to a conflict with another device, if the physical I/O region is only 8 and we try to request 9.

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#4 lore raw

Hi Jean and Wolfram

Quoted 12 lines · Jean Delvare

Hi Wolfram,

Quoted 9 lines · Wolfram Sang
Quoted 6 lines

drivers/i2c/busses/i2c-piix4.c line 61

Quoted 4 lines

/* count for request_region */

drivers/i2c/busses/i2c-piix4.c +1 -1
-#define SMBIOSIZE        8
+#define SMBIOSIZE        9

Are you certain that all supported devices have this extra register?

Isn't it better to have a potentially unused register mapped than a potentially used register unmapped

We have been "lucky" that it is a ioport and not a mmap region, otherwise we would have seen a nice oops :).

Quoted 4 lines

My concern is that the region request could fail due to a conflict with another device, if the physical I/O region is only 8 and we try to request 9.

I do not think that this is the case, if you check the top of the file you can see how there are many other definitions for registers. I expect that SMBIOSIZE=8 is just the original author being conservative.

Of course I cannot say that there is one platform where one extra ioport can cause a conflict, but I believe that we must request all the ports that we will use.

Regards!

Quoted 4 lines

--
Jean Delvare
SUSE L3 Support

Signature · 1 line
Ricardo Ribalda
#5 lore raw
In reply to Ricardo Ribalda Delgado

Hi Ricardo, Wolfram,

Quoted 15 lines · Ricardo Ribalda Delgado

Since '701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")' we are using the SMBSLVCNT register at offset 0x8. We need to request it.

Fixes 701dc207bf55 ("i2c: piix4: Avoid race conditions with IMC")

---
Please note, not tested on hardware.

 drivers/i2c/busses/i2c-piix4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-piix4.c +0 -0
index e34d82e79b98..73cc6799cc59 100644

drivers/i2c/busses/i2c-piix4.c line 64

Quoted 8 lines
drivers/i2c/busses/i2c-piix4.c +1 -1
@@ -58,7 +58,7 @@
 #define SMBSLVDAT	(0xC + piix4_smba)
 
 /* count for request_region */
-#define SMBIOSIZE	8
+#define SMBIOSIZE	9
 
 /* PCI Address Constants */
 #define SMBBA		0x090

I checked all the datasheets I have access to, and it should be good.

Signature · 2 lines
Jean Delvare
SUSE L3 Support