From patchwork Wed Oct 31 17:03:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Maciej Nowak X-Patchwork-Id: 991556 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=o2.pl Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sI4gmMZc"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42lZT72hkMz9s3T for ; Thu, 1 Nov 2018 04:04:59 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=13B6/Ho9paUVgKih4XSe2f3uIeh77mtcTY5n+Jt/uF8=; b=sI4gmMZcGuePnb J4ke/PH32TXwBQwbwZUKde7FYJIIJgAUXE56Erv3C1gGMNpWyJkGSHvhUxXV4PEGURtWCjsSa15/Y bQRN99ByZFHfy0nanQYCHhLfJwERV5TyQq7r7gulP7qAe4LI7Ox83NqVoE3Z/wQt3dBUVxoZqj0P9 23hjf9qTblMIBFS+mAFjlr/ec7/PX68UBU/9Q/TCEeCWeQUJfMoeWYF+tpWQpFNFmODtKGpRi9lqo W4ijVbXgXqRLp8nwViIH3v0n74D7lbCNFpKvf5gKtMP3LdfDAXYMDVnrNg1oVLJ4j3OrBEvSxn6nM R4sSZvCRO+UCpd4595wA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHtvJ-00028p-Ck; Wed, 31 Oct 2018 17:04:53 +0000 Received: from mx-out.tlen.pl ([193.222.135.148]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHtuS-0000x8-4Q for openwrt-devel@lists.openwrt.org; Wed, 31 Oct 2018 17:04:07 +0000 Received: (wp-smtpd smtp.tlen.pl 31229 invoked from network); 31 Oct 2018 18:03:49 +0100 Received: from 131.ip-164-132-48.eu (HELO vaio-vpcz1.localdomain) (tomek_n@o2.pl@[164.132.48.131]) (envelope-sender ) by smtp.tlen.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 31 Oct 2018 18:03:49 +0100 From: Tomasz Maciej Nowak To: openwrt-devel@lists.openwrt.org Date: Wed, 31 Oct 2018 18:03:01 +0100 Message-Id: <20181031170301.6936-6-tomek_n@o2.pl> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181031170301.6936-1-tomek_n@o2.pl> References: <20181031170301.6936-1-tomek_n@o2.pl> MIME-Version: 1.0 X-WP-MailID: 012cb2267028e2a1231ce5527443c19f X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 0000000 [MUNF] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181031_100400_376113_AFCB4357 X-CRM114-Status: UNSURE ( 6.90 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [193.222.135.148 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [193.222.135.148 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (tomek_n[at]o2.pl) Subject: [OpenWrt-Devel] [PATCH v3 5/6] x86: add intel microcode entries to grub config X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomasz Maciej Nowak Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Create initrd enries for x86 images, that'll load intel microcode as early as possible. To achieve that the test module for grub is enabled which provides shell-like conditionals. Also restrict the late load of microcode to AMD processors. Signed-off-by: Tomasz Maciej Nowak --- target/linux/x86/base-files/lib/preinit/02_load_x86_ucode | 6 ++++-- target/linux/x86/image/Makefile | 4 ++-- target/linux/x86/image/grub-iso.cfg | 3 +++ target/linux/x86/image/grub.cfg | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode index fb309c75c1..d3a23e24b2 100644 --- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode +++ b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode @@ -2,8 +2,10 @@ # Copyright (C) 2018 OpenWrt.org do_load_x86_ucode() { - if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then - echo 1 > /sys/devices/system/cpu/microcode/reload + if grep -q AuthenticAMD /proc/cpuinfo; then + if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then + echo 1 > /sys/devices/system/cpu/microcode/reload + fi fi } diff --git a/target/linux/x86/image/Makefile b/target/linux/x86/image/Makefile index 310a143e13..036523e075 100644 --- a/target/linux/x86/image/Makefile +++ b/target/linux/x86/image/Makefile @@ -9,8 +9,8 @@ include $(INCLUDE_DIR)/image.mk export PATH=$(TARGET_PATH):/sbin -GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial vga -GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial vga +GRUB2_MODULES = biosdisk boot chain configfile ext2 linux ls part_msdos reboot serial test vga +GRUB2_MODULES_ISO = biosdisk boot chain configfile iso9660 linux ls part_msdos reboot serial test vga GRUB_TERMINALS = GRUB_SERIAL_CONFIG = GRUB_TERMINAL_CONFIG = diff --git a/target/linux/x86/image/grub-iso.cfg b/target/linux/x86/image/grub-iso.cfg index 9c59bdf6d4..5d128aa3aa 100644 --- a/target/linux/x86/image/grub-iso.cfg +++ b/target/linux/x86/image/grub-iso.cfg @@ -7,4 +7,7 @@ set root='(cd)' menuentry "@TITLE@" { linux /boot/vmlinuz @CMDLINE@ noinitrd + if [ -s /boot/intel-ucode.img ]; then + initrd /boot/intel-ucode.img + fi } diff --git a/target/linux/x86/image/grub.cfg b/target/linux/x86/image/grub.cfg index dedfa0a636..a665686863 100644 --- a/target/linux/x86/image/grub.cfg +++ b/target/linux/x86/image/grub.cfg @@ -7,6 +7,9 @@ set root='(@ROOT@)' menuentry "@TITLE@" { linux /boot/vmlinuz @CMDLINE@ noinitrd + if [ -s /boot/intel-ucode.img ]; then + initrd /boot/intel-ucode.img + fi } menuentry "@TITLE@ (failsafe)" { linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd