|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 3/8] evtchn: rename and adjust guest_enabled_event()
On Tue, Oct 20, 2020 at 04:09:16PM +0200, Jan Beulich wrote:
> The function isn't about an "event" in general, but about a vIRQ. The
> function also failed to honor global vIRQ-s, instead assuming the caller
> would pass vCPU 0 in such a case.
>
> While at it also adjust the
> - types the function uses,
> - single user to make use of domain_vcpu().
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> v2: New.
>
> --- a/xen/arch/x86/cpu/mcheck/vmce.h
> +++ b/xen/arch/x86/cpu/mcheck/vmce.h
> @@ -5,9 +5,9 @@
>
> int vmce_init(struct cpuinfo_x86 *c);
>
> -#define dom0_vmce_enabled() (hardware_domain && hardware_domain->max_vcpus \
> - && hardware_domain->vcpu[0] \
> - && guest_enabled_event(hardware_domain->vcpu[0], VIRQ_MCA))
> +#define dom0_vmce_enabled() \
> + (hardware_domain && \
> + evtchn_virq_enabled(domain_vcpu(hardware_domain, 0), VIRQ_MCA))
>
> int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn);
>
> --- a/xen/common/event_channel.c
> +++ b/xen/common/event_channel.c
> @@ -778,9 +778,15 @@ out:
> return ret;
> }
>
> -int guest_enabled_event(struct vcpu *v, uint32_t virq)
> +bool evtchn_virq_enabled(const struct vcpu *v, unsigned int virq)
> {
> - return ((v != NULL) && (v->virq_to_evtchn[virq] != 0));
> + if ( !v )
Not sure it's worth adding a check that virq < NR_VIRQS here just to
be on the safe side...
> + return false;
> +
> + if ( virq_is_global(virq) && v->vcpu_id )
...as virq_is_global has an ASSERT to that extend (but that would be a
nop on release builds).
Thanks, Roger.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |