From patchwork Wed Jan 24 10:16:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huacai Chen X-Patchwork-Id: 13528895 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C70B2C47DDF for ; Wed, 24 Jan 2024 10:16:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0FABF10E30C; Wed, 24 Jan 2024 10:16:25 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by gabe.freedesktop.org (Postfix) with ESMTPS id D439410E8E6 for ; Wed, 24 Jan 2024 10:16:23 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 59F9262040; Wed, 24 Jan 2024 10:16:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F0E5C433F1; Wed, 24 Jan 2024 10:16:20 +0000 (UTC) From: Huacai Chen To: David Airlie , Daniel Vetter , Huacai Chen , Jingfeng Sui Subject: [PATCH V2] drm/loongson: Error out if no VRAM detected Date: Wed, 24 Jan 2024 18:16:07 +0800 Message-Id: <20240124101607.2910998-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xiaotian Wu , dri-devel@lists.freedesktop.org, Huacai Chen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 Reviewed-by: Sui Jingfeng --- 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 *