From patchwork Tue Apr 4 16:02:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96738 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp263112qgd; Tue, 4 Apr 2017 09:03:18 -0700 (PDT) X-Received: by 10.99.171.5 with SMTP id p5mr25190505pgf.208.1491321798342; Tue, 04 Apr 2017 09:03:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q22si2210702pfk.385.2017.04.04.09.03.18; Tue, 04 Apr 2017 09:03:18 -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 S1754232AbdDDQDL (ORCPT + 2 others); Tue, 4 Apr 2017 12:03:11 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:33122 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754552AbdDDQDK (ORCPT ); Tue, 4 Apr 2017 12:03:10 -0400 Received: by mail-wr0-f176.google.com with SMTP id w43so217977601wrb.0 for ; Tue, 04 Apr 2017 09:03:09 -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:in-reply-to:references; bh=LjaFjajdwrSxiInqInTs/DvpKX2ruEZ9watTTMDq+5Y=; b=ZWN8CHhooVt1i1SbQjuso7z9ky+oMyDGPkeZqrX2Af1mfS310VrCUwFqHxZOJ7SL7j tI1ZAr/TDOn6rC3UBH7kUAS+MdPUcIfqI1SfNaZswTW7C4yHstSra0G9K4OvlWfMlqAo g2u7rp4pbdFaL0pmQF+NQkR1vL3PyYPJKfiJA= 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:in-reply-to :references; bh=LjaFjajdwrSxiInqInTs/DvpKX2ruEZ9watTTMDq+5Y=; b=a3SmClepfTH+tk6nyRCAUKesk8uksDI4vg+waJDaTVtBz5OMCB6NK3D9ymdQEZ1oFN COls8eN1WryaX/sHn96APnkcOrEu0J4oUhPKHFhTKT6Pf0nAEdbiEt8L+hZHMtporwru WvF7mM1Vvkx0+o7RZot2iV9MW+pWWt8z0d0DHZjy9vi8Nf60VTu8o9OsGb0a6evWhNJi ql3B0A1vkcue4thcA9Rag/OGJWRRyUrFaJnP28QoKaGnbUqXh0j8Dd1nmMyaT7I2xsQO jL0X137oODpV8lEDVRQDI+aTjI2zlLAwtuBR9RhI4ya8fy3y3DwCmTzSFORYqUCjlbm5 D/qw== X-Gm-Message-State: AFeK/H16z0eC47WDPPzifLtVUwVPwM0QOLje0nAvQc6x2fa9CfkNrcShJl5ucXGmzrznujMl X-Received: by 10.223.162.198 with SMTP id t6mr22372182wra.155.1491321788862; Tue, 04 Apr 2017 09:03:08 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id z88sm19686465wrb.1.2017.04.04.09.03.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 09:03:08 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: "Cohen, Eugene" , Ard Biesheuvel , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] efi/libstub: Skip GOP with PIXEL_BLT_ONLY format Date: Tue, 4 Apr 2017 17:02:35 +0100 Message-Id: <20170404160245.27812-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404160245.27812-1-ard.biesheuvel@linaro.org> References: <20170404160245.27812-1-ard.biesheuvel@linaro.org> 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. Fixes: 9822504c1fa5 ("efifb: Enable the efi-framebuffer platform driver ...") Signed-off-by: Eugene Cohen [ardb: - move Blt() only check into the loop - clarify that Blt() only GOPs are unusable by the kernel] Cc: Matt Fleming Cc: # v4.7+ Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/gop.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.9.3 -- 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..24c461dea7af 100644 --- a/drivers/firmware/efi/libstub/gop.c +++ b/drivers/firmware/efi/libstub/gop.c @@ -149,7 +149,8 @@ setup_gop32(efi_system_table_t *sys_table_arg, struct screen_info *si, status = __gop_query32(sys_table_arg, gop32, &info, &size, ¤t_fb_base); - if (status == EFI_SUCCESS && (!first_gop || conout_found)) { + if (status == EFI_SUCCESS && (!first_gop || conout_found) && + info->pixel_format != PIXEL_BLT_ONLY) { /* * Systems that use the UEFI Console Splitter may * provide multiple GOP devices, not all of which are @@ -266,7 +267,8 @@ setup_gop64(efi_system_table_t *sys_table_arg, struct screen_info *si, status = __gop_query64(sys_table_arg, gop64, &info, &size, ¤t_fb_base); - if (status == EFI_SUCCESS && (!first_gop || conout_found)) { + if (status == EFI_SUCCESS && (!first_gop || conout_found) && + info->pixel_format != PIXEL_BLT_ONLY) { /* * Systems that use the UEFI Console Splitter may * provide multiple GOP devices, not all of which are