From: matwey@sai.msu.ru
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org, linux-parport@lists.infradead.org,
hsommer@eso.org, gnomes@lxorguk.ukuu.org.uk,
matwey.kornilov@gmail.com,
"Matwey V. Kornilov" <matwey@sai.msu.ru>
Subject: [PATCHv4 2/2] parport: parport_pc: Implement CPU model check to cut off false-positives
Date: Fri, 18 Jul 2014 11:12:55 +0400 [thread overview]
Message-ID: <1405667575-3291-3-git-send-email-matwey@sai.msu.ru> (raw)
In-Reply-To: <1405667575-3291-1-git-send-email-matwey@sai.msu.ru>
From: "Matwey V. Kornilov" <matwey@sai.msu.ru>
The code in intel_bug_present is known to produce much false-positives.
It is believed that the affected by the bug hardware are used with either Intel 80486 or Pentium.
Perform the check only when the kernel configured as CONFIG_X86_32,
then use cpuinfo_x86 of the first available CPU to check the model
and run initial check code.
Suggested-by: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Tested-by: Heiko Andreas Sommer <hsommer@eso.org>
Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
---
drivers/parport/parport_pc.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index a6eaafb..6b28f9f 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -65,6 +65,7 @@
#include <linux/parport_pc.h>
#include <linux/via.h>
#include <asm/parport.h>
+#include <asm/processor.h>
#define PARPORT_PC_MAX_PORTS PARPORT_MAX
@@ -1702,7 +1703,11 @@ static int parport_ECP_supported(struct parport *pb)
}
#endif
-static int intel_bug_present(struct parport *pb)
+/* It is believed that CPU model correlates with buggy LPT chipset model.
+ Here we check that or CPU is elder than Pentium Pro: either 80486 or Pentium.
+ If it is then we perform The Check. */
+#ifdef CONFIG_X86_32
+static int intel_bug_present_check_epp(struct parport *pb)
{
const struct parport_pc_private *priv = pb->private_data;
int bug_present = 0;
@@ -1725,6 +1730,20 @@ static int intel_bug_present(struct parport *pb)
return bug_present;
}
+static int intel_bug_present(struct parport *pb)
+{
+ struct cpuinfo_x86 *c = &cpu_data(0);
+
+ if (c->x86_vendor == X86_VENDOR_INTEL && (c->x86 == 4 || c->x86 == 5))
+ return intel_bug_present_check_epp(pb);
+ return 0;
+}
+#else
+static int intel_bug_present(struct parport *pb)
+{
+ return 0;
+}
+#endif
static int parport_ECPPS2_supported(struct parport *pb)
{
--
1.8.1.4
next prev parent reply other threads:[~2014-07-18 7:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-18 7:12 [PATCHv4 0/2] parport: parport_pc: Fix false-positives at checking for Intel bug matwey
2014-07-18 7:12 ` [PATCHv4 1/2] parport: parport_pc: Introduce intel_bug_present function matwey
2014-07-18 7:12 ` matwey [this message]
2014-07-18 7:31 ` [PATCHv4 2/2] parport: parport_pc: Implement CPU model check to cut off false-positives Ondrej Zary
2014-08-13 8:04 ` Matwey V. Kornilov
2015-01-21 16:51 ` [Linux-parport] " Leopold Palomo-Avellaneda
2015-01-21 17:09 ` Matwey V. Kornilov
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=1405667575-3291-3-git-send-email-matwey@sai.msu.ru \
--to=matwey@sai.msu.ru \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=gregkh@linuxfoundation.org \
--cc=hsommer@eso.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parport@lists.infradead.org \
--cc=matwey.kornilov@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
all inboxes | Powered by JetHome®