drm/loongson: Error out if no VRAM detected
authorHuacai Chen <chenhuacai@loongson.cn>
Wed, 24 Jan 2024 10:16:07 +0000 (18:16 +0800)
committerSui Jingfeng <sui.jingfeng@linux.dev>
Sun, 28 Jan 2024 11:06:46 +0000 (19:06 +0800)
When a Loongson laptop is equipped with a Radeon GPU, it can be true that
there is no dedicated VRAM soldered on the motherboard. This is probably
for cost reason, but drm/loongson driver is probed because the platform
BIOS (either UEFI or PMON) forget to disable the integrated GPU.

So in the lsdc_get_dedicated_vram() function, we error out if no dedicated
VRAM detected. This fix nothing, but serve as a sanity check only.

Tested-by: Xiaotian Wu <wuxiaotian@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
Link: https://patchwork.freedesktop.org/patch/msgid/20240124101607.2910998-1-chenhuacai@loongson.cn
drivers/gpu/drm/loongson/lsdc_drv.c

index 89ccc0c431690f7d458e999b464924b0af1b8107..d8ff60b46abe6e6f46d2b04935c2fc11ced6beb0 100644 (file)
@@ -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 : -ENODEV;
 }
 
 static struct lsdc_device *