From: Sui Jingfeng <sui.jingfeng@linux.dev>
To: Alex Deucher <alexdeucher@gmail.com>,
suijingfeng <suijingfeng@loongson.cn>
Cc: "Christian König" <christian.koenig@amd.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
amd-gfx@lists.freedesktop.org, linux-pci@vger.kernel.org,
"Alex Deucher" <alexander.deucher@amd.com>,
"Alex Williamson" <alex.williamson@redhat.com>
Subject: Re: [RFC,drm-misc-next v4 3/9] drm/radeon: Implement .be_primary() callback
Date: Thu, 7 Sep 2023 09:40:15 +0800 [thread overview]
Message-ID: <2da16c01-260b-365d-4651-91d9172e5ed8@linux.dev> (raw)
In-Reply-To: <CADnq5_OYPha5cGF+tSj4fvSmf-6tObzNSe2__nG-SbjX6v_2vw@mail.gmail.com>
On 2023/9/7 00:00, Alex Deucher wrote:
> On Tue, Sep 5, 2023 at 1:25 PM suijingfeng <suijingfeng@loongson.cn> wrote:
>> Hi,
>>
>>
>> On 2023/9/5 13:50, Christian König wrote:
>>> Am 04.09.23 um 21:57 schrieb Sui Jingfeng:
>>>> 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.
>>> Question is why is that useful? Should we give users the ability to
>>> control that?
>>>
>>> I don't see an use case for this.
>>>
>> On a specific machine with multiple GPUs mounted, only the
>> primary graphics get POST-ed (initialized) by the firmware.
>> Therefore the DRM drivers for the rest video cards have to
>> work without the prerequisite setups done by firmware, This
>> is called as POST.
> I think that should be regarded as a bug in the driver that should be
> fixed and this would not help with that case. If a driver can't
> initialize a device without aid from the pre-OS environment, that
> should be fixed in the driver. This solution also doesn't fix which
> device is selected as the primary by the pre-OS environment. That can
> only be fixed in the pre-OS environment code.
>
>> One of the use cases is to test if a specific DRM driver
>> would works properly, under the circumstance of not being
>> POST-ed, The ast drm driver is the first one which refused
>> to work if not being POST-ed by the firmware.
>>
>> Before apply this series, I was unable make drm/ast as the
>> primary video card easily. The problem is that on a multiple
>> video card configuration, the monitor connected with my
>> AST2400 card not light up. While confusing, a naive programmer
>> may suspect the PRIME is not working.
>>
>> After applied this series and passing ast.modeset=10 on the
>> kernel cmd line, I found that the monitor connected with my
>> ast2400 video card still black, It doesn't display and It
>> doesn't show image to me.
> The problem with adding modeset=10 is that it only helps when you have
> one GPU driven by that driver in the system. If you have multiple
> GPUs driven by that driver, which one would that apply to? E.g., what
> if you have 2 AMD GPUs in the system.
>
>> While in the process of study drm/ast, I know that drm/ast
>> driver has the POST code shipped, See the ast_post_gpu() function.
>> Then, I was wondering why this function doesn't works.
>>
>> After a short-time (hasty) debugging, I found that the ast_post_gpu()
>> function didn't get run. Because it have something to do with the
>> ast->config_mode. Without thinking too much, I hardcoded the
>> ast->config_mode as ast_use_p2a, the key point is to force the
>> ast_post_gpu() function to run.
>>
>>
>> ```
>>
>> --- a/drivers/gpu/drm/ast/ast_main.c
>> +++ b/drivers/gpu/drm/ast/ast_main.c
>> @@ -132,6 +132,8 @@ static int ast_device_config_init(struct ast_device
>> *ast)
>> }
>> }
>>
>> + ast->config_mode = ast_use_p2a;
>> +
>> switch (ast->config_mode) {
>> case ast_use_defaults:
>> drm_info(dev, "Using default configuration\n");
>>
>> ```
>>
>> Then, the monitor light up, it display the Ubuntu greeter to me. Therefore
>> my patch is useful, at least for the Linux drm driver tester and developer.
>> It allow programmers to test the specific part of a specific driver without
>> changing a line of the source code and without the need of sudo authority.
>>
>> It improves the efficiency of the testing and patch verification. I know
>> the PrimaryGPU option of Xorg conf, but this approach will remember the
>> setup have been made, you need modify it with root authority each time
>> you want to switch the primary. But on the process of rapid developing
>> and/or testing for multiple video drivers, with only one computer hardware
>> resource available. What we really want is a one-shot command, as provided
>> by this series. So, this is the first use case.
>>
>>
>> The second use case is that sometime the firmware is not reliable.
>> While there are thousands of ARM64, PowerPC and Mips servers machine,
>> Most of them don't have a good UEFI firmware support. I haven't test the
>> drm/amdgpu and drm/radeon at my ARM64 server yet. Because this ARM64
>> server always use the platform(BMC) integrated display controller as primary.
>> The UEFI firmware of it does not provide options menu to tune.
>> So, for the first time, the discrete card because useless, despite more powerful.
>> I will take time to carry on the testing, so I will be able to tell more
>> in the future.
>>
>>
>> Even on X86, when select the PEG as primary on the UEFI BIOS menu.
>> There is no way to tell the bios which one of my three
>> discrete video be the primary. Not to mention some old UEFI
>> firmware, which doesn't provide a setting at all.
>> While the benefit of my approach is the flexibility.
>> Yes the i915, amdgpu and radeon are good quality,
>> but there may have programmers want to try nouveau.
>>
>>
>> The third use case is that VGAARB is also not reliable, It will
>> select a wrong device as primary. Especially on Arm64, Loongarch
>> and mips arch etc. And the X server will use this wrong device
>> as primary and completely crash there. Either because of lacking
>> a driver or the driver has a bug which can not bear the graphic
>> environment up. VGAARB is firmware dependent.
>> My patch provide a temporary method to rescue.
>>
> It sounds like we need a general purpose "primary" selector. I think
> it's sort of orthogonal to VGA. VGAARB is just for managing VGA
> routing on PCI. It's not really directly related to which GPU you
> want to be the primary when the OS loads. Maybe some new kernel
> parameter, E.g., primary_display=<string> where the string would be
> the specific device you wanted to be the primary, E.g., you could use
> the PCI BDF on PCI devices, primary_display=0000:0a:00.0 or some other
> device string for non-PCI devices.
Indeed, thanks for you give the right direction.
Bjorn and Willianson also told me something similar,
but I didn't realized until today.
historically, VGAARB is only for managing VGA compatible device.
For legacy BIOS environment, the routing related to this need to handled.
I didn't realized those technique point by the time this series is sending.
Beside this, It not uncommon that a specific machine ship multiple identical
GPUs models Or GPUs from the same company (likely a integrated one and a discrete one)
My naive approach in v4 cannot solve complex problems like this.
I will try to solve this problems and concerns at the next version.
Thanks.
> Alex
next prev parent reply other threads:[~2023-09-07 1:40 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-04 19:57 [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 ` [RFC,drm-misc-next v4 1/9] " Sui Jingfeng
2023-09-04 19:57 ` [RFC,drm-misc-next v4 2/9] drm/nouveau: Implement .be_primary() callback Sui Jingfeng
2023-09-04 19:57 ` [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 [this message]
2023-09-04 19:57 ` [RFC,drm-misc-next v4 4/9] drm/amdgpu: " Sui Jingfeng
2023-09-04 19:57 ` [RFC,drm-misc-next v4 5/9] drm/i915: " Sui Jingfeng
2023-09-04 19:57 ` [RFC,drm-misc-next v4 6/9] drm/loongson: " Sui Jingfeng
2023-09-04 19:57 ` [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 ` [RFC,drm-misc-next v4 8/9] drm/hibmc: " Sui Jingfeng
2023-09-04 19:57 ` [RFC,drm-misc-next v4 9/9] drm/gma500: " Sui Jingfeng
2023-09-05 10:38 ` [RFC, drm-misc-next v4 0/9] PCI/VGA: Allowing the user to select the primary video adapter at boot time Jani Nikula
2023-09-05 13:28 ` Christian König
2023-09-05 14:28 ` Sui Jingfeng
2023-09-06 6:47 ` Christian König
2023-09-05 10:45 ` [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 ` 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
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=2da16c01-260b-365d-4651-91d9172e5ed8@linux.dev \
--to=sui.jingfeng@linux.dev \
--cc=alex.williamson@redhat.com \
--cc=alexander.deucher@amd.com \
--cc=alexdeucher@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.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=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;
as well as URLs for NNTP newsgroup(s).