Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI/VGA: Move vgaarb to drivers/pci

The VGA arbiter is really PCI-specific and doesn't depend on any GPU
things. Move it to the PCI subsystem.

Note that misc_init() must be called before vga_arb_device_init(). These
are both subsys_initcalls, so this ordering depends on the link order,
which is determined by drivers/Makefile:

obj-y += pci/
obj-y += char/ <-- misc_init()
obj-y += gpu/ <-- vga_arb_device_init() (before this commit)

The drivers/pci/ subsys_initcalls are called *before* misc_init(), so
convert vga_arb_device_init() to subsys_initcall_sync(), which is called
after *all* subsys_initcalls.

Link: https://lore.kernel.org/r/20220224224753.297579-2-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

+22 -22
+1 -1
Documentation/gpu/vgaarbiter.rst
··· 100 100 .. kernel-doc:: include/linux/vgaarb.h 101 101 :internal: 102 102 103 - .. kernel-doc:: drivers/gpu/vga/vgaarb.c 103 + .. kernel-doc:: drivers/pci/vgaarb.c 104 104 :export: 105 105 106 106 libpciaccess
-19
drivers/gpu/vga/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - config VGA_ARB 3 - bool "VGA Arbitration" if EXPERT 4 - default y 5 - depends on (PCI && !S390) 6 - help 7 - Some "legacy" VGA devices implemented on PCI typically have the same 8 - hard-decoded addresses as they did on ISA. When multiple PCI devices 9 - are accessed at same time they need some kind of coordination. Please 10 - see Documentation/gpu/vgaarbiter.rst for more details. Select this to 11 - enable VGA arbiter. 12 - 13 - config VGA_ARB_MAX_GPUS 14 - int "Maximum number of GPUs" 15 - default 16 16 - depends on VGA_ARB 17 - help 18 - Reserves space in the kernel to maintain resource locking for 19 - multiple GPUS. The overhead for each GPU is very small. 20 - 21 2 config VGA_SWITCHEROO 22 3 bool "Laptop Hybrid Graphics - GPU switching support" 23 4 depends on X86
-1
drivers/gpu/vga/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - obj-$(CONFIG_VGA_ARB) += vgaarb.o 3 2 obj-$(CONFIG_VGA_SWITCHEROO) += vga_switcheroo.o
+1 -1
drivers/gpu/vga/vgaarb.c drivers/pci/vgaarb.c
··· 1564 1564 pr_info("loaded\n"); 1565 1565 return rc; 1566 1566 } 1567 - subsys_initcall(vga_arb_device_init); 1567 + subsys_initcall_sync(vga_arb_device_init);
+19
drivers/pci/Kconfig
··· 252 252 253 253 endchoice 254 254 255 + config VGA_ARB 256 + bool "VGA Arbitration" if EXPERT 257 + default y 258 + depends on (PCI && !S390) 259 + help 260 + Some "legacy" VGA devices implemented on PCI typically have the same 261 + hard-decoded addresses as they did on ISA. When multiple PCI devices 262 + are accessed at same time they need some kind of coordination. Please 263 + see Documentation/gpu/vgaarbiter.rst for more details. Select this to 264 + enable VGA arbiter. 265 + 266 + config VGA_ARB_MAX_GPUS 267 + int "Maximum number of GPUs" 268 + default 16 269 + depends on VGA_ARB 270 + help 271 + Reserves space in the kernel to maintain resource locking for 272 + multiple GPUS. The overhead for each GPU is very small. 273 + 255 274 source "drivers/pci/hotplug/Kconfig" 256 275 source "drivers/pci/controller/Kconfig" 257 276 source "drivers/pci/endpoint/Kconfig"
+1
drivers/pci/Makefile
··· 30 30 obj-$(CONFIG_PCI_ECAM) += ecam.o 31 31 obj-$(CONFIG_PCI_P2PDMA) += p2pdma.o 32 32 obj-$(CONFIG_XEN_PCIDEV_FRONTEND) += xen-pcifront.o 33 + obj-$(CONFIG_VGA_ARB) += vgaarb.o 33 34 34 35 # Endpoint library must be initialized before its users 35 36 obj-$(CONFIG_PCI_ENDPOINT) += endpoint/