From patchwork Sun Dec 28 02:20:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 424285 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id F13BC1400D5 for ; Sun, 28 Dec 2014 13:23:22 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3FCC14B725; Sun, 28 Dec 2014 03:22:45 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MR9P-OocWCPH; Sun, 28 Dec 2014 03:22:45 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A4E764B729; Sun, 28 Dec 2014 03:21:54 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5718F4B69D for ; Sun, 28 Dec 2014 03:21:26 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 271aN9hJ6g-d for ; Sun, 28 Dec 2014 03:21:26 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-vc0-f201.google.com (mail-vc0-f201.google.com [209.85.220.201]) by theia.denx.de (Postfix) with ESMTPS id 4ACB64B69E for ; Sun, 28 Dec 2014 03:21:20 +0100 (CET) Received: by mail-vc0-f201.google.com with SMTP id hq11so572799vcb.2 for ; Sat, 27 Dec 2014 18:21:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5S6mAkyU9bgos8WQo2/8smTB4BWX/98nBkr34ooKmXU=; b=W+3/aGEoevRPY/MYZOy1juHOGE4LD10Ws/+2BxrHm/FBvd1BjKKx4CXeT3MSn0AWXD GG6B/arTmxuIucoXUjDrqWOnhTkjdWI64C7809KnnjBkM05dU8vf7gd9WEduGT00/tLz 3IhhFUhuz7DOuI0k147G/QSdt1UnxnziYOn0bR2E8G3AwEuHIdZEqOACjtrF+7vuIS5E YPD3lpbmRrTHhgBjyuqDbpy1bk9PeV+0UrhVBvjhgNmn8BjS9kiS8jN4ovaBtBK4cPoP IPhS1oEAQvfDqt1ciQVTaIl0P7li4AVdI2XNQk3D/FuR/8RHFd776B5YhQwDdRkm1YQz k8bg== X-Gm-Message-State: ALoCoQnvOorgBqhlb1yXY+MtZjIzunylA/ETto1Gvj/MU9FjqjFazxoeDDaALqiqhfnFL/5eeP4q X-Received: by 10.236.23.230 with SMTP id v66mr38665311yhv.42.1419733278793; Sat, 27 Dec 2014 18:21:18 -0800 (PST) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id u27si1529561yhu.4.2014.12.27.18.21.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Dec 2014 18:21:18 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id 7iefTs0x.2; Sat, 27 Dec 2014 18:21:18 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 3E5A8221583; Sat, 27 Dec 2014 19:21:18 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Sat, 27 Dec 2014 19:20:45 -0700 Message-Id: <1419733246-5612-22-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1419733246-5612-1-git-send-email-sjg@chromium.org> References: <1419733246-5612-1-git-send-email-sjg@chromium.org> Cc: Graeme Russ Subject: [U-Boot] [PATCH 21/22] x86: ivybridge: Update microcode early in boot X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.13 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de At present the normal update (which happens much later) does not work. This seems to have something to do with the 'no eviction' mode in the CAR, or at least moving the microcode update after that causes it not to work. For now, do an update early on so that it definitely works. Also refuse to continue unless the microcode update check (later in boot) is successful. Signed-off-by: Simon Glass --- arch/x86/cpu/ivybridge/car.S | 14 ++++++++++++++ arch/x86/cpu/ivybridge/cpu.c | 2 +- arch/x86/cpu/ivybridge/microcode_intel.c | 9 +++++++-- arch/x86/dts/link.dts | 3 --- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/arch/x86/cpu/ivybridge/car.S b/arch/x86/cpu/ivybridge/car.S index 6e7e1e4..95da087 100644 --- a/arch/x86/cpu/ivybridge/car.S +++ b/arch/x86/cpu/ivybridge/car.S @@ -45,6 +45,14 @@ car_init: movl $0xFEE00300, %esi movl %eax, (%esi) + /* TODO: Load microcode later - the 'no eviction' mode breaks this */ + movl $0x79, %ecx + xorl %edx, %edx + movl $_dt_ucode_base_size, %eax + movl (%eax), %eax + addl $0x30, %eax + wrmsr + post_code(POST_CAR_SIPI) /* Zero out all fixed range and variable range MTRRs */ movl $mtrr_table, %esi @@ -228,3 +236,9 @@ mtrr_table: .word 0x20C, 0x20D, 0x20E, 0x20F .word 0x210, 0x211, 0x212, 0x213 mtrr_table_end: + + .align 4 +_dt_ucode_base_size: + /* These next two fields are filled in by ifdtool */ + .long 0 /* microcode base */ + .long 0 /* microcode size */ diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c index 0543e06..e925310 100644 --- a/arch/x86/cpu/ivybridge/cpu.c +++ b/arch/x86/cpu/ivybridge/cpu.c @@ -263,7 +263,7 @@ int print_cpuinfo(void) enable_lapic(); ret = microcode_update_intel(); - if (ret && ret != -ENOENT && ret != -EEXIST) + if (ret) return ret; /* Enable upper 128bytes of CMOS */ diff --git a/arch/x86/cpu/ivybridge/microcode_intel.c b/arch/x86/cpu/ivybridge/microcode_intel.c index 0817751..c012820 100644 --- a/arch/x86/cpu/ivybridge/microcode_intel.c +++ b/arch/x86/cpu/ivybridge/microcode_intel.c @@ -120,6 +120,7 @@ int microcode_update_intel(void) int count; int node; int ret; + int rev; microcode_read_cpu(&cpu); node = 0; @@ -147,12 +148,16 @@ int microcode_update_intel(void) skipped++; continue; } - ret = microcode_read_rev(); wrmsr(0x79, (ulong)update.data, 0); + rev = microcode_read_rev(); debug("microcode: updated to revision 0x%x date=%04x-%02x-%02x\n", - microcode_read_rev(), update.date_code & 0xffff, + rev, update.date_code & 0xffff, (update.date_code >> 24) & 0xff, (update.date_code >> 16) & 0xff); + if (update.update_revision != rev) { + printf("Microcode update failed\n"); + return -EFAULT; + } count++; } while (1); } diff --git a/arch/x86/dts/link.dts b/arch/x86/dts/link.dts index a739080..1ebc334 100644 --- a/arch/x86/dts/link.dts +++ b/arch/x86/dts/link.dts @@ -214,9 +214,6 @@ microcode { update@0 { -#include "microcode/m12206a7_00000029.dtsi" - }; - update@1 { #include "microcode/m12306a9_0000001b.dtsi" }; };