Contributors: 14
Author Tokens Token Proportion Commits Commit Proportion
Ingo Molnar 106 32.02% 9 23.08%
Arjan van de Ven 81 24.47% 1 2.56%
Thomas Gleixner 53 16.01% 13 33.33%
Andrew Morton 30 9.06% 2 5.13%
Suresh B. Siddha 27 8.16% 4 10.26%
Yinghai Lu 17 5.14% 2 5.13%
Len Brown 4 1.21% 1 2.56%
Jan Beulich 3 0.91% 1 2.56%
Michael S. Tsirkin 3 0.91% 1 2.56%
Jeff Garzik 2 0.60% 1 2.56%
Jaswinder Singh Rajput 2 0.60% 1 2.56%
Greg Kroah-Hartman 1 0.30% 1 2.56%
Kees Cook 1 0.30% 1 2.56%
Lv Zheng 1 0.30% 1 2.56%
Total 331 39


// SPDX-License-Identifier: GPL-2.0
/*
 * APIC driver for "bigsmp" xAPIC machines with more than 8 virtual CPUs.
 *
 * Drives the local APIC in "clustered mode".
 */
#include <linux/cpumask.h>
#include <linux/dmi.h>
#include <linux/smp.h>

#include <asm/apic.h>
#include <asm/io_apic.h>

#include "local.h"

static u32 bigsmp_get_apic_id(u32 x)
{
	return (x >> 24) & 0xFF;
}

static void bigsmp_send_IPI_allbutself(int vector)
{
	default_send_IPI_mask_allbutself_phys(cpu_online_mask, vector);
}

static void bigsmp_send_IPI_all(int vector)
{
	default_send_IPI_mask_sequence_phys(cpu_online_mask, vector);
}

static int dmi_bigsmp; /* can be set by dmi scanners */

static int hp_ht_bigsmp(const struct dmi_system_id *d)
{
	printk(KERN_NOTICE "%s detected: force use of apic=bigsmp\n", d->ident);
	dmi_bigsmp = 1;

	return 0;
}


static const struct dmi_system_id bigsmp_dmi_table[] = {
	{ hp_ht_bigsmp, "HP ProLiant DL760 G2",
		{	DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
			DMI_MATCH(DMI_BIOS_VERSION, "P44-"),
		}
	},

	{ hp_ht_bigsmp, "HP ProLiant DL740",
		{	DMI_MATCH(DMI_BIOS_VENDOR, "HP"),
			DMI_MATCH(DMI_BIOS_VERSION, "P47-"),
		}
	},
	{ } /* NULL entry stops DMI scanning */
};

static int probe_bigsmp(void)
{
	return dmi_check_system(bigsmp_dmi_table);
}

static struct apic apic_bigsmp __ro_after_init = {

	.name				= "bigsmp",
	.probe				= probe_bigsmp,

	.dest_mode_logical		= false,

	.disable_esr			= 1,

	.cpu_present_to_apicid		= default_cpu_present_to_apicid,

	.max_apic_id			= 0xFE,
	.get_apic_id			= bigsmp_get_apic_id,

	.calc_dest_apicid		= apic_default_calc_apicid,

	.send_IPI			= default_send_IPI_single_phys,
	.send_IPI_mask			= default_send_IPI_mask_sequence_phys,
	.send_IPI_mask_allbutself	= NULL,
	.send_IPI_allbutself		= bigsmp_send_IPI_allbutself,
	.send_IPI_all			= bigsmp_send_IPI_all,
	.send_IPI_self			= default_send_IPI_self,

	.read				= native_apic_mem_read,
	.write				= native_apic_mem_write,
	.eoi				= native_apic_mem_eoi,
	.icr_read			= native_apic_icr_read,
	.icr_write			= native_apic_icr_write,
	.wait_icr_idle			= apic_mem_wait_icr_idle,
	.safe_wait_icr_idle		= apic_mem_wait_icr_idle_timeout,
};

bool __init apic_bigsmp_possible(bool cmdline_override)
{
	return apic == &apic_bigsmp || !cmdline_override;
}

void __init apic_bigsmp_force(void)
{
	if (apic != &apic_bigsmp)
		apic_install_driver(&apic_bigsmp);
}

apic_driver(apic_bigsmp);