From patchwork Mon May 6 14:50:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 10931221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB7F11515 for ; Mon, 6 May 2019 15:05:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ACFF205AD for ; Mon, 6 May 2019 15:05:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8F44F2878F; Mon, 6 May 2019 15:05:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 425FA205AD for ; Mon, 6 May 2019 15:05:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9a-0004MD-Id; Mon, 06 May 2019 15:03:42 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9Z-0004Lm-7r for xen-devel@lists.xenproject.org; Mon, 06 May 2019 15:03:41 +0000 X-Inumbo-ID: 1e4c2b40-7010-11e9-8e99-d39ca5764b89 Received: from new1-smtp.messagingengine.com (unknown [66.111.4.221]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1e4c2b40-7010-11e9-8e99-d39ca5764b89; Mon, 06 May 2019 15:03:34 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id CDDA4136C5; Mon, 6 May 2019 11:03:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 06 May 2019 11:03:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=j/pJrzCOwItYX2g5i YLCnlWTe3eZ4MWUfdEkcvCwSsY=; b=6Ery8UZmLD7b8zuTkTUYeatEQOZsiBWVq NYtuDU2FnXdZPIngs/sUvHZY0+oO4wirM3bcF8yAN7/a4yslPyqF6FhjkL4mLZN4 HVRQP8S8G4GcReLK+k+Tau7ko2vLcFVnbhgD5a0e5xwUiO6AL3B8NtvC4A2t5rMd NcrCPwtINc6PXF4BpAoCLov4Oqr2cdKsUEePzayDDa89/HdkUHqfxz5s0PHXuP7N Uf8GdHTC3rlMsamblmVwvA8naUSfI6tzLyyvj8yBa9wmGRkPaE7/ubziLmTg8IG3 H/9Nkpc8Kph989BSfB8prH40x5pe16V8edRg029Pqf93uMO6bHZdg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjeejgdekiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fthfevqddqjfgurhdqufhushhpvggtthdqlhhoficuldehmdenucfjughrpefhvffufffk ofgjfhggjghftgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghkucforghrtgiihi hkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvhhishhisghlvght hhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdeffeenucfrrghrrg hmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslhgvthhhihhnghhs lhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id BBED71037C; Mon, 6 May 2019 11:03:31 -0400 (EDT) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Mon, 6 May 2019 16:50:17 +0200 Message-Id: X-Mailer: git-send-email 2.17.2 In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: Subject: [Xen-devel] [PATCH 1/5] xen/bitmap: fix bitmap_fill with zero-sized bitmap X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Tim Deegan , Julien Grall , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP When bitmap_fill(..., 0) is called, do not try to write anything. Before this patch, it tried to write almost LONG_MAX, surely overwriting something. Signed-off-by: Marek Marczykowski-Górecki Reviewed-by: Andrew Cooper Reviewed-by: Jan Beulich --- Found while debugging framebuffer located above 4GB. In that case 32bit variable for it overflows and framebuffer initialization zeroed unrelated memory. Specifically, it hit mbi->mods_count, so later on bitmap_fill(module_map, mbi->mods_count) in __start_xen() crashed. --- xen/include/xen/bitmap.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h index fe3c720..0430c1c 100644 --- a/xen/include/xen/bitmap.h +++ b/xen/include/xen/bitmap.h @@ -126,6 +126,8 @@ static inline void bitmap_fill(unsigned long *dst, int nbits) size_t nlongs = BITS_TO_LONGS(nbits); switch (nlongs) { + case 0: + break; default: memset(dst, -1, (nlongs - 1) * sizeof(unsigned long)); /* fall through */ From patchwork Mon May 6 14:50:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 10931215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB1B91515 for ; Mon, 6 May 2019 15:05:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9E9320453 for ; Mon, 6 May 2019 15:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE0DF2878F; Mon, 6 May 2019 15:05:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78C9220453 for ; Mon, 6 May 2019 15:05:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9W-0004LN-A6; Mon, 06 May 2019 15:03:38 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9U-0004LI-Cm for xen-devel@lists.xenproject.org; Mon, 06 May 2019 15:03:36 +0000 X-Inumbo-ID: 1f0808e2-7010-11e9-843c-bc764e045a96 Received: from new1-smtp.messagingengine.com (unknown [66.111.4.221]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 1f0808e2-7010-11e9-843c-bc764e045a96; Mon, 06 May 2019 15:03:35 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 218B713BDD; Mon, 6 May 2019 11:03:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 06 May 2019 11:03:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=VHzPyhnUf5nGOMlnb HdZtF24wULqOF7nx5tDykzyxvA=; b=xvnk5ermldkWWaAOOiDWVD/ssDW6GGfSq A2sutjnO05WAum1LfCt2BWYPw+XgCA5IvO/adLc3q4QlOXT/3T2Oxv3FgZgfbdMc UfcvYLR/YDZjBs87Xz8VKqU8IS7EbkqXJwZt2R53nc9a+sJBIPznLAeu+LYgqe3z LiD5GiKbSExV2SS6RunFr/M0dqzGZa5Z06+QnhHUHtFhp6bt8hTH3jtT3puem6GT YLE3SECXKumP2b0QIDEU8KTdNn47gJ9iT6hUcqHJR5PZWvjJ6frXbvaYhIdwpfJK bFFfCjSquqIJ4QmwQg2SglSK1D8g02+vIXlWqyVS7uULF00rdMl1A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjeejgdekiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fthfevqddqjfgurhdqufhushhpvggtthdqlhhoficuldehmdenucfjughrpefhvffufffk ofgjfhggjghftgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghkucforghrtgiihi hkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvhhishhisghlvght hhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdeffeenucfrrghrrg hmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslhgvthhhihhnghhs lhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id 51EFD103CB; Mon, 6 May 2019 11:03:33 -0400 (EDT) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Mon, 6 May 2019 16:50:18 +0200 Message-Id: X-Mailer: git-send-email 2.17.2 In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: Subject: [Xen-devel] [PATCH 2/5] drivers/video: drop unused limits X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Tim Deegan , Julien Grall , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP MAX_BPP, MAX_FONT_W, MAX_FONT_H are not used in the code at all. Signed-off-by: Marek Marczykowski-Górecki Acked-by: Andrew Cooper --- xen/drivers/video/lfb.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/xen/drivers/video/lfb.c b/xen/drivers/video/lfb.c index d0c8c49..0475a68 100644 --- a/xen/drivers/video/lfb.c +++ b/xen/drivers/video/lfb.c @@ -12,9 +12,6 @@ #define MAX_XRES 1900 #define MAX_YRES 1200 -#define MAX_BPP 4 -#define MAX_FONT_W 8 -#define MAX_FONT_H 16 struct lfb_status { struct lfb_prop lfbp; From patchwork Mon May 6 14:50:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 10931211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 605B313AD for ; Mon, 6 May 2019 15:05:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E6B920453 for ; Mon, 6 May 2019 15:05:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 428B02878F; Mon, 6 May 2019 15:05:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B7B6B20453 for ; Mon, 6 May 2019 15:05:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9a-0004MX-Rn; Mon, 06 May 2019 15:03:42 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9Z-0004Ln-8A for xen-devel@lists.xenproject.org; Mon, 06 May 2019 15:03:41 +0000 X-Inumbo-ID: 1fdeec5e-7010-11e9-8459-2f617a146875 Received: from new1-smtp.messagingengine.com (unknown [66.111.4.221]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1fdeec5e-7010-11e9-8459-2f617a146875; Mon, 06 May 2019 15:03:36 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id BB6B5138DD; Mon, 6 May 2019 11:03:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 06 May 2019 11:03:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=vxIwGkZF0Qh48Fb/X 4px3qHjXLFIttc6teIFmBO2GJE=; b=FnENpOGlKYBctYnp1wYQLVqE6tNeol2F2 7Nx8tjzWzgypAtGHZ15yrpCm90ap+gX+belr6k111f/nZXl9S4qlOHvQ4LDmL58q 5i4wh3gDkri6kxAFO7jZI6PpTokJ1HoOnyanN4IzKKZk42cjYd3E5niEozAtqKCW rNWhrrKnwBuhxpZrRCDCAm1F9j7wFrYxFL1xX7MOPZjvQ7LAehlbWtPpmNJ4hi4v Y1etqu5Adc1H1m2IqEFQ6daiGy7mBRP7nnuRu4MdylypbRl1uDw8XsKW84MYtl6e d0w4gs6Q0vmB+h3nBvC+ectX97Vk5Te+La2rYZjnYlbzWIaatccaA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjeejgdekiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fthfevqddqjfgurhdqufhushhpvggtthdqlhhoficuldehmdenucfjughrpefhvffufffk ofgjfhggjghftgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghkucforghrtgiihi hkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvhhishhisghlvght hhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdeffeenucfrrghrrg hmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslhgvthhhihhnghhs lhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedv X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id EBBC51037C; Mon, 6 May 2019 11:03:34 -0400 (EDT) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Mon, 6 May 2019 16:50:19 +0200 Message-Id: X-Mailer: git-send-email 2.17.2 In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: Subject: [Xen-devel] [PATCH 3/5] drivers/video: Drop framebuffer size constraints X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Olaf Hering , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Tim Deegan , Julien Grall , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The limit 1900x1200 do not match real world devices (1900 looks like a typo, should be 1920). But in practice the limits are arbitrary and do not serve any real purpose. As discussed in "Increase framebuffer size to todays standards" thread, drop them completely. This fixes graphic console on device with 3840x2160 native resolution. Signed-off-by: Marek Marczykowski-Górecki Acked-by: Andrew Cooper --- Cc: Olaf Hering --- xen/drivers/video/lfb.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/xen/drivers/video/lfb.c b/xen/drivers/video/lfb.c index 0475a68..5022195 100644 --- a/xen/drivers/video/lfb.c +++ b/xen/drivers/video/lfb.c @@ -10,9 +10,6 @@ #include "lfb.h" #include "font.h" -#define MAX_XRES 1900 -#define MAX_YRES 1200 - struct lfb_status { struct lfb_prop lfbp; @@ -146,13 +143,6 @@ void lfb_carriage_return(void) int __init lfb_init(struct lfb_prop *lfbp) { - if ( lfbp->width > MAX_XRES || lfbp->height > MAX_YRES ) - { - printk(XENLOG_WARNING "Couldn't initialize a %ux%u framebuffer early.\n", - lfbp->width, lfbp->height); - return -EINVAL; - } - lfb.lfbp = *lfbp; lfb.lbuf = xmalloc_bytes(lfb.lfbp.bytes_per_line); From patchwork Mon May 6 14:50:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 10931217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70EA213AD for ; Mon, 6 May 2019 15:05:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DE9A2878F for ; Mon, 6 May 2019 15:05:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51F71287C3; Mon, 6 May 2019 15:05:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1CED2878F for ; Mon, 6 May 2019 15:05:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9b-0004Mz-6l; Mon, 06 May 2019 15:03:43 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9Z-0004Lw-Eo for xen-devel@lists.xenproject.org; Mon, 06 May 2019 15:03:41 +0000 X-Inumbo-ID: 20e430b4-7010-11e9-83d9-976c7285178d Received: from new1-smtp.messagingengine.com (unknown [66.111.4.221]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 20e430b4-7010-11e9-83d9-976c7285178d; Mon, 06 May 2019 15:03:38 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 7572413CFF; Mon, 6 May 2019 11:03:38 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 06 May 2019 11:03:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=UUUadiaqXjB9moxpb GteAdgEsyBVMvDkTtS9A9pOqh0=; b=e+Geq08CVGxrhzewwYNK2tR7KhwYRTr91 c3rzeh5xb45T/9pgb2szJwsgm4YYTMqoFic+F+XC7la8zqcw6Hzn8vVPWAh2jK+S HP0cXqk4dEIaqqCnZwd2NKe/ydOez/7Eu3f2JN06Y9/L8s3sz6KRqbLhPv/0xoYz RfpZQ7FAEsf9XUzsGrDMQ6aDn+P6FV/eSQgNX97RmQ0Bm2zS/zBDlchfzWkZlps3 mqUrz6IBd2ebwNrBKtPSWSbm0PYNxl6AAqxsMrqflsp1uWarsVihTQaa2m1Hrloh EROc9g97KFMgXVTrlGJKgoo4JpTZrcwlpQsjCsyMFePFCrbyHOfRg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjeejgdekiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fthfevqddqjfgurhdqufhushhpvggtthdqlhhoficuldehmdenucfjughrpefhvffufffk ofgjfhggjghftgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghkucforghrtgiihi hkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvhhishhisghlvght hhhinhhgshhlrggsrdgtohhmqeenucffohhmrghinhepughomhdtrdhinhhfohenucfkph epledurdeihedrfeegrdeffeenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghr vghksehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomhenucevlhhushhtvghruf hiiigvpedt X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id A46FC103C8; Mon, 6 May 2019 11:03:36 -0400 (EDT) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Mon, 6 May 2019 16:50:20 +0200 Message-Id: X-Mailer: git-send-email 2.17.2 In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: Subject: [Xen-devel] [PATCH 4/5] xen: fix handling framebuffer located above 4GB X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Tim Deegan , Julien Grall , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP On some machines (for example Thinkpad P52), UEFI GOP reports framebuffer located above 4GB (0x4000000000 on that machine). This address does not fit in {xen,dom0}_vga_console_info.u.vesa_lfb.lfb_base field, which is 32bit. The overflow here cause all kind of memory corruption when anything tries to write something on the screen, starting with zeroing the whole framebuffer in vesa_init(). Fix this similar to how it's done in Linux: add ext_lfb_base field at the end of the structure, to hold upper 32bits of the address. Since the field is added at the end of the structure, it will work with older Linux versions too (other than using possibly truncated address - no worse than without this change). Thanks to ABI containing size of the structure (start_info.console.dom0.info_size), Linux can detect when this field is present and use it appropriately then. Signed-off-by: Marek Marczykowski-Górecki --- xen/arch/x86/efi/efi-boot.h | 1 + xen/drivers/video/vesa.c | 15 +++++++++++---- xen/include/public/xen.h | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 5789d2c..7a13a30 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -550,6 +550,7 @@ static void __init efi_arch_video_init(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, vga_console_info.u.vesa_lfb.bytes_per_line = (mode_info->PixelsPerScanLine * bpp + 7) >> 3; vga_console_info.u.vesa_lfb.lfb_base = gop->Mode->FrameBufferBase; + vga_console_info.u.vesa_lfb.ext_lfb_base = gop->Mode->FrameBufferBase >> 32; vga_console_info.u.vesa_lfb.lfb_size = (gop->Mode->FrameBufferSize + 0xffff) >> 16; } diff --git a/xen/drivers/video/vesa.c b/xen/drivers/video/vesa.c index c92497e..f22cf7f 100644 --- a/xen/drivers/video/vesa.c +++ b/xen/drivers/video/vesa.c @@ -84,6 +84,7 @@ void __init vesa_early_init(void) void __init vesa_init(void) { struct lfb_prop lfbp; + unsigned long lfb_base; if ( !font ) return; @@ -97,15 +98,17 @@ void __init vesa_init(void) lfbp.text_columns = vlfb_info.width / font->width; lfbp.text_rows = vlfb_info.height / font->height; - lfbp.lfb = lfb = ioremap(vlfb_info.lfb_base, vram_remap); + lfb_base = vlfb_info.lfb_base; + lfb_base |= (unsigned long)vlfb_info.ext_lfb_base << 32; + lfbp.lfb = lfb = ioremap(lfb_base, vram_remap); if ( !lfb ) return; memset(lfb, 0, vram_remap); - printk(XENLOG_INFO "vesafb: framebuffer at %#x, mapped to 0x%p, " + printk(XENLOG_INFO "vesafb: framebuffer at %#lx, mapped to 0x%p, " "using %uk, total %uk\n", - vlfb_info.lfb_base, lfb, + lfb_base, lfb, vram_remap >> 10, vram_total >> 10); printk(XENLOG_INFO "vesafb: mode is %dx%dx%u, linelength=%d, font %ux%u\n", vlfb_info.width, vlfb_info.height, @@ -152,6 +155,10 @@ void __init vesa_mtrr_init(void) MTRR_TYPE_WRCOMB, MTRR_TYPE_WRTHROUGH }; unsigned int size_total; int rc, type; + unsigned long lfb_base; + + lfb_base = vlfb_info.lfb_base; + lfb_base |= (unsigned long)vlfb_info.ext_lfb_base << 32; if ( !lfb || (vesa_mtrr == 0) || (vesa_mtrr >= ARRAY_SIZE(mtrr_types)) ) return; @@ -167,7 +174,7 @@ void __init vesa_mtrr_init(void) /* Try and find a power of two to add */ do { - rc = mtrr_add(vlfb_info.lfb_base, size_total, type, 1); + rc = mtrr_add(lfb_base, size_total, type, 1); size_total >>= 1; } while ( (size_total >= PAGE_SIZE) && (rc == -EINVAL) ); } diff --git a/xen/include/public/xen.h b/xen/include/public/xen.h index ccdffc0..b0f0f7e 100644 --- a/xen/include/public/xen.h +++ b/xen/include/public/xen.h @@ -923,6 +923,8 @@ typedef struct dom0_vga_console_info { /* Mode attributes (offset 0x0, VESA command 0x4f01). */ uint16_t mode_attrs; #endif + /* high 32 bits of lfb_base */ + uint32_t ext_lfb_base; } vesa_lfb; } u; } dom0_vga_console_info_t; From patchwork Mon May 6 14:50:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= X-Patchwork-Id: 10931213 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7DCF413AD for ; Mon, 6 May 2019 15:05:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CAC720453 for ; Mon, 6 May 2019 15:05:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 609722878F; Mon, 6 May 2019 15:05:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1876C20453 for ; Mon, 6 May 2019 15:05:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9b-0004Nv-QC; Mon, 06 May 2019 15:03:43 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hNf9Z-0004M1-P2 for xen-devel@lists.xenproject.org; Mon, 06 May 2019 15:03:41 +0000 X-Inumbo-ID: 21d827a4-7010-11e9-843c-bc764e045a96 Received: from new1-smtp.messagingengine.com (unknown [66.111.4.221]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 21d827a4-7010-11e9-843c-bc764e045a96; Mon, 06 May 2019 15:03:40 +0000 (UTC) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 061B613ECE; Mon, 6 May 2019 11:03:40 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 06 May 2019 11:03:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:in-reply-to:message-id:mime-version :references:references:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=PzWno+nCIDVdwD5OP R9zT98Rark5n8AGgx+Zt3nVNRg=; b=nBAvcf4ZuJ/qiWlVpxsa6Ts/xGBb4FJSZ BKuADe+wMjUJdhw0E0HV2Q/FL9kEyFM6MHQwKQ8ph/QgVuO5i2zbv2b/0mh6GZOe rfDlh7suXIiuoMAYxTZkox33dScHiv4gP7ZC17kM8imUvkJNpbEy7hjSVNQ97ip7 MBOpZtBSp1guiWQORMnkl1cwZurTOh8hwfecFO4M/6FyRLmZt5SG4+rOzJqnTn6t vI2vSvOMpJG7xoPBP7CdUaDLju04LWaquHv6ZwekVTILc76ZtAaN+b6y5RipWDO0 JcABLaQIVlShKmZTKtaOA7LRxU0rfVtgzDI5kpmQGtYpeZh0YVf6g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrjeejgdekiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fthfevqddqjfgurhdqufhushhpvggtthdqlhhoficuldehmdenucfjughrpefhvffufffk ofgjfhggjghftgfgsehtkeertdertdejnecuhfhrohhmpeforghrvghkucforghrtgiihi hkohifshhkihdqifpkrhgvtghkihcuoehmrghrmhgrrhgvkhesihhnvhhishhisghlvght hhhinhhgshhlrggsrdgtohhmqeenucfkphepledurdeihedrfeegrdeffeenucfrrghrrg hmpehmrghilhhfrhhomhepmhgrrhhmrghrvghksehinhhvihhsihgslhgvthhhihhnghhs lhgrsgdrtghomhenucevlhhushhtvghrufhiiigvpedv X-ME-Proxy: Received: from localhost.localdomain (ip5b412221.dynamic.kabel-deutschland.de [91.65.34.33]) by mail.messagingengine.com (Postfix) with ESMTPA id 54BEE103CA; Mon, 6 May 2019 11:03:38 -0400 (EDT) From: =?utf-8?q?Marek_Marczykowski-G=C3=B3recki?= To: xen-devel@lists.xenproject.org Date: Mon, 6 May 2019 16:50:21 +0200 Message-Id: <0463b8875424fc7be3d8ec5610d21439507af325.1557154206.git-series.marmarek@invisiblethingslab.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: References: MIME-Version: 1.0 In-Reply-To: References: Subject: [Xen-devel] [PATCH 5/5] drivers/video: use vlfb_info consistently X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , =?utf-8?q?Marek_Marczykowski-G?= =?utf-8?q?=C3=B3recki?= , Tim Deegan , Julien Grall , Jan Beulich Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP vlfb_info is an alias for vga_console_info.u.vesa_lfb, so this change is purely cosmetic. But using the same name helps reading the code. Signed-off-by: Marek Marczykowski-Górecki Acked-by: Andrew Cooper --- xen/drivers/video/vesa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/drivers/video/vesa.c b/xen/drivers/video/vesa.c index f22cf7f..3767024 100644 --- a/xen/drivers/video/vesa.c +++ b/xen/drivers/video/vesa.c @@ -44,7 +44,7 @@ void __init vesa_early_init(void) { unsigned int vram_vmode; - vga_compat = !(vga_console_info.u.vesa_lfb.gbl_caps & 2); + vga_compat = !(vlfb_info.gbl_caps & 2); if ( (vlfb_info.bits_per_pixel < 8) || (vlfb_info.bits_per_pixel > 32) ) return;