Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Sui Jingfeng <sui.jingfeng@linux.dev>,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: Sui Jingfeng <suijingfeng@loongson.cn>,
	nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org
Subject: Re: [Intel-gfx] [RFC, drm-misc-next v4 0/9] PCI/VGA: Allowing the user to select the primary video adapter at boot time
Date: Tue, 05 Sep 2023 13:38:39 +0300	[thread overview]
Message-ID: <874jk8j45s.fsf@intel.com> (raw)
In-Reply-To: <20230904195724.633404-1-sui.jingfeng@linux.dev>

On Tue, 05 Sep 2023, Sui Jingfeng <sui.jingfeng@linux.dev> wrote:
> From: Sui Jingfeng <suijingfeng@loongson.cn>
>
> On a machine with multiple GPUs, a Linux user has no control over which
> one is primary at boot time. This series tries to solve above mentioned
> problem by introduced the ->be_primary() function stub. The specific
> device drivers can provide an implementation to hook up with this stub by
> calling the vga_client_register() function.
>
> Once the driver bound the device successfully, VGAARB will call back to
> the device driver. To query if the device drivers want to be primary or
> not. Device drivers can just pass NULL if have no such needs.
>
> Please note that:
>
> 1) The ARM64, Loongarch, Mips servers have a lot PCIe slot, and I would
>    like to mount at least three video cards.
>
> 2) Typically, those non-86 machines don't have a good UEFI firmware
>    support, which doesn't support select primary GPU as firmware stage.
>    Even on x86, there are old UEFI firmwares which already made undesired
>    decision for you.
>
> 3) This series is attempt to solve the remain problems at the driver level,
>    while another series[1] of me is target to solve the majority of the
>    problems at device level.
>
> Tested (limited) on x86 with four video card mounted, Intel UHD Graphics
> 630 is the default boot VGA, successfully override by ast2400 with
> ast.modeset=10 append at the kernel cmd line.

The value 10 is incredibly arbitrary, and multiplied as a magic number
all over the place.

> $ lspci | grep VGA
>
>  00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-S GT2 [UHD Graphics 630]
>  01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Caicos XTX [Radeon HD 8490 / R5 235X OEM]
>  04:00.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 30)
>  05:00.0 VGA compatible controller: NVIDIA Corporation GK208B [GeForce GT 720] (rev a1)

In this example, all of the GPUs are driven by different drivers. What
good does a module parameter do if you have multiple GPUs of the same
model, all driven by the same driver module?

BR,
Jani.

>
> $ sudo dmesg | grep vgaarb
>
>  pci 0000:00:02.0: vgaarb: setting as boot VGA device
>  pci 0000:00:02.0: vgaarb: VGA device added: decodes=io+mem,owns=io+mem,locks=none
>  pci 0000:01:00.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
>  pci 0000:04:00.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
>  pci 0000:05:00.0: vgaarb: VGA device added: decodes=io+mem,owns=none,locks=none
>  vgaarb: loaded
>  ast 0000:04:00.0: vgaarb: Override as primary by driver
>  i915 0000:00:02.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=io+mem
>  radeon 0000:01:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
>  ast 0000:04:00.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=none:owns=none
>
> v2:
> 	* Add a simple implemment for drm/i915 and drm/ast
> 	* Pick up all tags (Mario)
> v3:
> 	* Fix a mistake for drm/i915 implement
> 	* Fix patch can not be applied problem because of merge conflect.
> v4:
> 	* Focus on solve the real problem.
>
> v1,v2 at https://patchwork.freedesktop.org/series/120059/
>    v3 at https://patchwork.freedesktop.org/series/120562/
>
> [1] https://patchwork.freedesktop.org/series/122845/
>
> Sui Jingfeng (9):
>   PCI/VGA: Allowing the user to select the primary video adapter at boot
>     time
>   drm/nouveau: Implement .be_primary() callback
>   drm/radeon: Implement .be_primary() callback
>   drm/amdgpu: Implement .be_primary() callback
>   drm/i915: Implement .be_primary() callback
>   drm/loongson: Implement .be_primary() callback
>   drm/ast: Register as a VGA client by calling vga_client_register()
>   drm/hibmc: Register as a VGA client by calling vga_client_register()
>   drm/gma500: Register as a VGA client by calling vga_client_register()
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    | 11 +++-
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c       | 13 ++++-
>  drivers/gpu/drm/ast/ast_drv.c                 | 31 ++++++++++
>  drivers/gpu/drm/gma500/psb_drv.c              | 57 ++++++++++++++++++-
>  .../gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c   | 15 +++++
>  drivers/gpu/drm/i915/display/intel_vga.c      | 15 ++++-
>  drivers/gpu/drm/loongson/loongson_module.c    |  2 +-
>  drivers/gpu/drm/loongson/loongson_module.h    |  1 +
>  drivers/gpu/drm/loongson/lsdc_drv.c           | 10 +++-
>  drivers/gpu/drm/nouveau/nouveau_vga.c         | 11 +++-
>  drivers/gpu/drm/radeon/radeon_device.c        | 10 +++-
>  drivers/pci/vgaarb.c                          | 43 ++++++++++++--
>  drivers/vfio/pci/vfio_pci_core.c              |  2 +-
>  include/linux/vgaarb.h                        |  8 ++-
>  14 files changed, 210 insertions(+), 19 deletions(-)

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2023-09-05 10:38 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04 19:57 [Intel-gfx] [RFC, drm-misc-next v4 0/9] PCI/VGA: Allowing the user to select the primary video adapter at boot time Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 1/9] " Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 2/9] drm/nouveau: Implement .be_primary() callback Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 3/9] drm/radeon: " Sui Jingfeng
2023-09-05  5:50   ` Christian König
2023-09-05 17:24     ` suijingfeng
2023-09-06 16:00       ` Alex Deucher
2023-09-07  1:40         ` Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 4/9] drm/amdgpu: " Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 5/9] drm/i915: " Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 6/9] drm/loongson: " Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 7/9] drm/ast: Register as a VGA client by calling vga_client_register() Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 8/9] drm/hibmc: " Sui Jingfeng
2023-09-04 19:57 ` [Intel-gfx] [RFC, drm-misc-next v4 9/9] drm/gma500: " Sui Jingfeng
2023-09-04 20:36 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for PCI/VGA: Allowing the user to select the primary video adapter at boot time Patchwork
2023-09-04 20:54 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-09-04 22:14 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2023-09-05 10:38 ` Jani Nikula [this message]
2023-09-05 13:28   ` [Intel-gfx] [RFC, drm-misc-next v4 0/9] " Christian König
2023-09-05 14:28     ` Sui Jingfeng
2023-09-06  6:47       ` Christian König
2023-09-05 10:45 ` [Intel-gfx] [Nouveau] " Thomas Zimmermann
2023-09-05 13:30   ` suijingfeng
2023-09-05 15:05     ` Thomas Zimmermann
2023-09-06  2:14       ` suijingfeng
2023-09-06  7:00         ` Thomas Zimmermann
2023-09-06  2:34       ` suijingfeng
2023-09-06  7:18         ` Thomas Zimmermann
2023-09-06  3:08       ` suijingfeng
2023-09-06  7:46         ` Thomas Zimmermann
2023-09-06  4:14       ` Sui Jingfeng
2023-09-06  6:45     ` Christian König
2023-09-06  9:08       ` suijingfeng
2023-09-06  9:40         ` Christian König
2023-09-07  2:30           ` Sui Jingfeng
2023-09-07  9:08             ` Christian König
2023-09-07 12:32               ` suijingfeng
2023-09-07 12:43                 ` Christian König
2023-09-07 15:26                   ` suijingfeng
2023-09-07 15:32                     ` Christian König
2023-09-07 16:33               ` suijingfeng
2023-09-08  6:59                 ` Christian König
2023-09-06 10:31       ` Sui Jingfeng
2023-09-06 10:50         ` Christian König
2023-09-05 10:49 ` Thomas Zimmermann
2023-09-05 15:59   ` suijingfeng
2023-09-06  8:05     ` Thomas Zimmermann
2023-09-06  9:48       ` suijingfeng
2023-09-06 11:06         ` Thomas Zimmermann
2023-09-07  9:43         ` Jani Nikula
2023-09-05 14:52 ` [Intel-gfx] " Alex Williamson
2023-09-05 16:21   ` suijingfeng
2023-09-05 16:39     ` Alex Williamson
2023-09-06  3:51   ` Sui Jingfeng
2023-09-06 19:29     ` Alex Williamson
2023-09-06  0:52 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for PCI/VGA: Allowing the user to select the primary video adapter at boot time (rev2) Patchwork

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=874jk8j45s.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=bhelgaas@google.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=sui.jingfeng@linux.dev \
    --cc=suijingfeng@loongson.cn \
    /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