[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 4/7] x86/ucode/intel: Reimplement get_{data, total}size() helpers
Every caller actually passes a struct microcode_header_intel. Implement the helpers with proper types, and leave a comment explaining the Pentium Pro/II behaviour with empty {data,total}size fields. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- xen/arch/x86/cpu/microcode/intel.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c index 0cceac6255..dfe44679be 100644 --- a/xen/arch/x86/cpu/microcode/intel.c +++ b/xen/arch/x86/cpu/microcode/intel.c @@ -46,9 +46,16 @@ struct microcode_header_intel { unsigned int sig; unsigned int cksum; unsigned int ldrver; + + /* + * Microcode for the Pentium Pro and II had all further fields in the + * header reserved, had a fixed datasize of 2000 and totalsize of 2048, + * and didn't use platform flags despite the availability of the MSR. + */ + unsigned int pf; - unsigned int datasize; - unsigned int totalsize; + unsigned int _datasize; + unsigned int _totalsize; unsigned int reserved[3]; }; @@ -75,20 +82,21 @@ struct microcode_patch { struct microcode_intel *mc_intel; }; -#define DEFAULT_UCODE_DATASIZE (2000) +#define PPRO_UCODE_DATASIZE 2000 #define MC_HEADER_SIZE (sizeof(struct microcode_header_intel)) -#define DEFAULT_UCODE_TOTALSIZE (DEFAULT_UCODE_DATASIZE + MC_HEADER_SIZE) #define EXT_HEADER_SIZE (sizeof(struct extended_sigtable)) #define EXT_SIGNATURE_SIZE (sizeof(struct extended_signature)) #define DWSIZE (sizeof(u32)) -#define get_totalsize(mc) \ - (((struct microcode_intel *)mc)->hdr.totalsize ? \ - ((struct microcode_intel *)mc)->hdr.totalsize : \ - DEFAULT_UCODE_TOTALSIZE) - -#define get_datasize(mc) \ - (((struct microcode_intel *)mc)->hdr.datasize ? \ - ((struct microcode_intel *)mc)->hdr.datasize : DEFAULT_UCODE_DATASIZE) + +static uint32_t get_datasize(const struct microcode_header_intel *hdr) +{ + return hdr->_datasize ?: PPRO_UCODE_DATASIZE; +} + +static uint32_t get_totalsize(const struct microcode_header_intel *hdr) +{ + return hdr->_totalsize ?: PPRO_UCODE_DATASIZE + MC_HEADER_SIZE; +} #define sigmatch(s1, s2, p1, p2) \ (((s1) == (s2)) && (((p1) & (p2)) || (((p1) == 0) && ((p2) == 0)))) -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |