dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] drm/loongson: Error out if no VRAM detected
@ 2024-01-24 10:16 Huacai Chen
  2024-01-24 11:37 ` [V2] " Sui Jingfeng
  0 siblings, 1 reply; 2+ messages in thread
From: Huacai Chen @ 2024-01-24 10:16 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter, Huacai Chen, Jingfeng Sui
  Cc: Xiaotian Wu, dri-devel, Huacai Chen

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 <wuxiaotian@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 drivers/gpu/drm/loongson/lsdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c
index 89ccc0c43169..d8ff60b46abe 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 : -ENODEV;
 }
 
 static struct lsdc_device *
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [V2] drm/loongson: Error out if no VRAM detected
  2024-01-24 10:16 [PATCH V2] drm/loongson: Error out if no VRAM detected Huacai Chen
@ 2024-01-24 11:37 ` Sui Jingfeng
  0 siblings, 0 replies; 2+ messages in thread
From: Sui Jingfeng @ 2024-01-24 11:37 UTC (permalink / raw)
  To: Huacai Chen, David Airlie, Daniel Vetter, Huacai Chen,
	Maxime Ripard, Thomas Zimmermann
  Cc: Xiaotian Wu, dri-devel

Hi,


On 2024/1/24 18:16, Huacai Chen wrote:
> 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 <wuxiaotian@loongson.cn>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>


By the way, sending patch should Cc Maxime and Thomas in the future.
Since this patch is small patch, not a big deal, so it probably okay.

This serve as a basic sanity check, hopes this helps to mitigate the pains.


Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-24 11:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-24 10:16 [PATCH V2] drm/loongson: Error out if no VRAM detected Huacai Chen
2024-01-24 11:37 ` [V2] " Sui Jingfeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox