From 8783f4a8369c5af39c85478ad0be34add4fb1dc7 Mon Sep 17 00:00:00 2001 From: Huacai Chen Date: Fri, 19 Jan 2024 18:04:24 +0800 Subject: [PATCH] drm/loongson: Error out if no VRAM detected If there is no VRAM (it can be true if there is a discreted card, this is probably a hardware configuration issue in BIOS but it is observed in GDC-1401 laptop, L71 laptop and some Loongson-3C5000L based servers), we get such an error and Xorg fails to start: [ 136.401131] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed [ 137.444342] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed [ 138.871166] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed [ 140.444078] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed [ 142.403993] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed [ 143.970625] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed [ 145.862013] loongson 0000:00:06.1: [drm] *ERROR* Requesting(0MiB) failed So in lsdc_get_dedicated_vram() we error out if no VRAM (or VRAM is less than 1MB which is also an unusable case) detected. Tested-by: Xiaotian Wu Signed-off-by: Huacai Chen diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c index 89ccc0c43169..d09a781ccb0b 100644 --- a/drivers/gpu/drm/loongson/lsdc_drv.c +++ b/drivers/gpu/drm/loongson/lsdc_drv.c @@ -184,7 +184,7 @@ static int lsdc_get_dedicated_vram(struct lsdc_device *ldev, drm_info(ddev, "Dedicated vram start: 0x%llx, size: %uMiB\n", (u64)base, (u32)(size >> 20)); - return 0; + return (size > SZ_1M) ? 0 : -ENOSPC; } static struct lsdc_device * -- 2.41.0