All implementations use the same hook which is a wrapper around cpumask_of(cpu). Adjust callers to no longer use such dummy mask with a single CPU set, as the CPU is already known to the caller. This removes a pair of usages of for_each_cpu().
No functional change intended. Signed-off-by: Roger Pau Monné <[email protected]> --- xen/arch/x86/genapic/bigsmp.c | 1 - xen/arch/x86/genapic/default.c | 1 - xen/arch/x86/genapic/delivery.c | 5 ----- xen/arch/x86/genapic/x2apic.c | 7 ------- xen/arch/x86/include/asm/genapic.h | 4 ---- xen/arch/x86/irq.c | 19 +++++++------------ 6 files changed, 7 insertions(+), 30 deletions(-) diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c index 066feb4a1755..c0bcee659f1b 100644 --- a/xen/arch/x86/genapic/bigsmp.c +++ b/xen/arch/x86/genapic/bigsmp.c @@ -47,7 +47,6 @@ static int __init cf_check probe_bigsmp(void) const struct genapic __initconst_cf_clobber apic_bigsmp = { APIC_INIT("bigsmp", probe_bigsmp), .init_apic_ldr = init_apic_ldr_phys, - .vector_allocation_cpumask = vector_allocation_cpumask_phys, .send_IPI_mask = send_IPI_mask_phys, .send_IPI_self = send_IPI_self_legacy }; diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c index ab9a292464d6..58b5884aac0d 100644 --- a/xen/arch/x86/genapic/default.c +++ b/xen/arch/x86/genapic/default.c @@ -17,7 +17,6 @@ const struct genapic __initconst_cf_clobber apic_default = { APIC_INIT("default", NULL), .init_apic_ldr = init_apic_ldr_flat, - .vector_allocation_cpumask = vector_allocation_cpumask_phys, .send_IPI_mask = send_IPI_mask_flat, .send_IPI_self = send_IPI_self_legacy }; diff --git a/xen/arch/x86/genapic/delivery.c b/xen/arch/x86/genapic/delivery.c index 5d105e848502..777570f3b633 100644 --- a/xen/arch/x86/genapic/delivery.c +++ b/xen/arch/x86/genapic/delivery.c @@ -30,11 +30,6 @@ void cf_check init_apic_ldr_phys(void) /* We only deliver in phys mode - no setup needed. */ } -const cpumask_t *cf_check vector_allocation_cpumask_phys(int cpu) -{ - return cpumask_of(cpu); -} - unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask) { /* As we are using single CPU as destination, pick only one CPU here */ diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c index f4709ab92950..89d66bc627d7 100644 --- a/xen/arch/x86/genapic/x2apic.c +++ b/xen/arch/x86/genapic/x2apic.c @@ -141,7 +141,6 @@ static void cf_check send_IPI_mask_x2apic_cluster( static const struct genapic __initconst_cf_clobber apic_x2apic_phys = { APIC_INIT("x2apic_phys", NULL), .init_apic_ldr = init_apic_ldr_phys, - .vector_allocation_cpumask = vector_allocation_cpumask_phys, .send_IPI_mask = send_IPI_mask_x2apic_phys, .send_IPI_self = send_IPI_self_x2apic }; @@ -156,12 +155,6 @@ static const struct genapic __initconst_cf_clobber apic_x2apic_phys = { static const struct genapic __initconst_cf_clobber apic_x2apic_mixed = { APIC_INIT("x2apic_mixed", NULL), - /* - * The following fields are exclusively used by external interrupts and - * hence are set to use Physical destination mode handlers. - */ - .vector_allocation_cpumask = vector_allocation_cpumask_phys, - /* * The following fields are exclusively used by IPIs and hence are set to * use Cluster Logical destination mode handlers. Note that init_apic_ldr diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h index 6d979279bd2b..33ec492a6ff5 100644 --- a/xen/arch/x86/include/asm/genapic.h +++ b/xen/arch/x86/include/asm/genapic.h @@ -24,7 +24,6 @@ struct genapic { int (*probe)(void); void (*init_apic_ldr)(void); - const cpumask_t *(*vector_allocation_cpumask)(int cpu); void (*send_IPI_mask)(const cpumask_t *mask, int vector); void (*send_IPI_self)(uint8_t vector); }; @@ -35,8 +34,6 @@ struct genapic { #define TARGET_CPUS ((const typeof(cpu_online_map) *)&cpu_online_map) #define init_apic_ldr() alternative_vcall(genapic.init_apic_ldr) -#define vector_allocation_cpumask(cpu) \ - alternative_call(genapic.vector_allocation_cpumask, cpu) extern struct genapic genapic; extern const struct genapic apic_default; @@ -50,7 +47,6 @@ void cf_check send_IPI_mask_flat(const cpumask_t *cpumask, int vector); void cf_check init_apic_ldr_phys(void); unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask); void cf_check send_IPI_mask_phys(const cpumask_t *mask, int vector); -const cpumask_t *cf_check vector_allocation_cpumask_phys(int cpu); void generic_apic_probe(void); void generic_bigsmp_probe(void); diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 80f7417d2103..7009a3c6d0dd 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -621,16 +621,12 @@ static int _assign_irq_vector(struct irq_desc *desc, const cpumask_t *mask) for_each_cpu(cpu, mask) { - const cpumask_t *vec_mask; - int new_cpu; int vector, offset; /* Only try and allocate irqs on cpus that are present. */ if (!cpu_online(cpu)) continue; - vec_mask = vector_allocation_cpumask(cpu); - vector = current_vector; offset = current_offset; next: @@ -650,13 +646,12 @@ next: && test_bit(vector, irq_used_vectors) ) goto next; - if ( cpumask_test_cpu(0, vec_mask) && + if ( !cpu && vector >= FIRST_LEGACY_VECTOR && vector <= LAST_LEGACY_VECTOR ) goto next; - for_each_cpu(new_cpu, vec_mask) - if (per_cpu(vector_irq, new_cpu)[vector] >= 0) - goto next; + if ( per_cpu(vector_irq, cpu)[vector] >= 0 ) + goto next; /* Found one! */ current_vector = vector; current_offset = offset; @@ -688,12 +683,12 @@ next: release_old_vec(desc); } - trace_irq_mask(TRC_HW_IRQ_ASSIGN_VECTOR, irq, vector, vec_mask); + trace_irq_mask(TRC_HW_IRQ_ASSIGN_VECTOR, irq, vector, cpumask_of(cpu)); - for_each_cpu(new_cpu, vec_mask) - per_cpu(vector_irq, new_cpu)[vector] = irq; + per_cpu(vector_irq, cpu)[vector] = irq; desc->arch.vector = vector; - cpumask_copy(desc->arch.cpu_mask, vec_mask); + cpumask_clear(desc->arch.cpu_mask); + cpumask_set_cpu(cpu, desc->arch.cpu_mask); desc->arch.used = IRQ_USED; ASSERT((desc->arch.used_vectors == NULL) -- 2.51.0
