Commit 35d86fb6 authored by Zack Rusin's avatar Zack Rusin

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: default avatarZack Rusin <zackr@vmware.com>
Reviewed-by: default avatarMartin Krastev <krastevm@vmware.com>
Reviewed-by: default avatarMaaz Mombasawala <mombasawalam@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230321020949.335012-2-zack@kde.org
parent 49043846
...@@ -45,6 +45,9 @@ ...@@ -45,6 +45,9 @@
#include <drm/ttm/ttm_placement.h> #include <drm/ttm/ttm_placement.h>
#include <generated/utsrelease.h> #include <generated/utsrelease.h>
#ifdef CONFIG_X86
#include <asm/hypervisor.h>
#endif
#include <linux/cc_platform.h> #include <linux/cc_platform.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -897,6 +900,16 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id) ...@@ -897,6 +900,16 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
cap2_names, ARRAY_SIZE(cap2_names)); cap2_names, ARRAY_SIZE(cap2_names));
} }
if (!vmwgfx_supported(dev_priv)) {
vmw_disable_backdoor();
drm_err_once(&dev_priv->drm,
"vmwgfx seems to be running on an unsupported hypervisor.");
drm_err_once(&dev_priv->drm,
"This configuration is likely broken.");
drm_err_once(&dev_priv->drm,
"Please switch to a supported graphics device to avoid problems.");
}
ret = vmw_dma_select_mode(dev_priv); ret = vmw_dma_select_mode(dev_priv);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
drm_info(&dev_priv->drm, drm_info(&dev_priv->drm,
...@@ -1320,6 +1333,22 @@ static void vmw_master_drop(struct drm_device *dev, ...@@ -1320,6 +1333,22 @@ static void vmw_master_drop(struct drm_device *dev,
vmw_kms_legacy_hotspot_clear(dev_priv); vmw_kms_legacy_hotspot_clear(dev_priv);
} }
bool vmwgfx_supported(struct vmw_private *vmw)
{
#if defined(CONFIG_X86)
return hypervisor_is_type(X86_HYPER_VMWARE);
#elif defined(CONFIG_ARM64)
/*
* On aarch64 only svga3 is supported
*/
return vmw->pci_id == VMWGFX_PCI_ID_SVGA3;
#else
drm_warn_once(&vmw->drm,
"vmwgfx is running on an unknown architecture.");
return false;
#endif
}
/** /**
* __vmw_svga_enable - Enable SVGA mode, FIFO and use of VRAM. * __vmw_svga_enable - Enable SVGA mode, FIFO and use of VRAM.
* *
......
...@@ -773,6 +773,7 @@ static inline u32 vmw_max_num_uavs(struct vmw_private *dev_priv) ...@@ -773,6 +773,7 @@ static inline u32 vmw_max_num_uavs(struct vmw_private *dev_priv)
extern void vmw_svga_enable(struct vmw_private *dev_priv); extern void vmw_svga_enable(struct vmw_private *dev_priv);
extern void vmw_svga_disable(struct vmw_private *dev_priv); extern void vmw_svga_disable(struct vmw_private *dev_priv);
bool vmwgfx_supported(struct vmw_private *vmw);
/** /**
...@@ -1358,6 +1359,7 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst, ...@@ -1358,6 +1359,7 @@ int vmw_bo_cpu_blit(struct ttm_buffer_object *dst,
struct vmw_diff_cpy *diff); struct vmw_diff_cpy *diff);
/* Host messaging -vmwgfx_msg.c: */ /* Host messaging -vmwgfx_msg.c: */
void vmw_disable_backdoor(void);
int vmw_host_get_guestinfo(const char *guest_info_param, int vmw_host_get_guestinfo(const char *guest_info_param,
char *buffer, size_t *length); char *buffer, size_t *length);
__printf(1, 2) int vmw_host_printf(const char *fmt, ...); __printf(1, 2) int vmw_host_printf(const char *fmt, ...);
......
...@@ -1179,3 +1179,12 @@ int vmw_mksstat_remove_ioctl(struct drm_device *dev, void *data, ...@@ -1179,3 +1179,12 @@ int vmw_mksstat_remove_ioctl(struct drm_device *dev, void *data,
return -EAGAIN; return -EAGAIN;
} }
/**
* vmw_disable_backdoor: Disables all backdoor communication
* with the hypervisor.
*/
void vmw_disable_backdoor(void)
{
vmw_msg_enabled = 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment