From patchwork Tue Apr 4 15:27:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96736 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp248083qgd; Tue, 4 Apr 2017 08:28:01 -0700 (PDT) X-Received: by 10.84.209.133 with SMTP id y5mr29572632plh.25.1491319681791; Tue, 04 Apr 2017 08:28:01 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si17812030pga.100.2017.04.04.08.28.01; Tue, 04 Apr 2017 08:28:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754345AbdDDP2A (ORCPT + 25 others); Tue, 4 Apr 2017 11:28:00 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:35108 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754198AbdDDP14 (ORCPT ); Tue, 4 Apr 2017 11:27:56 -0400 Received: by mail-wm0-f42.google.com with SMTP id y22so28666367wmh.0 for ; Tue, 04 Apr 2017 08:27:55 -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=Uf28dn4wJaUsZI+FHU3yJqpFMLQH6oQY97ZA2IOItMgh01p1KB4uc7M+MpHKHzj+Q7 UhSMtWVoIVi/qWyhVq7BINfTVVEorwoBSNCyzUX1JjU5H/DxoagO9l6yOP94ZlJ4GUmI bmAPULzaQc3KSkiMkc3QFJ4AozjvsbhLT5lV4= 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=C3aSDGzTmIgx+vFN2Sk1j0ycicaI8M46sEfjJJ5Eev5wukpyg+Tyv7a5vdmnZhuEXa EAdwZCVjyI7B5nMeBebJQ4R6TC+NZ+41IeP93awPJc8oL15S4ychuSR06L6zuvESKUnJ F9CPAGzlQ/faLYoNJK179TeVs0mW2vLSW5ZdnQnqkwlY95agB3tAM6MzQH1VIyvyd+tG PRdILUnKBUFA+hANz4cw2ZA9YKf4Z84phrsWzXChH3Bys5ZeMRD9Rqt8PJouCFdxuhKM ZfikV3eBL1rPe14j+fuQR+uTb2EHcflVULGpF1Rrv2bm69f/hljqNHE4YxUFFD24dgve WZiQ== X-Gm-Message-State: AFeK/H28dvIN8yMj9ZglOsDCGDd1+8MH/LZ8peplHT9bS7W2/FIioj5j f9laP/nf15JDGNXS X-Received: by 10.28.113.12 with SMTP id m12mr14939213wmc.18.1491319674991; Tue, 04 Apr 2017 08:27:54 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id n53sm4421205wrn.28.2017.04.04.08.27.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 08:27:54 -0700 (PDT) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner , "H . Peter Anvin" Cc: leif.lindholm@linaro.org, lorenzo.pieralisi@arm.com, "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 16:27:43 +0100 Message-Id: <20170404152744.26687-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170404152744.26687-1-ard.biesheuvel@linaro.org> References: <20170404152744.26687-1-ard.biesheuvel@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 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