diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c index c7a75afd2b9a..4d663cab4f48 100644 --- a/arch/x86/kernel/cpu/microcode/intel.c +++ b/arch/x86/kernel/cpu/microcode/intel.c @@ -12,16 +12,16 @@ */ #define pr_fmt(fmt) "microcode: " fmt #include +#include #include #include #include +#include #include #include #include #include #include -#include -#include #include #include @@ -36,7 +36,6 @@ static const char ucode_path[] = "kernel/x86/microcode/GenuineIntel.bin"; #define UCODE_BSP_LOADED ((struct microcode_intel *)0x1UL) /* Defines for the microcode staging mailbox interface */ - #define MBOX_REG_NUM 4 #define MBOX_REG_SIZE sizeof(u32) @@ -344,24 +343,18 @@ static void init_stage(struct staging_state *ss) writel(MASK_MBOX_CTRL_ABORT, ss->mmio_base + MBOX_CONTROL_OFFSET); } -/* - * Return PAGE_SIZE, or remaining bytes if this is the final chunk - */ -static inline unsigned int calc_next_chunk_size(unsigned int ucode_len, unsigned int offset) -{ - return min(PAGE_SIZE, ucode_len - offset); -} - /* * Update the chunk size and decide whether another chunk can be sent. * This accounts for remaining data and retry limits. */ static bool can_send_next_chunk(struct staging_state *ss, int *err) { - ss->chunk_size = calc_next_chunk_size(ss->ucode_len, ss->offset); + /* a page size or remaining bytes if this is the final chunk */ + ss->chunk_size = min(PAGE_SIZE, ss->ucode_len - ss->offset); + /* * Each microcode image is divided into chunks, each at most - * one page size. A 10-chunk image would typically require 10 + * one page size. A 10-chunk image would typically require 10 * transactions. * * However, the hardware managing the mailbox has limited