Commit 4c54158e authored by Nikolay Borisov's avatar Nikolay Borisov Committed by Jialin Zhang
Browse files

kabi: Allow extra bugsints (bsc#1213927).

suse inclusion
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I7RQ67

Reference: https://github.com/SUSE/kernel/commit/9aee1654a4063ca19b8f4bda22b157b465bf9b6d



--------------------------------

suse-commit: fc75ce0587a9184fc130351acb6474d84203ca3e

Signed-off-by: default avatarNikolay Borisov <nik.borisov@suse.com>

 Conflicts:
	arch/x86/include/asm/cpufeature.h
	arch/x86/include/asm/cpufeatures.h
	tools/arch/x86/include/asm/cpufeatures.h

Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent a9efa75d
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -47,10 +47,14 @@ extern const char * const x86_power_flags[32];
 * In order to save room, we index into this array by doing
 * X86_BUG_<name> - NCAPINTS*32.
 */
extern const char * const x86_bug_flags[NBUGINTS*32];
extern const char * const x86_bug_flags[(NBUGINTS+NEXTBUGINTS)*32];

#define IS_EXT_BUGBIT(bit) ((bit>>5) >= (NCAPINTS+NBUGINTS))

#define test_cpu_cap(c, bit)						\
	 arch_test_bit(bit, (unsigned long *)((c)->x86_capability))
	 (IS_EXT_BUGBIT(bit) ? arch_test_bit((bit) - ((NCAPINTS+NBUGINTS)*32), \
				(unsigned long *)((c)->x86_ext_capability)) : \
				arch_test_bit(bit, (unsigned long *)((c)->x86_capability)))

/*
 * There are 32 bits/features in each mask word.  The high bits
@@ -137,13 +141,24 @@ extern const char * const x86_bug_flags[NBUGINTS*32];

#define boot_cpu_has(bit)	cpu_has(&boot_cpu_data, bit)

#define set_cpu_cap(c, bit)	set_bit(bit, (unsigned long *)((c)->x86_capability))
#define set_cpu_cap(c, bit)  do {						  \
	if (IS_EXT_BUGBIT(bit))							  \
		set_bit(bit - ((NCAPINTS+NBUGINTS))*32,				  \
			(unsigned long *)((c)->x86_ext_capability)); \
	else									  \
		set_bit(bit, (unsigned long *)((c)->x86_capability));		  \
} while (0)


extern void setup_clear_cpu_cap(unsigned int bit);
extern void clear_cpu_cap(struct cpuinfo_x86 *c, unsigned int bit);

#define setup_force_cpu_cap(bit) do { \
	set_cpu_cap(&boot_cpu_data, bit);	\
	if (IS_EXT_BUGBIT(bit))    \
		set_bit(bit - ((NCAPINTS+NBUGINTS))*32,				  \
			(unsigned long *)&cpu_caps_set[NCAPINTS+NBUGINTS]);	  \
	else \
		set_bit(bit, (unsigned long *)cpu_caps_set);	\
} while (0)

+2 −2
Original line number Diff line number Diff line
@@ -14,8 +14,8 @@
 * Defines x86 CPU feature bits
 */
#define NCAPINTS			19	   /* N 32-bit words worth of info */
#define NBUGINTS			2	   /* N 32-bit bug flags */

#define NBUGINTS			1	   /* N 32-bit bug flags */
#define NEXTBUGINTS			1	   /* N 32-bit extended bug flags */
/*
 * Note: If the comment begins with a quoted string, that string is used
 * in /proc/cpuinfo instead of the macro name.  If the string is "",
+4 −1
Original line number Diff line number Diff line
@@ -141,6 +141,9 @@ struct cpuinfo_x86 {
	/* Address space bits used by the cache internally */
	u8			x86_cache_bits;
	unsigned		initialized : 1;
#ifndef __GENKSYMS__
	__u32		x86_ext_capability[NEXTBUGINTS];
#endif
} __randomize_layout;

struct extra_cpuinfo_x86 {
@@ -182,7 +185,7 @@ extern struct cpuinfo_x86 new_cpu_data;
extern struct extra_cpuinfo_x86	extra_boot_cpu_data;

extern __u32			cpu_caps_cleared[NCAPINTS + NBUGINTS];
extern __u32			cpu_caps_set[NCAPINTS + NBUGINTS];
extern __u32			cpu_caps_set[NCAPINTS + NBUGINTS + NEXTBUGINTS];

#ifdef CONFIG_SMP
DECLARE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
+1 −1
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ void __init_or_module noinline apply_alternatives(struct alt_instr *start,
		instr = (u8 *)&a->instr_offset + a->instr_offset;
		replacement = (u8 *)&a->repl_offset + a->repl_offset;
		BUG_ON(a->instrlen > sizeof(insn_buff));
		BUG_ON(feature >= (NCAPINTS + NBUGINTS) * 32);
		BUG_ON(feature >= (NCAPINTS + NBUGINTS + NEXTBUGINTS) * 32);

		/*
		 * Patch if either:
+6 −1
Original line number Diff line number Diff line
@@ -592,7 +592,7 @@ static const char *table_lookup_model(struct cpuinfo_x86 *c)

/* Aligned to unsigned long to avoid split lock in atomic bitmap ops */
__u32 cpu_caps_cleared[NCAPINTS + NBUGINTS] __aligned(sizeof(unsigned long));
__u32 cpu_caps_set[NCAPINTS + NBUGINTS] __aligned(sizeof(unsigned long));
__u32 cpu_caps_set[NCAPINTS + NBUGINTS + NEXTBUGINTS] __aligned(sizeof(unsigned long));

void load_percpu_segment(int cpu)
{
@@ -855,6 +855,11 @@ static void apply_forced_caps(struct cpuinfo_x86 *c)
		c->x86_capability[i] &= ~cpu_caps_cleared[i];
		c->x86_capability[i] |= cpu_caps_set[i];
	}

	for (i = 0; i < NEXTBUGINTS; i++) {
		c->x86_ext_capability[i] |= cpu_caps_set[NCAPINTS+NBUGINTS + i];
	}

}

static void init_speculation_control(struct cpuinfo_x86 *c)
Loading