aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/microcode/amd.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2018-03-23 11:24:57 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-23 11:31:58 -0400
commit03fe2debbb2771fb90881e4ce8109b09cf772a5c (patch)
treefbaf8738296b2e9dcba81c6daef2d515b6c4948c /arch/x86/kernel/cpu/microcode/amd.c
parent6686c459e1449a3ee5f3fd313b0a559ace7a700e (diff)
parentf36b7534b83357cf52e747905de6d65b4f7c2512 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Fun set of conflict resolutions here... For the mac80211 stuff, these were fortunately just parallel adds. Trivially resolved. In drivers/net/phy/phy.c we had a bug fix in 'net' that moved the function phy_disable_interrupts() earlier in the file, whilst in 'net-next' the phy_error() call from this function was removed. In net/ipv4/xfrm4_policy.c, David Ahern's changes to remove the 'rt_table_id' member of rtable collided with a bug fix in 'net' that added a new struct member "rt_mtu_locked" which needs to be copied over here. The mlxsw driver conflict consisted of net-next separating the span code and definitions into separate files, whilst a 'net' bug fix made some changes to that moved code. The mlx5 infiniband conflict resolution was quite non-trivial, the RDMA tree's merge commit was used as a guide here, and here are their notes: ==================== Due to bug fixes found by the syzkaller bot and taken into the for-rc branch after development for the 4.17 merge window had already started being taken into the for-next branch, there were fairly non-trivial merge issues that would need to be resolved between the for-rc branch and the for-next branch. This merge resolves those conflicts and provides a unified base upon which ongoing development for 4.17 can be based. Conflicts: drivers/infiniband/hw/mlx5/main.c - Commit 42cea83f9524 (IB/mlx5: Fix cleanup order on unload) added to for-rc and commit b5ca15ad7e61 (IB/mlx5: Add proper representors support) add as part of the devel cycle both needed to modify the init/de-init functions used by mlx5. To support the new representors, the new functions added by the cleanup patch needed to be made non-static, and the init/de-init list added by the representors patch needed to be modified to match the init/de-init list changes made by the cleanup patch. Updates: drivers/infiniband/hw/mlx5/mlx5_ib.h - Update function prototypes added by representors patch to reflect new function names as changed by cleanup patch drivers/infiniband/hw/mlx5/ib_rep.c - Update init/de-init stage list to match new order from cleanup patch ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/x86/kernel/cpu/microcode/amd.c')
-rw-r--r--arch/x86/kernel/cpu/microcode/amd.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index a998e1a7d46f..48179928ff38 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -339,7 +339,7 @@ int __init save_microcode_in_initrd_amd(unsigned int cpuid_1_eax)
339 return -EINVAL; 339 return -EINVAL;
340 340
341 ret = load_microcode_amd(true, x86_family(cpuid_1_eax), desc.data, desc.size); 341 ret = load_microcode_amd(true, x86_family(cpuid_1_eax), desc.data, desc.size);
342 if (ret != UCODE_OK) 342 if (ret > UCODE_UPDATED)
343 return -EINVAL; 343 return -EINVAL;
344 344
345 return 0; 345 return 0;
@@ -683,27 +683,35 @@ static enum ucode_state __load_microcode_amd(u8 family, const u8 *data,
683static enum ucode_state 683static enum ucode_state
684load_microcode_amd(bool save, u8 family, const u8 *data, size_t size) 684load_microcode_amd(bool save, u8 family, const u8 *data, size_t size)
685{ 685{
686 struct ucode_patch *p;
686 enum ucode_state ret; 687 enum ucode_state ret;
687 688
688 /* free old equiv table */ 689 /* free old equiv table */
689 free_equiv_cpu_table(); 690 free_equiv_cpu_table();
690 691
691 ret = __load_microcode_amd(family, data, size); 692 ret = __load_microcode_amd(family, data, size);
692 693 if (ret != UCODE_OK) {
693 if (ret != UCODE_OK)
694 cleanup(); 694 cleanup();
695 return ret;
696 }
695 697
696#ifdef CONFIG_X86_32 698 p = find_patch(0);
697 /* save BSP's matching patch for early load */ 699 if (!p) {
698 if (save) { 700 return ret;
699 struct ucode_patch *p = find_patch(0); 701 } else {
700 if (p) { 702 if (boot_cpu_data.microcode == p->patch_id)
701 memset(amd_ucode_patch, 0, PATCH_MAX_SIZE); 703 return ret;
702 memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), 704
703 PATCH_MAX_SIZE)); 705 ret = UCODE_NEW;
704 }
705 } 706 }
706#endif 707
708 /* save BSP's matching patch for early load */
709 if (!save)
710 return ret;
711
712 memset(amd_ucode_patch, 0, PATCH_MAX_SIZE);
713 memcpy(amd_ucode_patch, p->data, min_t(u32, ksize(p->data), PATCH_MAX_SIZE));
714
707 return ret; 715 return ret;
708} 716}
709 717