[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 2/4] x86/HVM: fix ID handling of x2APIC emulation



>>> On 18.09.14 at 16:44, <JBeulich@xxxxxxxx> wrote:
> @@ -1227,6 +1229,22 @@ static int lapic_save_regs(struct domain
>      return rc;
>  }
>  
> +/*
> + * Following lapic_load_hidden()/lapic_load_regs() we may need to
> + * correct ID and LDR when they come from an old, broken hypervisor.
> + */
> +static void lapic_load_fixup(struct vlapic *vlapic)
> +{
> +     uint32_t id = vlapic->loaded.id;
> +
> +     if ( vlapic_x2apic_mode(vlapic) &&
> +          id && vlapic->loaded.ldr == 1 &&
> +          /* Further checks are optional: ID != 0 contradicts LDR == 1. */
> +          GET_xAPIC_ID(id) == vlapic_vcpu(vlapic)->vcpu_id * 2 &&
> +          id == SET_xAPIC_ID(GET_xAPIC_ID(id)) )
> +         set_x2apic_id(vlapic);

+    else /* Undo an eventual earlier fixup. */
+    {
+        vlapic_set_reg(vlapic, APIC_ID, id);
+        vlapic_set_reg(vlapic, APIC_LDR, vlapic->loaded.ldr);
+    }

> +}

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.