From patchwork Thu May 23 19:06:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 165053 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp2608342ili; Thu, 23 May 2019 12:16:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwM/DiIkAJ/HbUlY7t/Nasq7gT8zQPY5F/Ww4CHv6MIRArSCeJIYPaQnlrxurwg3v+VZHwS X-Received: by 2002:a17:90a:21ce:: with SMTP id q72mr3439539pjc.3.1558639009202; Thu, 23 May 2019 12:16:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558639009; cv=none; d=google.com; s=arc-20160816; b=EzRT+B8DDhBHpfNBArpWQrVi4K6UxJRmmfapgvRZwhjPAn0AxK9TUHJ3lnmsCLpxap rt9Ocn35EwRqv43XlxxiTds8Rs39CCvbEoReo0z/HHACWil2LVdY6tcPO8ZXzercdr1e qI42+gMG+L5V8/F+Nd2jtqeZ2hXZ82zZpsIinbo2wsma2OyWVVME1x9dAV9X70QcQmwi jjatsJC/BazbJlnzMF3y3ZQnoS0ijjIVgs8bQSr0UrwfW3FsstNgnIjTa3sSFB+abG5E e5Azx3d45cxEzVq5fY/qzZGZIpIBNGj23JOjTD+xpSAnwy92CZ/BW1B+GilvwbeBDANZ l/Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lRqkBUqu5IDPL1mH/DqJlmad9bbm3eTPUBXnW7/rUiU=; b=CeLyMgB6BhIXl+T3hRU7zxiFF8/uz9aa46z4x43heVxBQgGr6oJxou50Ibi8p8Vw5V puGyHGQNjDic5w2+MKJv/mn6Rx6+Vvq1pIRuKUnv9dqzykvv0LmJckKdhzEqqQ+AreGR Z9EpQHhFV8aSKjNYdLCR4MZVUOecXtd0SO2jRD9wE6eLtyByxXVlCb1+CKVWikV1peKa Umoewwb0+bb99F7T3KlHExgslDlqWNVzdOnWv3+Lm0r24jxuziOtKSQh0pUuDx9l/GGu d/7/gcK19keqwcKpJyUlbxOKbeLXRNLfaxqjHNjlFxUyRvw6xSDBjetpZbqsS2M5A92o 4XMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bq7EZULO; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l97si410254pje.18.2019.05.23.12.16.48; Thu, 23 May 2019 12:16:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@kernel.org header.s=default header.b=bq7EZULO; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389250AbfEWTQr (ORCPT + 14 others); Thu, 23 May 2019 15:16:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:51576 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389240AbfEWTQq (ORCPT ); Thu, 23 May 2019 15:16:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 12DDE21855; Thu, 23 May 2019 19:16:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558639005; bh=OGUu2Sgn161BC2t3viF5PL0nsPJFqDhoMlU0WpAaogM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bq7EZULOQPcewON2SEzDT97TWbRo0YIwtsTqoQz/xTYzChZRnGGei2Evis4wmU3Wk 5hPCNoHCi+jJXrZPIcXjuGwY+dFZ5eaEWG2QQff20jOyLiAy7/bV84/uVg2/0GRILJ okEmn9zcZ8PHLAGxIZNBJO0xAtHE+qKrhhoz1zcA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Hilliard , Ard Biesheuvel , Borislav Petkov , James Morse , Linus Torvalds , Matt Fleming , Peter Jones , Peter Zijlstra , Thomas Gleixner , linux-efi@vger.kernel.org, Ingo Molnar Subject: [PATCH 4.19 061/114] fbdev/efifb: Ignore framebuffer memmap entries that lack any memory types Date: Thu, 23 May 2019 21:06:00 +0200 Message-Id: <20190523181737.128552956@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190523181731.372074275@linuxfoundation.org> References: <20190523181731.372074275@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ard Biesheuvel commit f8585539df0a1527c78b5d760665c89fe1c105a9 upstream. The following commit: 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when mapping the FB") updated the EFI framebuffer code to use memory mappings for the linear framebuffer that are permitted by the memory attributes described by the EFI memory map for the particular region, if the framebuffer happens to be covered by the EFI memory map (which is typically only the case for framebuffers in shared memory). This is required since non-x86 systems may require cacheable attributes for memory mappings that are shared with other masters (such as GPUs), and this information cannot be described by the Graphics Output Protocol (GOP) EFI protocol itself, and so we rely on the EFI memory map for this. As reported by James, this breaks some x86 systems: [ 1.173368] efifb: probing for efifb [ 1.173386] efifb: abort, cannot remap video memory 0x1d5000 @ 0xcf800000 [ 1.173395] Trying to free nonexistent resource <00000000cf800000-00000000cf9d4bff> [ 1.173413] efi-framebuffer: probe of efi-framebuffer.0 failed with error -5 The problem turns out to be that the memory map entry that describes the framebuffer has no memory attributes listed at all, and so we end up with a mem_flags value of 0x0. So work around this by ensuring that the memory map entry's attribute field has a sane value before using it to mask the set of usable attributes. Reported-by: James Hilliard Tested-by: James Hilliard Signed-off-by: Ard Biesheuvel Cc: # v4.19+ Cc: Borislav Petkov Cc: James Morse Cc: Linus Torvalds Cc: Matt Fleming Cc: Peter Jones Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: linux-efi@vger.kernel.org Fixes: 38ac0287b7f4 ("fbdev/efifb: Honour UEFI memory map attributes when ...") Link: http://lkml.kernel.org/r/20190516213159.3530-2-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/efifb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -476,8 +476,12 @@ static int efifb_probe(struct platform_d * If the UEFI memory map covers the efifb region, we may only * remap it using the attributes the memory map prescribes. */ - mem_flags |= EFI_MEMORY_WT | EFI_MEMORY_WB; - mem_flags &= md.attribute; + md.attribute &= EFI_MEMORY_UC | EFI_MEMORY_WC | + EFI_MEMORY_WT | EFI_MEMORY_WB; + if (md.attribute) { + mem_flags |= EFI_MEMORY_WT | EFI_MEMORY_WB; + mem_flags &= md.attribute; + } } if (mem_flags & EFI_MEMORY_WC) info->screen_base = ioremap_wc(efifb_fix.smem_start,