From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82CB5226CF3; Tue, 24 Jun 2025 20:30:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797051; cv=none; b=rmEDOjFfEa/rO0ZWWYndW0kYWnpWDnmz68BwXoBT+syu/yr6Z/5WrQtZQPRL5C2x32biR4q8OS7pdmZ1Xn+MSwPXE997a3twD9moyexVekTl14lk6nhW9EgzOdObn+0Qyez15FeBYqe/GlJMYRVbofq5IXcxEbiMix5nzb/3TyU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797051; c=relaxed/simple; bh=dwUS0NNQBo6ioFvBv9MvL8ShjmESObZeByXZvWYMJKk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lfc0tFh6BJE4mlJm0yawN2Nh0gU3NcarspOdjjCMeWOzSolCcmaIzcUjmMXGMZWctGPBObXW4lCaQBd2NNGv9Okfah82Nv6lMlYqv5vx5kQd88F7s4le/DUrFsn/JhiAVL8FQcpE6PRg+hH14Rf35yGOUxYxIpyjASCeHq7YrxQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B0qF+VrE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B0qF+VrE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C63C1C4CEF0; Tue, 24 Jun 2025 20:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797051; bh=dwUS0NNQBo6ioFvBv9MvL8ShjmESObZeByXZvWYMJKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B0qF+VrEpm9PcHkfA+Nr09IQ9DvuNyNUtKOhoAQbDQqjjE1ofB+JzuQpU3BCW4xJ7 hGfy9RqOJtCwXX8UlpxxResPC8Jsk/+JIwnoBCnL1KXc8gmR6ABti7ZJq6zWJM1R0V cIZGceXaypx3YkPJ/m3ZzN9q6c5obCYNV30Qe/Ut29p5sWv9rhZHUkLEl/8BfyOIf5 Yi+iUngbNtWhN++rX8XXemp4WvmP/S45lbcDvnjCAqa5gyaixX5HUFjDmsYH0Lt5T4 nq1FE5r0WVSMeYeqiejWZwpPwEnAbD0flIRL0S0KHKfc28zJw1l5VOf6kEd6DTE+3Y tUSwq6UQaDvuw== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello , Simona Vetter Subject: [PATCH v5 1/9] PCI: Add helper for checking if a PCI device is a display controller Date: Tue, 24 Jun 2025 15:30:34 -0500 Message-ID: <20250624203042.1102346-2-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello Several places in the kernel do class shifting to match whether a PCI device is display class. Introduce a helper for those places to use. Reviewed-by: Daniel Dadap Reviewed-by: Simona Vetter Signed-off-by: Mario Limonciello Acked-by: Bjorn Helgaas --- include/linux/pci.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index 05e68f35f3923..e77754e43c629 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -744,6 +744,21 @@ static inline bool pci_is_vga(struct pci_dev *pdev) return false; } =20 +/** + * pci_is_display - Check if a PCI device is a display controller + * @pdev: Pointer to the PCI device structure + * + * This function determines whether the given PCI device corresponds + * to a display controller. Display controllers are typically used + * for graphical output and are identified based on their class code. + * + * Return: true if the PCI device is a display controller, false otherwise. + */ +static inline bool pci_is_display(struct pci_dev *pdev) +{ + return (pdev->class >> 16) =3D=3D PCI_BASE_CLASS_DISPLAY; +} + #define for_each_pci_bridge(dev, bus) \ list_for_each_entry(dev, &bus->devices, bus_list) \ if (!pci_is_bridge(dev)) {} else --=20 2.43.0 From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04D602EE271; Tue, 24 Jun 2025 20:30:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797054; cv=none; b=WW0V0eoOBx9VmTuDvgYclacncCbrrhNWgkHYkynWBqXiCF266kcaYnQAacZCwU0zKajNj2gmpz6PZyLeyk//0VSeH28HJZKVS+6R6oGBCqC0e8fjKkWranQAR9osMw5WDqSoejBJ2dTVyEbi2ge5XHYL0YbB2PnRhurY0jyVV3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797054; c=relaxed/simple; bh=ZUEaBNdA8Lm5/HmaCro4bOIyTqXr2dVXogleY25ibLU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NJSYkobQacIIsqdf6PCOVm+wszvQTNDq3K13Mcv2o74fBayUDMJebnlVCqAkuEKyudlCM/HoCT9/92E3Rj4168lC2L6Ci5nFjrx0Y3whlGKiMycHsXxJoxNMKD4xGW4e9sJTpjnYGpCqyCejbFnLDulOVluBrPOSfOi7Wvu1PxA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e3hpFGob; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e3hpFGob" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40E65C4CEE3; Tue, 24 Jun 2025 20:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797053; bh=ZUEaBNdA8Lm5/HmaCro4bOIyTqXr2dVXogleY25ibLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e3hpFGobv4QkWBmpS31l8K6Jt47ji95lqwQUQdP2JySMGVQ/9pZ3Zn4AYCbl8K6Dt uUXKVnnb7oyXZiiql1LJEp59TNfF0BE8tVs8HPJ0aNuR8fLixKZPCqC32N/Ru/Uoy8 qjy6Zrh20+kHAoEYD6fgSWkX5VGU+Fh1ocuhoPV89JiUxNebcZo+TWz6U3HmzLC2ZU P/5A5DcXENcpPvitZyoSIyi0bygFqnbkYOSRT0MwlvrRM6IlVVnLQJTHchrT0CFLIf PmTH0I+GsOp+POkvv/2tgxWyNtal76I4LiWp1TZ4mYXii6eHDjhOAzal3QlNIqTOI+ dVy70n3EYNpdw== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello , Simona Vetter , Bjorn Helgaas Subject: [PATCH v5 2/9] vfio/pci: Use pci_is_display() Date: Tue, 24 Jun 2025 15:30:35 -0500 Message-ID: <20250624203042.1102346-3-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello The inline pci_is_display() helper does the same thing. Use it. Acked-by: Alex Williamson Reviewed-by: Daniel Dadap Reviewed-by: Simona Vetter Suggested-by: Bjorn Helgaas Signed-off-by: Mario Limonciello --- drivers/vfio/pci/vfio_pci_igd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci_igd.c b/drivers/vfio/pci/vfio_pci_ig= d.c index ef490a4545f48..988b6919c2c31 100644 --- a/drivers/vfio/pci/vfio_pci_igd.c +++ b/drivers/vfio/pci/vfio_pci_igd.c @@ -437,8 +437,7 @@ static int vfio_pci_igd_cfg_init(struct vfio_pci_core_d= evice *vdev) =20 bool vfio_pci_is_intel_display(struct pci_dev *pdev) { - return (pdev->vendor =3D=3D PCI_VENDOR_ID_INTEL) && - ((pdev->class >> 16) =3D=3D PCI_BASE_CLASS_DISPLAY); + return (pdev->vendor =3D=3D PCI_VENDOR_ID_INTEL) && pci_is_display(pdev); } =20 int vfio_pci_igd_init(struct vfio_pci_core_device *vdev) --=20 2.43.0 From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F44A2EE97D; Tue, 24 Jun 2025 20:30:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797056; cv=none; b=WdQff0G40ch74p4N49LmR9mOhkJLfDpc4femxxhF6MDr1V2Ooa7YK6MXCzbXKVtO8doYS7aWiylXW16sW3HGGTmZKI1+CTv95aYRqhlvW8vbNHch/T14rp3VWVqLV+t7zUuZaaZ8sgnnu2V/K2vO1EUBrugCyn6ttanK/eyzpwA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797056; c=relaxed/simple; bh=LQvOsrvAxtIF9zfBp3smdp/HiFPvr9jOTvuEZPP26Xw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QTgQcURysCuopnrJu/v7nK2siiOv0IW3trSwXB4tClHRh0hw2GKdfPd9492oGwVerRnZlIeWNk5m/wt3+oSnpT/r0jcDKhxyvDH+B6BzB8Ot83BsUNcSRhVGsqIUeth4ExexdMwhArUglabI7pbrC3aAs5poJ+ZIrGExP31DjFs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=grwUq4Az; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="grwUq4Az" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C72AFC4CEF3; Tue, 24 Jun 2025 20:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797056; bh=LQvOsrvAxtIF9zfBp3smdp/HiFPvr9jOTvuEZPP26Xw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grwUq4Azg2rXwcXTPBvEhrqfy4Fp289hvna9O8cgNI7bLHp4lR1i0g/5gOFDdT/1/ SAU/MlJDFjn5D+sGiSHzU6Hk+w0gt2j+dV6DQkY7Wf/0U8ah7i96QY//0MWQPcAm2D tH5CdqIardMhctjwYl3iYp4OY6IcfS/bJxJqnhgP4aLGcJK5ZQGq52VMsMx7aWZPJr sXa67NCUjivkoC/MJRlN8LUdG5QNQeNwtSq7w3YJTsRXiGfZjcydJi5yZGWRA3X6uT pQ16bnh7PwD/kgiOg3R+UPuEGjuqmNbejLRyJvAr++Mq+ENrgDgLXq+57HPva+iZKH Leb77Jzke4Hjw== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello , Simona Vetter , Bjorn Helgaas Subject: [PATCH v5 3/9] vga_switcheroo: Use pci_is_display() Date: Tue, 24 Jun 2025 15:30:36 -0500 Message-ID: <20250624203042.1102346-4-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello The inline pci_is_display() helper does the same thing. Use it. Reviewed-by: Daniel Dadap Reviewed-by: Simona Vetter Suggested-by: Bjorn Helgaas Signed-off-by: Mario Limonciello --- drivers/gpu/vga/vga_switcheroo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switche= roo.c index 18f2c92beff8e..68e45a26e85f7 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c @@ -437,7 +437,7 @@ find_active_client(struct list_head *head) */ bool vga_switcheroo_client_probe_defer(struct pci_dev *pdev) { - if ((pdev->class >> 16) =3D=3D PCI_BASE_CLASS_DISPLAY) { + if (pci_is_display(pdev)) { /* * apple-gmux is needed on pre-retina MacBook Pro * to probe the panel if pdev is the inactive GPU. --=20 2.43.0 From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C90472EF9BC; Tue, 24 Jun 2025 20:30:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797058; cv=none; b=s33WnWqV7t5QxGNdiexImwuKn41L1WNWw918PizB8E7uVvjYqV2Rd0ShvaRnEwGGNnE0oLY8mezqAga3c9ZaKTeA9GBiGhT8w1t1YEzVrchGvOzQpZmfDoNDvmC4X6Aef5fll3W8eHaZw5wFHn+g81AQAEggtOQQi40boQ70Emg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797058; c=relaxed/simple; bh=0JY3xV5HErzsQVOruBIRg0clSTUDvYlikV8MoSsd/64=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XipXM9/PG34jRkOqmCXOXaWXhI0NafnwYj2KkZK4DYocaA9KpVdufI52GKnJC2Xf3/6sVOMpAJKgH1HmYh7nUjqMvnAWD0XyTekb25krOHllKet95eWdi2ccl9208HjjOp5rL6dcjExa5anh+K+m+g7St8ZZ+UuKzCBgMJcElq0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=givKAtwJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="givKAtwJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54879C4CEF0; Tue, 24 Jun 2025 20:30:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797058; bh=0JY3xV5HErzsQVOruBIRg0clSTUDvYlikV8MoSsd/64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=givKAtwJjKiz/1i1gMN2tiFA2z4ebAavmWzFWKoQqKZRb/nCLYsGwM50LYrcSDsCy lKBB8RxO3uAHeTx+l4YQELuEGGM6F6u5CR7Ym52YA5VOHhTdhtm1OGsxW+OdcAw2LV mtvdCbyGS0CIcfr4Kzhi7zwL2/JDwgXBK92B1qx5Wa6B1vbSi747OHKr4nXy2Qyrsj cWE0ksHtEpd200bae1ZAOAqxLyZEK+1Ci/Xub09bvBqmyaQIBVnxLEu97DSa9BkE1L wYXqurE8GuWSB7JBe4PnxAkvFag4usy+P64++Z6+CG7skva+Vw/ofadMMwlGsF18OG iFcIZpYK/mOBQ== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello , Simona Vetter , Bjorn Helgaas Subject: [PATCH v5 4/9] iommu/vt-d: Use pci_is_display() Date: Tue, 24 Jun 2025 15:30:37 -0500 Message-ID: <20250624203042.1102346-5-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello The inline pci_is_display() helper does the same thing. Use it. Reviewed-by: Lu Baolu Reviewed-by: Daniel Dadap Reviewed-by: Simona Vetter Suggested-by: Bjorn Helgaas Signed-off-by: Mario Limonciello --- drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 7aa3932251b2f..17267cd476ce7 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -34,7 +34,7 @@ #define ROOT_SIZE VTD_PAGE_SIZE #define CONTEXT_SIZE VTD_PAGE_SIZE =20 -#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) =3D=3D PCI_BASE_CLASS_DIS= PLAY) +#define IS_GFX_DEVICE(pdev) pci_is_display(pdev) #define IS_USB_DEVICE(pdev) ((pdev->class >> 8) =3D=3D PCI_CLASS_SERIAL_US= B) #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) =3D=3D PCI_CLASS_BRIDGE_IS= A) #define IS_AZALIA(pdev) ((pdev)->vendor =3D=3D 0x8086 && (pdev)->device = =3D=3D 0x3a3e) --=20 2.43.0 From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B89192F0024; Tue, 24 Jun 2025 20:31:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797061; cv=none; b=PcOHPXig5ldDq6nWvS9wD0VBL0vKudakGLT8qgsas+gJAbUWn8zOaOBk1xwUZLiGdB3rwIZVOsG/Uj2T6KDXng3uW7pbZHvQladfKptrhG51meZe++mepeq2rKv1QnjyVxSGhCcuwV6tfCmTJ6blk2npE9232mScX47tMA7LX2Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797061; c=relaxed/simple; bh=IOGKTg8m2lLVk2BGnUQp473zWXZ7OF1rNECuXqPIWig=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xe8jZFTXEuJd3ObMxIjPZ3gUxgPojetJ7r93TesHa01YhTCw9ho/H9ubQJ7Cca1RkAbWhCaF0glVgnjwV+Lq3ObPJy5I3sI15YVfAj9v/kYPF3I7vk+MlKjC6fM7TYzpEhE1R5RRGHLFJRuP3i8tG0iL3MOdqsFK70/4AN3rkbQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ahNBv4yX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ahNBv4yX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E727DC4CEE3; Tue, 24 Jun 2025 20:30:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797061; bh=IOGKTg8m2lLVk2BGnUQp473zWXZ7OF1rNECuXqPIWig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ahNBv4yX8EO99vKJpAvNS+O2urY2tr2R8zWfMAqNbjwnPVYnrZdWc/dwGv0x9pLbb X885lJNW7lnzd876SwCUVLV42FqkMym+ZPtzLIaf3IY/4LoiRGEEqtJs5o6O71+0f4 gHKzrQZH2svf6dvve/GvThIwwx/TVS0MAZfXoqnfUq03mo/70wSdRq7eNnm/HpC9hc 3o80ZxiOQ78TbRUELULMbqa3nELmCMyE9k/qnyc+aDzCsh1uwLBsbKk+Cx1BvvAw1U zu6VO57pGDjHaIFWB/FRxW6ZvoMdk7Fsq8Ia2EzhpBCemyFocEHS1DLVrtwuvxqCOj UJfebQuJX8xnQ== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello , Takashi Iwai , Simona Vetter , Bjorn Helgaas Subject: [PATCH v5 5/9] ALSA: hda: Use pci_is_display() Date: Tue, 24 Jun 2025 15:30:38 -0500 Message-ID: <20250624203042.1102346-6-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello The inline pci_is_display() helper does the same thing. Use it. Reviewed-by: Takashi Iwai Reviewed-by: Daniel Dadap Reviewed-by: Simona Vetter Suggested-by: Bjorn Helgaas Signed-off-by: Mario Limonciello --- sound/hda/hdac_i915.c | 2 +- sound/pci/hda/hda_intel.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index e9425213320ea..44438c799f957 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c @@ -155,7 +155,7 @@ static int i915_gfx_present(struct pci_dev *hdac_pci) =20 for_each_pci_dev(display_dev) { if (display_dev->vendor !=3D PCI_VENDOR_ID_INTEL || - (display_dev->class >> 16) !=3D PCI_BASE_CLASS_DISPLAY) + !pci_is_display(display_dev)) continue; =20 if (pci_match_id(denylist, display_dev)) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 439cf1bda6e66..75badb5c69b8e 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -1465,7 +1465,7 @@ static struct pci_dev *get_bound_vga(struct pci_dev *= pci) * the dGPU is the one who is involved in * vgaswitcheroo. */ - if (((p->class >> 16) =3D=3D PCI_BASE_CLASS_DISPLAY) && + if (pci_is_display(p) && (atpx_present() || apple_gmux_detect(NULL, NULL))) return p; pci_dev_put(p); @@ -1477,7 +1477,7 @@ static struct pci_dev *get_bound_vga(struct pci_dev *= pci) p =3D pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus), pci->bus->number, 0); if (p) { - if ((p->class >> 16) =3D=3D PCI_BASE_CLASS_DISPLAY) + if (pci_is_display(p)) return p; pci_dev_put(p); } --=20 2.43.0 From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2F63E2EA48B; Tue, 24 Jun 2025 20:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797064; cv=none; b=s9ykBHaszgfzx31iWhklbCVYvRVcRwyxvnFhJdNSI14HfD0xpOJTrz7ddX307nk4X6EvUc0VIs1eX3L5bhgv2F4Ujxe8Tto50YNo5RF7wEWY1EmpS0g6qmAar4hxBAv92omugAHY/xxI0wqgf5vOBfB0fHgb9Fxa3HDmKWCEwB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797064; c=relaxed/simple; bh=glRBi2ARDp3d+Stsv79iYRajcXAB16Ljdcta010d3iw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i5/xQgRAy+j25tOrJSUNrvKmVrSnML1LYMqKMoI3BUjbVuMz0pr67hqqW7dVnkVzid5d9HOLluxD5x56w7cCWgC0EoUDZu+zR/epiYh3BXi4uURBYZa5Py6K1JZQPeu1G1gcJ1aXFLsh0MWMfCenmefgqQ5qZq3dkYjxGHW42d4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=luHxbjY8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="luHxbjY8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8336DC4CEF0; Tue, 24 Jun 2025 20:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797063; bh=glRBi2ARDp3d+Stsv79iYRajcXAB16Ljdcta010d3iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=luHxbjY8QkJ0Yg2QXmhfaKo9Bqs9u5neonEgfPJNBoHYZIanCGdbiyxm4ianZFl6/ VR5mQjb0tkMQrB5tD5M5evHAFgu9dHeDmuV+21qp2tHIakCsiL+o5dKD8wh85h8Por pz3a+fxzlIQtl9KrwdEUL/cZy8d8W7+S/bhWJwxqgF3F+h5kEZEd0FGmCFnoqXd1sE T43uS0SrYZP05oQn9xOkZgR46P5M3t1OXIRNFBNlLB5oqVBIUjtwXw2GwSCfqdxY6J 32TFBKNqAdIGp/Oktup2ZQzNpJLhFSo/Oy+rYifg6mbb5I4CeGUWnuKbCVPeLHXiAL Ke928R8h+5NBQ== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello , kernel test robot Subject: [PATCH v5 6/9] Fix access to video_is_primary_device() when compiled without CONFIG_VIDEO Date: Tue, 24 Jun 2025 15:30:39 -0500 Message-ID: <20250624203042.1102346-7-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello When compiled without CONFIG_VIDEO the architecture specific implementations of video_is_primary_device() include prototypes and assume that video-common.c will be linked. Guard against this so that the fallback inline implementation that returns false will be used when compiled without CONFIG_VIDEO. Acked-by: Thomas Zimmermann Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202506221312.49Fy1aNA-lkp@int= el.com/ Signed-off-by: Mario Limonciello --- v5: * add tag v4: * new patch --- arch/parisc/include/asm/video.h | 2 +- arch/sparc/include/asm/video.h | 2 ++ arch/x86/include/asm/video.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/parisc/include/asm/video.h b/arch/parisc/include/asm/vide= o.h index c5dff3223194a..a9d50ebd6e769 100644 --- a/arch/parisc/include/asm/video.h +++ b/arch/parisc/include/asm/video.h @@ -6,7 +6,7 @@ =20 struct device; =20 -#if defined(CONFIG_STI_CORE) +#if defined(CONFIG_STI_CORE) && defined(CONFIG_VIDEO) bool video_is_primary_device(struct device *dev); #define video_is_primary_device video_is_primary_device #endif diff --git a/arch/sparc/include/asm/video.h b/arch/sparc/include/asm/video.h index a6f48f52db584..773717b6d4914 100644 --- a/arch/sparc/include/asm/video.h +++ b/arch/sparc/include/asm/video.h @@ -19,8 +19,10 @@ static inline pgprot_t pgprot_framebuffer(pgprot_t prot, #define pgprot_framebuffer pgprot_framebuffer #endif =20 +#ifdef CONFIG_VIDEO bool video_is_primary_device(struct device *dev); #define video_is_primary_device video_is_primary_device +#endif =20 static inline void fb_memcpy_fromio(void *to, const volatile void __iomem = *from, size_t n) { diff --git a/arch/x86/include/asm/video.h b/arch/x86/include/asm/video.h index 0950c9535fae9..08ec328203ef8 100644 --- a/arch/x86/include/asm/video.h +++ b/arch/x86/include/asm/video.h @@ -13,8 +13,10 @@ pgprot_t pgprot_framebuffer(pgprot_t prot, unsigned long offset); #define pgprot_framebuffer pgprot_framebuffer =20 +#ifdef CONFIG_VIDEO bool video_is_primary_device(struct device *dev); #define video_is_primary_device video_is_primary_device +#endif =20 #include =20 --=20 2.43.0 From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42B992F19B9; Tue, 24 Jun 2025 20:31:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797066; cv=none; b=kJPDwIRDdhYnwJTthullYhjJ+TvRY8SUjQjpTR+eI4Jc/hWIL38O9OYiQFkYG9q4qevTqfmaxIJ9rQMPvH+HOlaf6JFlbrnteEgt9acpuRM8i9Hhk/ECsM2lR05mN4KcIMps32bCvW42uBHL19dm63TI+2skzuubaavayyYPkOo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797066; c=relaxed/simple; bh=tNsaHP450SEY2mkWYa5laraTkeQQ7mGoQTMeknOCJe0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DKE/fMa39LHPGhQtr8TDrSHkm7vp8iprPOuhbQ5YgZedRKPJC7G5sssLw7mLjfyY2J3nF3yF/FCQMNzz89sNQAxekFcTulWfJ7JPk5jpKmJkXCmLiLONML63lrb/iazexUkuRSEj9CY7RRG4A7XerS4FJlmIEZuAAM+zDrLT2v0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d2qJqA+v; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d2qJqA+v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F283BC4CEF3; Tue, 24 Jun 2025 20:31:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797066; bh=tNsaHP450SEY2mkWYa5laraTkeQQ7mGoQTMeknOCJe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d2qJqA+vuJBzPZEmJdvOJPs0WGOEq13JW6wHMObIO6JjZjyzC59kYS0rMgQVz9xRc PPmmC9MLNNHzvNtgOqZVSyOs8S7mFrn50qWMWq47E1Buka5RUhUI9lvEW4mBtVfbZJ RgD1oz/27E8CiqVyZEGdQ0o9sDPc+L+siIN0WMEmIcwPWLyFuIB29YyRyIaRz6bcD0 R5gihxlSKaMTRXFcBgp9WMd4sNY6liomAd0asqw8rWCA2D+nZKfE37G7FPTw7Jqslh qKlKYB6KP2zaaHRV3mcfKIxSNs13z0MmgPEdvVmfZiQ8asJqwD57WLXUI0+HT0MJHl 34tMP+nNE0+HQ== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello Subject: [PATCH v5 7/9] PCI/VGA: Replace vga_is_firmware_default() with a screen info check Date: Tue, 24 Jun 2025 15:30:40 -0500 Message-ID: <20250624203042.1102346-8-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello vga_is_firmware_default() checks firmware resources to find the owner framebuffer resources to find the firmware PCI device. This is an open coded implementation of screen_info_pci_dev(). Switch to using screen_info_pci_dev() instead. Suggested-by: Thomas Zimmermann Signed-off-by: Mario Limonciello Acked-by: Bjorn Helgaas --- v5: * split from next patch --- drivers/pci/vgaarb.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/drivers/pci/vgaarb.c b/drivers/pci/vgaarb.c index 78748e8d2dbae..c3457708c01e3 100644 --- a/drivers/pci/vgaarb.c +++ b/drivers/pci/vgaarb.c @@ -556,34 +556,9 @@ EXPORT_SYMBOL(vga_put); =20 static bool vga_is_firmware_default(struct pci_dev *pdev) { -#if defined(CONFIG_X86) - u64 base =3D screen_info.lfb_base; - u64 size =3D screen_info.lfb_size; - struct resource *r; - u64 limit; + struct screen_info *si =3D &screen_info; =20 - /* Select the device owning the boot framebuffer if there is one */ - - if (screen_info.capabilities & VIDEO_CAPABILITY_64BIT_BASE) - base |=3D (u64)screen_info.ext_lfb_base << 32; - - limit =3D base + size; - - /* Does firmware framebuffer belong to us? */ - pci_dev_for_each_resource(pdev, r) { - if (resource_type(r) !=3D IORESOURCE_MEM) - continue; - - if (!r->start || !r->end) - continue; - - if (base < r->start || limit >=3D r->end) - continue; - - return true; - } -#endif - return false; + return pdev =3D=3D screen_info_pci_dev(si); } =20 static bool vga_arb_integrated_gpu(struct device *dev) --=20 2.43.0 From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F1D72E9ECC; Tue, 24 Jun 2025 20:31:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797068; cv=none; b=ewyJK6qmtVSKaoxHdyBYvdEswqdjrCaIVoPTR13Izh3oSgvXZUxvnkygcJjkrfihNDvARuWUG0fQ193WeiJbIjERAK0m31IF/nBZqulZZ0SNX/XdegwyyuGQGBpXCtV7q5EE/qqtBBh8xc/Mnq4peNlaNd3CSOg6VupvlTI04/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797068; c=relaxed/simple; bh=29HKhswcd8px+N2nYcp6Yih2LctL4W2GlFxn1lIVTTA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uzZyyxpsYiCzkMFy8f3FrXnQibT25AyQE7wbAL2Nm2DrXVep6GTYMR7LtcbvfQXB4nHeL/IUDenJRTBcOg1+jwXiQYgXjGpuOsrXL/MO/2+P/GgZtbqh71inKCRzhNH4JrlMPxwQ4WquBtteDljlav1w3GP25ODMBnAShlp+PD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=X4z7Bh7U; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="X4z7Bh7U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E5D8C4CEF2; Tue, 24 Jun 2025 20:31:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797068; bh=29HKhswcd8px+N2nYcp6Yih2LctL4W2GlFxn1lIVTTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4z7Bh7UvZuyb79HPoHsaTmjP2tjyVF/oofZKnyi+WWMKgjEJftheG78LSVDzRhpK g3+CJNB4mcxzM4L73y9jBQDr+Nq3HSjYQOdJ9ZbsK1k7D1n+lthvZH7h7IHjB4H8fu K1u8zY2Mob/hLE8qS1CN2nXL+oqrzWNGyr94wVHR2MR36toGK5xQPqY5AcKi9toDrD tStNIA5gYSTpGgqO/ouL+mlv8Nz4Xbhbkg940WnFLSp7YBw+Txbdv6LNF07GTktPhJ eHFI6Iu2Xih50DzjD1d4l0g971ZVfsChmJIIcBg8RxtRB8eOWodd8YW+BwDTvKiknw QZtndpO/aLrPA== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello Subject: [PATCH v5 8/9] fbcon: Use screen info to find primary device Date: Tue, 24 Jun 2025 15:30:41 -0500 Message-ID: <20250624203042.1102346-9-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello On systems with non VGA GPUs fbcon can't find the primary GPU because video_is_primary_device() only checks the VGA arbiter. Add a screen info check to video_is_primary_device() so that callers can get accurate data on such systems. Suggested-by: Thomas Zimmermann Signed-off-by: Mario Limonciello --- v5: * Only change video-common.c v4: * use helper --- arch/x86/video/video-common.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/x86/video/video-common.c b/arch/x86/video/video-common.c index 81fc97a2a837a..917568e4d7fb1 100644 --- a/arch/x86/video/video-common.c +++ b/arch/x86/video/video-common.c @@ -9,6 +9,7 @@ =20 #include #include +#include #include =20 #include @@ -27,6 +28,7 @@ EXPORT_SYMBOL(pgprot_framebuffer); =20 bool video_is_primary_device(struct device *dev) { + struct screen_info *si =3D &screen_info; struct pci_dev *pdev; =20 if (!dev_is_pci(dev)) @@ -34,7 +36,16 @@ bool video_is_primary_device(struct device *dev) =20 pdev =3D to_pci_dev(dev); =20 - return (pdev =3D=3D vga_default_device()); + if (!pci_is_display(pdev)) + return false; + + if (pdev =3D=3D vga_default_device()) + return true; + + if (pdev =3D=3D screen_info_pci_dev(si)) + return true; + + return false; } EXPORT_SYMBOL(video_is_primary_device); =20 --=20 2.43.0 From nobody Wed Oct 8 20:01:58 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F16E2F363F; Tue, 24 Jun 2025 20:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797071; cv=none; b=XuPUwqXuD7EI6H2/jd4cvQC5Ej+/kc0eEkW/5XtDP8yum8b4cf6ifCHb4bTRicri3SHj/SEVrFnuuzueOZd6awFFWf0XAqLJ/LKgPuXag5z2TNaGqzUfwivgTMi1u936p6xtSbW2jxAe+hn0LRuv9VYatoRBAzmsMO7OZGWz2zQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750797071; c=relaxed/simple; bh=wM2bSTdZ79jUE3zyr7FAmD4oLwJqwdJQwmMFYKhFlKU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oTHG6qKE8zelZUhnmnCjYcvYkCtIkwHk8AC87+8yk7L4l23Ph0dm7spD0GC8lgu+Luf+mli2uiiN88MTC/FVMVFaDVb6Aeft4R0mRXYrF0M4LlzTSU/ELd9S1hENArcuW9JdaOtJDzorYUtXnw05aat2j16JwcDr0lwQCBBUCcg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qQlK2FPj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qQlK2FPj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB08EC4CEE3; Tue, 24 Jun 2025 20:31:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750797070; bh=wM2bSTdZ79jUE3zyr7FAmD4oLwJqwdJQwmMFYKhFlKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQlK2FPjVa6ekb+NmbvTShAdEs6MzKU4zYhV6yfdzNPUQLXXLV1OnJW1kBh5kJXP/ zbdgn+tkr3HNWm6RAcvKVAj9XF5rp6876WuiWyh490/VsfIW7O+iNgt6t1SyMPS35B LyWqtvKiX6gskjCIZE2CC/zdBeef4dk38iPOrskonZcuaz/fg3MGEWveQ5nq7MQGR4 9p19VkWDUohGMsYCXFgmS9HZGZ99FNVd3UYs1AChTwwRnFuvdStEBw+tDuLBoRxEJJ 1g5g4zW51XZ3v4LMQS+ewcpSScNGWVlGl7XrlzCo6N4jEis8CfQvha8gpjruB0K78d QaJ55g/sLrMrg== From: Mario Limonciello To: Bjorn Helgaas Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , David Airlie , Simona Vetter , Lukas Wunner , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Alex Williamson , Jaroslav Kysela , Takashi Iwai , dri-devel@lists.freedesktop.org (open list:DRM DRIVERS), linux-kernel@vger.kernel.org (open list), iommu@lists.linux.dev (open list:INTEL IOMMU (VT-d)), linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM), kvm@vger.kernel.org (open list:VFIO DRIVER), linux-sound@vger.kernel.org (open list:SOUND), Daniel Dadap , Mario Limonciello Subject: [PATCH v5 9/9] PCI: Add a new 'boot_display' attribute Date: Tue, 24 Jun 2025 15:30:42 -0500 Message-ID: <20250624203042.1102346-10-superm1@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250624203042.1102346-1-superm1@kernel.org> References: <20250624203042.1102346-1-superm1@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Mario Limonciello On systems with multiple GPUs there can be uncertainty which GPU is the primary one used to drive the display at bootup. In order to disambiguate this add a new sysfs attribute 'boot_display' that uses the output of video_is_primary_device() to populate whether a PCI device was used for driving the display. Signed-off-by: Mario Limonciello Acked-by: Bjorn Helgaas --- v4: * new patch --- Documentation/ABI/testing/sysfs-bus-pci | 9 +++++++++ drivers/pci/pci-sysfs.c | 14 ++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/te= sting/sysfs-bus-pci index 69f952fffec72..897cfc1b0de0f 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci @@ -612,3 +612,12 @@ Description: =20 # ls doe_features 0001:01 0001:02 doe_discovery + +What: /sys/bus/pci/devices/.../boot_display +Date: October 2025 +Contact: Linux PCI developers +Description: + This file indicates whether the device was used as a boot + display. If the device was used as the boot display, the file + will contain "1". If the device is a display device but wasn't + used as a boot display, the file will contain "0". diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 268c69daa4d57..5bbf79b1b953d 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "pci.h" =20 #ifndef ARCH_PCI_DEV_GROUPS @@ -679,6 +680,13 @@ const struct attribute_group *pcibus_groups[] =3D { NULL, }; =20 +static ssize_t boot_display_show(struct device *dev, struct device_attribu= te *attr, + char *buf) +{ + return sysfs_emit(buf, "%u\n", video_is_primary_device(dev)); +} +static DEVICE_ATTR_RO(boot_display); + static ssize_t boot_vga_show(struct device *dev, struct device_attribute *= attr, char *buf) { @@ -1698,6 +1706,7 @@ late_initcall(pci_sysfs_init); =20 static struct attribute *pci_dev_dev_attrs[] =3D { &dev_attr_boot_vga.attr, + &dev_attr_boot_display.attr, NULL, }; =20 @@ -1710,6 +1719,11 @@ static umode_t pci_dev_attrs_are_visible(struct kobj= ect *kobj, if (a =3D=3D &dev_attr_boot_vga.attr && pci_is_vga(pdev)) return a->mode; =20 +#ifdef CONFIG_VIDEO + if (a =3D=3D &dev_attr_boot_display.attr && pci_is_display(pdev)) + return a->mode; +#endif + return 0; } =20 --=20 2.43.0