Re: [vmwgfx] crash upon vmw_open_channel() when booting on Oracle VM VirtualBox

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2023-01-28 at 20:44 +0900, Tetsuo Handa wrote:
> Hello.
> 
> I noticed that a kernel built with vmwgfx driver fails to boot a Linux guest
> on Oracle VM VirtualBox 7.0.4 on Windows 11 on DELL Inspiron 14 5420.
> I didn't notice this problem when I booted an older kernel on an older version
> of Oracle VM VirtualBox on Windows 8.1 on an older PC.
> 
> The location that crashes is
> 
>         VMW_PORT(VMW_PORT_CMD_OPEN_CHANNEL,
>                 (protocol | GUESTMSG_FLAG_COOKIE), si, di,
>                 0,
>                 VMW_HYPERVISOR_MAGIC,
>                 eax, ebx, ecx, edx, si, di);
> 
> in vmw_open_channel(). It might be that some changes in VirtualBox side
> is conflicting with how VMware tries to test if the guest is VMware.
> How can I debug this problem?

You'd have to figure out what exactly is the problem. I couldn't reproduce it on
vmware hypervisors with your .config. FWIW that code has been there and hasn't been
changed in years. Oracle emulated svga device always had problems, was never
supported by vmwgfx and afaict is not maintained by Oracle so I'd strongly suggest
that you switch to some other graphics device on virtualbox.

In the meantime I think the attached patch should at least get you booting. You can
give it a try and if it works I can push it sometime this week.

z

From db6405fb221a9b8e8232dff8695775584d341ca8 Mon Sep 17 00:00:00 2001
From: Zack Rusin <zackr@xxxxxxxxxx>
Date: Sun, 29 Jan 2023 00:42:20 -0500
Subject: [PATCH] drm/vmwgfx: Print errors when running on broken/unsupported
 configs

virtualbox implemented an incomplete version of the svga device which
they decided to drop soon after the initial release. The device was
always broken in various ways and never supported by vmwgfx.

vmwgfx should refuse to load on those configurations but currently
drm has no way of reloading fbdev when the specific pci driver refuses
to load, which would leave users without a usable fb. Instead of
refusing to load print an error and disable a bunch of functionality
that virtualbox never implemented to at least get fb to work on their
setup.

Signed-off-by: Zack Rusin <zackr@xxxxxxxxxx>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 28 ++++++++++++++++++++++++++++
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h |  3 +++
 drivers/gpu/drm/vmwgfx/vmwgfx_msg.c |  2 +-
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 8e1cd9d6ced2..339a0725ed0c 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -46,6 +46,7 @@
 #include <drm/ttm/ttm_placement.h>
 #include <generated/utsrelease.h>
 
+#include <asm/hypervisor.h>
 #include <linux/cc_platform.h>
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
@@ -898,6 +899,16 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
 				 cap2_names, ARRAY_SIZE(cap2_names));
 	}
 
+	if (!vmwgfx_supported(dev_priv)) {
+		vmw_msg_enabled = 0;
+		drm_err_once(
+			&dev_priv->drm,
+			"vmwgfx seems to be running on an unsupported hypervisor. "
+			"This configuration is likely broken. "
+			"Please switch to a supported graphics device to avoid problems."
+			);
+	}
+
 	ret = vmw_dma_select_mode(dev_priv);
 	if (unlikely(ret != 0)) {
 		drm_info(&dev_priv->drm,
@@ -1321,6 +1332,23 @@ static void vmw_master_drop(struct drm_device *dev,
 	vmw_kms_legacy_hotspot_clear(dev_priv);
 }
 
+
+bool vmwgfx_supported(struct vmw_private *vmw)
+{
+#if defined(__i386__) || defined(__x86_64__)
+	return hypervisor_is_type(X86_HYPER_VMWARE);
+#elif defined(__aarch64__)
+	/*
+	 * On aarch64 only svga3 is supported
+	 */
+	return vmw->pci_id == VMWGFX_PCI_ID_SVGA3;
+#else
+	drm_warn_once(&dev->drm,
+		"vmwgfx is running on an unknown architecture.");
+	return false;
+#endif
+}
+
 /**
  * __vmw_svga_enable - Enable SVGA mode, FIFO and use of VRAM.
  *
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index c230cdfa1475..e436b8d042bc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -653,6 +653,8 @@ struct vmw_private {
 #endif
 };
 
+bool vmwgfx_supported(struct vmw_private *vmw);
+
 static inline struct vmw_surface *vmw_res_to_srf(struct vmw_resource *res)
 {
 	return container_of(res, struct vmw_surface, res);
@@ -1356,6 +1358,7 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,
 		    struct vmw_diff_cpy *diff);
 
 /* Host messaging -vmwgfx_msg.c: */
+extern u32 vmw_msg_enabled;
 int vmw_host_get_guestinfo(const char *guest_info_param,
 			   char *buffer, size_t *length);
 __printf(1, 2) int vmw_host_printf(const char *fmt, ...);
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
index e76976a95a1e..1458e1ad967a 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_msg.c
@@ -67,7 +67,7 @@
 
 #define MAX_USER_MSG_LENGTH	PAGE_SIZE
 
-static u32 vmw_msg_enabled = 1;
+u32 vmw_msg_enabled = 1;
 
 enum rpc_msg_type {
 	MSG_TYPE_OPEN,
-- 
2.38.1


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux