Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp625108rwd; Mon, 12 Jun 2023 20:13:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5nskg0Qgg9ENUr2PL3AJQ6X5oXwbZIXdfOCr/vfGM2DdqizpF+gEfQ2iJqZw537l7efl+s X-Received: by 2002:a05:6402:1a27:b0:514:8eb3:8bf6 with SMTP id be7-20020a0564021a2700b005148eb38bf6mr7162125edb.35.1686626021103; Mon, 12 Jun 2023 20:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686626021; cv=none; d=google.com; s=arc-20160816; b=pukTDdRp1ATAle4QRBljwc84UVSXKJVyevi8ZkOFmF+LkViVqpb1+f/B8n+1qS9n3G 8bVr9zFm3P6ZIQi94ClO85CsYD7WxGbcphf5vC61fKsYAZfUp9jHMeFwNcucuID4XaqY hScrdWkcQGhuF0t3ndM3HQMbi6UzBK3H0Abuyl2uKsxpBWWYMpwzCaZMKwgu2+1QKPE7 b8GxrQecWBQhr71wqLANETVZpfoILFQ9Yvv70MnzETnOkWjkcur9fcldxoZqtZgbguj9 irg5Mx2w6xqHCno9lETn3F/8x/iemRQ9pMAP3xZ3ot2XfILpJ8aoJ2rAv+m6EpPxwta9 fZEg== 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=pbIMea7cuacsZy/JzziAe3K7B9vojJKzx4C88oE87bE=; b=N/lEs4gZP+ueMmZG/oPLDcxpqDOM9DCI6UabB2ifHdEwkcJRPbbKZ5CmlXjxx8aCk9 BOe9ql/7N0wI5T67jix01TJPcXuWoN4NEBLyeD2OmI5tbLoD0B8RQIdOeV//K2Y0kxPI FtgkgYGWK/5Rd1xv2wxEK/dZtAVIqMwRlEXigGfFc7jm02P4raWmj11WFzqoh7WJ6EiB KtMBQmtMbD9Ixr2HAqWTQIijBGR4+77HQr0K/JJXyb9MYX6wwWXA03Zsogp+oH2AE9d2 jA0lDvlX1QPf6XgyN3ViG3MVFEsesAWWzkjtKxv1rOWu7BmyvZKAo1qCKg9J6PozUAwx iJvw== 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 ba8-20020a0564021ac800b00514911f9e5fsi6688021edb.242.2023.06.12.20.13.16; Mon, 12 Jun 2023 20:13:41 -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 S239370AbjFMDEG (ORCPT + 99 others); Mon, 12 Jun 2023 23:04:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239650AbjFMDDp (ORCPT ); Mon, 12 Jun 2023 23:03:45 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5E8433AA9; Mon, 12 Jun 2023 20:02:27 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.43:47948.1267835893 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.43]) by 189.cn (HERMES) with SMTP id CFD121002CE; Tue, 13 Jun 2023 11:01:53 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-75648544bd-7vx9t with ESMTP id 959ce8b3422a4ec298e3af6accf345e8 for bhelgaas@google.com; Tue, 13 Jun 2023 11:01:54 CST X-Transaction-ID: 959ce8b3422a4ec298e3af6accf345e8 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: Bjorn Helgaas 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, linux-fbdev@vger.kernel.org Subject: [PATCH v7 0/8] PCI/VGA: Introduce is_boot_device function callback to vga_client_register Date: Tue, 13 Jun 2023 11:01:43 +0800 Message-Id: <20230613030151.216625-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 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