Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp250092rwd; Mon, 12 Jun 2023 12:59:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ56WegUZYR4hLd920wxwVWUOzVp3vnU6oDD8U3COgf6p+vUkvxxUp4bYLk0qihUaTCAxh5G X-Received: by 2002:a17:907:368d:b0:961:78c2:1d27 with SMTP id bi13-20020a170907368d00b0096178c21d27mr11787109ejc.19.1686599973947; Mon, 12 Jun 2023 12:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686599973; cv=none; d=google.com; s=arc-20160816; b=rsalR2u4av+rCsQ/SM9S6RPOj6ox55xKRlL+CqusBg6K2tyipAtNXACtnqjQFn27r7 dVoH5PfF3h2Sqr9soEdfBnGlgdwD2bEmnPf9BdHcuZpFLJVoxmCbPeXVd7Q3efRh1te0 MLJPHiqxheV0Fq0ASmZJLiHsHt20Bqz8fvGTp1akCF8We/uxWS7ryC+Amb9PyeLC7OQB fCvxe7HOn+it5fC+9soyUFkOLnIXoBd1kUBnHCq7aqpDJbavhh0HsP2mwXarCto37LU2 Dtb2hGpnHLHEo7l54tvr40Ps+g+29+U7mw61Mx2R2yOvG/xIOkXJ4XE+mHE/8lDGxk8/ d4BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:sender:hmm_source_type :hmm_attache_num:hmm_source_ip; bh=pxpXDSIVD+pG4q56yzx1JrJ6OddlUc0lQ/9SGG9gJnY=; b=CoWBdk7wBJnZauE8gPSPHz6KI6H2i5XWE1iJPII0z2Usuxheb4BwMlMrzZSJsW0eI/ o+z3eyJUfSUKozXMx7CoF5d91c+MvFLZwzonKX4d11t1i/4AKci/6mwWb3iiS9S+bGgP E2SlYTvfdunBn14T92HhOgAkzBZuTQZqO6qZg0HVfSNXMLWIeIG6xuzpcQQODShoWvI1 zBXRRfzqWy0xkSd+5Wheiz/D4KkH8NueWkabSisPduwNKF/XJY3nT2AV+qUsVGi08RDy tSanK9siX1Uy8QJVop0wlzAZ6R2NZTkQygo12vQF3e3rIkbLoTqFmZ8b8x1dvonDAiKT EsLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u7-20020a170906408700b009789b55c1ecsi2091925ejj.153.2023.06.12.12.58.39; Mon, 12 Jun 2023 12:59:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235968AbjFLT0C (ORCPT + 99 others); Mon, 12 Jun 2023 15:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230466AbjFLT0A (ORCPT ); Mon, 12 Jun 2023 15:26:00 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E86ADB1; Mon, 12 Jun 2023 12:25:57 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.41:42778.1249123675 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id E55DE1001B5; Tue, 13 Jun 2023 03:25:52 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-75648544bd-xwndj with ESMTP id c3854781d6844409b550d5c2521a5b02 for alexander.deucher@amd.com; Tue, 13 Jun 2023 03:25:55 CST X-Transaction-ID: c3854781d6844409b550d5c2521a5b02 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn From: Sui Jingfeng <15330273260@189.cn> To: Alex Deucher , Christian Konig , Pan Xinhui , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Ben Skeggs , Karol Herbst , Lyude Paul , Bjorn Helgaas , Alex Williamson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Hawking Zhang , Mario Limonciello , Lijo Lazar , YiPeng Chai , Andrey Grodzovsky , Somalapuram Amaranath , Bokun Zhang , Ville Syrjala , Li Yi , Sui Jingfeng , Jason Gunthorpe , Kevin Tian , Cornelia Huck , Yishai Hadas , Abhishek Sahu , Yi Liu Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-pci@vger.kernel.org, kvm@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH v6 0/8] PCI/VGA: introduce is_boot_device function callback to vga_client_register Date: Tue, 13 Jun 2023 03:25:42 +0800 Message-Id: <20230612192550.197053-1-15330273260@189.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FROM_LOCAL_DIGITS, FROM_LOCAL_HEX,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sui Jingfeng The vga_is_firmware_default() function is arch-dependent, it's probably wrong if we simply remove the arch guard. As the VRAM BAR which contains firmware framebuffer may move, while the lfb_base and lfb_size members of the screen_info does not change accordingly. In short, it should take the re-allocation of the PCI BAR into consideration. With the observation that device drivers or video aperture helpers may have better knowledge about which PCI bar contains the firmware fb, which could avoid the need to iterate all of the PCI BARs. But as a PCI function at pci/vgaarb.c, vga_is_firmware_default() is not suitable to make such an optimization since it is loaded too early. There are PCI display controllers that don't have a dedicated VRAM bar, this function will lose its effectiveness in such a case. Luckily, the device driver can provide an accurate workaround. Therefore, this patch introduces a callback that allows the device driver to tell the VGAARB if the device is the default boot device. Also honor the comment: "Clients have two callback mechanisms they can use" Sui Jingfeng (8): PCI/VGA: Use unsigned type for the io_state variable PCI/VGA: Deal only with VGA class devices PCI/VGA: Tidy up the code and comment format PCI/VGA: Replace full MIT license text with SPDX identifier video/aperture: Add a helper to detect if an aperture contains firmware FB PCI/VGA: Introduce is_boot_device function callback to vga_client_register drm/amdgpu: Implement the is_boot_device callback function drm/radeon: Implement the is_boot_device callback function drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 12 +- drivers/gpu/drm/drm_aperture.c | 16 +++ drivers/gpu/drm/i915/display/intel_vga.c | 3 +- drivers/gpu/drm/nouveau/nouveau_vga.c | 2 +- drivers/gpu/drm/radeon/radeon_device.c | 12 +- drivers/pci/vgaarb.c | 153 +++++++++++++-------- drivers/vfio/pci/vfio_pci_core.c | 2 +- drivers/video/aperture.c | 29 ++++ include/drm/drm_aperture.h | 2 + include/linux/aperture.h | 7 + include/linux/vgaarb.h | 35 ++--- 11 files changed, 184 insertions(+), 89 deletions(-) -- 2.25.1