Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1560866
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 05/13] x86/microcode/AMD: Extend the container struct |
| Date | 2017-01-17 18:50 +0100 |
| Message-ID | <t0G3o-1zz-41@gated-at.bofh.it> (permalink) |
| References | <t0FTI-1vq-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Borislav Petkov <bp@suse.de>
Make it into a container descriptor which is being passed around and
stores important info like the matching container and the patch for the
current CPU.
Later patches will use this and thus get rid of a double container
parsing.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/cpu/microcode/amd.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index ef36b613db62..7073588a2a09 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -42,9 +42,13 @@ static struct equiv_cpu_entry *equiv_cpu_table;
/*
* This points to the current valid container of microcode patches which we will
- * save from the initrd/builtin before jettisoning its contents.
+ * save from the initrd/builtin before jettisoning its contents. @mc is the
+ * microcode patch we found to match.
*/
-struct container {
+struct cont_desc {
+ struct microcode_amd *mc;
+ u32 psize;
+ u16 eq_id;
u8 *data;
size_t size;
} cont;
@@ -119,9 +123,9 @@ static u16 find_equiv_id(struct equiv_cpu_entry *equiv_table, u32 sig)
* table or 0 if none found.
*/
static u16
-find_proper_container(u8 *ucode, size_t size, struct container *ret_cont)
+find_proper_container(u8 *ucode, size_t size, struct cont_desc *desc)
{
- struct container ret = { NULL, 0 };
+ struct cont_desc ret = { 0 };
u32 eax, ebx, ecx, edx;
struct equiv_cpu_entry *eq;
int offset, left;
@@ -164,7 +168,7 @@ find_proper_container(u8 *ucode, size_t size, struct container *ret_cont)
*/
left = ret.size - offset;
- *ret_cont = ret;
+ *desc = ret;
return eq_id;
}
@@ -219,11 +223,11 @@ static int __apply_microcode_amd(struct microcode_amd *mc)
* Returns true if container found (sets @ret_cont), false otherwise.
*/
static bool apply_microcode_early_amd(void *ucode, size_t size, bool save_patch,
- struct container *ret_cont)
+ struct cont_desc *desc)
{
u8 (*patch)[PATCH_MAX_SIZE];
u32 rev, *header, *new_rev;
- struct container ret;
+ struct cont_desc ret;
int offset, left;
u16 eq_id = 0;
u8 *data;
@@ -276,8 +280,8 @@ static bool apply_microcode_early_amd(void *ucode, size_t size, bool save_patch,
left -= offset;
}
- if (ret_cont)
- *ret_cont = ret;
+ if (desc)
+ *desc = ret;
return true;
}
--
2.11.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/13] x86/microcode: 4.11 queue Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
[PATCH 12/13] x86/microcode/AMD: Simplify saving from initrd Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
Re: [PATCH 12/13] x86/microcode/AMD: Simplify saving from initrd Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 22:20 +0100
[PATCH 11/13] x86/microcode/AMD: Unify load_ucode_amd_ap() Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
Re: [PATCH 11/13] x86/microcode/AMD: Unify load_ucode_amd_ap() Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 22:00 +0100
Re: [PATCH 11/13] x86/microcode/AMD: Unify load_ucode_amd_ap() Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 22:20 +0100
[PATCH 05/13] x86/microcode/AMD: Extend the container struct Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
Re: [PATCH 05/13] x86/microcode/AMD: Extend the container struct Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 21:50 +0100
[PATCH 09/13] x86/microcode/AMD: Use find_microcode_in_initrd() Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
Re: [PATCH 09/13] x86/microcode/AMD: Use find_microcode_in_initrd() Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 22:20 +0100
[PATCH 04/13] x86/microcode/AMD: Shorten function parameter's name Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
Re: [PATCH 04/13] x86/microcode/AMD: Shorten function parameter's name Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 21:10 +0100
[PATCH 10/13] x86/microcode/AMD: Check patch level only on the BSP Borislav Petkov <bp@alien8.de> - 2017-01-17 18:50 +0100
Re: [PATCH 10/13] x86/microcode/AMD: Check patch level only on the BSP Thomas Gleixner <tglx@linutronix.de> - 2017-01-17 21:50 +0100
csiph-web