Message ID | 20230630110243.141671-1-sui.jingfeng@linux.dev |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10278613vqr; Fri, 30 Jun 2023 04:19:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ78bHdGULm6iTwVUlItjVl308g8UCnyOLdn2VEnaCpmoC3g+DCsagVTWkw1AnAuuDAJjmMI X-Received: by 2002:a05:6a20:9389:b0:121:637e:f0e5 with SMTP id x9-20020a056a20938900b00121637ef0e5mr8474448pzh.5.1688123964892; Fri, 30 Jun 2023 04:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688123964; cv=none; d=google.com; s=arc-20160816; b=q7+uaXyXcBtZzsuBw3fFbtKLfWNWhfMxyT62rBSB2FThQx0avPgpL/xgZhF5rljGfW bK2DCf9/SbYgsDWLFAXzKjhnSNZbSe6ecfHomDiLWoz1JfMBvpqwHTMaRxZpNVBRv+yL cd0LHKZm8bQtqX4dY9b1F1XngOldSgmIXikZ/Dbsu7/H9Ok4s6IdI2ptP5GEQVcc3eL2 1P79v0/rU62K/my4YcHZ2HaE9tY2MjqnF47LzZdS4LR2fGNRSwljOhY6hksCnC21l661 0D9HKb84W4mqHf8IUvOdJD49rF440U3oyyQd1x0APUjF6MxdFm+WP8yQWdsM/h7L7jzn 1yhg== 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:dkim-signature; bh=cVG0vYo3/T6AYLTc+lVhTKp0CFi2Q+EH9QFPQ8sIsCY=; fh=REIEntcELeOSCgth7PNVI0D2soInT9ankplTWWRgs+4=; b=0799Qcv/pmMzI0BBgl0p1lEUMTYoQYTqVAdf9QhGqG8X04GdtMoppYcT4VToMs4kub eDkPSHMe4kLza8r99HNC56CISDfhJyKT6KVTgyVMOgVB7qoQl5ITXMSh6aCQv/8dpm+G JyolaeF7W4oSp9PDcVAhz8NnokE0FhTIPsPjV/noCuy2+l93MltOcpQuwPTGW333E+la stzzjSLVuAH4bmaSJhTjfN4pi+1b/imlhKNoyOAS9zZkxdfLCdX3hv6soXBXHwCoHyaB lWO/DmeEk3NInC5xrrEa6Pd70iOadJW59GuActA14VzfPGoGBL4FwS1SWHfs0b+DR77z Qq0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=QJBgFt91; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x34-20020a634a22000000b0054ff42d3833si12629468pga.336.2023.06.30.04.19.12; Fri, 30 Jun 2023 04:19:24 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=QJBgFt91; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232665AbjF3LDs (ORCPT <rfc822;nicolai.engesland@gmail.com> + 99 others); Fri, 30 Jun 2023 07:03:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232477AbjF3LDT (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 30 Jun 2023 07:03:19 -0400 Received: from out-48.mta0.migadu.com (out-48.mta0.migadu.com [IPv6:2001:41d0:1004:224b::30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06435199B for <linux-kernel@vger.kernel.org>; Fri, 30 Jun 2023 04:02:52 -0700 (PDT) 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=1688122970; 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; bh=cVG0vYo3/T6AYLTc+lVhTKp0CFi2Q+EH9QFPQ8sIsCY=; b=QJBgFt91Udo2cXx8LVpCoBtf7Y4/HJOpcgBM5f7wsHRC7s8fn0Gq0+gjEx8Kdqa8vLzzux ImcisPtx/765642G+b1B9DPM0cwQmRH7G6DfBumi4NU28u+y6k1b891sHZhyldmWbhiRGW 1E3abKbe5vxdsoxrSChe7QJ6GbCbOoo= From: Sui Jingfeng <sui.jingfeng@linux.dev> To: Alex Deucher <alexander.deucher@amd.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Thomas Zimmermann <tzimmermann@suse.de>, Maxime Ripard <mripard@kernel.org>, Jani Nikula <jani.nikula@linux.intel.com> Cc: dri-devel@lists.freedesktop.org, amd-gfx@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, Sui Jingfeng <suijingfeng@loongson.cn> Subject: [PATCH v1 0/4] PCI/VGA: Improve the default VGA device selection Date: Fri, 30 Jun 2023 19:02:39 +0800 Message-Id: <20230630110243.141671-1-sui.jingfeng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770126271750393293?= X-GMAIL-MSGID: =?utf-8?q?1770126274220984077?= |
Series |
PCI/VGA: Improve the default VGA device selection
|
|
Message
Sui Jingfeng
June 30, 2023, 11:02 a.m. UTC
From: Sui Jingfeng <suijingfeng@loongson.cn>
Currently, the default VGA device selection is not perfect. Potential
problems are:
1) This function is a no-op on non-x86 architectures.
2) It does not take the PCI Bar may get relocated into consideration.
3) It is not effective for the PCI device without a dedicated VRAM Bar.
4) It is device-agnostic, thus it has to waste the effort to iterate all
of the PCI Bar to find the VRAM aperture.
5) It has invented lots of methods to determine which one is the default
boot device on a multiple video card coexistence system. But this is
still a policy because it doesn't give the user a choice to override.
With the observation that device drivers or video aperture helpers may
have better knowledge about which PCI bar contains the firmware FB,
This patch tries to solve the above problems by introducing a function
callback to the vga_client_register() function interface. DRM device
drivers for the PCI device need to register the is_boot_device() function
callback during the driver loading time. Once the driver binds the device
successfully, VRAARB will call back to the driver. This gives the device
drivers a chance to provide accurate boot device identification. Which in
turn unlock the abitration service to non-x86 architectures. A device
driver can also pass a NULL pointer to the keep the original behavior.
Sui Jingfeng (4):
video/aperture: Add a helper to detect if an aperture contains
firmware FB
PCI/VGA: Improve the default VGA device selection
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 | 21 +++++++++++++++-
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 | 8 +++---
11 files changed, 104 insertions(+), 10 deletions(-)