lkml.org 
[lkml]   [2022]   [Jul]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2] x86/xen: Add support for HVMOP_set_evtchn_upcall_vector
From

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.


-boris


> + rc = xen_set_callback_via(1);
> +

\
 
 \ /
  Last update: 2022-07-27 01:34    [W:0.081 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site