|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 30/39] xen/riscv: prepare new IMSIC VS-file
On 21.09.2026 18:15, Baptiste Le Duc wrote:
> On 8/27/26 5:24 PM, Oleksii Kurochko wrote:
>> @@ -389,6 +448,76 @@ int cf_check vcpu_imsic_init(struct vcpu *v)
>> return 0;
>> }
>>
>> +/*
>> + * Arguments of the imsic_vsfile_local_*() helpers, which are executed by
>> the
>> + * pCPU owning the interrupt file, thereby through imsic_call_on_cpu().
>> + */
>> +struct imsic_vsfile_data {
>> + unsigned int hgei;
>> + unsigned int nr_eix;
>> + struct imsic_mrif *mrif;
>> +};
>> +
>> +/*
>> + * Execute func() on the pCPU which owns the IMSIC interrupt file func() is
>> + * going to work with.
>> + *
>> + * An IMSIC VS-file is reachable only through hstatus.VGEIN of the hart the
>> + * file belongs to, and a guest interrupt file index is meaningless on any
>> + * other hart, so such work always has to be done by that very hart.
>> + *
>> + * The local case runs with IRQs disabled to provide func() with the same
>> + * environment it is given when it is called from the function call IPI
>> + * handler.
>> + */
>> +static void imsic_call_on_cpu(unsigned int cpu, void (*func)(void *),
>> + void *data)
>> +{
>> + if ( cpu == smp_processor_id() )
>> + {
>> + unsigned long flags;
>> +
>> + local_irq_save(flags);
>> + func(data);
>> + local_irq_restore(flags);
>> + }
>> + else
>> + on_selected_cpus(cpumask_of(cpu), func, data, 1);
>> +}
>> +
>> +static void cf_check imsic_vsfile_local_clear(void *data)
> I think the remark from Jan to direclty pass the type instead of void
> could be applied here.
No, the function pointer is passed to ...
>> @@ -699,5 +836,27 @@ void imsic_migrate_vcpu(struct vcpu *v)
>> if ( v->arch.last_cpu == NR_CPUS )
>> return;
>>
>> + /*
>> + * At this point, all interrupt producers are still using the old IMSIC
>> + * VS-file.
>> + */
>> +
>> + /*
>> + * Latch the pCPU the new interrupt file is taken from: vgein_assign()
>> + * allocates it from v->processor's pool of guest interrupt files, and
>> + * only that hart can access the file afterwards.
>> + */
>> + new_vsfile_cpu = v->processor;
>> +
>> + new_vsfile_hgei = vgein_assign(v);
>> +
>> + /* We don't support SW interrupt files at the moment. */
>> + BUG_ON(!new_vsfile_hgei);
>> +
>> + vsfile_data.hgei = new_vsfile_hgei;
>> +
>> + /* Zero-out new IMSIC VS-file */
>> + imsic_call_on_cpu(new_vsfile_cpu, imsic_vsfile_local_clear,
>> &vsfile_data);
... imsic_call_on_cpu() here, which in turn passes it to on_selected_cpus().
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |