Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1340955imm; Tue, 2 Oct 2018 06:48:12 -0700 (PDT) X-Google-Smtp-Source: ACcGV63YNkuVCdqncav5Yi1lJPL4Jqcf7E3W+wKWDJcGZCIPbWm14KazLf+AUDUuIonf4IiMG4Mc X-Received: by 2002:a62:c957:: with SMTP id k84-v6mr16658193pfg.205.1538488092407; Tue, 02 Oct 2018 06:48:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538488092; cv=none; d=google.com; s=arc-20160816; b=mGF4m/HuKFhigQhEmEYlDmGuta37kDexqPM4yUpbvckjyecSSCtCDR59MjTyFz0DF4 Y//x36HndzfgSFfTamXmAD0PuTLE4MiRkf7N/DcSHtm4w+vcNZsD7pnrMTsp8CtCmeLZ Sj3SMncLzbc0drmHAdsaD1609OFque5IpFYCFYSoD9qmz1PYms3QStDHCt1CQKURbhsT fIKNT6oR0n6R+cq9jcN43rcEqchmIm+O9LXSi+4MyjcHi0uC0FgKApQu/4ydNrOwdT6q MR5RmBkxETFt01Z+dUgVfp0UdzGQnjNmlgOJaG0ddAIfbQ+oESa7kDX0/bEaOoadehdV UI4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=7MwpWRaGojvIg3/JL5CSpGx+LGcsyNlAoUQ10qNh6jE=; b=XTRAYaZSBWURTl0yrOlCU4I6y7ku5FDO5jt4L0OSs7owjo7ILunptym8YEjyVdq+ql 7fcpchvUEtjQuAKcDRlcyOd+/4IfNHGgvr/UtLOYpgtMxMbdJGlqG6krH57ODtbpaZaD 7m75h51WDLagFhAtbihv1pLOvQrd1+fkzsEgajL7vVTeTG8lZlNcnMRh6VSAMUQ+vF8q wenOtuNnAju2vONcO0hterMT2nyijUTqh6nmU85QZq459W9mV3gw5Zq7qzMOF8boaNbZ tmhCewXqR3wP7PM9FZ5K9Gc0BYWdNMCQGkA0dOsGj5nJQtO2He4YHFFSlHApXQFeUy3k G5fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7-v6si957821pgj.532.2018.10.02.06.47.57; Tue, 02 Oct 2018 06:48:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732622AbeJBUSk (ORCPT + 99 others); Tue, 2 Oct 2018 16:18:40 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35602 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731578AbeJBUSk (ORCPT ); Tue, 2 Oct 2018 16:18:40 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id A6F285AA; Tue, 2 Oct 2018 13:35:15 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yussuf Khalil , Mika Westerberg , Jean Delvare , Wolfram Sang , Sasha Levin Subject: [PATCH 4.14 136/137] i2c: i801: Allow ACPI AML access I/O ports not reserved for SMBus Date: Tue, 2 Oct 2018 06:25:37 -0700 Message-Id: <20181002132508.024626411@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132458.446916963@linuxfoundation.org> References: <20181002132458.446916963@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mika Westerberg [ Upstream commit 7fd6d98b89f382d414e1db528e29a67bbd749457 ] Commit 7ae81952cda ("i2c: i801: Allow ACPI SystemIO OpRegion to conflict with PCI BAR") made it possible for AML code to access SMBus I/O ports by installing custom SystemIO OpRegion handler and blocking i80i driver access upon first AML read/write to this OpRegion. However, while ThinkPad T560 does have SystemIO OpRegion declared under the SMBus device, it does not access any of the SMBus registers: Device (SMBU) { ... OperationRegion (SMBP, PCI_Config, 0x50, 0x04) Field (SMBP, DWordAcc, NoLock, Preserve) { , 5, TCOB, 11, Offset (0x04) } Name (TCBV, 0x00) Method (TCBS, 0, NotSerialized) { If ((TCBV == 0x00)) { TCBV = (\_SB.PCI0.SMBU.TCOB << 0x05) } Return (TCBV) /* \_SB_.PCI0.SMBU.TCBV */ } OperationRegion (TCBA, SystemIO, TCBS (), 0x10) Field (TCBA, ByteAcc, NoLock, Preserve) { Offset (0x04), , 9, CPSC, 1 } } Problem with the current approach is that it blocks all I/O port access and because this system has touchpad connected to the SMBus controller after first AML access (happens during suspend/resume cycle) the touchpad fails to work anymore. Fix this so that we allow ACPI AML I/O port access if it does not touch the region reserved for the SMBus. Fixes: 7ae81952cda ("i2c: i801: Allow ACPI SystemIO OpRegion to conflict with PCI BAR") Link: https://bugzilla.kernel.org/show_bug.cgi?id=200737 Reported-by: Yussuf Khalil Signed-off-by: Mika Westerberg Reviewed-by: Jean Delvare Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-i801.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -1416,6 +1416,13 @@ static void i801_add_tco(struct i801_pri } #ifdef CONFIG_ACPI +static bool i801_acpi_is_smbus_ioport(const struct i801_priv *priv, + acpi_physical_address address) +{ + return address >= priv->smba && + address <= pci_resource_end(priv->pci_dev, SMBBAR); +} + static acpi_status i801_acpi_io_handler(u32 function, acpi_physical_address address, u32 bits, u64 *value, void *handler_context, void *region_context) @@ -1431,7 +1438,7 @@ i801_acpi_io_handler(u32 function, acpi_ */ mutex_lock(&priv->acpi_lock); - if (!priv->acpi_reserved) { + if (!priv->acpi_reserved && i801_acpi_is_smbus_ioport(priv, address)) { priv->acpi_reserved = true; dev_warn(&pdev->dev, "BIOS is accessing SMBus registers\n");