From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752764AbdGCMXT (ORCPT ); Mon, 3 Jul 2017 08:23:19 -0400 Received: from mga14.intel.com ([192.55.52.115]:40917 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751860AbdGCMXQ (ORCPT ); Mon, 3 Jul 2017 08:23:16 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,303,1496127600"; d="scan'208";a="988171606" Date: Mon, 3 Jul 2017 15:23:17 +0300 From: David Weinehall To: Lyude Cc: intel-gfx@lists.freedesktop.org, Jean Delvare , Wolfram Sang , Benjamin Tissoires , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Mika Westerberg , Jean Delvare Subject: Re: [Intel-gfx] [PATCH] i2c: i801: Allow ACPI SystemIO OpRegion to conflict harder Message-ID: <20170703122317.gcu2nx7lomzzghvm@boom> Mail-Followup-To: Lyude , intel-gfx@lists.freedesktop.org, Jean Delvare , Wolfram Sang , Benjamin Tissoires , "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Mika Westerberg , Jean Delvare References: <20170626204009.32607-1-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170626204009.32607-1-lyude@redhat.com> X-Editor: Vi Improved X-Accept-Language: Swedish, English X-GPG-Fingerprint: ED69 8CF5 6102 21B9 AFD1 9DB7 0B27 96FD 15DA A404 X-GPG-Key: http://www.acc.umu.se/~tao/files/pub_15daa404.gpg.asc X-Clacks-Overhead: GNU Terry Pratchett User-Agent: NeoMutt/20170306 (1.8.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 26, 2017 at 04:40:08PM -0400, Lyude wrote: > There's quite a number of machines on the market, mainly Lenovo > ThinkPads, that make the horrible mistake in their firmware of reusing > the PCIBAR space reserved for the SMBus for things that are completely > unrelated to the SMBus controller, such as the OpRegion used for i915. > This is very bad and entirely evil, but with Lenovo's historically poor > track record of fixing their firmware, it is extremely unlikely this is > ever going to be properly fixed. > > So, while it would be nice if we could just cut off the SMBus controller > and call it a day this unfortunately breaks RMI4 mode completely for > most of the ThinkPads. Even though this behavior is extremely wrong, for > whatever reason sharing the PCIBAR between the OpRegion and SMBus seems > to be just fine. Regardless however, I think it's safe to assume that > when the BIOS accesses the PCIBAR space of the SMBus controller like > this that it's trying to get to something else that we mapped the SMBus > controller over. > > On my X1 Carbon, this assumption appears to be correct. I've traced down > the firmware accesses to being caused by the firmware mistakenly placing > the SWSCI mailbox for i915 on top of the SMBus host controller region. > And indeed, blacklisting i915 causes the firmware to never attempt to > touch this region. > > So, in order to try to workaround this and not break either SMBus or > i915, we temporarily unmap the PCI device for the SMBus controller, > do the thing that the firmware wanted to do, then remap the device and > report a firmware bug. > > Signed-off-by: Lyude > Cc: Rafael J. Wysocki > Cc: Benjamin Tissoires > Cc: Mika Westerberg > Cc: Jean Delvare > Cc: Wolfram Sang > Cc: intel-gfx@lists.freedesktop.org > --- > So: unfortunately > > a7ae81952cda (i2c: i801: Allow ACPI SystemIO OpRegion to conflict with PCI BAR) > > Seems to prevent the ThinkPad X1 Carbon 4th gen and the T460s from actually > using their SMBus controllers at all. As mentioned above, I've traced the issue > down to the firmware responding to the SWSCI by sticking data in places it > shouldn't, e.g. the SMBus registers. > > I'm entirely unsure if this patch is the correct fix for this, and wouldn't be > at all surprised if it's just as bad of a patch as I think it is ;P. So I > figured I'd send it to intel-gfx and the authors of the original version of this > patch to get their take on it and see if there might be something less hacky we > can do to fix this. How does "that other" operating system handle this? FWIW I own a ThinkPad X1 Carbon 4th Gen, so I'm happy for your work on it :) Kind regards, David From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Weinehall Subject: Re: [PATCH] i2c: i801: Allow ACPI SystemIO OpRegion to conflict harder Date: Mon, 3 Jul 2017 15:23:17 +0300 Message-ID: <20170703122317.gcu2nx7lomzzghvm@boom> References: <20170626204009.32607-1-lyude@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: Content-Disposition: inline In-Reply-To: <20170626204009.32607-1-lyude@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Lyude Cc: Jean Delvare , Wolfram Sang , Benjamin Tissoires , intel-gfx@lists.freedesktop.org, "Rafael J . Wysocki" , linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, Mika Westerberg , Jean Delvare List-Id: linux-i2c@vger.kernel.org T24gTW9uLCBKdW4gMjYsIDIwMTcgYXQgMDQ6NDA6MDhQTSAtMDQwMCwgTHl1ZGUgd3JvdGU6Cj4g VGhlcmUncyBxdWl0ZSBhIG51bWJlciBvZiBtYWNoaW5lcyBvbiB0aGUgbWFya2V0LCBtYWlubHkg TGVub3ZvCj4gVGhpbmtQYWRzLCB0aGF0IG1ha2UgdGhlIGhvcnJpYmxlIG1pc3Rha2UgaW4gdGhl aXIgZmlybXdhcmUgb2YgcmV1c2luZwo+IHRoZSBQQ0lCQVIgc3BhY2UgcmVzZXJ2ZWQgZm9yIHRo ZSBTTUJ1cyBmb3IgdGhpbmdzIHRoYXQgYXJlIGNvbXBsZXRlbHkKPiB1bnJlbGF0ZWQgdG8gdGhl IFNNQnVzIGNvbnRyb2xsZXIsIHN1Y2ggYXMgdGhlIE9wUmVnaW9uIHVzZWQgZm9yIGk5MTUuCj4g VGhpcyBpcyB2ZXJ5IGJhZCBhbmQgZW50aXJlbHkgZXZpbCwgYnV0IHdpdGggTGVub3ZvJ3MgaGlz dG9yaWNhbGx5IHBvb3IKPiB0cmFjayByZWNvcmQgb2YgZml4aW5nIHRoZWlyIGZpcm13YXJlLCBp dCBpcyBleHRyZW1lbHkgdW5saWtlbHk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