[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/2] x86/efi: Simplify efi_arch_cpu() a little
On 24.07.2024 15:28, Alejandro Vallejo wrote: > On Wed Jul 24, 2024 at 6:42 AM BST, Jan Beulich wrote: >> On 23.07.2024 15:47, Alejandro Vallejo wrote: >>> On Mon Jul 22, 2024 at 11:18 AM BST, Andrew Cooper wrote: >>>> + if ( (eax >> 16) != 0x8000 || eax < 0x80000000U ) >>>> + blexit(L"In 64bit mode, but no extended CPUID leaves?!?"); >>> >>> I'm not sure about the condition even for the old code. If eax had >>> 0x90000000 >>> (because new convention appeared 10y in the future), then there would be >>> extended leaves but we would be needlessly bailing out. Why not simply check >>> that eax < 0x80000001 in here? >> >> eax = 0x90000000 is in leaf group 0x9000, not in the extended leaf group >> (0x8000). The splitting into groups may not be written down very well, >> but you can see the pattern in e.g. groups 0x8086 and 0xc000 also being >> used (by non-Intel non-AMD hardware), without those really being extended >> leaves in the sense that 0x8000xxxx are. >> >> Jan > > The code is checking for a number specifically in the extended group, but > that's the output of leaf 0x80000000 which is defined to be just that. > > AMD: "The value returned in EAX provides the largest extended function number > supported by the processor" > > Intel: "Maximum Input Value for Extended Function CPUID Information." > > Unless there are quirks I don't know about (I admit it's not unlikely) I just > don't see why this condition needs to be anything else than a check that the > maximum function number is bigger than any of the leaves we read further > ahead. > > If the number happens to start with 8000, that'd be fine; but there's no > reason > to bail out if it was 8001. How do you know? We'll learn once someone starts populating that leaf group. It _may_ be the continuation of extended leaves then (once the other 64k were all consumed, i.e. in perhaps hundreds of years). Just take again the case where the 8086 groups is populated: What if there [80000000].eax = 8086yyyy? That'll be wrong, as 8086 forms its own group. So no, I'm similarly unaware of quirks, but with this we're trying to guard ourselves against some entirely bogus output (from all we know today). Jan
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |