[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v7s235pv.ffs@tglx>
Date: Fri, 21 Mar 2025 13:53:32 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Neeraj Upadhyay <Neeraj.Upadhyay@....com>, linux-kernel@...r.kernel.org
Cc: bp@...en8.de, mingo@...hat.com, dave.hansen@...ux.intel.com,
Thomas.Lendacky@....com, nikunj@....com, Santosh.Shukla@....com,
Vasant.Hegde@....com, Suravee.Suthikulpanit@....com, David.Kaplan@....com,
x86@...nel.org, hpa@...or.com, peterz@...radead.org, seanjc@...gle.com,
pbonzini@...hat.com, kvm@...r.kernel.org, kirill.shutemov@...ux.intel.com,
huibo.wang@....com, naveen.rao@....com
Subject: Re: [RFC v2 01/17] x86/apic: Add new driver for Secure AVIC
On Wed, Feb 26 2025 at 14:35, Neeraj Upadhyay wrote:
> +static void x2apic_savic_send_IPI(int cpu, int vector)
> +{
> + u32 dest = per_cpu(x86_cpu_to_apicid, cpu);
> +
> + /* x2apic MSRs are special and need a special fence: */
> + weak_wrmsr_fence();
> + __x2apic_send_IPI_dest(dest, vector, APIC_DEST_PHYSICAL);
> +}
> +
> +static void
> +__send_IPI_mask(const struct cpumask *mask, int vector, int apic_dest)
> +{
> + unsigned long query_cpu;
> + unsigned long this_cpu;
> + unsigned long flags;
> +
> + /* x2apic MSRs are special and need a special fence: */
> + weak_wrmsr_fence();
> +
> + local_irq_save(flags);
> +
> + this_cpu = smp_processor_id();
> + for_each_cpu(query_cpu, mask) {
> + if (apic_dest == APIC_DEST_ALLBUT && this_cpu == query_cpu)
> + continue;
> + __x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu),
> + vector, APIC_DEST_PHYSICAL);
> + }
> + local_irq_restore(flags);
> +}
> +
> +static void x2apic_savic_send_IPI_mask(const struct cpumask *mask, int vector)
> +{
> + __send_IPI_mask(mask, vector, APIC_DEST_ALLINC);
> +}
> +
> +static void x2apic_savic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
> +{
> + __send_IPI_mask(mask, vector, APIC_DEST_ALLBUT);
> +}
The above are identical copies (aside of the names) of the functions in
x2apic_phys.c.
Why can't this simply share the code ?
Thanks,
tglx
Powered by blists - more mailing lists