linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Jean Delvare <jdelvare@suse.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Mario Limonciello <mario_limonciello@dell.com>
Subject: Re: [PATCH] i2c: i801: Allow ACPI SystemIO OpRegion to conflict with PCI BAR
Date: Fri, 29 Apr 2016 17:56:14 -0700	[thread overview]
Message-ID: <CALCETrUL9kFrGuRJVOhOvJXQRiYOyHMeWsANr__PfSSEvYWaYw@mail.gmail.com> (raw)
In-Reply-To: <CALCETrXF0PnEnHrNXkQJ6dFq3HhF7tRgkOt7zZF5EBinU_Wc+g@mail.gmail.com>

On Fri, Apr 29, 2016 at 2:42 PM, Andy Lutomirski <luto@amacapital.net> wrote:
> On Fri, Apr 29, 2016 at 2:00 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
>> On Friday 29 April 2016 20:10:23 Andy Lutomirski wrote:
>>> On Fri, Apr 29, 2016 at 2:03 AM, Pali Rohár <pali.rohar@gmail.com>
>>> wrote:
>>> > On Thursday 28 April 2016 11:34:38 Andy Lutomirski wrote:
>>> >> On 04/28/2016 03:23 AM, Mika Westerberg wrote:
>>> >> >Many Intel systems the BIOS declares a SystemIO OpRegion below
>>> >> >the SMBus
>>> >> >
>>> >> >PCI device as can be seen in ACPI DSDT table from Lenovo Yoga 900:
>>> >> >  Device (SBUS)
>>> >> >  {
>>> >> >
>>> >> >      OperationRegion (SMBI, SystemIO, (SBAR << 0x05), 0x10)
>>> >> >      Field (SMBI, ByteAcc, NoLock, Preserve)
>>> >> >      {
>>> >> >
>>> >> >          HSTS,   8,
>>> >> >          Offset (0x02),
>>> >> >          HCON,   8,
>>> >> >          HCOM,   8,
>>> >> >          TXSA,   8,
>>> >> >          DAT0,   8,
>>> >> >          DAT1,   8,
>>> >> >          HBDR,   8,
>>> >> >          PECR,   8,
>>> >> >          RXSA,   8,
>>> >> >          SDAT,   16
>>> >> >
>>> >> >      }
>>> >> >
>>> >> >There are also bunch of ASL methods that that the BIOS can use to
>>> >> >access these fields. Most of the systems in question ASL methods
>>> >> >accessing the SMBI OpRegion are never used.
>>> >> >
>>> >> >Now, because of this SMBI OpRegion many systems fail to load the
>>> >> >SMBus
>>> >> >
>>> >> >driver with an error looking like one below:
>>> >> >  ACPI Warning: SystemIO range
>>> >> >  0x0000000000003040-0x000000000000305F
>>> >> >
>>> >> >       conflicts with OpRegion
>>> >> >       0x0000000000003040-0x000000000000304F
>>> >> >       (\_SB.PCI0.SBUS.SMBI) (20160108/utaddress-255)
>>> >> >
>>> >> >  ACPI: If an ACPI driver is available for this device, you
>>> >> >  should use
>>> >> >
>>> >> >       it instead of the native driver
>>> >> >
>>> >> >The reason is that this SMBI OpRegion conflicts with the PCI BAR
>>> >> >used by the SMBus driver.
>>> >> >
>>> >> >It turns out that we can install a custom SystemIO address space
>>> >> >handler for the SMBus device to intercept all accesses through
>>> >> >that OpRegion. This allows us to share the PCI BAR with the ASL
>>> >> >code if it for some reason is using it. We do not expect that
>>> >> >this OpRegion handler will ever be called but if it is we print
>>> >> >a warning and execute the read/write operation under a lock
>>> >> >which prevents ASL and OS from messing each other.
>>> >>
>>> >> Tested-by: Andy Lutomirski <luto@kernel.org> # Dell XPS 13 9350
>>> >>
>>> >> This successfully works around:
>>> >>
>>> >> https://bugzilla.kernel.org/show_bug.cgi?id=110041
>>> >>
>>> >> but the BIOS people should still fix their ASL.  Sigh.
>>> >>
>>> >> On the Dell laptop, the observable effect is that the driver loads
>>> >> and finds the iTCO thing.
>>> >>
>>> >> Pali, this may be considerably more useful on your laptop.
>>> >
>>> > Andy, I am right that I will be able to load i2c-i801.ko driver
>>> > without acpi_enforce_resources=lax parameter?
>>>
>>> Yes, and it works on my laptop.
>>
>> Looks like it is working also on my laptop.
>>
>>> > If yes, then it sounds good! Finally I would be able to bind
>>> > lis3lv02d_i2c.ko driver for accelerometer which is on my E6440
>>> > machine.
>>> >
>>> > Andy, is there any way to tell i2c-i801.ko driver that on i2c bus
>>> > (which that driver exports) is present some i2c device? Months ago
>>> > I got list of Latitude machines on which i2c address is that
>>> > accelerometer present.
>>> >
>>> > It is possible to hardcode that mapping (DMI name of laptop --> i2c
>>> > address) into dell-laptop driver, so i2c-i801.ko and
>>> > lis3lv02d_i2c.ko will be automatically loaded and lis3l binded
>>> > correctly to i801 i2c address?
>>>
>>> I don't know how this part works, but I doubt that doing it in
>>> dell-laptop will be convenient.  After all, dell-laptop can load
>>> before i2c-i801.
>>>
>>> Jean and Wolfram: is there a quirk mechanism to add i2c devices that
>>> aren't directly enumerable but are known to exist due to DMI?
>>
>> Maybe something like i2c_register_board_info()?
>
> Maybe.  i think that wants to be called before the adapter shows up, though.

i2c_probe_optional_slaves may be a more appropriate place to put this.

Also, is there any indication in your DSDT that this thing exists?

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2016-04-30  0:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 10:23 [PATCH] i2c: i801: Allow ACPI SystemIO OpRegion to conflict with PCI BAR Mika Westerberg
2016-04-28 18:34 ` Andy Lutomirski
2016-04-29  8:56   ` Mika Westerberg
2016-04-30  1:13     ` Andy Lutomirski
2016-05-02 10:12       ` Mika Westerberg
2016-05-02 11:42         ` Rafael J. Wysocki
2016-05-02 12:40           ` Mika Westerberg
2016-05-02 15:29         ` Andy Lutomirski
2016-05-02 15:50           ` Mika Westerberg
2016-05-02 15:53             ` Andy Lutomirski
2016-05-02 21:29             ` Rafael J. Wysocki
2016-05-03  8:53               ` Mika Westerberg
2016-04-29  9:03   ` Pali Rohár
2016-04-29 18:10     ` Andy Lutomirski
2016-04-29 21:00       ` Pali Rohár
2016-04-29 21:42         ` Andy Lutomirski
2016-04-30  0:56           ` Andy Lutomirski [this message]
2016-04-30  8:12             ` Pali Rohár
2016-05-05  8:27             ` Pali Rohár
     [not found]               ` <CALCETrW3i7QkVNRo4RQkRViPBo8dSn=4mKDZiA=Ar3v7=dgz1A@mail.gmail.com>
2016-05-07 14:11                 ` Pali Rohár
2016-05-07 15:06             ` Jean Delvare
2016-04-29 20:21 ` Rafael J. Wysocki
2016-05-02 10:21   ` Mika Westerberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALCETrUL9kFrGuRJVOhOvJXQRiYOyHMeWsANr__PfSSEvYWaYw@mail.gmail.com \
    --to=luto@amacapital.net \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mario_limonciello@dell.com \
    --cc=mika.westerberg@linux.intel.com \
    --cc=pali.rohar@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).