* Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI @ 2021-12-17 0:31 Alex Henrie 2021-12-17 7:41 ` Hector Martin 0 siblings, 1 reply; 8+ messages in thread From: Alex Henrie @ 2021-12-17 0:31 UTC (permalink / raw) To: linux-i2c, marcan, wsa, jdelvare; +Cc: alexhenrie24 Dear kernel developers, I am having a similar problem, but unfortunately this patch doesn't work for me (I get the error "BIOS uses SMBus unsafely"). Would it be acceptable to add a module parameter to allow access to the SMBus, even if the BIOS is using it? I realize that this is not a good idea in general, but I believe it is safe in my particular case, and I don't see any other way to solve my problem. -Alex ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI 2021-12-17 0:31 [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI Alex Henrie @ 2021-12-17 7:41 ` Hector Martin 2021-12-18 2:51 ` [External] " Alex Henrie 0 siblings, 1 reply; 8+ messages in thread From: Hector Martin @ 2021-12-17 7:41 UTC (permalink / raw) To: Alex Henrie, linux-i2c, wsa, jdelvare; +Cc: alexhenrie24 On 17/12/2021 09.31, Alex Henrie wrote: > Dear kernel developers, > > I am having a similar problem, but unfortunately this patch doesn't > work for me (I get the error "BIOS uses SMBus unsafely"). Would it be > acceptable to add a module parameter to allow access to the SMBus, even > if the BIOS is using it? I realize that this is not a good idea in > general, but I believe it is safe in my particular case, and I don't > see any other way to solve my problem. > > -Alex > How is this safe in your case? If the BIOS is using SMBus without locking it, and may do so at any time, then there's no way to safely use it from Linux. -- Hector Martin (marcan@marcan.st) Public Key: https://mrcn.st/pub ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [External] Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI 2021-12-17 7:41 ` Hector Martin @ 2021-12-18 2:51 ` Alex Henrie 2021-12-18 3:39 ` Hector Martin 2022-01-18 12:53 ` [External] " Jean Delvare 0 siblings, 2 replies; 8+ messages in thread From: Alex Henrie @ 2021-12-18 2:51 UTC (permalink / raw) To: Hector Martin; +Cc: linux-i2c, wsa, jdelvare, alexhenrie24 On Fri, 17 Dec 2021 16:41:05 +0900 Hector Martin <marcan@marcan.st> wrote: > On 17/12/2021 09.31, Alex Henrie wrote: > > I am having a similar problem, but unfortunately this patch doesn't > > work for me (I get the error "BIOS uses SMBus unsafely"). Would it be > > acceptable to add a module parameter to allow access to the SMBus, even > > if the BIOS is using it? I realize that this is not a good idea in > > general, but I believe it is safe in my particular case, and I don't > > see any other way to solve my problem. > > How is this safe in your case? If the BIOS is using SMBus without > locking it, and may do so at any time, then there's no way to safely use > it from Linux. The BIOS appears to access the SMBus during the first few minutes after boot, and then it stops using it. So "safe" may not be the right word, but in my case, it seems to work OK to use the SMBus as long as the uptime is greater than a few minutes. -Alex ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [External] Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI 2021-12-18 2:51 ` [External] " Alex Henrie @ 2021-12-18 3:39 ` Hector Martin 2021-12-20 17:41 ` Alex Henrie 2022-01-18 12:53 ` [External] " Jean Delvare 1 sibling, 1 reply; 8+ messages in thread From: Hector Martin @ 2021-12-18 3:39 UTC (permalink / raw) To: Alex Henrie; +Cc: linux-i2c, wsa, jdelvare, alexhenrie24 On 18/12/2021 11.51, Alex Henrie wrote: > On Fri, 17 Dec 2021 16:41:05 +0900 > Hector Martin <marcan@marcan.st> wrote: > >> On 17/12/2021 09.31, Alex Henrie wrote: >>> I am having a similar problem, but unfortunately this patch doesn't >>> work for me (I get the error "BIOS uses SMBus unsafely"). Would it be >>> acceptable to add a module parameter to allow access to the SMBus, even >>> if the BIOS is using it? I realize that this is not a good idea in >>> general, but I believe it is safe in my particular case, and I don't >>> see any other way to solve my problem. >> >> How is this safe in your case? If the BIOS is using SMBus without >> locking it, and may do so at any time, then there's no way to safely use >> it from Linux. > > The BIOS appears to access the SMBus during the first few minutes after > boot, and then it stops using it. So "safe" may not be the right word, > but in my case, it seems to work OK to use the SMBus as long as the > uptime is greater than a few minutes. > > -Alex > Linux will probe the SMBus on startup, so that still seems like a rather fragile situation. You'd have to blacklist the module and load it separately a few minutes after boot, or something like that... -- Hector Martin (marcan@marcan.st) Public Key: https://mrcn.st/pub ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI 2021-12-18 3:39 ` Hector Martin @ 2021-12-20 17:41 ` Alex Henrie 2022-01-05 1:37 ` Alex Henrie 0 siblings, 1 reply; 8+ messages in thread From: Alex Henrie @ 2021-12-20 17:41 UTC (permalink / raw) To: Hector Martin; +Cc: linux-i2c, wsa, jdelvare, alexhenrie24 On Sat, 18 Dec 2021 12:39:11 +0900 Hector Martin <marcan@marcan.st> wrote: > On 18/12/2021 11.51, Alex Henrie wrote: > > On Fri, 17 Dec 2021 16:41:05 +0900 > > Hector Martin <marcan@marcan.st> wrote: > > > >> On 17/12/2021 09.31, Alex Henrie wrote: > >>> I am having a similar problem, but unfortunately this patch doesn't > >>> work for me (I get the error "BIOS uses SMBus unsafely"). Would it be > >>> acceptable to add a module parameter to allow access to the SMBus, even > >>> if the BIOS is using it? I realize that this is not a good idea in > >>> general, but I believe it is safe in my particular case, and I don't > >>> see any other way to solve my problem. > >> > >> How is this safe in your case? If the BIOS is using SMBus without > >> locking it, and may do so at any time, then there's no way to safely use > >> it from Linux. > > > > The BIOS appears to access the SMBus during the first few minutes after > > boot, and then it stops using it. So "safe" may not be the right word, > > but in my case, it seems to work OK to use the SMBus as long as the > > uptime is greater than a few minutes. > > Linux will probe the SMBus on startup, so that still seems like a rather > fragile situation. You'd have to blacklist the module and load it > separately a few minutes after boot, or something like that... It's awful, I agree. I was just hoping to find a slightly less awful solution than patching the kernel to remove the BIOS access check, which is what I currently have to do. It seems to me that if multiple people are in this situation, it might make sense to add a module parameter to disable the check. -Alex ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI 2021-12-20 17:41 ` Alex Henrie @ 2022-01-05 1:37 ` Alex Henrie 2022-01-08 3:47 ` Hector Martin 0 siblings, 1 reply; 8+ messages in thread From: Alex Henrie @ 2022-01-05 1:37 UTC (permalink / raw) To: Hector Martin; +Cc: linux-i2c, wsa, jdelvare, alexhenrie24 Hi Hector, I had an idea today that you might like better. In your proposed patch to share the SMBus with the BIOS, the kernel will lock itself out of the SMBus if the BIOS uses it unsafely. What if we add a module parameter to instead return -EPERM in i801_acpi_io_handler, effectively locking the BIOS out of the SMBus instead of locking the kernel out? I tried hacking that behavior in and so far it's working well on my troublesome machine. -Alex diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 8020b6b97..442eef67a 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1629,6 +1629,9 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, mutex_lock(&priv->acpi_lock); if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) { + mutex_unlock(&priv->acpi_lock); + return -EPERM; + priv->acpi_reserved = true; dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n"); ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI 2022-01-05 1:37 ` Alex Henrie @ 2022-01-08 3:47 ` Hector Martin 0 siblings, 0 replies; 8+ messages in thread From: Hector Martin @ 2022-01-08 3:47 UTC (permalink / raw) To: Alex Henrie; +Cc: linux-i2c, wsa, jdelvare, alexhenrie24 On 2022/01/05 10:37, Alex Henrie wrote: > Hi Hector, > > I had an idea today that you might like better. In your proposed patch > to share the SMBus with the BIOS, the kernel will lock itself out of > the SMBus if the BIOS uses it unsafely. What if we add a module > parameter to instead return -EPERM in i801_acpi_io_handler, effectively > locking the BIOS out of the SMBus instead of locking the kernel out? I > tried hacking that behavior in and so far it's working well on my > troublesome machine. > > -Alex > > diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c > index 8020b6b97..442eef67a 100644 > --- a/drivers/i2c/busses/i2c-i801.c > +++ b/drivers/i2c/busses/i2c-i801.c > @@ -1629,6 +1629,9 @@ i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, > mutex_lock(&priv->acpi_lock); > > if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) { > + mutex_unlock(&priv->acpi_lock); > + return -EPERM; > + > priv->acpi_reserved = true; > > dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n"); > I think this makes more sense. It would be up to users to choose to cripple whatever the BIOS does, of course (the reason why I sent this patch in in the first place was because I needed the ACPI SMBus routines to work on my machine to make backlight controls work). -- Hector Martin (marcan@marcan.st) Public Key: https://mrcn.st/pub ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [External] Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI 2021-12-18 2:51 ` [External] " Alex Henrie 2021-12-18 3:39 ` Hector Martin @ 2022-01-18 12:53 ` Jean Delvare 1 sibling, 0 replies; 8+ messages in thread From: Jean Delvare @ 2022-01-18 12:53 UTC (permalink / raw) To: Alex Henrie; +Cc: Hector Martin, linux-i2c, wsa, alexhenrie24 On Fri, 17 Dec 2021 19:51:28 -0700, Alex Henrie wrote: > The BIOS appears to access the SMBus during the first few minutes after > boot, and then it stops using it. So "safe" may not be the right word, > but in my case, it seems to work OK to use the SMBus as long as the > uptime is greater than a few minutes. This is a fairly uncommon pattern. Do you have an idea, which device and registers the BIOS is accessing? Did you try tracing it? -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-18 12:53 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-12-17 0:31 [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI Alex Henrie 2021-12-17 7:41 ` Hector Martin 2021-12-18 2:51 ` [External] " Alex Henrie 2021-12-18 3:39 ` Hector Martin 2021-12-20 17:41 ` Alex Henrie 2022-01-05 1:37 ` Alex Henrie 2022-01-08 3:47 ` Hector Martin 2022-01-18 12:53 ` [External] " Jean Delvare
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox