cpuid code is and has always been isadep
Today, the CPUID code is currently part of i86pc. This doesn't make any sense and really never has: what we're doing here is entirely about the innards of a particular processor and figuring out its various ISA features, not about a machine architecture. Let's move this code to intel/ where it belongs.
While we're here, there are a few bits and pieces we can tidy without doing a lot of extra work:
- There hasn't been any pass 0 for a long time, and the setting of X86FSET_CPUID in locore.s is redundant. We can remove these references to pass 0 from the comments as well.
- Since every supported CPU has the CPUID instruction and we already were setting X86FSET_CPUID unconditionally (twice, even), we should no longer test for this feature. There are a handful of consumers currently doing so, which we can change to assertions.
- In the process, we should remove a few references to ACPI from the comments, since this is now common code and ACPI is a PC feature.
There is in fact a lot more dead code that can be removed, particularly support for processor models and families that never supported 64-bit instructions and on which we therefore can never execute, but that's not included here in generic or i86pc code. Doing this on its own makes it clear how little change there really is here, and avoids confusing git into throwing away the history on these files.
Updated by Robert Mustacchi about 1 month ago
To test this we've done a few different things. While we've used this in the oxide arch, importantly for testing against existing systems (both Intel and AMD). In particular what I went through and took a look at was the following kernel information:
- x86_featureset via mdb -k
::x86_featureset ! cat > feat.out
- isainfo -x
- The main cpuid information, e.g. mdb -k
cpuid_info0::print ! cat > cpuid.out
Here we looked at what changed before and after on two systems:
- An AMD Rome based server
- An Intel Ivy Bridge based server
In both cases the isainfo and feature set did not change. The cpuid structure changed in two ways:
- The number of passes had increased because that was a side effect of this change and how we structured things (particularly with the elimination of pass0) and phrasing things more generally.
- In the AMD case the revision string pointer address had changed, but the actual value of the string was the same.
Updated by Electric Monk about 1 month ago
- Status changed from New to Closed
- % Done changed from 0 to 100
commit ab5bb018eb284290d89d61bbae1913c3ea82b3af Author: Keith M Wesolowski <firstname.lastname@example.org> Date: 2022-08-20T18:04:45.000Z 14834 cpuid code is and has always been isadep 14835 split cpuid pass1 Reviewed by: Robert Mustacchi <email@example.com> Reviewed by: Andy Fiddaman <firstname.lastname@example.org> Approved by: Garrett D'Amore <email@example.com>