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: 13258731 X-Patchwork-Delegate: bhelgaas@google.com 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18113C7EE29 for ; Mon, 29 May 2023 15:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229558AbjE2PpO (ORCPT ); Mon, 29 May 2023 11:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjE2PpL (ORCPT ); Mon, 29 May 2023 11:45:11 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B0B7EC9; Mon, 29 May 2023 08:45:07 -0700 (PDT) Received: from loongson.cn (unknown [10.20.42.43]) by gateway (Coremail) with SMTP id _____8BxGvKByHRkeEUCAA--.5360S3; Mon, 29 May 2023 23:45:05 +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 Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, dri-devel@lists.freedesktop.org, Li Yi 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: AQ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r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr 1UYxBIdaVFxhVjvjDU0xZFpf9x07j0sjUUUUUU= Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org 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;