public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
To: <herbert@gondor.apana.org.au>, <davem@davemloft.net>,
	<tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de>,
	<x86@kernel.org>, <hpa@zytor.com>, <tony.luck@intel.com>,
	<dave.hansen@intel.com>, <seanjc@google.com>,
	<fenghua.yu@intel.com>, <thomas.lendacky@amd.com>,
	<kyung.min.park@intel.com>, <kim.phillips@amd.com>,
	<mgross@linux.intel.com>, <peterz@infradead.org>,
	<krish.sadhukhan@oracle.com>, <liam.merwick@oracle.com>,
	<mlevitsk@redhat.com>, <reinette.chatre@intel.com>,
	<babu.moger@amd.com>, <linux-crypto@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <TimGuo-oc@zhaoxin.com>, <CooperYan@zhaoxin.com>,
	<QiyuanWang@zhaoxin.com>, <HerryYang@zhaoxin.com>,
	<CobeChen@zhaoxin.com>, <SilviaZhao@zhaoxin.com>
Subject: [PATCH v1 2/3] x86/cpu: Set low performance CRC32C flag on some Zhaoxin CPUs
Date: Thu, 7 Jan 2021 14:19:07 +0800	[thread overview]
Message-ID: <1610000348-17316-3-git-send-email-TonyWWang-oc@zhaoxin.com> (raw)
In-Reply-To: <1610000348-17316-1-git-send-email-TonyWWang-oc@zhaoxin.com>

Some Zhaoxin CPUs declare support SSE4.2 instruction sets but
having a CRC32C instruction implementation that not working as
intended. Set low performance CRC32C flag on these CPUs for later
use.

Signed-off-by: Tony W Wang-oc <TonyWWang-oc@zhaoxin.com>
---
 arch/x86/kernel/cpu/centaur.c | 7 +++++++
 arch/x86/kernel/cpu/zhaoxin.c | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index 345f7d9..13e6fbe 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -109,6 +109,13 @@ static void early_init_centaur(struct cpuinfo_x86 *c)
 		set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
 		set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
 	}
+
+	/*
+	 * These CPUs declare support SSE4.2 instruction sets but
+	 * having low performance CRC32C instruction implementation.
+	 */
+	if (c->x86 == 0x6 || (c->x86 == 0x7 && c->x86_model <= 0x3b))
+		set_cpu_cap(c, X86_FEATURE_CRC32C);
 }
 
 static void init_centaur(struct cpuinfo_x86 *c)
diff --git a/arch/x86/kernel/cpu/zhaoxin.c b/arch/x86/kernel/cpu/zhaoxin.c
index 05fa4ef..837ec65 100644
--- a/arch/x86/kernel/cpu/zhaoxin.c
+++ b/arch/x86/kernel/cpu/zhaoxin.c
@@ -79,6 +79,12 @@ static void early_init_zhaoxin(struct cpuinfo_x86 *c)
 			c->x86_coreid_bits = get_count_order((ebx >> 16) & 0xff);
 	}
 
+	/*
+	 * These CPUs declare support SSE4.2 instruction sets but
+	 * having low performance CRC32C instruction implementation.
+	 */
+	if (c->x86 == 0x6 || (c->x86 == 0x7 && c->x86_model <= 0x3b))
+		set_cpu_cap(c, X86_FEATURE_CRC32C);
 }
 
 static void init_zhaoxin(struct cpuinfo_x86 *c)
-- 
2.7.4


  parent reply	other threads:[~2021-01-07  6:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07  6:19 [PATCH v1 0/3] crypto: x86/crc32c-intel - Exclude some Zhaoxin CPUs Tony W Wang-oc
2021-01-07  6:19 ` [PATCH v1 1/3] x86/cpufeatures: Add low performance CRC32C instruction CPU feature Tony W Wang-oc
2021-01-07  6:37   ` Borislav Petkov
2021-01-11 10:51     ` Tony W Wang-oc
2021-01-11 11:03       ` Borislav Petkov
2021-01-15  1:43         ` Tony W Wang-oc
2021-01-11 15:20     ` hpa
2021-01-07  6:19 ` Tony W Wang-oc [this message]
2021-01-07 15:52   ` [PATCH v1 2/3] x86/cpu: Set low performance CRC32C flag on some Zhaoxin CPUs Dave Hansen
2021-01-11 10:54     ` Tony W Wang-oc
2021-01-07  6:19 ` [PATCH v1 3/3] crypto: x86/crc32c-intel Exclude low performance CRC32C instruction CPUs Tony W Wang-oc

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=1610000348-17316-3-git-send-email-TonyWWang-oc@zhaoxin.com \
    --to=tonywwang-oc@zhaoxin.com \
    --cc=CobeChen@zhaoxin.com \
    --cc=CooperYan@zhaoxin.com \
    --cc=HerryYang@zhaoxin.com \
    --cc=QiyuanWang@zhaoxin.com \
    --cc=SilviaZhao@zhaoxin.com \
    --cc=TimGuo-oc@zhaoxin.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=davem@davemloft.net \
    --cc=fenghua.yu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=kim.phillips@amd.com \
    --cc=krish.sadhukhan@oracle.com \
    --cc=kyung.min.park@intel.com \
    --cc=liam.merwick@oracle.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=mingo@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=peterz@infradead.org \
    --cc=reinette.chatre@intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /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