Re: [PATCH v2] x86/xen: Add support for HVMOP_set_evtchn_upcall_vector

From: Jane Malalane
Date: Wed Jul 27 2022 - 11:42:55 EST


On 27/07/2022 00:31, Boris Ostrovsky wrote:
> [CAUTION - EXTERNAL EMAIL] DO NOT reply, click links, or open
> attachments unless you have verified the sender and know the content is
> safe.
>
> On 7/26/22 8:56 AM, Jane Malalane wrote:
>> +/* Setup per-vCPU vector-type callbacks and trick toolstack to think
>> + * we are enlightened. If this setup is unavailable, fallback to the
>> + * global vector-type callback. */
>
>
> Comment style.
>
>
>> +static __init void xen_init_setup_upcall_vector(void)
>> +{
>> +    unsigned int cpu = 0;
>
>
> Unnecessary variable.
>
>
>> +
>> +    if (!xen_have_vector_callback)
>> +        return;
>> +
>> +    if ((cpuid_eax(xen_cpuid_base() + 4) &
>> XEN_HVM_CPUID_UPCALL_VECTOR) &&
>> +        !xen_set_upcall_vector(cpu) && !xen_set_callback_via(1))
>> +        xen_percpu_upcall = true;
>> +    else if (xen_feature(XENFEAT_hvm_callback_vector))
>> +        xen_setup_callback_vector();
>> +    else
>> +        xen_have_vector_callback = false;
>> +}
>> +
>> +int xen_set_upcall_vector(unsigned int cpu)
>> +{
>> +    int rc;
>> +    xen_hvm_evtchn_upcall_vector_t op = {
>> +        .vector = HYPERVISOR_CALLBACK_VECTOR,
>> +        .vcpu = per_cpu(xen_vcpu_id, cpu),
>> +    };
>> +
>> +    rc = HYPERVISOR_hvm_op(HVMOP_set_evtchn_upcall_vector, &op);
>> +    if (rc)
>> +        return rc;
>> +
>> +    if (!cpu)
>
>
> A comment (e.g. "Let toolstack know that we are enlightened." or
> something along these lines) would be useful here.
>Thanks, will include all these changes in a v3.

Jane.