From patchwork Tue Jul 11 16:43:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13309123 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 0B9B3C0015E for ; Tue, 11 Jul 2023 16:53:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CDB4E10E3FF; Tue, 11 Jul 2023 16:53:34 +0000 (UTC) X-Greylist: delayed 604 seconds by postgrey-1.36 at gabe; Tue, 11 Jul 2023 16:53:32 UTC Received: from out-25.mta1.migadu.com (out-25.mta1.migadu.com [95.215.58.25]) by gabe.freedesktop.org (Postfix) with ESMTPS id 198D310E3FD for ; Tue, 11 Jul 2023 16:53:32 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689093837; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JsW608w9Icre+eeXWiPepSjKi7cGG5If1vSETO465rs=; b=QF9u5YarQ3XzlTFgOQ75cikl4e7GNbilk51J/EF5FT5P17CXSbsJhIZPn2v2xfDNiD3iPg OL2K7w14/U1uqKbPrZ+SREEjfjWxoRcLu+YoI4CCjBNUfs96b9Eb/rlpz4+aGHn7BvrvUg A5l4s7aCH2f1LJn0RlazEQQwuZEJWso= From: Sui Jingfeng To: David Airlie Subject: [PATCH v3 9/9] drm/loongson: Add an implement for the is_primary_gpu function callback Date: Wed, 12 Jul 2023 00:43:10 +0800 Message-Id: <20230711164310.791756-10-sui.jingfeng@linux.dev> In-Reply-To: <20230711164310.791756-1-sui.jingfeng@linux.dev> References: <20230711164310.791756-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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: linux-fbdev@vger.kernel.org, Sui Jingfeng , kvm@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sui Jingfeng Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/loongson/lsdc_drv.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/loongson/lsdc_drv.c b/drivers/gpu/drm/loongson/lsdc_drv.c index d10a28c2c494..92ef07d6a534 100644 --- a/drivers/gpu/drm/loongson/lsdc_drv.c +++ b/drivers/gpu/drm/loongson/lsdc_drv.c @@ -257,6 +257,14 @@ static unsigned int lsdc_vga_set_decode(struct pci_dev *pdev, bool state) return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM; } +static bool lsdc_is_primary_gpu(struct pci_dev *pdev) +{ + struct drm_device *ddev = pci_get_drvdata(pdev); + struct lsdc_device *ldev = to_lsdc(ddev); + + return drm_aperture_contain_firmware_fb(ldev->vram_base, ldev->vram_size); +} + static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { const struct lsdc_desc *descp; @@ -289,7 +297,7 @@ static int lsdc_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_set_drvdata(pdev, ddev); - vga_client_register(pdev, lsdc_vga_set_decode, NULL); + vga_client_register(pdev, lsdc_vga_set_decode, lsdc_is_primary_gpu); drm_kms_helper_poll_init(ddev);