[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230904195724.633404-4-sui.jingfeng@linux.dev>
Date: Tue, 5 Sep 2023 03:57:18 +0800
From: Sui Jingfeng <sui.jingfeng@...ux.dev>
To: Bjorn Helgaas <bhelgaas@...gle.com>
Cc: amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, intel-gfx@...ts.freedesktop.org,
nouveau@...ts.freedesktop.org, linux-pci@...r.kernel.org,
Sui Jingfeng <suijingfeng@...ngson.cn>,
Alex Deucher <alexander.deucher@....com>,
Christian Koenig <christian.koenig@....com>
Subject: [RFC,drm-misc-next v4 3/9] drm/radeon: Implement .be_primary() callback
From: Sui Jingfeng <suijingfeng@...ngson.cn>
On a machine with multiple GPUs, a Linux user has no control over which one
is primary at boot time. This patch tries to solve the mentioned problem by
implementing the .be_primary() callback. Pass radeon.modeset=10 on the
kernel cmd line if you really want the device bound by radeon to be the
primary video adapter, no matter what VGAARB say.
Cc: Alex Deucher <alexander.deucher@....com>
Cc: Christian Koenig <christian.koenig@....com>
Signed-off-by: Sui Jingfeng <suijingfeng@...ngson.cn>
---
drivers/gpu/drm/radeon/radeon_device.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 71f2ff39d6a1..b661cd3a8dc2 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -1263,6 +1263,14 @@ static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = {
.can_switch = radeon_switcheroo_can_switch,
};
+static bool radeon_want_to_be_primary(struct pci_dev *pdev)
+{
+ if (radeon_modeset == 10)
+ return true;
+
+ return false;
+}
+
/**
* radeon_device_init - initialize the driver
*
@@ -1425,7 +1433,7 @@ int radeon_device_init(struct radeon_device *rdev,
/* if we have > 1 VGA cards, then disable the radeon VGA resources */
/* this will fail for cards that aren't VGA class devices, just
* ignore it */
- vga_client_register(rdev->pdev, radeon_vga_set_decode, NULL);
+ vga_client_register(rdev->pdev, radeon_vga_set_decode, radeon_want_to_be_primary);
if (rdev->flags & RADEON_IS_PX)
runtime = true;
--
2.34.1
Powered by blists - more mailing lists