Skip to contentSkip to conversation

x86/cpu: Create Zhaoxin processors architecture support file

PATCH In review Tony W Wang-oc 5 participants 7 messages Jun 18, 2019 – Jun 25, 2019

Subsystems (2)
lore
Share & tools
lore

Tony W Wang-oc

author maintainer
#0 lore raw

PATCH v2 1/3 x86/cpu: Create Zhaoxin processors architecture support file

Add x86 architecture support for new Zhaoxin processors. Carve out initialization code needed by Zhaoxin processors into a separate compilation unit.

To identify Zhaoxin CPU, add a new vendor type X86_VENDOR_ZHAOXIN for system recognition.

---
 MAINTAINERS                      |   6 ++
 arch/x86/Kconfig.cpu             |  13 ++++
 arch/x86/include/asm/processor.h |   3 +-
 arch/x86/kernel/cpu/Makefile     |   1 +
 arch/x86/kernel/cpu/zhaoxin.c    | 164 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 186 insertions(+), 1 deletion(-)
 create mode 100644 arch/x86/kernel/cpu/zhaoxin.c
MAINTAINERS +6 -0
index ff7c2b7e..0f10f68 100644
@@ -17562,6 +17562,12 @@ Q:	https://patchwork.linuxtv.org/project/linux-media/list/
 S:	Maintained
 F:	drivers/media/dvb-frontends/zd1301_demod*
 
+ZHAOXIN PROCESSOR SUPPORT
+M:	Tony W Wang-oc <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	arch/x86/kernel/cpu/zhaoxin.c
+
 ZPOOL COMPRESSED PAGE STORAGE API
 M:	Dan Streetman <[email protected]>
 L:	[email protected]
arch/x86/Kconfig.cpu +13 -0
index 6adce15..8e29c99 100644
@@ -480,3 +480,16 @@ config CPU_SUP_UMC_32
 	  CPU might render the kernel unbootable.
 
 	  If unsure, say N.
+
+config CPU_SUP_ZHAOXIN
+	default y
+	bool "Support Zhaoxin processors" if PROCESSOR_SELECT
+	help
+	  This enables detection, tunings and quirks for Zhaoxin processors
+
+	  You need this enabled if you want your kernel to run on a
+	  Zhaoxin CPU. Disabling this option on other types of CPUs
+	  makes the kernel a tiny bit smaller. Disabling it on a Zhaoxin
+	  CPU might render the kernel unbootable.
+
+	  If unsure, say N.
arch/x86/include/asm/processor.h +2 -1
index 6aba36b..3eab6ec 100644
@@ -146,7 +146,8 @@ enum cpuid_regs_idx {
 #define X86_VENDOR_TRANSMETA	7
 #define X86_VENDOR_NSC		8
 #define X86_VENDOR_HYGON	9
-#define X86_VENDOR_NUM		10
+#define X86_VENDOR_ZHAOXIN	10
+#define X86_VENDOR_NUM		11
 
 #define X86_VENDOR_UNKNOWN	0xff
 
arch/x86/kernel/cpu/Makefile +1 -0
index 3ffe1b0..fab4378 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_CPU_SUP_CYRIX_32)		+= cyrix.o
 obj-$(CONFIG_CPU_SUP_CENTAUR)		+= centaur.o
 obj-$(CONFIG_CPU_SUP_TRANSMETA_32)	+= transmeta.o
 obj-$(CONFIG_CPU_SUP_UMC_32)		+= umc.o
+obj-$(CONFIG_CPU_SUP_ZHAOXIN)		+= zhaoxin.o
 
 obj-$(CONFIG_X86_MCE)			+= mce/
 obj-$(CONFIG_MTRR)			+= mtrr/
arch/x86/kernel/cpu/zhaoxin.c new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 8 lines · Tony W Wang-oc

Add x86 architecture support for new Zhaoxin processors. Carve out initialization code needed by Zhaoxin processors into a separate compilation unit.

To identify Zhaoxin CPU, add a new vendor type X86_VENDOR_ZHAOXIN for system recognition.

Quoted 8 lines
---
 MAINTAINERS                      |   6 ++
 arch/x86/Kconfig.cpu             |  13 ++++
 arch/x86/include/asm/processor.h |   3 +-
 arch/x86/kernel/cpu/Makefile     |   1 +
 arch/x86/kernel/cpu/zhaoxin.c    | 164 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 186 insertions(+), 1 deletion(-)
 create mode 100644 arch/x86/kernel/cpu/zhaoxin.c

Looks ok to me.

Rafael, can you ACK the other two so that they all go through the tip tree?

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#2 lore raw
In reply to Tony W Wang-oc
x86/cpu: Create Zhaoxin processors architecture support file
Commit-ID:  761fdd5e3327db6c646a09bab5ad48cd42680cd2
Gitweb:     https://git.kernel.org/tip/761fdd5e3327db6c646a09bab5ad48cd42680cd2
Author:     Tony W Wang-oc <[email protected]>
AuthorDate: Tue, 18 Jun 2019 08:37:05 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 22 Jun 2019 11:45:57 +0200

x86/cpu: Create Zhaoxin processors architecture support file

Add x86 architecture support for new Zhaoxin processors. Carve out initialization code needed by Zhaoxin processors into a separate compilation unit.

To identify Zhaoxin CPU, add a new vendor type X86_VENDOR_ZHAOXIN for system recognition.

---
 MAINTAINERS                      |   6 ++
 arch/x86/Kconfig.cpu             |  13 +++
 arch/x86/include/asm/processor.h |   3 +-
 arch/x86/kernel/cpu/Makefile     |   1 +
 arch/x86/kernel/cpu/zhaoxin.c    | 167 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 189 insertions(+), 1 deletion(-)
MAINTAINERS +6 -0
index 57f496cff999..dfdefc6cb3a2 100644
@@ -17477,6 +17477,12 @@ Q:	https://patchwork.linuxtv.org/project/linux-media/list/
 S:	Maintained
 F:	drivers/media/dvb-frontends/zd1301_demod*
 
+ZHAOXIN PROCESSOR SUPPORT
+M:	Tony W Wang-oc <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	arch/x86/kernel/cpu/zhaoxin.c
+
 ZPOOL COMPRESSED PAGE STORAGE API
 M:	Dan Streetman <[email protected]>
 L:	[email protected]
arch/x86/Kconfig.cpu +13 -0
index 6adce15268bd..8e29c991ba3e 100644
@@ -480,3 +480,16 @@ config CPU_SUP_UMC_32
 	  CPU might render the kernel unbootable.
 
 	  If unsure, say N.
+
+config CPU_SUP_ZHAOXIN
+	default y
+	bool "Support Zhaoxin processors" if PROCESSOR_SELECT
+	help
+	  This enables detection, tunings and quirks for Zhaoxin processors
+
+	  You need this enabled if you want your kernel to run on a
+	  Zhaoxin CPU. Disabling this option on other types of CPUs
+	  makes the kernel a tiny bit smaller. Disabling it on a Zhaoxin
+	  CPU might render the kernel unbootable.
+
+	  If unsure, say N.
arch/x86/include/asm/processor.h +2 -1
index c34a35c78618..e57d2ca2ed87 100644
@@ -144,7 +144,8 @@ enum cpuid_regs_idx {
 #define X86_VENDOR_TRANSMETA	7
 #define X86_VENDOR_NSC		8
 #define X86_VENDOR_HYGON	9
-#define X86_VENDOR_NUM		10
+#define X86_VENDOR_ZHAOXIN	10
+#define X86_VENDOR_NUM		11
 
 #define X86_VENDOR_UNKNOWN	0xff
 
arch/x86/kernel/cpu/Makefile +1 -0
index 5102bf7c8192..a7d9a4cb3ab6 100644
@@ -38,6 +38,7 @@ obj-$(CONFIG_CPU_SUP_CYRIX_32)		+= cyrix.o
 obj-$(CONFIG_CPU_SUP_CENTAUR)		+= centaur.o
 obj-$(CONFIG_CPU_SUP_TRANSMETA_32)	+= transmeta.o
 obj-$(CONFIG_CPU_SUP_UMC_32)		+= umc.o
+obj-$(CONFIG_CPU_SUP_ZHAOXIN)		+= zhaoxin.o
 
 obj-$(CONFIG_X86_MCE)			+= mce/
 obj-$(CONFIG_MTRR)			+= mtrr/
arch/x86/kernel/cpu/zhaoxin.c new file +167 -0

167 lines not on this page · raw message

#3 lore raw
Quoted 9 lines · tip-bot for Tony W Wang-oc
Commit-ID:  761fdd5e3327db6c646a09bab5ad48cd42680cd2
Gitweb:     https://git.kernel.org/tip/761fdd5e3327db6c646a09bab5ad48cd42680cd2
Author:     Tony W Wang-oc <[email protected]>
AuthorDate: Tue, 18 Jun 2019 08:37:05 +0000
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Sat, 22 Jun 2019 11:45:57 +0200

x86/cpu: Create Zhaoxin processors architecture support file

[]

arch/x86/kernel/cpu/zhaoxin.c

Quoted 1 line
arch/x86/kernel/cpu/zhaoxin.c +0 -0

[]

arch/x86/kernel/cpu/zhaoxin.c line 35

Quoted 10 lines
arch/x86/kernel/cpu/zhaoxin.c +10 -0
+static void init_zhaoxin_cap(struct cpuinfo_x86 *c)
+{
+	u32  lo, hi;
+
+	/* Test for Extended Feature Flags presence */
+	if (cpuid_eax(0xC0000000) >= 0xC0000001) {
+		u32 tmp = cpuid_edx(0xC0000001);
+
+		/* Enable ACE unit, if present and disabled */
+		if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) {

trivia:

Perhaps this is more intelligible for humans to read and it deduplicates the comment as:

		if ((tmp & ACE_PRESENT) && !(tmp & ACE_ENABLED))

The compiler produces the same object code.

author maintainer
#4 lore raw
Quoted 18 lines · Joe Perches
Quoted 2 lines

x86/cpu: Create Zhaoxin processors architecture support file

[]

arch/x86/kernel/cpu/zhaoxin.c

Quoted 1 line
arch/x86/kernel/cpu/zhaoxin.c +0 -0

[]

arch/x86/kernel/cpu/zhaoxin.c line 35

Quoted 10 lines
arch/x86/kernel/cpu/zhaoxin.c +10 -0
+static void init_zhaoxin_cap(struct cpuinfo_x86 *c)
+{
+	u32  lo, hi;
+
+	/* Test for Extended Feature Flags presence */
+	if (cpuid_eax(0xC0000000) >= 0xC0000001) {
+		u32 tmp = cpuid_edx(0xC0000001);
+
+		/* Enable ACE unit, if present and disabled */
+		if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) {

trivia:

Quoted 7 lines

Perhaps this is more intelligible for humans to read and it deduplicates the comment as:

		if ((tmp & ACE_PRESENT) && !(tmp & ACE_ENABLED))

The compiler produces the same object code.

Thanks for the trivia, I will change this in the next version patch set.

Thanks
TonyWWang-oc

#5 lore raw

Tony,

Quoted 22 lines · Tony W Wang-oc
Quoted 21 lines · Joe Perches
Quoted 2 lines

x86/cpu: Create Zhaoxin processors architecture support file

[]

arch/x86/kernel/cpu/zhaoxin.c

Quoted 1 line
arch/x86/kernel/cpu/zhaoxin.c +0 -0

[]

arch/x86/kernel/cpu/zhaoxin.c line 35

Quoted 10 lines
arch/x86/kernel/cpu/zhaoxin.c +10 -0
+static void init_zhaoxin_cap(struct cpuinfo_x86 *c)
+{
+	u32  lo, hi;
+
+	/* Test for Extended Feature Flags presence */
+	if (cpuid_eax(0xC0000000) >= 0xC0000001) {
+		u32 tmp = cpuid_edx(0xC0000001);
+
+		/* Enable ACE unit, if present and disabled */
+		if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) {

trivia:

Perhaps this is more intelligible for humans to read and it deduplicates the comment as:

Quoted 6 lines
Quoted 4 lines
		if ((tmp & ACE_PRESENT) && !(tmp & ACE_ENABLED))

The compiler produces the same object code.

Thanks for the trivia, I will change this in the next version patch set.

as you might have noticed from the tip bot commit notification mail, your patch set has been merged into the tip tree and is queued for the 5.3 merge window. So a new patch set is pointless. If at all then you can send a delta patch.

Though I have to say, that I prefer the existing check:

Quoted 1 line
Quoted 1 line

arch/x86/kernel/cpu/zhaoxin.c line 35

Quoted 1 line
arch/x86/kernel/cpu/zhaoxin.c +1 -0
+		if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) {

It's pretty clear, but that's really a matter of personal preference. So from my side there is nothing to do at all.

Thanks,

tglx

author maintainer
#6 lore raw
Quoted 38 lines · Thomas Gleixner

Tony,

Quoted 5 lines · Tony W Wang-oc
Quoted 4 lines · Joe Perches
Quoted 2 lines

x86/cpu: Create Zhaoxin processors architecture support file

[]

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/x86/kernel/cpu/zhaoxin.c

Quoted 17 lines
Quoted 17 lines

[]

arch/x86/kernel/cpu/zhaoxin.c line 35

Quoted 10 lines
arch/x86/kernel/cpu/zhaoxin.c new file +10 -0
+static void init_zhaoxin_cap(struct cpuinfo_x86 *c)
+{
+	u32  lo, hi;
+
+	/* Test for Extended Feature Flags presence */
+	if (cpuid_eax(0xC0000000) >= 0xC0000001) {
+		u32 tmp = cpuid_edx(0xC0000001);
+
+		/* Enable ACE unit, if present and disabled */
+		if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) {

trivia:

Perhaps this is more intelligible for humans to read and it deduplicates the comment as:

Quoted 6 lines
Quoted 4 lines
		if ((tmp & ACE_PRESENT) && !(tmp & ACE_ENABLED))

The compiler produces the same object code.

Thanks for the trivia, I will change this in the next version patch set.

as you might have noticed from the tip bot commit notification mail, your patch set has been merged into the tip tree and is queued for the 5.3 merge window. So a new patch set is pointless. If at all then you can send a delta patch.

Quoted 6 lines

Though I have to say, that I prefer the existing check:

Quoted 1 line
Quoted 1 line

arch/x86/kernel/cpu/zhaoxin.c line 35

Quoted 1 line
arch/x86/kernel/cpu/zhaoxin.c new file +1 -0
+		if ((tmp & (ACE_PRESENT | ACE_ENABLED)) == ACE_PRESENT) {

It's pretty clear, but that's really a matter of personal preference. So from my side there is nothing to do at all.

Got it, I will not change this code.

Thanks
TonyWWang-oc