Re: [PATCH v3] i2c: i801: Safely share SMBus with BIOS/ACPI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx)
Public Key: https://mrcn.st/pub



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux