Each level of CPUID leaf 0Bh or 1Fh reports the shift that addresses
the next level up. Leaf 0Bh has only the SMT and core levels, so the
core level's shift identifies the package. Leaf 1Fh may enumerate
module, tile, die and die group levels above the core level, and then
the core level's shift identifies one of those instead.
topo_probe_intel_0xb() used the core level's shift for the package in
both cases. On a processor that enumerates a module level, every
module became a package, and the L3 cache was cut down to the module
with "WARNING: L3 data cache covers more APIC IDs than a package", so
the scheduler did not see that the modules share it. An Atom x7809C
(Amston Lake), which reports shifts of 1, 3 and 7 for its SMT, core and
module levels, came up as two packages of four cores. The N150 (Twin
Lake) in the PR is affected in the same way.
Use the shift of the last level enumerated for the package. The SDM
describes the package as the unenumerated domain above the last valid
sub-leaf, and no level type marks it. This also covers a leaf that
reports only an SMT level, which used to make every thread a package.
A processor that enumerates a die level is now counted as one package
per socket and not one per die; its dies remain visible through their
caches.
Cross-check what the leaf reports. Ignore a level whose shift is
smaller than that of the level below it. Warn about a level type that
is out of the order the SDM fixes for the types defined so far, or that
leaf 0Bh reserves, but still use its shift, which bounds the package in
any case. Accept a type that leaf 1Fh does not define yet wherever it
appears: the SDM does not order the type values and allows for a new
level between two existing ones.
While here, name the remaining leaf 1Fh level types, and test only
EBX[15:0], the field that is defined, when choosing between leaves 1Fh,
0Bh and 04h.
PR: 297032
Fixes: 6badb512a94d ("Prefer CPUID leaf 1Fh for Intel CPU...")
MFC after: 1 month
Sponsored by: Rubicon Communications, LLC ("Netgate")