From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751580AbdJVNEy (ORCPT ); Sun, 22 Oct 2017 09:04:54 -0400 Received: from merlin.infradead.org ([205.233.59.134]:46058 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbdJVNEw (ORCPT ); Sun, 22 Oct 2017 09:04:52 -0400 Date: Sun, 22 Oct 2017 15:04:29 +0200 From: Peter Zijlstra To: hpa@zytor.com, torvalds@linux-foundation.org, tglx@linutronix.de, mingo@kernel.org, Yazen.Ghannam@amd.com, mirh@protonmail.ch, sherry.hurwitz@amd.com, bp@suse.de, stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-tip-commits@vger.kernel.org Subject: Re: [tip:x86/urgent] x86/cpu/AMD: Apply the Erratum 688 fix when the BIOS doesn't Message-ID: <20171022130429.GA3165@worktop.lehotels.local> References: <20171022104731.28249-1-bp@alien8.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 22, 2017 at 05:16:29AM -0700, tip-bot for Borislav Petkov wrote: > +static void __fix_erratum_688(void *info) > +{ > +#define MSR_AMD64_IC_CFG 0xC0011021 > + > + msr_set_bit(MSR_AMD64_IC_CFG, 3); > + msr_set_bit(MSR_AMD64_IC_CFG, 14); I realize this is an erratum work around, but would it be too much to ask for a small comment explaining the magic values? > +} > + > +/* Apply erratum 688 fix so machines without a BIOS fix work. */ > +static __init void fix_erratum_688(void) > +{ > + struct pci_dev *F4; > + u32 val; > + > + if (boot_cpu_data.x86 != 0x14) > + return; > + > + if (!amd_northbridges.num) > + return; > + > + F4 = node_to_amd_nb(0)->link; > + if (!F4) > + return; > + > + if (pci_read_config_dword(F4, 0x164, &val)) > + return; > + > + if (val & BIT(2)) > + return; > + > + on_each_cpu(__fix_erratum_688, NULL, 0); > + > + pr_info("x86/cpu/AMD: CPU erratum 688 worked around\n"); Except for all CPUs that were not online at this point in time... So suppose I boot with a limited number of CPUs and then later bring up the rest, bad things happen.