[tip:x86/urgent] x86/cpu/cyrix: Remove {get,set}Cx86_old macros used for Cyrix processors

2019-03-21 Thread tip-bot for Matthew Whitehead
Commit-ID:  0f4d3aa761b71cd6984330baca1e18bf0590e441
Gitweb: https://git.kernel.org/tip/0f4d3aa761b71cd6984330baca1e18bf0590e441
Author: Matthew Whitehead 
AuthorDate: Thu, 14 Mar 2019 16:46:01 -0400
Committer:  Thomas Gleixner 
CommitDate: Thu, 21 Mar 2019 12:28:50 +0100

x86/cpu/cyrix: Remove {get,set}Cx86_old macros used for Cyrix processors

The getCx86_old() and setCx86_old() macros have been replaced with
correctly working getCx86() and setCx86(), so remove these unused macros.

Signed-off-by: Matthew Whitehead 
Signed-off-by: Thomas Gleixner 
Cc: l...@kernel.org
Link: 
https://lkml.kernel.org/r/1552596361-8967-3-git-send-email-tedheads...@gmail.com

---
 arch/x86/include/asm/processor-cyrix.h | 21 -
 1 file changed, 21 deletions(-)

diff --git a/arch/x86/include/asm/processor-cyrix.h 
b/arch/x86/include/asm/processor-cyrix.h
index aaedd73ea2c6..df700a6cc869 100644
--- a/arch/x86/include/asm/processor-cyrix.h
+++ b/arch/x86/include/asm/processor-cyrix.h
@@ -3,19 +3,6 @@
  * NSC/Cyrix CPU indexed register access. Must be inlined instead of
  * macros to ensure correct access ordering
  * Access order is always 0x22 (=offset), 0x23 (=value)
- *
- * When using the old macros a line like
- *   setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
- * gets expanded to:
- *  do {
- *outb((CX86_CCR2), 0x22);
- *outb((({
- *outb((CX86_CCR2), 0x22);
- *inb(0x23);
- *}) | 0x88), 0x23);
- *  } while (0);
- *
- * which in fact violates the access order (= 0x22, 0x22, 0x23, 0x23).
  */
 
 static inline u8 getCx86(u8 reg)
@@ -29,11 +16,3 @@ static inline void setCx86(u8 reg, u8 data)
outb(reg, 0x22);
outb(data, 0x23);
 }
-
-#define getCx86_old(reg) ({ outb((reg), 0x22); inb(0x23); })
-
-#define setCx86_old(reg, data) do { \
-   outb((reg), 0x22); \
-   outb((data), 0x23); \
-} while (0)
-


[tip:x86/urgent] x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors

2019-03-21 Thread tip-bot for Matthew Whitehead
Commit-ID:  18fb053f9b827bd98cfc64f2a35df8ab19745a1d
Gitweb: https://git.kernel.org/tip/18fb053f9b827bd98cfc64f2a35df8ab19745a1d
Author: Matthew Whitehead 
AuthorDate: Thu, 14 Mar 2019 16:46:00 -0400
Committer:  Thomas Gleixner 
CommitDate: Thu, 21 Mar 2019 12:28:50 +0100

x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors

There are comments in processor-cyrix.h advising you to _not_ make calls
using the deprecated macros in this style:

  setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);

This is because it expands the macro into a non-functioning calling
sequence. The calling order must be:

  outb(CX86_CCR2, 0x22);
  inb(0x23);

>From the comments:

 * When using the old macros a line like
 *   setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
 * gets expanded to:
 *  do {
 *outb((CX86_CCR2), 0x22);
 *outb((({
 *outb((CX86_CCR2), 0x22);
 *inb(0x23);
 *}) | 0x88), 0x23);
 *  } while (0);

The new macros fix this problem, so use them instead. Tested on an
actual Geode processor.

Signed-off-by: Matthew Whitehead 
Signed-off-by: Thomas Gleixner 
Cc: l...@kernel.org
Link: 
https://lkml.kernel.org/r/1552596361-8967-2-git-send-email-tedheads...@gmail.com

---
 arch/x86/kernel/cpu/cyrix.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index d12226f60168..1d9b8aaea06c 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -124,7 +124,7 @@ static void set_cx86_reorder(void)
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */
 
/* Load/Store Serialize to mem access disable (=reorder it) */
-   setCx86_old(CX86_PCR0, getCx86_old(CX86_PCR0) & ~0x80);
+   setCx86(CX86_PCR0, getCx86(CX86_PCR0) & ~0x80);
/* set load/store serialize from 1GB to 4GB */
ccr3 |= 0xe0;
setCx86(CX86_CCR3, ccr3);
@@ -135,11 +135,11 @@ static void set_cx86_memwb(void)
pr_info("Enable Memory-Write-back mode on Cyrix/NSC processor.\n");
 
/* CCR2 bit 2: unlock NW bit */
-   setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) & ~0x04);
+   setCx86(CX86_CCR2, getCx86(CX86_CCR2) & ~0x04);
/* set 'Not Write-through' */
write_cr0(read_cr0() | X86_CR0_NW);
/* CCR2 bit 2: lock NW bit and set WT1 */
-   setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x14);
+   setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x14);
 }
 
 /*
@@ -153,14 +153,14 @@ static void geode_configure(void)
local_irq_save(flags);
 
/* Suspend on halt power saving and enable #SUSP pin */
-   setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x88);
+   setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
 
ccr3 = getCx86(CX86_CCR3);
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);   /* enable MAPEN */
 
 
/* FPU fast, DTE cache, Mem bypass */
-   setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x38);
+   setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x38);
setCx86(CX86_CCR3, ccr3);   /* disable MAPEN */
 
set_cx86_memwb();
@@ -296,7 +296,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)
/* GXm supports extended cpuid levels 'ala' AMD */
if (c->cpuid_level == 2) {
/* Enable cxMMX extensions (GX1 Datasheet 54) */
-   setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7) | 1);
+   setCx86(CX86_CCR7, getCx86(CX86_CCR7) | 1);
 
/*
 * GXm : 0x30 ... 0x5f GXm  datasheet 51
@@ -319,7 +319,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)
if (dir1 > 7) {
dir0_msn++;  /* M II */
/* Enable MMX extensions (App note 108) */
-   setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7)|1);
+   setCx86(CX86_CCR7, getCx86(CX86_CCR7)|1);
} else {
/* A 6x86MX - it has the bug. */
set_cpu_bug(c, X86_BUG_COMA);


[tip:x86/cpu] x86/CPU: Use correct macros for Cyrix calls

2018-09-22 Thread tip-bot for Matthew Whitehead
Commit-ID:  03b099bdcdf7125d4a63dc9ddeefdd454e05123d
Gitweb: https://git.kernel.org/tip/03b099bdcdf7125d4a63dc9ddeefdd454e05123d
Author: Matthew Whitehead 
AuthorDate: Fri, 21 Sep 2018 17:20:40 -0400
Committer:  Borislav Petkov 
CommitDate: Sat, 22 Sep 2018 11:46:56 +0200

x86/CPU: Use correct macros for Cyrix calls

There are comments in processor-cyrix.h advising you to _not_ make calls
using the deprecated macros in this style:

  setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);

This is because it expands the macro into a non-functioning calling
sequence. The calling order must be:

  outb(CX86_CCR2, 0x22);
  inb(0x23);

>From the comments:

 * When using the old macros a line like
 *   setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);
 * gets expanded to:
 *  do {
 *outb((CX86_CCR2), 0x22);
 *outb((({
 *outb((CX86_CCR2), 0x22);
 *inb(0x23);
 *}) | 0x88), 0x23);
 *  } while (0);

The new macros fix this problem, so use them instead.

Signed-off-by: Matthew Whitehead 
Signed-off-by: Borislav Petkov 
Reviewed-by: Andy Lutomirski 
Cc: Greg Kroah-Hartman 
Cc: "H. Peter Anvin" 
Cc: Ingo Molnar 
Cc: Jia Zhang 
Cc: Peter Zijlstra 
Cc: Philippe Ombredanne 
Cc: Thomas Gleixner 
Link: http://lkml.kernel.org/r/20180921212041.13096-2-tedheads...@gmail.com
---
 arch/x86/kernel/cpu/cyrix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/cyrix.c b/arch/x86/kernel/cpu/cyrix.c
index 8949b7ae6d92..d12226f60168 100644
--- a/arch/x86/kernel/cpu/cyrix.c
+++ b/arch/x86/kernel/cpu/cyrix.c
@@ -437,7 +437,7 @@ static void cyrix_identify(struct cpuinfo_x86 *c)
/* enable MAPEN  */
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10);
/* enable cpuid  */
-   setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x80);
+   setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x80);
/* disable MAPEN */
setCx86(CX86_CCR3, ccr3);
local_irq_restore(flags);


[tip:x86/cpu] x86/CPU: Change query logic so CPUID is enabled before testing

2018-09-22 Thread tip-bot for Matthew Whitehead
Commit-ID:  2893cc8ff892fa74972d8dc0e1d0dc65116daaa3
Gitweb: https://git.kernel.org/tip/2893cc8ff892fa74972d8dc0e1d0dc65116daaa3
Author: Matthew Whitehead 
AuthorDate: Fri, 21 Sep 2018 17:20:41 -0400
Committer:  Borislav Petkov 
CommitDate: Sat, 22 Sep 2018 11:47:39 +0200

x86/CPU: Change query logic so CPUID is enabled before testing

Presently we check first if CPUID is enabled. If it is not already
enabled, then we next call identify_cpu_without_cpuid() and clear
X86_FEATURE_CPUID.

Unfortunately, identify_cpu_without_cpuid() is the function where CPUID
becomes _enabled_ on Cyrix 6x86/6x86L CPUs.

Reverse the calling sequence so that CPUID is first enabled, and then
check a second time to see if the feature has now been activated.

[ bp: Massage commit message and remove trailing whitespace. ]

Suggested-by: Andy Lutomirski 
Signed-off-by: Matthew Whitehead 
Signed-off-by: Borislav Petkov 
Reviewed-by: Andy Lutomirski 
Cc: David Woodhouse 
Cc: H. Peter Anvin 
Cc: Ingo Molnar 
Cc: Konrad Rzeszutek Wilk 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: http://lkml.kernel.org/r/20180921212041.13096-3-tedheads...@gmail.com
---
 arch/x86/kernel/cpu/common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 44c4ef3d989b..658c85d16a9b 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1076,6 +1076,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 
*c)
memset(&c->x86_capability, 0, sizeof c->x86_capability);
c->extended_cpuid_level = 0;
 
+   if (!have_cpuid_p())
+   identify_cpu_without_cpuid(c);
+
/* cyrix could have cpuid enabled via c_identify()*/
if (have_cpuid_p()) {
cpu_detect(c);
@@ -1093,7 +1096,6 @@ static void __init early_identify_cpu(struct cpuinfo_x86 
*c)
if (this_cpu->c_bsp_init)
this_cpu->c_bsp_init(c);
} else {
-   identify_cpu_without_cpuid(c);
setup_clear_cpu_cap(X86_FEATURE_CPUID);
}
 


[tip:x86/urgent] x86/Kconfig: Explicitly enumerate i686-class CPUs in Kconfig

2018-02-16 Thread tip-bot for Matthew Whitehead
Commit-ID:  25d76ac888216c369dea91768764728b83769799
Gitweb: https://git.kernel.org/tip/25d76ac888216c369dea91768764728b83769799
Author: Matthew Whitehead 
AuthorDate: Thu, 15 Feb 2018 11:54:56 -0500
Committer:  Ingo Molnar 
CommitDate: Fri, 16 Feb 2018 10:36:39 +0100

x86/Kconfig: Explicitly enumerate i686-class CPUs in Kconfig

The X86_P6_NOP config class leaves out many i686-class CPUs. Instead,
explicitly enumerate all these CPUs.

Using a configuration with M686 currently sets X86_MINIMUM_CPU_FAMILY=5
instead of the correct value of 6.

Booting on an i586 it will fail to generate the "This kernel
requires an i686 CPU, but only detected an i586 CPU" message and
intentional halt as expected. It will instead just silently hang
when it hits i686-specific instructions.

Signed-off-by: Matthew Whitehead 
Cc: Andy Lutomirski 
Cc: Arjan van de Ven 
Cc: Borislav Petkov 
Cc: Brian Gerst 
Cc: Denys Vlasenko 
Cc: H. Peter Anvin 
Cc: Josh Poimboeuf 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1518713696-11360-3-git-send-email-tedheads...@gmail.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/Kconfig.cpu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index ec64aa7..8b8d229 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -385,7 +385,7 @@ config X86_CMOV
 config X86_MINIMUM_CPU_FAMILY
int
default "64" if X86_64
-   default "6" if X86_32 && X86_P6_NOP
+   default "6" if X86_32 && (MPENTIUM4 || MPENTIUMM || MPENTIUMIII || 
MPENTIUMII || M686 || MVIAC3_2 || MVIAC7 || MEFFICEON || MATOM || MCRUSOE || 
MCORE2 || MK7 || MK8)
default "5" if X86_32 && X86_CMPXCHG64
default "4"
 


[tip:x86/urgent] x86/Kconfig: Exclude i586-class CPUs lacking PAE support from the HIGHMEM64G Kconfig group

2018-02-16 Thread tip-bot for Matthew Whitehead
Commit-ID:  69b8d3fcabdc81d9efd82b4a506c8279cbaba692
Gitweb: https://git.kernel.org/tip/69b8d3fcabdc81d9efd82b4a506c8279cbaba692
Author: Matthew Whitehead 
AuthorDate: Thu, 15 Feb 2018 11:54:55 -0500
Committer:  Ingo Molnar 
CommitDate: Fri, 16 Feb 2018 10:36:39 +0100

x86/Kconfig: Exclude i586-class CPUs lacking PAE support from the HIGHMEM64G 
Kconfig group

i586-class machines also lack support for Physical Address Extension (PAE),
so add them to the exclusion list.

Signed-off-by: Matthew Whitehead 
Cc: Andy Lutomirski 
Cc: Arjan van de Ven 
Cc: Borislav Petkov 
Cc: Brian Gerst 
Cc: Denys Vlasenko 
Cc: H. Peter Anvin 
Cc: Josh Poimboeuf 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1518713696-11360-2-git-send-email-tedheads...@gmail.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a528c14..c1236b1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1404,7 +1404,7 @@ config HIGHMEM4G
 
 config HIGHMEM64G
bool "64GB"
-   depends on !M486
+   depends on !M486 && !M586 && !M586TSC && !M586MMX && !MGEODE_LX && 
!MGEODEGX1 && !MCYRIXIII && !MELAN && !MWINCHIPC6 && !WINCHIP3D && !MK6
select X86_PAE
---help---
  Select this if you have a 32-bit processor and more than 4


[tip:x86/urgent] x86/Kconfig: Add missing i586-class CPUs to the X86_CMPXCHG64 Kconfig group

2018-02-16 Thread tip-bot for Matthew Whitehead
Commit-ID:  f960cfd12650fad43c1cde07a1f7642cf2c57f97
Gitweb: https://git.kernel.org/tip/f960cfd12650fad43c1cde07a1f7642cf2c57f97
Author: Matthew Whitehead 
AuthorDate: Thu, 15 Feb 2018 11:54:54 -0500
Committer:  Ingo Molnar 
CommitDate: Fri, 16 Feb 2018 10:36:39 +0100

x86/Kconfig: Add missing i586-class CPUs to the X86_CMPXCHG64 Kconfig group

Several i586-class CPUs supporting this instruction are missing from
the X86_CMPXCHG64 config group.

Using a configuration with either M586TSC or M586MMX currently sets
X86_MINIMUM_CPU_FAMILY=4 instead of the correct value of 5.

Booting on an i486 it will fail to generate the "This kernel
requires an i586 CPU, but only detected an i486 CPU" message and
intentional halt as expected. It will instead just silently hang
when it hits i586-specific instructions.

The M586 CPU is not in this list because at least the Cyrix 5x86
lacks this instruction, and perhaps others.

Signed-off-by: Matthew Whitehead 
Cc: Andy Lutomirski 
Cc: Arjan van de Ven 
Cc: Borislav Petkov 
Cc: Brian Gerst 
Cc: Denys Vlasenko 
Cc: H. Peter Anvin 
Cc: Josh Poimboeuf 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1518713696-11360-1-git-send-email-tedheads...@gmail.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/Kconfig.cpu | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 65a9a47..ec64aa7 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -374,7 +374,7 @@ config X86_TSC
 
 config X86_CMPXCHG64
def_bool y
-   depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || 
MPENTIUMIII || MPENTIUMII || M686 || MATOM
+   depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || 
MPENTIUMIII || MPENTIUMII || M686 || M586TSC || M586MMX || MATOM || MGEODE_LX 
|| MGEODEGX1 || MK6 || MK7 || MK8
 
 # this should be set for all -march=.. options where the compiler
 # generates cmov.