+ if (level_type != 2 || !x2apic_mode) {
+ avic_host_physical_id_mask = 0xffULL;
+ goto out;
+ }
+
+ core_mask_width = eax & 0xF;
+
+ max_phys_mask_width = get_count_order(apic_get_max_phys_apicid());
+
+ /*
+ * Sanity check to ensure core_mask_width for a processor does not
+ * exceed the calculated mask.
+ */
+ if (WARN_ON(core_mask_width > max_phys_mask_width))
+ return -EINVAL;