Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3916137imm; Mon, 8 Oct 2018 11:38:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV63kInGLpPnMdeO6lL4AE0FRl193yQc/IPSm+yiUVNmSsf5PumVVpt/vxp6dNDZqQCyEIy3S X-Received: by 2002:a17:902:8481:: with SMTP id c1-v6mr25561027plo.158.1539023891549; Mon, 08 Oct 2018 11:38:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539023891; cv=none; d=google.com; s=arc-20160816; b=sgeuzVhmqNxO/MWMLgt9RNu/CRCkJ9BkBxr9GteUbT4h9IYkxjB++SNT5icoylMrK0 Sj8F4bwTqnxc4a1hhO5o+1WO2G5bPeTUJ1Zt0isTmIc7taOpPA4M5cZsuOCiljRKErWc BbL6GSkzwGLgNYzdQwrFA2LI5fnSzeT7m85MMCtzgUGWk3G+RAWRokZcg1iEI43b9lAy ed4r075ropXeYB3YAncxj803le1yy3FEIQEz3fLMpS+UGBa2ZDPTs5ysEhqHWG7pwicU YNxTTcpwe8dJI/6u6q1+Siox5Y4ewVPD4kvjn/N0MEwfn+2idWeb9rd0779GqxQnH1Ds EAGw== 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:dkim-signature; bh=55e+dXDi5A6uvQ4S6W67z/Q/GzK70dIwdgzpez2pbxM=; b=ONChDQAtpsVlouR4aE7Vb7cDXvaCO9Qt88D7qq2HBy+pq3yKu4Qgrlu9MSPzpyP4pl NKrLXQu9EO5jVb3SeDK0hGgt+JMnYCpekgIjLHIUp+ufWbawoxhbUVo33AozIwzwJL2U z9Mh/KjMLaqix+yoka43FU/ePtqwKYAzPigi8y6dhhfbumhbyMRx9vJ+Pqs5AISx6m7l 5nCfmR3k6FmfmiTa1JHXCjDitXekdRIMeUYYlsljGyp12ggh2A6gyqlhp55C2aVxWqt1 flNuk7sX+M6QHbbYQqCe+j5qeHOtpsB47G4fG5QeZEOhkYogEILm24DV7+0goyNey6my kh7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zLeNUqbB; 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 s65-v6si17684550pgb.486.2018.10.08.11.37.56; Mon, 08 Oct 2018 11:38:11 -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; dkim=pass header.i=@kernel.org header.s=default header.b=zLeNUqbB; 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 S1728388AbeJIBsw (ORCPT + 99 others); Mon, 8 Oct 2018 21:48:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:33252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726522AbeJIBsv (ORCPT ); Mon, 8 Oct 2018 21:48:51 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F146A2087D; Mon, 8 Oct 2018 18:35:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539023748; bh=QG/2pPU/ouww6Zj2nioihZuNKuYXUAZKJrG1as4sByI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zLeNUqbBLPZmiLjRnH3yz3HUIY2phgj8RWeaeJ9uzcZQNMAqceEKcbO8D9FIU1sPt EBzB8kooBEJ35qeHv5VCfo6NmhHnYjsL0W141ziP0yd9/i/BV7K7t0ZlPSfXMfUyvs RSCrt5YgiuPFPefKdYKe1GmXdYlWiQsLfZWhDBKU= 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.4 070/113] i2c: i801: Allow ACPI AML access I/O ports not reserved for SMBus Date: Mon, 8 Oct 2018 20:31:11 +0200 Message-Id: <20181008175534.815678904@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175530.864641368@linuxfoundation.org> References: <20181008175530.864641368@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.4-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 @@ -1272,6 +1272,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) @@ -1287,7 +1294,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");