[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d0835c59-7989-4d41-b63f-82f7da0e6fab@intel.com>
Date: Fri, 30 Jan 2026 15:09:35 -0800
From: Sohil Mehta <sohil.mehta@...el.com>
To: Andrew Cooper <andrew.cooper3@...rix.com>, Dave Hansen
<dave.hansen@...ux.intel.com>
CC: Thomas Gleixner <tglx@...nel.org>, Ingo Molnar <mingo@...hat.com>, "H .
Peter Anvin" <hpa@...or.com>, Peter Zijlstra <peterz@...radead.org>, "Josh
Poimboeuf" <jpoimboe@...nel.org>, Pawan Gupta
<pawan.kumar.gupta@...ux.intel.com>, Dave Hansen <dave.hansen@...el.com>,
Nikolay Borisov <nik.borisov@...e.com>, <linux-kernel@...r.kernel.org>,
Borislav Petkov <bp@...en8.de>, <x86@...nel.org>
Subject: Re: [PATCH v4] scripts/x86/intel: Add a script to update the old
microcode list
On 1/30/2026 2:00 PM, Andrew Cooper wrote:
> On 30/01/2026 7:47 pm, Sohil Mehta wrote:
>> +# Functions to extract family, model, and stepping
>> +def bits(val, bottom, top):
>> + mask = (1 << (top + 1 - bottom)) - 1
>> + mask = mask << bottom
>> + return (val & mask) >> bottom
>
> return (val >> bottom) & mask
>
Yup, that is better. Saves an extra step/line.
>> +# Prepare the microcode entries
>> +ucode_entries = []
>> +for ucode_key in ucode_dict:
>> + rev = ucode_dict[ucode_key]
>> + sig = rev['sig']
>> + ucode_entries.append({
>> + 'family': family(sig),
>> + 'model': model(sig),
>> + 'steppings': 1 << step(sig),
>> + 'platforms': rev['platforms'],
>> + 'rev': rev['rev'],
>> + 'sig': sig
>> + })
>
> This is crying out for a small class, and for the use of set()
>
> Try the attached version, which is rather more pythonic.
Thank you for improving the script. It looks cleaner and "pythonic". It
works for my usage with unique ucode files in a single directory.
Dave probably has a use case where he passes multiple directories to the
script. IIUC, the new version just inserts a unique entry for every FMS
+ pf_mask and skips the repeats. But it doesn't necessarily use the
latest revision for the duplicates. We probably need an equivalent logic
for this:
if existing is not None:
# If the existing one is newer, just move on:
if existing['rev'] > rev['rev']:
continue
Dave, opinion?
Powered by blists - more mailing lists