public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lv Zheng <lv.zheng@intel.com>
To: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>
Cc: Lv Zheng <lv.zheng@intel.com>, Lv Zheng <zetalog@gmail.com>,
	<linux-kernel@vger.kernel.org>,
	linux-acpi@vger.kernel.org
Subject: [PATCH v2 0/5] ACPI / EC: Fix issues related to the event handling.
Date: Thu, 11 Jun 2015 13:21:14 +0800	[thread overview]
Message-ID: <cover.1433999639.git.lv.zheng@intel.com> (raw)
In-Reply-To: <cover.1433734431.git.lv.zheng@intel.com>

ACPI specification doesn't define the SCI_EVT clearing timing for the EC
firmware. There could be 4 possible positions the firmware may use to clear
the SCI_EVT indication:
 STATUS: After indicating SCI_EVT to the host via the status register
         (EC_SC), the target can clear SCI_EVT at any time.
 QUERY: After seeing the query request (QR_EC) written to the command
        register (EC_CMD) by the host and having prepared the responding
        event value in the data register (EC_DATA), the target can safely
        clear SCI_EVT.
 EVENT: After seeing the event response read from the data register
        (EC_DATA) by the host, the target can clear SCI_EVT.
 METHOD: After the event has been handled via the host _Qxx evaluation,
         the target can clear SCI_EVT.

The old EC driver re-checked SCI_EVT using the 3rd position, while during
the race fixes, the new EC driver was switched to re-check SCI_EVT using
the 1st position. Using the earliest position may help to reduce issues
when the other races are not fully fixed and there is an ACPI specification
statement around an expected behavior:
 The query value of zero is reserved for a spurious query result and
 indicates "no outstanding events."
This statement was the motivation of this choice.

But there are platforms do not follow this definition, since there is also
a coverity issue left in the new EC driver, the unmatched SCI_EVT clearing
timing finally was trapped by this coverity issue, and users can see that
the new EC driver stops processing further SCI_EVTs. The new EC driver then
implemented EC_FLAGS_QUERY_HANDSHAKE quirk as a workaround for such
platforms.
Now more and more reports can be seen for this SCI_EVT clearing timing
unmatched problem, we need to consider a better approach to fix all of them
instead of adding new EC_FLAGS_QUERY_HANDSHAKE quirk users.

This patchset thus finally implements 3 of 4 modes to handle the SCI_EVT
clearing timing variations (1 was proven by 94411 not compliant to the
Windows behavior). And according to the tests, chooses the next earlier
position (the 2rd position) as the default behavior.

This patchset also fixes the coverity problem so that even though the
default behavior still cannot match the Windows behavior, it is possible
for the new EC driver to proceed to handle further SCI_EVT indications.

Related bug reports are as follows:
Link: https://bugzilla.kernel.org/show_bug.cgi?id=44161
Link: https://bugzilla.kernel.org/show_bug.cgi?id=82611
Link: https://bugzilla.kernel.org/show_bug.cgi?id=94411
Link: https://bugzilla.kernel.org/show_bug.cgi?id=97381
Link: https://bugzilla.kernel.org/show_bug.cgi?id=98111

Lv Zheng (5):
  ACPI / EC: Cleanup transaction state transition.
  ACPI / EC: Convert event handling work queue into loop style.
  ACPI / EC: Add event clearing variation support.
  ACPI / EC: Fix EC_FLAGS_QUERY_HANDSHAKE platforms using new event
    clearing timing.
  ACPI / EC: Fix a code coverity issue when QR_EC transactions are
    failed.

 drivers/acpi/ec.c       |  217 +++++++++++++++++++++++++++++++++++++++++------
 drivers/acpi/internal.h |    1 +
 2 files changed, 191 insertions(+), 27 deletions(-)

-- 
1.7.10


  parent reply	other threads:[~2015-06-11  5:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-08  5:26 [PATCH 0/6] ACPI / EC: Fix issues related to the event handling Lv Zheng
2015-06-08  5:27 ` [PATCH 1/6] ACPI / EC: Cleanup transaction state transition Lv Zheng
2015-06-08  5:27 ` [PATCH 2/6] ACPI / EC: Cleanup _Qxx evaluation work item Lv Zheng
2015-06-09 14:41   ` Zheng, Lv
2015-06-08  5:28 ` [PATCH 3/6] ACPI / EC: Convert event handling work queue into loop style Lv Zheng
2015-06-08  5:28 ` [PATCH 4/6] ACPI / EC: Add event clearing variation support Lv Zheng
2015-06-08  5:28 ` [PATCH 5/6] ACPI / EC: Fix EC_FLAGS_QUERY_HANDSHAKE platforms using new event clearing timing Lv Zheng
2015-06-08  5:28 ` [PATCH 6/6] ACPI / EC: Fix a code coverity issue when QR_EC transactions are failed Lv Zheng
2015-06-11  5:21 ` Lv Zheng [this message]
2015-06-11  5:21   ` [PATCH v2 1/5] ACPI / EC: Cleanup transaction state transition Lv Zheng
2015-06-11  5:21   ` [PATCH v2 2/5] ACPI / EC: Convert event handling work queue into loop style Lv Zheng
2015-06-11  5:21   ` [PATCH v2 3/5] ACPI / EC: Add event clearing variation support Lv Zheng
2015-06-11  5:21   ` [PATCH v2 4/5] ACPI / EC: Fix EC_FLAGS_QUERY_HANDSHAKE platforms using new event clearing timing Lv Zheng
2015-06-11  5:21   ` [PATCH v2 5/5] ACPI / EC: Fix a code coverity issue when QR_EC transactions are failed Lv Zheng
2015-06-15 23:19   ` [PATCH v2 0/5] ACPI / EC: Fix issues related to the event handling Rafael J. Wysocki

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=cover.1433999639.git.lv.zheng@intel.com \
    --to=lv.zheng@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=zetalog@gmail.com \
    /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