On Mon, Dec 13, 2021, Suravee Suthikulpanit wrote:
The AVIC physical APIC ID table entry contains the host physical
APIC ID field, which the hardware uses to keep track of where each
vCPU is running. Originally, the field is an 8-bit value, which can
only support physical APIC ID up to 255.
To support system with larger APIC ID, the AVIC hardware extends
this field to support up to the largest possible physical APIC ID
available on the system.
Therefore, replace the hard-coded mask value with the value
calculated from the maximum possible physical APIC ID in the system.
...
+static void avic_init_host_physical_apicid_mask(void)
+{
+ if (!x2apic_mode) {
+ /* If host is in xAPIC mode, default to only 8-bit mask. */
+ avic_host_physical_id_mask = 0xffULL;
Use GENMASK(7:0) instead of open coding the equivalent. Oh, and
avic_host_physical_id_mask doesn't need to be a u64, it's hard capped at 12 bits
and so can be a simple int.