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>,
Lyude Paul <lyude@redhat.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Mario Limonciello <mario.limonciello@amd.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>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Subject: [PATCH v2 5/6] drm/i915: Implement the is_boot_device callback function
Date: Mon, 3 Jul 2023 02:27:43 +0800 [thread overview]
Message-ID: <20230702182744.755467-6-sui.jingfeng@linux.dev> (raw)
In-Reply-To: <20230702182744.755467-1-sui.jingfeng@linux.dev>
From: Sui Jingfeng <suijingfeng@loongson.cn>
This patch add a function to identify if a device is the default boot
selected by the firmware, it require the GPU has firmware framebuffer
driver support (such as efifb). If a specific hardware doesn't have
firmware framebuffer support, then the introduced function will just
return false. But even in this case, it still do no harms.
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Lyude Paul <lyude@redhat.com>
Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
---
drivers/gpu/drm/i915/display/intel_vga.c | 31 +++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/display/intel_vga.c b/drivers/gpu/drm/i915/display/intel_vga.c
index 98d7d4dffe9f..7a0ba677c932 100644
--- a/drivers/gpu/drm/i915/display/intel_vga.c
+++ b/drivers/gpu/drm/i915/display/intel_vga.c
@@ -6,6 +6,8 @@
#include <linux/pci.h>
#include <linux/vgaarb.h>
+#include <drm/drm_aperture.h>
+
#include <video/vga.h>
#include "soc/intel_gmch.h"
@@ -113,6 +115,32 @@ intel_vga_set_decode(struct pci_dev *pdev, bool enable_decode)
return VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM;
}
+static bool intel_vga_is_default_boot_device(struct pci_dev *pdev)
+{
+ struct drm_i915_private *i915 = pdev_to_i915(pdev);
+ struct drm_device *drm = &i915->drm;
+ struct i915_gem_mm *mm = &i915->mm;
+ struct intel_memory_region *mr;
+ unsigned int i;
+ bool ret;
+
+ for (i = 0; i < ARRAY_SIZE(mm->regions); i++) {
+ mr = mm->regions[i];
+ if (mr) {
+ ret = drm_aperture_contain_firmware_fb(mr->io_start,
+ mr->io_size);
+
+ if (ret) {
+ drm_dbg(drm, "%s contains firmware fb\n",
+ mr->name);
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
int intel_vga_register(struct drm_i915_private *i915)
{
struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
@@ -126,7 +154,8 @@ int intel_vga_register(struct drm_i915_private *i915)
* then we do not take part in VGA arbitration and the
* vga_client_register() fails with -ENODEV.
*/
- ret = vga_client_register(pdev, intel_vga_set_decode, NULL);
+ ret = vga_client_register(pdev, intel_vga_set_decode,
+ intel_vga_is_default_boot_device);
if (ret && ret != -ENODEV)
return ret;
--
2.25.1
next prev parent reply other threads:[~2023-07-02 18:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-02 18:27 [PATCH v2 0/6] PCI/VGA: Improve the default VGA device selection Sui Jingfeng
2023-07-02 18:27 ` [PATCH v2 1/6] video/aperture: Add a helper to detect if an aperture contains firmware FB Sui Jingfeng
2023-07-02 18:27 ` [PATCH v2 2/6] PCI/VGA: Improve the default VGA device selection Sui Jingfeng
2023-07-02 18:27 ` [PATCH v2 3/6] drm/amdgpu: Implement the is_boot_device callback function Sui Jingfeng
2023-07-02 18:27 ` [PATCH v2 4/6] drm/radeon: " Sui Jingfeng
2023-07-02 18:27 ` Sui Jingfeng [this message]
2023-07-02 18:27 ` [PATCH v2 6/6] drm/ast: Register as a vga client to vgaarb by calling vga_client_register() Sui Jingfeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230702182744.755467-6-sui.jingfeng@linux.dev \
--to=sui.jingfeng@linux.dev \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bhelgaas@google.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=mario.limonciello@amd.com \
--cc=mripard@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=rodrigo.vivi@intel.com \
--cc=suijingfeng@loongson.cn \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=tzimmermann@suse.de \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).