Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53756d37 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by Ingo Molnar
Browse files

x86: add set/clear_cpu_cap operations



The patch to suppress bitops-related warnings added a pile of ugly
casts.  Many of these were related to the management of x86 CPU
capabilities.  Clean these up by adding specific set/clear_cpu_cap
macros, and use them consistently.

Signed-off-by: default avatarJeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andi Kleen <ak@suse.de>

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 5548fecd
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -356,15 +356,15 @@ void alternatives_smp_switch(int smp)
	spin_lock_irqsave(&smp_alt, flags);
	if (smp) {
		printk(KERN_INFO "SMP alternatives: switching to SMP code\n");
		clear_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
		clear_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_UP);
		clear_cpu_cap(&cpu_data(0), X86_FEATURE_UP);
		list_for_each_entry(mod, &smp_alt_modules, next)
			alternatives_smp_lock(mod->locks, mod->locks_end,
					      mod->text, mod->text_end);
	} else {
		printk(KERN_INFO "SMP alternatives: switching to UP code\n");
		set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
		set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
		set_cpu_cap(&boot_cpu_data, X86_FEATURE_UP);
		set_cpu_cap(&cpu_data(0), X86_FEATURE_UP);
		list_for_each_entry(mod, &smp_alt_modules, next)
			alternatives_smp_unlock(mod->locks, mod->locks_end,
						mod->text, mod->text_end);
@@ -431,8 +431,9 @@ void __init alternative_instructions(void)
	if (smp_alt_once) {
		if (1 == num_possible_cpus()) {
			printk(KERN_INFO "SMP alternatives: switching to UP code\n");
			set_bit(X86_FEATURE_UP, boot_cpu_data.x86_capability);
			set_bit(X86_FEATURE_UP, cpu_data(0).x86_capability);
			set_cpu_cap(&boot_cpu_data, X86_FEATURE_UP);
			set_cpu_cap(&cpu_data(0), X86_FEATURE_UP);

			alternatives_smp_unlock(__smp_locks, __smp_locks_end,
						_text, _etext);
		}
+4 −4
Original line number Diff line number Diff line
@@ -1078,7 +1078,7 @@ static int __init detect_init_APIC (void)
		printk(KERN_WARNING "Could not enable APIC!\n");
		return -1;
	}
	set_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
	set_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
	mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;

	/* The BIOS may have set up the APIC at some other address */
@@ -1168,7 +1168,7 @@ void __init init_apic_mappings(void)
int __init APIC_init_uniprocessor (void)
{
	if (enable_local_apic < 0)
		clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);

	if (!smp_found_config && !cpu_has_apic)
		return -1;
@@ -1180,7 +1180,7 @@ int __init APIC_init_uniprocessor (void)
	    APIC_INTEGRATED(apic_version[boot_cpu_physical_apicid])) {
		printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
		       boot_cpu_physical_apicid);
		clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
		clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
		return -1;
	}

@@ -1536,7 +1536,7 @@ early_param("lapic", parse_lapic);
static int __init parse_nolapic(char *arg)
{
	enable_local_apic = -1;
	clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
	clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
	return 0;
}
early_param("nolapic", parse_nolapic);
+1 −1
Original line number Diff line number Diff line
@@ -1211,7 +1211,7 @@ early_param("apic", apic_set_verbosity);
static __init int setup_disableapic(char *str)
{
	disable_apic = 1;
	clear_bit(X86_FEATURE_APIC, boot_cpu_data.x86_capability);
	clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
	return 0;
}
early_param("disableapic", setup_disableapic);
+1 −1
Original line number Diff line number Diff line
@@ -45,6 +45,6 @@ void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
			&regs[CR_ECX], &regs[CR_EDX]);

		if (regs[cb->reg] & (1 << cb->bit))
			set_bit(cb->feature, c->x86_capability);
			set_cpu_cap(c, cb->feature);
	}
}
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ void mce_log(struct mce *mce)
			/* When the buffer fills up discard new entries. Assume
			   that the earlier errors are the more interesting. */
			if (entry >= MCE_LOG_LEN) {
				set_bit(MCE_OVERFLOW, &mcelog.flags);
				set_bit(MCE_OVERFLOW, (unsigned long *)&mcelog.flags);
				return;
			}
			/* Old left over entry. Skip. */
Loading