Messages in this thread | | | Date | Tue, 26 Jul 2022 19:31:33 -0400 | Subject | Re: [PATCH v2] x86/xen: Add support for HVMOP_set_evtchn_upcall_vector | From | Boris Ostrovsky <> |
| |
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); > +
| |