From patchwork Mon May 29 15:45:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng X-Patchwork-Id: 13258737 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 9B914C77B7A for ; Mon, 29 May 2023 15:45:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B0EFB10E22D; Mon, 29 May 2023 15:45:21 +0000 (UTC) Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by gabe.freedesktop.org (Postfix) with ESMTP id CA8E910E280 for ; Mon, 29 May 2023 15:45:08 +0000 (UTC) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8Bx1fCByHRkdkUCAA--.5268S3; Mon, 29 May 2023 23:45:06 +0800 (CST) Received: from openarena.loongson.cn (unknown [10.20.42.43]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxGLaAyHRk2yd_AA--.10807S2; Mon, 29 May 2023 23:45:05 +0800 (CST) From: Sui Jingfeng To: Bjorn Helgaas Subject: [PATCH] pci/vgaarb: make vga_is_firmware_default() arch independent Date: Mon, 29 May 2023 23:45:04 +0800 Message-Id: <20230529154504.2117953-1-suijingfeng@loongson.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxGLaAyHRk2yd_AA--.10807S2 X-CM-SenderInfo: xvxlyxpqjiv03j6o00pqjv00gofq/ X-Coremail-Antispam: 1Uk129KBjvJXoW7Kw4xGw4xWr1fGr1rJw48Xrb_yoW8ZryrpF ZYyFWrCF4kWF4FkrW2q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Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: loongson-kernel@lists.loongnix.cn, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Li Yi Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The vga_is_firmware_default() function will work on non-x86 architectures as long as the arch has UEFI GOP support, which passes the firmware framebuffer base address and size. This patch makes the vga_is_firmware_default() function arch-independent. This could help the VGAARB subsystem make the right choice for multiple GPU systems. Usually an integrated one and a discrete one for desktop computers. Depending on the firmware framebuffer being put into which GPU's VRAM, VGAARB could inherit the firmware's choice, which in turn, is the exact choice of the user. Signed-off-by: Sui Jingfeng --- drivers/pci/vgaarb.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 5a696078b382..f81b6c54e327 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -61,7 +61,6 @@ static bool vga_arbiter_used; static DEFINE_SPINLOCK(vga_lock); static DECLARE_WAIT_QUEUE_HEAD(vga_wait_queue); - static const char *vga_iostate_to_str(unsigned int iostate) { /* Ignore VGA_RSRC_IO and VGA_RSRC_MEM */ @@ -545,7 +544,6 @@ EXPORT_SYMBOL(vga_put); static bool vga_is_firmware_default(struct pci_dev *pdev) { -#if defined(CONFIG_X86) || defined(CONFIG_IA64) u64 base = screen_info.lfb_base; u64 size = screen_info.lfb_size; struct resource *r; @@ -571,7 +569,7 @@ static bool vga_is_firmware_default(struct pci_dev *pdev) return true; } -#endif + return false; } @@ -865,8 +863,7 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev) } /* this is called with the lock */ -static inline void vga_update_device_decodes(struct vga_device *vgadev, - int new_decodes) +static void vga_update_device_decodes(struct vga_device *vgadev, int new_decodes) { struct device *dev = &vgadev->pdev->dev; int old_decodes, decodes_removed, decodes_unlocked;