From: Andy Lutomirski <luto@amacapital.net>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: "Andy Lutomirski" <luto@kernel.org>,
"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>,
"Pali Rohár" <pali.rohar@gmail.com>,
"Mario Limonciello" <mario_limonciello@dell.com>
Subject: Re: [PATCH] i2c: i801: Allow ACPI SystemIO OpRegion to conflict with PCI BAR
Date: Mon, 2 May 2016 08:53:55 -0700 [thread overview]
Message-ID: <CALCETrUTEgiPzmymP9Nok7K85ECSWwbyJUpPZ_mCh74dczC+0Q@mail.gmail.com> (raw)
In-Reply-To: <20160502155021.GB1717@lahna.fi.intel.com>
On Mon, May 2, 2016 at 8:50 AM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> On Mon, May 02, 2016 at 08:29:42AM -0700, Andy Lutomirski wrote:
>> On Mon, May 2, 2016 at 3:12 AM, Mika Westerberg
>> <mika.westerberg@linux.intel.com> wrote:
>> > On Fri, Apr 29, 2016 at 06:13:52PM -0700, Andy Lutomirski wrote:
>> >> A question, though: there's nothing that keeps i801_access from being
>> >> called in between consecutive ACPI accesses. Could this confuse the
>> >> ASL code? Would it be helpful if i801_access were to save away the
>> >> old register state and restore it when it's done in the event that an
>> >> opregion access has been seen so that the ASL-configured state doesn't
>> >> get stomped on?
>> >
>> > Looking at those ASL methods of Lenovo Yoga 900 for example they seem to
>> > initialize the hardware, do the transaction and cleanup in one go.
>> > That's also what the i2c-i801.c driver is doing as far as I can say. So
>> > in that sense they should not mess with each other.
>> >
>>
>> Is your locking actually sufficient to get that right? You're taking
>> acpi_lock, which is private to the driver, so you're only holding it
>> during actual opregion access AFAICT. That means that, if one thread
>> is in the ACPI interpreter in one of these blocks and another thread
>> is in the driver, they could still interleave their accesses. Am I
>> missing something?
>
> No, you are right.
>
>> > Of course this all breaks if the ASL code expects the state to survive
>> > between transactions.
>> >
>> >> Also, what happens if i801_access happens while the i801 master is
>> >> busy with an ASL-initiated transaction? Will it wait for the
>> >> transaction to finish?
>> >
>> > Yes, it should since ->acpi_lock is taken by i801_acpi_io_handler().
>>
>> But i801_acpi_io_handler has no concept of a transaction AFAICT.
>
> Indeed it only handles access one-by-one not by transaction. So if the
> ASL code is in middle of a transaction and i2c-i801.c starts one as well
> it will mess the registers.
>
> Back to drawing board :-/
:-/
I can try to test using the ACPI debugger maybe, but my laptop with
this problem doesn't have any calls to the offending ASL at all, so
just booting it won't exercise any of the interesting cases at all.
--
Andy Lutomirski
AMA Capital Management, LLC
next prev parent reply other threads:[~2016-05-02 15:54 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 [this message]
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
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=CALCETrUTEgiPzmymP9Nok7K85ECSWwbyJUpPZ_mCh74dczC+0Q@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).