Re: [PATCH v3 01/17] x86/apic: Add new driver for Secure AVIC

From: Thomas Gleixner
Date: Thu Apr 03 2025 - 07:37:10 EST


On Tue, Apr 01 2025 at 17:06, Neeraj Upadhyay wrote:
> +static void __send_ipi_mask(const struct cpumask *mask, int vector, bool excl_self)
> +{
> + unsigned long query_cpu;
> + unsigned long this_cpu;
> + unsigned long flags;

Just coalesce them into a single line: 'unsigned long a, b;'

> + /* x2apic MSRs are special and need a special fence: */
> + weak_wrmsr_fence();
> +
> + local_irq_save(flags);

guard(irqsave)();

> + this_cpu = smp_processor_id();
> + for_each_cpu(query_cpu, mask) {
> + if (excl_self && 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 int x2apic_savic_probe(void)
> +{
> + if (!cc_platform_has(CC_ATTR_SNP_SECURE_AVIC))
> + return 0;
> +
> + if (!x2apic_mode) {
> + pr_err("Secure AVIC enabled in non x2APIC mode\n");
> + snp_abort();

Why does this return 1?

> + }
> +
> + return 1;
> +}