From patchwork Thu Mar 16 07:51:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 95388 Delivered-To: patch@linaro.org Received: by 10.140.89.134 with SMTP id v6csp699911qgd; Thu, 16 Mar 2017 00:58:49 -0700 (PDT) X-Received: by 10.84.129.195 with SMTP id b61mr10393996plb.83.1489651129449; Thu, 16 Mar 2017 00:58:49 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p17si4502502pgi.218.2017.03.16.00.58.49; Thu, 16 Mar 2017 00:58:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751121AbdCPH6t (ORCPT + 2 others); Thu, 16 Mar 2017 03:58:49 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38281 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbdCPH6s (ORCPT ); Thu, 16 Mar 2017 03:58:48 -0400 Received: by mail-wm0-f47.google.com with SMTP id t189so40639384wmt.1 for ; Thu, 16 Mar 2017 00:58:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=GosBI59dd14uo/koA326reXR0wLDgQUM+R5yquYW4rI=; b=FiyWxIxWKFR9xzWamEKcN5BfdYzQ1RHLiNqV3DaGQkW3cfj0iT7Tz494B8oCawVya9 3G+qQHaLABNoZ9r2PYEoIKL7BzuU0L+uMql6d6MX7chWPJTFXF7wB2lG/IAoxUFI+pgk WGljgm1rNcLJ75dfcC4ANY8iyWrATT1HK8Qt0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=GosBI59dd14uo/koA326reXR0wLDgQUM+R5yquYW4rI=; b=gcO0gRtCv86yBVWmHwpVg6d/R1oZnI/1UYaq2RyB9JKKrySudsb+P8eAbZzw4AFzrj n9gadCLQrzwLqSkevZV85qSI5I/Oc8og8ba+V8AR+MctThK02GiwTRXp0sZkuohCMRjQ 0UEbZdsAcAT9YtCtPPrQS9TCHbrFFBESmu0L+YubABeR3b/qBmAHPci9MYosq8bKpXxu 9qZi0/qErB13CDBtFSqwmxfou1DTqlN6ktVM5FQJfwAzbWbQctKd/I2ob5aMZcEAYU1X DqUFs9kTH0ZsBzwhr4kOsmaCRIAPliCqiz2QbHFgu2qwyPRQG0QzDfme7Fb8tI/TcKrb 7NqA== X-Gm-Message-State: AFeK/H0pyvFQEFODrkGCVI6AJx7KhJh7Xf4E+H+BrjQ+KqHJ7fPdg6By0Whn5LBvjBJ/Fldb X-Received: by 10.28.69.202 with SMTP id l71mr23936378wmi.68.1489650691303; Thu, 16 Mar 2017 00:51:31 -0700 (PDT) Received: from localhost.localdomain ([105.144.205.163]) by smtp.gmail.com with ESMTPSA id z21sm5150631wrz.31.2017.03.16.00.51.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Mar 2017 00:51:30 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk, "Cohen, Eugene" , Ard Biesheuvel Subject: [PATCH] efi/libstub: skip GOP with PIXEL_BLT_ONLY format Date: Thu, 16 Mar 2017 07:51:02 +0000 Message-Id: <1489650662-3598-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: "Cohen, Eugene" The UEFI Specification permits Graphics Output Protocol (GOP) instances without direct framebuffer access. This is indicated in the Mode structure with a PixelFormat enumeration value of PIXEL_BLT_ONLY. Given that the kernel does not know how to drive a Blt() only framebuffer (which is only permitted before ExitBootServices() anyway), we should disregard such framebuffers when looking for a GOP instance that is suitable for use as the boot console. So modify the EFI GOP initialization to not use a PIXEL_BLT_ONLY instance, preventing attempts later in boot to use an invalid screen_info.lfb_base address. Signed-off-by: Eugene Cohen [ardb: clarify that Blt() only GOPs are unusable by the kernel] Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/gop.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libstub/gop.c index 932742e4cf23..b05b282b470d 100644 --- a/drivers/firmware/efi/libstub/gop.c +++ b/drivers/firmware/efi/libstub/gop.c @@ -178,6 +178,10 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, if (!first_gop) goto out; + /* Does the GOP implement a BLT-only framebuffer? */ + if (pixel_format == PIXEL_BLT_ONLY) + goto out; + /* EFI framebuffer */ si->orig_video_isVGA = VIDEO_TYPE_EFI; @@ -295,6 +299,10 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, if (!first_gop) goto out; + /* Does the GOP implement a BLT-only framebuffer? */ + if (pixel_format == PIXEL_BLT_ONLY) + goto out; + /* EFI framebuffer */ si->orig_video_isVGA = VIDEO_TYPE_EFI;