Please skip this version, the report is right: the helper applied the xAPIC shift and mask unconditionally, so it returned 0 for a vCPU in x2APIC mode on a VM that enabled KVM_X2APIC_API_USE_32BIT_IDS, and truncated IDs above 255.
v3 handles both modes and I checked it against every way KVM reports an ID, including a vCPU with ID 300 and a guest that renames its own xAPIC ID: https://lore.kernel.org/all/[email protected] Hemanth

