Commit c1d1ee9a authored by Thomas Gleixner's avatar Thomas Gleixner

x86/apic: Get rid of apic->target_cpus

The target_cpus() callback of the apic struct is not really useful. Some
APICs return cpu_online_mask and others cpus_all_mask. The latter is bogus
as it does not take holes in the cpus_possible_mask into account.

Replace it with cpus_online_mask which makes the most sense and remove the
callback.

The usage sites will be removed in a later step anyway, so get rid of it
now to have incremental changes.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarJuergen Gross <jgross@suse.com>
Tested-by: default avatarYu Chen <yu.c.chen@intel.com>
Acked-by: default avatarJuergen Gross <jgross@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Alok Kataria <akataria@vmware.com>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Rui Zhang <rui.zhang@intel.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Arjan van de Ven <arjan@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Len Brown <lenb@kernel.org>
Link: https://lkml.kernel.org/r/20170913213154.070850916@linutronix.de
parent 023a6117
...@@ -298,7 +298,6 @@ struct apic { ...@@ -298,7 +298,6 @@ struct apic {
u32 irq_dest_mode; u32 irq_dest_mode;
/* Functions and data related to vector allocation */ /* Functions and data related to vector allocation */
const struct cpumask *(*target_cpus)(void);
void (*vector_allocation_domain)(int cpu, struct cpumask *retmask, void (*vector_allocation_domain)(int cpu, struct cpumask *retmask,
const struct cpumask *mask); const struct cpumask *mask);
int (*cpu_mask_to_apicid)(const struct cpumask *cpumask, int (*cpu_mask_to_apicid)(const struct cpumask *cpumask,
...@@ -484,8 +483,6 @@ static inline unsigned int read_apic_id(void) ...@@ -484,8 +483,6 @@ static inline unsigned int read_apic_id(void)
return apic->get_apic_id(reg); return apic->get_apic_id(reg);
} }
extern const struct cpumask *default_target_cpus(void);
extern const struct cpumask *online_target_cpus(void);
extern int default_apic_id_valid(int apicid); extern int default_apic_id_valid(int apicid);
extern int default_acpi_madt_oem_check(char *, char *); extern int default_acpi_madt_oem_check(char *, char *);
extern void default_setup_apic_routing(void); extern void default_setup_apic_routing(void);
......
...@@ -78,20 +78,6 @@ int default_check_phys_apicid_present(int phys_apicid) ...@@ -78,20 +78,6 @@ int default_check_phys_apicid_present(int phys_apicid)
return physid_isset(phys_apicid, phys_cpu_present_map); return physid_isset(phys_apicid, phys_cpu_present_map);
} }
const struct cpumask *default_target_cpus(void)
{
#ifdef CONFIG_SMP
return cpu_online_mask;
#else
return cpumask_of(0);
#endif
}
const struct cpumask *online_target_cpus(void)
{
return cpu_online_mask;
}
int default_apic_id_valid(int apicid) int default_apic_id_valid(int apicid)
{ {
return (apicid < 255); return (apicid < 255);
......
...@@ -154,7 +154,6 @@ static struct apic apic_flat __ro_after_init = { ...@@ -154,7 +154,6 @@ static struct apic apic_flat __ro_after_init = {
.irq_delivery_mode = dest_LowestPrio, .irq_delivery_mode = dest_LowestPrio,
.irq_dest_mode = 1, /* logical */ .irq_dest_mode = 1, /* logical */
.target_cpus = online_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = APIC_DEST_LOGICAL, .dest_logical = APIC_DEST_LOGICAL,
.check_apicid_used = NULL, .check_apicid_used = NULL,
...@@ -249,7 +248,6 @@ static struct apic apic_physflat __ro_after_init = { ...@@ -249,7 +248,6 @@ static struct apic apic_physflat __ro_after_init = {
.irq_delivery_mode = dest_Fixed, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = 0, /* physical */ .irq_dest_mode = 0, /* physical */
.target_cpus = online_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = 0, .dest_logical = 0,
.check_apicid_used = NULL, .check_apicid_used = NULL,
......
...@@ -83,12 +83,6 @@ static int noop_apic_id_registered(void) ...@@ -83,12 +83,6 @@ static int noop_apic_id_registered(void)
return physid_isset(0, phys_cpu_present_map); return physid_isset(0, phys_cpu_present_map);
} }
static const struct cpumask *noop_target_cpus(void)
{
/* only BSP here */
return cpumask_of(0);
}
static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask, static void noop_vector_allocation_domain(int cpu, struct cpumask *retmask,
const struct cpumask *mask) const struct cpumask *mask)
{ {
...@@ -127,7 +121,6 @@ struct apic apic_noop __ro_after_init = { ...@@ -127,7 +121,6 @@ struct apic apic_noop __ro_after_init = {
/* logical delivery broadcast to all CPUs: */ /* logical delivery broadcast to all CPUs: */
.irq_dest_mode = 1, .irq_dest_mode = 1,
.target_cpus = noop_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = APIC_DEST_LOGICAL, .dest_logical = APIC_DEST_LOGICAL,
.check_apicid_used = default_check_apicid_used, .check_apicid_used = default_check_apicid_used,
......
...@@ -249,7 +249,6 @@ static const struct apic apic_numachip1 __refconst = { ...@@ -249,7 +249,6 @@ static const struct apic apic_numachip1 __refconst = {
.irq_delivery_mode = dest_Fixed, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = 0, /* physical */ .irq_dest_mode = 0, /* physical */
.target_cpus = online_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = 0, .dest_logical = 0,
.check_apicid_used = NULL, .check_apicid_used = NULL,
...@@ -300,7 +299,6 @@ static const struct apic apic_numachip2 __refconst = { ...@@ -300,7 +299,6 @@ static const struct apic apic_numachip2 __refconst = {
.irq_delivery_mode = dest_Fixed, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = 0, /* physical */ .irq_dest_mode = 0, /* physical */
.target_cpus = online_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = 0, .dest_logical = 0,
.check_apicid_used = NULL, .check_apicid_used = NULL,
......
...@@ -154,7 +154,6 @@ static struct apic apic_bigsmp __ro_after_init = { ...@@ -154,7 +154,6 @@ static struct apic apic_bigsmp __ro_after_init = {
/* phys delivery to target CPU: */ /* phys delivery to target CPU: */
.irq_dest_mode = 0, .irq_dest_mode = 0,
.target_cpus = default_target_cpus,
.disable_esr = 1, .disable_esr = 1,
.dest_logical = 0, .dest_logical = 0,
.check_apicid_used = bigsmp_check_apicid_used, .check_apicid_used = bigsmp_check_apicid_used,
......
...@@ -2553,9 +2553,8 @@ int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity) ...@@ -2553,9 +2553,8 @@ int acpi_get_override_irq(u32 gsi, int *trigger, int *polarity)
} }
/* /*
* This function currently is only a helper for the i386 smp boot process where * This function updates target affinity of IOAPIC interrupts to include
* we need to reprogram the ioredtbls to cater for the cpus which have come online * the CPUs which came online during SMP bringup.
* so mask in all cases should simply be apic->target_cpus()
*/ */
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
void __init setup_ioapic_dest(void) void __init setup_ioapic_dest(void)
...@@ -2588,7 +2587,7 @@ void __init setup_ioapic_dest(void) ...@@ -2588,7 +2587,7 @@ void __init setup_ioapic_dest(void)
if (!irqd_can_balance(idata) || irqd_affinity_was_set(idata)) if (!irqd_can_balance(idata) || irqd_affinity_was_set(idata))
mask = irq_data_get_affinity_mask(idata); mask = irq_data_get_affinity_mask(idata);
else else
mask = apic->target_cpus(); mask = irq_default_affinity;
chip = irq_data_get_irq_chip(idata); chip = irq_data_get_irq_chip(idata);
/* Might be lapic_chip for irq 0 */ /* Might be lapic_chip for irq 0 */
......
...@@ -109,7 +109,6 @@ static struct apic apic_default __ro_after_init = { ...@@ -109,7 +109,6 @@ static struct apic apic_default __ro_after_init = {
/* logical delivery broadcast to all CPUs: */ /* logical delivery broadcast to all CPUs: */
.irq_dest_mode = 1, .irq_dest_mode = 1,
.target_cpus = default_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = APIC_DEST_LOGICAL, .dest_logical = APIC_DEST_LOGICAL,
.check_apicid_used = default_check_apicid_used, .check_apicid_used = default_check_apicid_used,
......
...@@ -255,7 +255,7 @@ static int assign_irq_vector_policy(int irq, int node, ...@@ -255,7 +255,7 @@ static int assign_irq_vector_policy(int irq, int node,
if (node != NUMA_NO_NODE && if (node != NUMA_NO_NODE &&
assign_irq_vector(irq, data, cpumask_of_node(node), irqdata) == 0) assign_irq_vector(irq, data, cpumask_of_node(node), irqdata) == 0)
return 0; return 0;
return assign_irq_vector(irq, data, apic->target_cpus(), irqdata); return assign_irq_vector(irq, data, cpu_online_mask, irqdata);
} }
static void clear_irq_vector(int irq, struct apic_chip_data *data) static void clear_irq_vector(int irq, struct apic_chip_data *data)
......
...@@ -193,11 +193,6 @@ static int x2apic_cluster_probe(void) ...@@ -193,11 +193,6 @@ static int x2apic_cluster_probe(void)
return 1; return 1;
} }
static const struct cpumask *x2apic_cluster_target_cpus(void)
{
return cpu_all_mask;
}
/* /*
* Each x2apic cluster is an allocation domain. * Each x2apic cluster is an allocation domain.
*/ */
...@@ -215,7 +210,7 @@ static void cluster_vector_allocation_domain(int cpu, struct cpumask *retmask, ...@@ -215,7 +210,7 @@ static void cluster_vector_allocation_domain(int cpu, struct cpumask *retmask,
* derived from the first cpu in the mask) members specified * derived from the first cpu in the mask) members specified
* in the mask. * in the mask.
*/ */
if (mask == x2apic_cluster_target_cpus()) if (cpumask_equal(mask, cpu_online_mask))
cpumask_copy(retmask, cpumask_of(cpu)); cpumask_copy(retmask, cpumask_of(cpu));
else else
cpumask_and(retmask, mask, &cmsk->mask); cpumask_and(retmask, mask, &cmsk->mask);
...@@ -232,7 +227,6 @@ static struct apic apic_x2apic_cluster __ro_after_init = { ...@@ -232,7 +227,6 @@ static struct apic apic_x2apic_cluster __ro_after_init = {
.irq_delivery_mode = dest_LowestPrio, .irq_delivery_mode = dest_LowestPrio,
.irq_dest_mode = 1, /* logical */ .irq_dest_mode = 1, /* logical */
.target_cpus = x2apic_cluster_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = APIC_DEST_LOGICAL, .dest_logical = APIC_DEST_LOGICAL,
.check_apicid_used = NULL, .check_apicid_used = NULL,
......
...@@ -147,7 +147,6 @@ static struct apic apic_x2apic_phys __ro_after_init = { ...@@ -147,7 +147,6 @@ static struct apic apic_x2apic_phys __ro_after_init = {
.irq_delivery_mode = dest_Fixed, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = 0, /* physical */ .irq_dest_mode = 0, /* physical */
.target_cpus = online_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = 0, .dest_logical = 0,
.check_apicid_used = NULL, .check_apicid_used = NULL,
......
...@@ -584,7 +584,6 @@ static struct apic apic_x2apic_uv_x __ro_after_init = { ...@@ -584,7 +584,6 @@ static struct apic apic_x2apic_uv_x __ro_after_init = {
.irq_delivery_mode = dest_Fixed, .irq_delivery_mode = dest_Fixed,
.irq_dest_mode = 0, /* Physical */ .irq_dest_mode = 0, /* Physical */
.target_cpus = online_target_cpus,
.disable_esr = 0, .disable_esr = 0,
.dest_logical = APIC_DEST_LOGICAL, .dest_logical = APIC_DEST_LOGICAL,
.check_apicid_used = NULL, .check_apicid_used = NULL,
......
...@@ -160,7 +160,6 @@ static struct apic xen_pv_apic = { ...@@ -160,7 +160,6 @@ static struct apic xen_pv_apic = {
/* .irq_delivery_mode - used in native_compose_msi_msg only */ /* .irq_delivery_mode - used in native_compose_msi_msg only */
/* .irq_dest_mode - used in native_compose_msi_msg only */ /* .irq_dest_mode - used in native_compose_msi_msg only */
.target_cpus = default_target_cpus,
.disable_esr = 0, .disable_esr = 0,
/* .dest_logical - default_send_IPI_ use it but we use our own. */ /* .dest_logical - default_send_IPI_ use it but we use our own. */
.check_apicid_used = default_check_apicid_used, /* Used on 32-bit */ .check_apicid_used = default_check_apicid_used, /* Used on 32-bit */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment