Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4309628pxu; Tue, 1 Dec 2020 01:32:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTszNe88mThkgdQbX1GRAGIkneowRlHI4rMZTFqc6TPKZ6mXhDn7mxEs9yQoAvgYROtv+Y X-Received: by 2002:a17:906:7f13:: with SMTP id d19mr2213575ejr.54.1606815174391; Tue, 01 Dec 2020 01:32:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606815174; cv=none; d=google.com; s=arc-20160816; b=f1jptUkVUUUD6lFW1lZ8f/UrzJlGs4fRk2d6K2SCeyYKQuiXDo4K2VWC0akSWtpk23 5AIzGkXtssEOdd3FoVv4xII5SkbF8vh59p49HKxQ45vvqBUwJGqld7We06E7m5KJ16wj NN4H7Hk9usxwe81B0edtmOFuhLmV7Bx6RqNF4uaSHcTqpmkHNvQwfuBZXW9bp7vFo2PZ Wmsd1rB+2uqrFuoUaQ+Dnn4TQ0/DkiKY8uO75Xj47vi9HEoMxi+AlddyAyQfQVUpp04r x7umag6s0JVvjkmLpMDluENP7bScVyIswS9APXpmOPlR7AJkfOhujO65TBk1/o0qEw/o Lvww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Dw6GekvgGwMJwT1kh4X8KazNo1tT/9EGxrQp8jILmqg=; b=unYMy3HAKabwWf55XR3nm0Kx2m+HwCoNCBBrH/ybD5ZPd/x80/tKV7e5qveXbXEIBE uZvPtTz4xHyosmGZbjyyHvxNJ4hI+ghYfHg7sUrpwPaV3AD/JZU5rOrAo6XHWdjd/ROr 7VLzqCzGupbqm5my3uN5eEOMYXWTZ/83gKj2WNq4J2gHfPqW676OzlU7ac3HiBxqZDxM Dd3lb04df7ID94gNUQZOzX6sDqxVXqqWw/UaPpyawwCvEkltOdkhNYVQQ3qp0Y1k7FrV RhX/6kt0FLDE9/GHaOWVEjdM+ML0htjLxdDWyRbC7Ycj/5LrI3Mu7cUOttP+8G5B2Ja/ fmfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WY7pahdM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x18si620741ejd.193.2020.12.01.01.32.32; Tue, 01 Dec 2020 01:32:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WY7pahdM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388063AbgLAI7H (ORCPT + 99 others); Tue, 1 Dec 2020 03:59:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:34600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388029AbgLAI6y (ORCPT ); Tue, 1 Dec 2020 03:58:54 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 CCA9F21D7A; Tue, 1 Dec 2020 08:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606813093; bh=RccXeOf06Uamqb4/AwKlFrIiqLaMCZpeLLEmrTHswvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WY7pahdMJpCQyeft58MlHicv8Kidy/A7TqFF0e2ffFrudoIAMGaZHoJSLLJlYP85b mfZ9JehFKtvNAiskSPsIldoiAQbHN+lLiv76q9t6PYs6wMuSqoUwHoskxBCysnJ4Fp n71SbGGwwV6B5mYDzG8PqZuTEIjAYxmOLrQCqUso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Boqun Feng , Dexuan Cui , Michael Kelley , Haiyang Zhang , Wei Liu , Sasha Levin Subject: [PATCH 4.14 31/50] video: hyperv_fb: Fix the cache type when mapping the VRAM Date: Tue, 1 Dec 2020 09:53:30 +0100 Message-Id: <20201201084648.875214121@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201201084644.803812112@linuxfoundation.org> References: <20201201084644.803812112@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dexuan Cui [ Upstream commit 5f1251a48c17b54939d7477305e39679a565382c ] x86 Hyper-V used to essentially always overwrite the effective cache type of guest memory accesses to WB. This was problematic in cases where there is a physical device assigned to the VM, since that often requires that the VM should have control over cache types. Thus, on newer Hyper-V since 2018, Hyper-V always honors the VM's cache type, but unexpectedly Linux VM users start to complain that Linux VM's VRAM becomes very slow, and it turns out that Linux VM should not map the VRAM uncacheable by ioremap(). Fix this slowness issue by using ioremap_cache(). On ARM64, ioremap_cache() is also required as the host also maps the VRAM cacheable, otherwise VM Connect can't display properly with ioremap() or ioremap_wc(). With this change, the VRAM on new Hyper-V is as fast as regular RAM, so it's no longer necessary to use the hacks we added to mitigate the slowness, i.e. we no longer need to allocate physical memory and use it to back up the VRAM in Generation-1 VM, and we also no longer need to allocate physical memory to back up the framebuffer in a Generation-2 VM and copy the framebuffer to the real VRAM. A further big change will address these for v5.11. Fixes: 68a2d20b79b1 ("drivers/video: add Hyper-V Synthetic Video Frame Buffer Driver") Tested-by: Boqun Feng Signed-off-by: Dexuan Cui Reviewed-by: Michael Kelley Reviewed-by: Haiyang Zhang Link: https://lore.kernel.org/r/20201118000305.24797-1-decui@microsoft.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin --- drivers/video/fbdev/hyperv_fb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index 2fd49b2358f8b..f3938c5278832 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -712,7 +712,12 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info) goto err1; } - fb_virt = ioremap(par->mem->start, screen_fb_size); + /* + * Map the VRAM cacheable for performance. This is also required for + * VM Connect to display properly for ARM64 Linux VM, as the host also + * maps the VRAM cacheable. + */ + fb_virt = ioremap_cache(par->mem->start, screen_fb_size); if (!fb_virt) goto err2; -- 2.27.0