From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F11C427FB38 for ; Wed, 18 Jun 2025 09:11:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750237892; cv=none; b=hHFFfqqidjO0qtsB3DYIYSbXKleiodr4ZgpCyIqlTGc78NVxQdcXdVugrUduLD34b+MndD2f2GvBkrgC5LwXhF0jCKkre4syFcXWcIuzhb2hbP9SXSJ8iCCBT8f3bq7i/XBZDCJ8A196g16xOgmWt2MO8EqfyXo9d20LAAYjLnQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750237892; c=relaxed/simple; bh=wtk9Ai6A4vr3BAnsawlLRuT9qb0f0DfvHt+JKai0XOM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=haug+jxOi/2L31GBEmaaD8P+JrwgXhr7WosMthotAMzcaCcWjGaFPGmhUi0lyW8252NNEyJ83AG4R0d2p8qlkB1ickH470jEkYsJ1i84en0AeYZgJFmx+hmYMu62LRjDJwCBLNtuL9kD1o4qeCN+SkvSrhYojZoLZSy46JoXvtY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=czm+tfj4; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=9GbG36Tq; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=czm+tfj4; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=9GbG36Tq; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="czm+tfj4"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="9GbG36Tq"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="czm+tfj4"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="9GbG36Tq" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 32F081F7BD; Wed, 18 Jun 2025 09:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1750237887; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=XT0YDbIFqwL77QwQbS95PqOFNQJH+g7ngu33WM22oqI=; b=czm+tfj4qEcbk1y9278iyA8JIwTcdAWy0PP7QzUM6WOP4PlAPtyj5Z9W9+7oVWtEpjHsz6 cslpoQwvp3p6QpxOjzVlyBQNvCzHTxT3772NKhnadvCE9ZMa2fY0rxl4vddA4c645nNGz/ BxDsQYf8t77jI+OBaU0AuXbt6AGrE2c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1750237887; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=XT0YDbIFqwL77QwQbS95PqOFNQJH+g7ngu33WM22oqI=; b=9GbG36TqynDLngDbg0YEC/YS256YOPztJ/n6TDCAJtaLScp5NZZfeujTEorKo1M75xjwtG 3ld2E3SVdU6ttJAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1750237887; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=XT0YDbIFqwL77QwQbS95PqOFNQJH+g7ngu33WM22oqI=; b=czm+tfj4qEcbk1y9278iyA8JIwTcdAWy0PP7QzUM6WOP4PlAPtyj5Z9W9+7oVWtEpjHsz6 cslpoQwvp3p6QpxOjzVlyBQNvCzHTxT3772NKhnadvCE9ZMa2fY0rxl4vddA4c645nNGz/ BxDsQYf8t77jI+OBaU0AuXbt6AGrE2c= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1750237887; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=XT0YDbIFqwL77QwQbS95PqOFNQJH+g7ngu33WM22oqI=; b=9GbG36TqynDLngDbg0YEC/YS256YOPztJ/n6TDCAJtaLScp5NZZfeujTEorKo1M75xjwtG 3ld2E3SVdU6ttJAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 8BF0613A3F; Wed, 18 Jun 2025 09:11:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id rtvwIL6CUmhIFgAAD6G6ig (envelope-from ); Wed, 18 Jun 2025 09:11:26 +0000 Message-ID: <4b4224b8-aa91-4f21-8425-2adf9a2b3d38@suse.de> Date: Wed, 18 Jun 2025 11:11:26 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 6/6] vgaarb: Look at all PCI display devices in VGA arbiter To: Mario Limonciello , Alex Williamson , David Airlie Cc: Bjorn Helgaas , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Jaroslav Kysela , Takashi Iwai , "open list:DRM DRIVERS" , open list , "open list:INTEL IOMMU (VT-d)" , "open list:PCI SUBSYSTEM" , "open list:VFIO DRIVER" , "open list:SOUND" , Daniel Dadap , Mario Limonciello References: <20250617175910.1640546-1-superm1@kernel.org> <20250617175910.1640546-7-superm1@kernel.org> <20250617132228.434adebf.alex.williamson@redhat.com> <08257531-c8e4-47b1-a5d1-1e67378ff129@kernel.org> Content-Language: en-US From: Thomas Zimmermann Autocrypt: addr=tzimmermann@suse.de; keydata= xsBNBFs50uABCADEHPidWt974CaxBVbrIBwqcq/WURinJ3+2WlIrKWspiP83vfZKaXhFYsdg XH47fDVbPPj+d6tQrw5lPQCyqjwrCPYnq3WlIBnGPJ4/jreTL6V+qfKRDlGLWFjZcsrPJGE0 BeB5BbqP5erN1qylK9i3gPoQjXGhpBpQYwRrEyQyjuvk+Ev0K1Jc5tVDeJAuau3TGNgah4Yc hdHm3bkPjz9EErV85RwvImQ1dptvx6s7xzwXTgGAsaYZsL8WCwDaTuqFa1d1jjlaxg6+tZsB 9GluwvIhSezPgnEmimZDkGnZRRSFiGP8yjqTjjWuf0bSj5rUnTGiyLyRZR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6VhFJA5hfn3T0TtrijKP4A SAQO9xD1Zk9/61JWk8OysuIh7MXkl0fxbRKWE93XeQBhIJHQfnc+YBLprdnxR446Sh8Wn/2D Ya8cavuWf2zrB6cZurs048xe0UbSW5AOSo4V9M0jzYI4nZqTmPxYyXbm30Kvmz0rYVRaitYJ 4kyYYMhuULvrJDMjZRvaNe52tkKAvMevcGdt38H4KSVXAylqyQOW5zvPc4/sq9c= In-Reply-To: <08257531-c8e4-47b1-a5d1-1e67378ff129@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Flag: NO X-Spam-Score: -4.30 X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_TO(0.00)[kernel.org,redhat.com,gmail.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_TWELVE(0.00)[25]; RCVD_TLS_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_DN_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email] X-Spam-Level: Hi Am 17.06.25 um 22:22 schrieb Mario Limonciello: > > > On 6/17/25 2:22 PM, Alex Williamson wrote: >> On Tue, 17 Jun 2025 12:59:10 -0500 >> Mario Limonciello wrote: >> >>> From: Mario Limonciello >>> >>> On a mobile system with an AMD integrated GPU + NVIDIA discrete GPU the >>> AMD GPU is not being selected by some desktop environments for any >>> rendering tasks. This is because neither GPU is being treated as >>> "boot_vga" but that is what some environments use to select a GPU [1]. >>> >>> The VGA arbiter driver only looks at devices that report as PCI display >>> VGA class devices. Neither GPU on the system is a PCI display VGA class >>> device: >>> >>> c5:00.0 3D controller: NVIDIA Corporation Device 2db9 (rev a1) >>> c6:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] >>> Device 150e (rev d1) >>> >>> If the GPUs were looked at the vga_is_firmware_default() function >>> actually >>> does do a good job at recognizing the case from the device used for the >>> firmware framebuffer. >>> >>> Modify the VGA arbiter code and matching sysfs file entries to >>> examine all >>> PCI display class devices. The existing logic stays the same. >>> >>> This will cause all GPUs to gain a `boot_vga` file, but the correct >>> device >>> (AMD GPU in this case) will now show `1` and the incorrect device >>> shows `0`. >>> Userspace then picks the right device as well. >>> >>> Link: >>> https://github.com/robherring/libpciaccess/commit/b2838fb61c3542f107014b285cbda097acae1e12 >>> [1] >>> Suggested-by: Daniel Dadap >>> Acked-by: Thomas Zimmermann >>> Signed-off-by: Mario Limonciello >>> --- >>>   drivers/pci/pci-sysfs.c | 2 +- >>>   drivers/pci/vgaarb.c    | 8 ++++---- >>>   2 files changed, 5 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c >>> index 268c69daa4d57..c314ee1b3f9ac 100644 >>> --- a/drivers/pci/pci-sysfs.c >>> +++ b/drivers/pci/pci-sysfs.c >>> @@ -1707,7 +1707,7 @@ static umode_t >>> pci_dev_attrs_are_visible(struct kobject *kobj, >>>       struct device *dev = kobj_to_dev(kobj); >>>       struct pci_dev *pdev = to_pci_dev(dev); >>>   -    if (a == &dev_attr_boot_vga.attr && pci_is_vga(pdev)) >>> +    if (a == &dev_attr_boot_vga.attr && pci_is_display(pdev)) >>>           return a->mode; >>>         return 0; >>> diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c >>> index 78748e8d2dbae..63216e5787d73 100644 >>> --- a/drivers/pci/vgaarb.c >>> +++ b/drivers/pci/vgaarb.c >>> @@ -1499,8 +1499,8 @@ static int pci_notify(struct notifier_block >>> *nb, unsigned long action, >>>         vgaarb_dbg(dev, "%s\n", __func__); >>>   -    /* Only deal with VGA class devices */ >>> -    if (!pci_is_vga(pdev)) >>> +    /* Only deal with PCI display class devices */ >>> +    if (!pci_is_display(pdev)) >>>           return 0; >>>         /* >>> @@ -1546,12 +1546,12 @@ static int __init vga_arb_device_init(void) >>>         bus_register_notifier(&pci_bus_type, &pci_notifier); >>>   -    /* Add all VGA class PCI devices by default */ >>> +    /* Add all PCI display class devices by default */ >>>       pdev = NULL; >>>       while ((pdev = >>>           pci_get_subsys(PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, >>>                      PCI_ANY_ID, pdev)) != NULL) { >>> -        if (pci_is_vga(pdev)) >>> +        if (pci_is_display(pdev)) >>>               vga_arbiter_add_pci_device(pdev); >>>       } >> >> At the very least a non-VGA device should not mark that it decodes >> legacy resources, marking the boot VGA device is only a part of what >> the VGA arbiter does.  It seems none of the actual VGA arbitration >> interfaces have been considered here though. >> >> I still think this is a bad idea and I'm not sure Thomas didn't >> withdraw his ack in the previous round[1].  Thanks, > > Ah; I didn't realize that was intended to be a withdrawl. > If there's another version of this I'll remove it. Then let me formally withdraw the A-b. I think this updated patch doesn't address the concerns raised in the previous reviews. AFAIU vgaarb is really only about VGA devices. Best regards Thomas > > Dave, > > What is your current temperature on this approach? > > Do you still think it's best for something in the kernel or is this > better done in libpciaccess? > > Mutter, Kwin, and Cosmic all handle this case in the compositor. > > >> >> Alex >> >> [1]https://lore.kernel.org/all/bc0a3ac2-c86c-43b8-b83f-edfdfa5ee184@suse.de/ >> >> > -- -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)