From patchwork Wed Aug 30 15:45:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13370322 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 06A6BC83F15 for ; Wed, 30 Aug 2023 15:46:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5679710E554; Wed, 30 Aug 2023 15:46:09 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by gabe.freedesktop.org (Postfix) with ESMTP id 3AB9B10E555 for ; Wed, 30 Aug 2023 15:45:50 +0000 (UTC) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8Dxg_AqZO9kkyEdAA--.59881S3; Wed, 30 Aug 2023 23:45:46 +0800 (CST) Received: from openarena.loongson.cn (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxviMqZO9kjVRnAA--.12491S2; Wed, 30 Aug 2023 23:45:46 +0800 (CST) From: Sui Jingfeng To: Patrik Jakobsson , David Airlie , Daniel Vetter Subject: [PATCH 0/3] drm/gma500: Fix the failure to map the stolen memory Date: Wed, 30 Aug 2023 23:45:43 +0800 Message-Id: <20230830154546.499987-1-suijingfeng@loongson.cn> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8DxviMqZO9kjVRnAA--.12491S2 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBj93XoW7Kry3XF1DCr1rtFW7tryfXwc_yoW8K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.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When another discrete video card(SM750 or AST1400) is mounted into the mini PCIe slot of my ASRock AD2550B-ITX board, the gma500 drivers fails to work. It probably because the UEFI firmware of that board forget to initialize the PSB_PGETBL_CTL reg, therefore the value of dev_priv->pge_ctl is 0, then the value of gtt_phys_start is also 0. On normal case, the value of the dev_priv->stolen_base is 0xbf800000 for this board, so the value of the vram_stolen_size will be negative in this case, the calculation of the stolen vram size of drm/gma500 is pasted at below: vram_stolen_size = pg->gtt_phys_start - dev_priv->stolen_base - PAGE_SIZE; = 0 - 0xbf800000 - 4096 = 1056764 KiB Which is so large, so this cause the ioremap_wc() fail, see below dmesg for more information. gma500 0000:00:02.0: enabling device (0000 -> 0003) gma500 0000:00:02.0: GPU: power management timed out. gma500 0000:00:02.0: [drm] Phys start of GTT: 0x0 gma500 0000:00:02.0: [drm] Stolen memory base 0xbf800000, size 1056764KiB x86/PAT: systemd-udevd:386 conflicting memory types bf800000-fffff000 write-combining<->uncached-minus x86/PAT: memtype_reserve failed [mem 0xbf800000-0xffffefff], track write-combining, req write-combining ioremap memtype_reserve failed -16 gma500 0000:00:02.0: Failure to map stolen base. gma500: probe of 0000:00:02.0 failed with error -12 Regardless, we want this driver works even there have another video card mounted. This patch solve this problem by given 8M stolen memory if the value of pg->gtt_phys_start is zero. And after apply this patch, it works fine. $ dmesg | grep drm gma500 0000:00:02.0: [drm] Phys start of GTT: 0x0 gma500 0000:00:02.0: [drm] Stolen memory base 0xbf800000, size 8192KiB [drm] Initialized gma500 1.0.0 20140314 for 0000:00:02.0 on minor 0 gma500 0000:00:02.0: [drm] fb1: gma500drmfb frame buffer device Sui Jingfeng (3): drm/gma500: Print the stolen memory base and size with drm_info() drm/gma500: Print the start address of the GTT drm/gma500: Fix the failure to map the stolen memory drivers/gpu/drm/gma500/gem.c | 10 +++++++--- drivers/gpu/drm/gma500/gtt.c | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) base-commit: bb585492db95d4cc7fe3797523ed2bbf5c621d37