The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: sonofagun@openmailbox.org, Nikos Barkas <levelwol@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/AMD: Apply erratum 688 on machines without a BIOS fix
Date: Wed, 19 Oct 2016 17:00:56 +0200	[thread overview]
Message-ID: <20161019150056.sdhp2nilc5oaqyis@pd.tnic> (raw)
In-Reply-To: <b4ad7273efbb0c60a6c93ae68f82a44e@openmailbox.org>

On Wed, Oct 19, 2016 at 04:58:08PM +0300, sonofagun@openmailbox.org wrote:
> 
> AMD F14h machines have an erratum which can cause unpredictable program
> behaviour under specific branch conditions. The workaround is to set
> MSRC001_1021[14] and MSRC001_1021[3]. Both bits are reserved for this MSR,
> so we trust AMD suggestions. Since there is no BIOS update containing that
> workaround for some machines, we do it ourselves unconditionally on this
> family too. Our Compaq CQ57 laptop which has broken firmware in various
> areas does not contain both workarounds(MSRc0011021: 0000000010208000)...

...

> +#define MSR_AMD64_IC_CFG	0xC0011021
> +
> +static void init_amd_on(struct cpuinfo_x86 *c)
> +{
> +	/*
> +	 * Apply erratum 688 fix unconditionally so machines without a BIOS
> +	 * fix work.
> +	 */
> +	msr_set_bit(MSR_AMD64_IC_CFG, 3);
> +	msr_set_bit(MSR_AMD64_IC_CFG, 14);
> +}

You can't force this unconditionally. Look at the suggested workaround:

"BIOS should set MSRC001_1021[14] = 1b and MSRC001_1021[3] = 1b. This
workaround is required only when bit 2 of Fixed Errata Status Register
(D18F4x164[2]) = 0b."

So you need to do something like this:

	if (c->x86_model == 2 && c->x86_mask == 0) {
		u32 val = pci_read_config(0, 0x18, 0x4, 0x164);

		if (!(val & BIT(2))) {
			msr_set_bit(MSR_AMD64_IC_CFG, 3);
			msr_set_bit(MSR_AMD64_IC_CFG, 14);
		}
	}

Also, please paste /proc/cpuinfo from that machine.

Then, keep that *whole* changelog above when sending v2 of the patch - I like
the level of detail of your explanation! ;-)

Thanks.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

  reply	other threads:[~2016-10-19 15:01 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 13:58 [PATCH] x86/AMD: Apply erratum 688 on machines without a BIOS fix sonofagun
2016-10-19 15:00 ` Borislav Petkov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-10-21 16:19 sonofagun
2016-10-21 16:47 ` Borislav Petkov
2016-10-21 21:51   ` sonofagun
2016-10-21 23:01     ` Borislav Petkov
2016-10-22 11:16       ` sonofagun
2016-10-22 14:12         ` Borislav Petkov
2016-10-23  9:39           ` sonofagun
2016-10-23  9:57             ` Borislav Petkov
2016-10-23 17:06               ` sonofagun
2016-10-23 17:25                 ` Borislav Petkov
2016-10-23 21:02                   ` sonofagun
2016-10-23 21:39                     ` Borislav Petkov
2016-10-24 11:38                       ` sonofagun
2016-10-24  9:35                         ` Borislav Petkov
2016-10-24 13:13                           ` sonofagun
2016-10-24 17:14                             ` Borislav Petkov
2016-10-24 20:39                               ` sonofagun
2016-10-25  9:29                                 ` Borislav Petkov
2016-10-25 13:16                                   ` sonofagun
2016-10-28 16:21                               ` Borislav Petkov
2016-10-31 21:54                                 ` sonofagun
2016-10-31 22:59                                   ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161019150056.sdhp2nilc5oaqyis@pd.tnic \
    --to=bp@alien8.de \
    --cc=levelwol@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sonofagun@openmailbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox